diff -Nru python-gevent-0.13.7/AUTHORS python-gevent-1.0/AUTHORS --- python-gevent-0.13.7/AUTHORS 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/AUTHORS 2013-11-26 16:25:45.000000000 +0000 @@ -27,19 +27,31 @@ Nick Barkas Galfy Pundee Alexander Boudkar + Damien Churchill + Tom Lynn + Shaun Cutts + David LaBissoniere + Alexandre Kandalintsev + Geert Jansen + Vitaly Kruglikov + Saúl Ibarra Corretgé + Oliver Beattie + Bobby Powers + Anton Patrushev + Jan-Philip Gehrcke + Alex Gaynor + 陈小玉 + Philip Conrad + + See https://github.com/surfly/gevent/graphs/contributors for more info. Gevent is inspired by and uses some code from eventlet which was written by Bob Ipollito Donovan Preston -The libevent wrappers are based on pyevent by - - Dug Song - Martin Murray - The win32util module is taken from Twisted. -Some modules (local, ssl, httplib) contain code from the Python standard library. +Some modules (local, ssl) contain code from the Python standard library. If your code is used in gevent and you are not mentioned above, please contact the maintainer. diff -Nru python-gevent-0.13.7/c-ares/ares_build.h.dist python-gevent-1.0/c-ares/ares_build.h.dist --- python-gevent-0.13.7/c-ares/ares_build.h.dist 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_build.h.dist 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,252 @@ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H + + +/* Copyright (C) 2009 - 2010 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * See file ares_build.h.in, run configure, and forget that this file + * exists it is only used for non-configure systems. + * But you can keep reading if you want ;-) + * + */ + +/* ================================================================ */ +/* NOTES FOR NON-CONFIGURE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * c-ares library user nor by the c-ares library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the c-ares development + * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ + * + * Try to keep one section per platform, compiler and architecture, + * otherwise, if an existing section is reused for a different one and + * later on the original is adjusted, probably the piggybacking one can + * be adversely changed. + * + * In order to differentiate between platforms/compilers/architectures + * use only compiler built in predefined preprocessor symbols. + * + * This header file shall only export symbols which are 'cares' or 'CARES' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file ares_build.h.dist or ares_build.h, + * this is due to the following reason: file ares_build.h.dist is renamed + * to ares_build.h when the c-ares source code distribution archive file is + * created. + * + * File ares_build.h.dist is not included in the distribution archive. + * File ares_build.h is not present in the git tree. + * + * The distributed ares_build.h file is only intended to be used on systems + * which can not run the also distributed configure script. + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed ares_build.h file with one that is suitable + * and specific to the library being configured and built, which is generated + * from the ares_build.h.in template file. + * + * If you check out from git on a non-configure platform, you must run the + * appropriate buildconf* script to set up ares_build.h and other local files. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CARES_SIZEOF_LONG +# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined +#endif + +#ifdef CARES_TYPEOF_ARES_SOCKLEN_T +# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined +#endif + +#ifdef CARES_SIZEOF_ARES_SOCKLEN_T +# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ +/* ================================================================ */ + +#if defined(__DJGPP__) || defined(__GO32__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__SALFORDC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__BORLANDC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__TURBOC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__WATCOMC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__POCC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__LCC__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__SYMBIAN32__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__MWERKS__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(_WIN32_WCE) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__MINGW32__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__VMS) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +#elif defined(__OS400__) +# if defined(__ILEC400__) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 +# define CARES_PULL_SYS_TYPES_H 1 +# define CARES_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(__MVS__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_ILP32) +# define CARES_SIZEOF_LONG 4 +# elif defined(_LP64) +# define CARES_SIZEOF_LONG 8 +# endif +# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 +# define CARES_PULL_SYS_TYPES_H 1 +# define CARES_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(__370__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_ILP32) +# define CARES_SIZEOF_LONG 4 +# elif defined(_LP64) +# define CARES_SIZEOF_LONG 8 +# endif +# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 +# define CARES_PULL_SYS_TYPES_H 1 +# define CARES_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(TPF) +# define CARES_SIZEOF_LONG 8 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +/* ===================================== */ +/* KEEP MSVC THE PENULTIMATE ENTRY */ +/* ===================================== */ + +#elif defined(_MSC_VER) +# define CARES_SIZEOF_LONG 4 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 + +/* ===================================== */ +/* KEEP GENERIC GCC THE LAST ENTRY */ +/* ===================================== */ + +#elif defined(__GNUC__) +# if defined(__i386__) || defined(__ppc__) +# define CARES_SIZEOF_LONG 4 +# elif defined(__x86_64__) || defined(__ppc64__) +# define CARES_SIZEOF_LONG 8 +# endif +# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +# define CARES_SIZEOF_ARES_SOCKLEN_T 4 +# define CARES_PULL_SYS_TYPES_H 1 +# define CARES_PULL_SYS_SOCKET_H 1 + +#else +# error "Unknown non-configure build target!" + Error Compilation_aborted_Unknown_non_configure_build_target +#endif + +/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */ +/* sys/types.h is required here to properly make type definitions below. */ +#ifdef CARES_PULL_SYS_TYPES_H +# include +#endif + +/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ +/* sys/socket.h is required here to properly make type definitions below. */ +#ifdef CARES_PULL_SYS_SOCKET_H +# include +#endif + +/* Data type definition of ares_socklen_t. */ + +#ifdef CARES_TYPEOF_ARES_SOCKLEN_T + typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; +#endif + +#endif /* __CARES_BUILD_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_build.h.in python-gevent-1.0/c-ares/ares_build.h.in --- python-gevent-0.13.7/c-ares/ares_build.h.in 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_build.h.in 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,110 @@ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H + + +/* Copyright (C) 2009 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * c-ares library user nor by the c-ares library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the c-ares development + * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ + * + * This header file shall only export symbols which are 'cares' or 'CARES' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file ares_build.h.in or ares_build.h, + * this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed ares_build.h file with one that is suitable + * and specific to the library being configured and built, which is generated + * from the ares_build.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CARES_SIZEOF_LONG +# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined +#endif + +#ifdef CARES_TYPEOF_ARES_SOCKLEN_T +# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined +#endif + +#ifdef CARES_SIZEOF_ARES_SOCKLEN_T +# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +#undef CARES_PULL_WS2TCPIP_H +#ifdef CARES_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#undef CARES_PULL_SYS_TYPES_H +#ifdef CARES_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#undef CARES_PULL_SYS_SOCKET_H +#ifdef CARES_PULL_SYS_SOCKET_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#undef CARES_SIZEOF_LONG + +/* Integral data type used for ares_socklen_t. */ +#undef CARES_TYPEOF_ARES_SOCKLEN_T + +/* The size of `ares_socklen_t', as computed by sizeof. */ +#undef CARES_SIZEOF_ARES_SOCKLEN_T + +/* Data type definition of ares_socklen_t. */ +typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; + +#endif /* __CARES_BUILD_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_cancel.c python-gevent-1.0/c-ares/ares_cancel.c --- python-gevent-0.13.7/c-ares/ares_cancel.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_cancel.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,63 @@ + +/* Copyright (C) 2004 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include +#include +#include "ares.h" +#include "ares_private.h" + +/* + * ares_cancel() cancels all ongoing requests/resolves that might be going on + * on the given channel. It does NOT kill the channel, use ares_destroy() for + * that. + */ +void ares_cancel(ares_channel channel) +{ + struct query *query; + struct list_node* list_head; + struct list_node* list_node; + int i; + + list_head = &(channel->all_queries); + for (list_node = list_head->next; list_node != list_head; ) + { + query = list_node->data; + list_node = list_node->next; /* since we're deleting the query */ + query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); + ares__free_query(query); + } +#ifndef NDEBUG + /* Freeing the query should remove it from all the lists in which it sits, + * so all query lists should be empty now. + */ + assert(ares__is_list_empty(&(channel->all_queries))); + for (i = 0; i < ARES_QID_TABLE_SIZE; i++) + { + assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); + } + for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) + { + assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); + } +#endif + if (!(channel->flags & ARES_FLAG_STAYOPEN)) + { + if (channel->servers) + { + for (i = 0; i < channel->nservers; i++) + ares__close_sockets(channel, &channel->servers[i]); + } + } +} diff -Nru python-gevent-0.13.7/c-ares/ares__close_sockets.c python-gevent-1.0/c-ares/ares__close_sockets.c --- python-gevent-0.13.7/c-ares/ares__close_sockets.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares__close_sockets.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,66 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#include +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "ares.h" +#include "ares_private.h" + +void ares__close_sockets(ares_channel channel, struct server_state *server) +{ + struct send_request *sendreq; + + /* Free all pending output buffers. */ + while (server->qhead) + { + /* Advance server->qhead; pull out query as we go. */ + sendreq = server->qhead; + server->qhead = sendreq->next; + if (sendreq->data_storage != NULL) + free(sendreq->data_storage); + free(sendreq); + } + server->qtail = NULL; + + /* Reset any existing input buffer. */ + if (server->tcp_buffer) + free(server->tcp_buffer); + server->tcp_buffer = NULL; + server->tcp_lenbuf_pos = 0; + + /* Reset brokenness */ + server->is_broken = 0; + + /* Close the TCP and UDP sockets. */ + if (server->tcp_socket != ARES_SOCKET_BAD) + { + SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); + sclose(server->tcp_socket); + server->tcp_socket = ARES_SOCKET_BAD; + server->tcp_connection_generation = ++channel->tcp_connection_generation; + } + if (server->udp_socket != ARES_SOCKET_BAD) + { + SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); + sclose(server->udp_socket); + server->udp_socket = ARES_SOCKET_BAD; + } +} diff -Nru python-gevent-0.13.7/c-ares/ares_config.h.in python-gevent-1.0/c-ares/ares_config.h.in --- python-gevent-0.13.7/c-ares/ares_config.h.in 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_config.h.in 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,506 @@ +/* ares_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* define this if ares is built for a big endian system */ +#undef ARES_BIG_ENDIAN + +/* when building as static part of libcurl */ +#undef BUILDING_LIBCURL + +/* Definition to make a library symbol externally visible. */ +#undef CARES_SYMBOL_SCOPE_EXTERN + +/* if a /etc/inet dir is being used */ +#undef ETC_INET + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_QUAL_ARG1 + +/* Define to the type of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG1 + +/* Define to the type of arg 2 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG2 + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG46 + +/* Define to the type of arg 7 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG7 + +/* Specifies the number of arguments to getservbyport_r */ +#undef GETSERVBYPORT_R_ARGS + +/* Specifies the size of the buffer to pass to getservbyport_r */ +#undef GETSERVBYPORT_R_BUFSIZE + +/* Define to 1 if you have AF_INET6. */ +#undef HAVE_AF_INET6 + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_NAMESER_COMPAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_NAMESER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the `bitncmp' function. */ +#undef HAVE_BITNCMP + +/* Define to 1 if bool is an available type. */ +#undef HAVE_BOOL_T + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#undef HAVE_CLOCK_GETTIME_MONOTONIC + +/* Define to 1 if you have the closesocket function. */ +#undef HAVE_CLOSESOCKET + +/* Define to 1 if you have the CloseSocket camel case function. */ +#undef HAVE_CLOSESOCKET_CAMEL + +/* Define to 1 if you have the connect function. */ +#undef HAVE_CONNECT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the fcntl function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#undef HAVE_FCNTL_O_NONBLOCK + +/* Define to 1 if you have the freeaddrinfo function. */ +#undef HAVE_FREEADDRINFO + +/* Define to 1 if you have a working getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#undef HAVE_GETADDRINFO_THREADSAFE + +/* Define to 1 if you have the getenv function. */ +#undef HAVE_GETENV + +/* Define to 1 if you have the gethostbyaddr function. */ +#undef HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the gethostname function. */ +#undef HAVE_GETHOSTNAME + +/* Define to 1 if you have the getnameinfo function. */ +#undef HAVE_GETNAMEINFO + +/* Define to 1 if you have the getservbyport_r function. */ +#undef HAVE_GETSERVBYPORT_R + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `if_indextoname' function. */ +#undef HAVE_IF_INDEXTONAME + +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ +#undef HAVE_INET_NET_PTON + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#undef HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the ioctl function. */ +#undef HAVE_IOCTL + +/* Define to 1 if you have the ioctlsocket function. */ +#undef HAVE_IOCTLSOCKET + +/* Define to 1 if you have the IoctlSocket camel case function. */ +#undef HAVE_IOCTLSOCKET_CAMEL + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +#undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +#undef HAVE_IOCTLSOCKET_FIONBIO + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#undef HAVE_IOCTL_FIONBIO + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#undef HAVE_IOCTL_SIOCGIFADDR + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* if your compiler supports LL */ +#undef HAVE_LL + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#undef HAVE_LONGLONG + +/* Define to 1 if you have the malloc.h header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the memory.h header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#undef HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have PF_INET6. */ +#undef HAVE_PF_INET6 + +/* Define to 1 if you have the recv function. */ +#undef HAVE_RECV + +/* Define to 1 if you have the recvfrom function. */ +#undef HAVE_RECVFROM + +/* Define to 1 if you have the send function. */ +#undef HAVE_SEND + +/* Define to 1 if you have the setsockopt function. */ +#undef HAVE_SETSOCKOPT + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +#undef HAVE_SETSOCKOPT_SO_NONBLOCK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#undef HAVE_SIG_ATOMIC_T + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ +#undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + +/* Define to 1 if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the strcmpi function. */ +#undef HAVE_STRCMPI + +/* Define to 1 if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the stricmp function. */ +#undef HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the strncmpi function. */ +#undef HAVE_STRNCMPI + +/* Define to 1 if you have the strnicmp function. */ +#undef HAVE_STRNICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define to 1 if you have struct addrinfo. */ +#undef HAVE_STRUCT_ADDRINFO + +/* Define to 1 if you have struct in6_addr. */ +#undef HAVE_STRUCT_IN6_ADDR + +/* Define to 1 if you have struct sockaddr_in6. */ +#undef HAVE_STRUCT_SOCKADDR_IN6 + +/* if struct sockaddr_storage is defined */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define to 1 if you have the timeval struct. */ +#undef HAVE_STRUCT_TIMEVAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the windows.h header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the winsock2.h header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the winsock.h header file. */ +#undef HAVE_WINSOCK_H + +/* Define to 1 if you have the writev function. */ +#undef HAVE_WRITEV + +/* Define to 1 if you have the ws2tcpip.h header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +#undef NEED_MALLOC_H + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +#undef NEED_MEMORY_H + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +#undef NEED_REENTRANT + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +#undef NEED_THREAD_SAFE + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* cpu-machine-OS */ +#undef OS + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* a suitable file/device to read random data from */ +#undef RANDOM_FILE + +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#undef RECVFROM_QUAL_ARG5 + +/* Define to the type of arg 1 for recvfrom. */ +#undef RECVFROM_TYPE_ARG1 + +/* Define to the type pointed by arg 2 for recvfrom. */ +#undef RECVFROM_TYPE_ARG2 + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG2_IS_VOID + +/* Define to the type of arg 3 for recvfrom. */ +#undef RECVFROM_TYPE_ARG3 + +/* Define to the type of arg 4 for recvfrom. */ +#undef RECVFROM_TYPE_ARG4 + +/* Define to the type pointed by arg 5 for recvfrom. */ +#undef RECVFROM_TYPE_ARG5 + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG5_IS_VOID + +/* Define to the type pointed by arg 6 for recvfrom. */ +#undef RECVFROM_TYPE_ARG6 + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG6_IS_VOID + +/* Define to the function return type for recvfrom. */ +#undef RECVFROM_TYPE_RETV + +/* Define to the type of arg 1 for recv. */ +#undef RECV_TYPE_ARG1 + +/* Define to the type of arg 2 for recv. */ +#undef RECV_TYPE_ARG2 + +/* Define to the type of arg 3 for recv. */ +#undef RECV_TYPE_ARG3 + +/* Define to the type of arg 4 for recv. */ +#undef RECV_TYPE_ARG4 + +/* Define to the function return type for recv. */ +#undef RECV_TYPE_RETV + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to the type qualifier of arg 2 for send. */ +#undef SEND_QUAL_ARG2 + +/* Define to the type of arg 1 for send. */ +#undef SEND_TYPE_ARG1 + +/* Define to the type of arg 2 for send. */ +#undef SEND_TYPE_ARG2 + +/* Define to the type of arg 3 for send. */ +#undef SEND_TYPE_ARG3 + +/* Define to the type of arg 4 for send. */ +#undef SEND_TYPE_ARG4 + +/* Define to the function return type for send. */ +#undef SEND_TYPE_RETV + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `struct in6_addr', as computed by sizeof. */ +#undef SIZEOF_STRUCT_IN6_ADDR + +/* The size of `struct in_addr', as computed by sizeof. */ +#undef SIZEOF_STRUCT_IN_ADDR + +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to disable non-blocking sockets. */ +#undef USE_BLOCKING_SOCKETS + +/* Version number of package */ +#undef VERSION + +/* Define to avoid automatic inclusion of winsock.h */ +#undef WIN32_LEAN_AND_MEAN + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Type to use in place of in_addr_t when system does not provide it. */ +#undef in_addr_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* the signed version of size_t */ +#undef ssize_t diff -Nru python-gevent-0.13.7/c-ares/ares_create_query.c python-gevent-1.0/c-ares/ares_create_query.c --- python-gevent-0.13.7/c-ares/ares_create_query.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_create_query.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,209 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_private.h" + +/* Header format, from RFC 1035: + * 1 1 1 1 1 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ID | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * |QR| Opcode |AA|TC|RD|RA| Z | RCODE | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | QDCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ANCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | NSCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ARCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * + * AA, TC, RA, and RCODE are only set in responses. Brief description + * of the remaining fields: + * ID Identifier to match responses with queries + * QR Query (0) or response (1) + * Opcode For our purposes, always QUERY + * RD Recursion desired + * Z Reserved (zero) + * QDCOUNT Number of queries + * ANCOUNT Number of answers + * NSCOUNT Number of name server records + * ARCOUNT Number of additional records + * + * Question format, from RFC 1035: + * 1 1 1 1 1 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | | + * / QNAME / + * / / + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | QTYPE | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | QCLASS | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * + * The query name is encoded as a series of labels, each represented + * as a one-byte length (maximum 63) followed by the text of the + * label. The list is terminated by a label of length zero (which can + * be thought of as the root domain). + */ + +int ares_create_query(const char *name, int dnsclass, int type, + unsigned short id, int rd, unsigned char **buf, + int *buflen, int max_udp_size) +{ + int len; + unsigned char *q; + const char *p; + + /* Set our results early, in case we bail out early with an error. */ + *buflen = 0; + *buf = NULL; + + /* Compute the length of the encoded name so we can check buflen. + * Start counting at 1 for the zero-length label at the end. */ + len = 1; + for (p = name; *p; p++) + { + if (*p == '\\' && *(p + 1) != 0) + p++; + len++; + } + /* If there are n periods in the name, there are n + 1 labels, and + * thus n + 1 length fields, unless the name is empty or ends with a + * period. So add 1 unless name is empty or ends with a period. + */ + if (*name && *(p - 1) != '.') + len++; + + /* Immediately reject names that are longer than the maximum of 255 + * bytes that's specified in RFC 1035 ("To simplify implementations, + * the total length of a domain name (i.e., label octets and label + * length octets) is restricted to 255 octets or less."). We aren't + * doing this just to be a stickler about RFCs. For names that are + * too long, 'dnscache' closes its TCP connection to us immediately + * (when using TCP) and ignores the request when using UDP, and + * BIND's named returns ServFail (TCP or UDP). Sending a request + * that we know will cause 'dnscache' to close the TCP connection is + * painful, since that makes any other outstanding requests on that + * connection fail. And sending a UDP request that we know + * 'dnscache' will ignore is bad because resources will be tied up + * until we time-out the request. + */ + if (len > MAXCDNAME) + return ARES_EBADNAME; + + *buflen = len + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0); + *buf = malloc(*buflen); + if (!*buf) + return ARES_ENOMEM; + + /* Set up the header. */ + q = *buf; + memset(q, 0, HFIXEDSZ); + DNS_HEADER_SET_QID(q, id); + DNS_HEADER_SET_OPCODE(q, QUERY); + if (rd) { + DNS_HEADER_SET_RD(q, 1); + } + else { + DNS_HEADER_SET_RD(q, 0); + } + DNS_HEADER_SET_QDCOUNT(q, 1); + + if (max_udp_size) { + DNS_HEADER_SET_ARCOUNT(q, 1); + } + + /* A name of "." is a screw case for the loop below, so adjust it. */ + if (strcmp(name, ".") == 0) + name++; + + /* Start writing out the name after the header. */ + q += HFIXEDSZ; + while (*name) + { + if (*name == '.') + return ARES_EBADNAME; + + /* Count the number of bytes in this label. */ + len = 0; + for (p = name; *p && *p != '.'; p++) + { + if (*p == '\\' && *(p + 1) != 0) + p++; + len++; + } + if (len > MAXLABEL) + return ARES_EBADNAME; + + /* Encode the length and copy the data. */ + *q++ = (unsigned char)len; + for (p = name; *p && *p != '.'; p++) + { + if (*p == '\\' && *(p + 1) != 0) + p++; + *q++ = *p; + } + + /* Go to the next label and repeat, unless we hit the end. */ + if (!*p) + break; + name = p + 1; + } + + /* Add the zero-length label at the end. */ + *q++ = 0; + + /* Finish off the question with the type and class. */ + DNS_QUESTION_SET_TYPE(q, type); + DNS_QUESTION_SET_CLASS(q, dnsclass); + + if (max_udp_size) + { + q += QFIXEDSZ; + memset(q, 0, EDNSFIXEDSZ); + q++; + DNS_RR_SET_TYPE(q, ns_t_opt); + DNS_RR_SET_CLASS(q, max_udp_size); + } + + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_data.c python-gevent-1.0/c-ares/ares_data.c --- python-gevent-0.13.7/c-ares/ares_data.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_data.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,231 @@ + +/* Copyright (C) 2009-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + +#include "ares_setup.h" + +#include + +#include "ares.h" +#include "ares_data.h" +#include "ares_private.h" + + +/* +** ares_free_data() - c-ares external API function. +** +** This function must be used by the application to free data memory that +** has been internally allocated by some c-ares function and for which a +** pointer has already been returned to the calling application. The list +** of c-ares functions returning pointers that must be free'ed using this +** function is: +** +** ares_get_servers() +** ares_parse_srv_reply() +** ares_parse_txt_reply() +*/ + +void ares_free_data(void *dataptr) +{ + struct ares_data *ptr; + + if (!dataptr) + return; + +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:1684) + /* 1684: conversion from pointer to same-sized integral type */ +#endif + + ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data)); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif + + if (ptr->mark != ARES_DATATYPE_MARK) + return; + + switch (ptr->type) + { + case ARES_DATATYPE_MX_REPLY: + + if (ptr->data.mx_reply.next) + ares_free_data(ptr->data.mx_reply.next); + if (ptr->data.mx_reply.host) + free(ptr->data.mx_reply.host); + break; + + case ARES_DATATYPE_SRV_REPLY: + + if (ptr->data.srv_reply.next) + ares_free_data(ptr->data.srv_reply.next); + if (ptr->data.srv_reply.host) + free(ptr->data.srv_reply.host); + break; + + case ARES_DATATYPE_TXT_REPLY: + + if (ptr->data.txt_reply.next) + ares_free_data(ptr->data.txt_reply.next); + if (ptr->data.txt_reply.txt) + free(ptr->data.txt_reply.txt); + break; + + case ARES_DATATYPE_ADDR_NODE: + + if (ptr->data.addr_node.next) + ares_free_data(ptr->data.addr_node.next); + break; + + case ARES_DATATYPE_NAPTR_REPLY: + + if (ptr->data.naptr_reply.next) + ares_free_data(ptr->data.naptr_reply.next); + if (ptr->data.naptr_reply.flags) + free(ptr->data.naptr_reply.flags); + if (ptr->data.naptr_reply.service) + free(ptr->data.naptr_reply.service); + if (ptr->data.naptr_reply.regexp) + free(ptr->data.naptr_reply.regexp); + if (ptr->data.naptr_reply.replacement) + free(ptr->data.naptr_reply.replacement); + break; + + case ARES_DATATYPE_SOA_REPLY: + if (ptr->data.soa_reply.nsname) + free(ptr->data.soa_reply.nsname); + if (ptr->data.soa_reply.hostmaster) + free(ptr->data.soa_reply.hostmaster); + break; + + default: + return; + } + + free(ptr); +} + + +/* +** ares_malloc_data() - c-ares internal helper function. +** +** This function allocates memory for a c-ares private ares_data struct +** for the specified ares_datatype, initializes c-ares private fields +** and zero initializes those which later might be used from the public +** API. It returns an interior pointer which can be passed by c-ares +** functions to the calling application, and that must be free'ed using +** c-ares external API function ares_free_data(). +*/ + +void *ares_malloc_data(ares_datatype type) +{ + struct ares_data *ptr; + + ptr = malloc(sizeof(struct ares_data)); + if (!ptr) + return NULL; + + switch (type) + { + case ARES_DATATYPE_MX_REPLY: + ptr->data.mx_reply.next = NULL; + ptr->data.mx_reply.host = NULL; + ptr->data.mx_reply.priority = 0; + break; + + case ARES_DATATYPE_SRV_REPLY: + ptr->data.srv_reply.next = NULL; + ptr->data.srv_reply.host = NULL; + ptr->data.srv_reply.priority = 0; + ptr->data.srv_reply.weight = 0; + ptr->data.srv_reply.port = 0; + break; + + case ARES_DATATYPE_TXT_REPLY: + ptr->data.txt_reply.next = NULL; + ptr->data.txt_reply.txt = NULL; + ptr->data.txt_reply.length = 0; + break; + + case ARES_DATATYPE_ADDR_NODE: + ptr->data.addr_node.next = NULL; + ptr->data.addr_node.family = 0; + memset(&ptr->data.addr_node.addrV6, 0, + sizeof(ptr->data.addr_node.addrV6)); + break; + + case ARES_DATATYPE_NAPTR_REPLY: + ptr->data.naptr_reply.next = NULL; + ptr->data.naptr_reply.flags = NULL; + ptr->data.naptr_reply.service = NULL; + ptr->data.naptr_reply.regexp = NULL; + ptr->data.naptr_reply.replacement = NULL; + ptr->data.naptr_reply.order = 0; + ptr->data.naptr_reply.preference = 0; + break; + + case ARES_DATATYPE_SOA_REPLY: + ptr->data.soa_reply.nsname = NULL; + ptr->data.soa_reply.hostmaster = NULL; + ptr->data.soa_reply.serial = 0; + ptr->data.soa_reply.refresh = 0; + ptr->data.soa_reply.retry = 0; + ptr->data.soa_reply.expire = 0; + ptr->data.soa_reply.minttl = 0; + break; + + default: + free(ptr); + return NULL; + } + + ptr->mark = ARES_DATATYPE_MARK; + ptr->type = type; + + return &ptr->data; +} + + +/* +** ares_get_datatype() - c-ares internal helper function. +** +** This function returns the ares_datatype of the data stored in a +** private ares_data struct when given the public API pointer. +*/ + +ares_datatype ares_get_datatype(void * dataptr) +{ + struct ares_data *ptr; + +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:1684) + /* 1684: conversion from pointer to same-sized integral type */ +#endif + + ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data)); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif + + if (ptr->mark == ARES_DATATYPE_MARK) + return ptr->type; + + return ARES_DATATYPE_UNKNOWN; +} diff -Nru python-gevent-0.13.7/c-ares/ares_data.h python-gevent-1.0/c-ares/ares_data.h --- python-gevent-0.13.7/c-ares/ares_data.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_data.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,69 @@ + +/* Copyright (C) 2009-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +typedef enum { + ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */ + ARES_DATATYPE_SRV_REPLY, /* struct ares_srv_reply - introduced in 1.7.0 */ + ARES_DATATYPE_TXT_REPLY, /* struct ares_txt_reply - introduced in 1.7.0 */ + ARES_DATATYPE_ADDR_NODE, /* struct ares_addr_node - introduced in 1.7.1 */ + ARES_DATATYPE_MX_REPLY, /* struct ares_mx_reply - introduced in 1.7.2 */ + ARES_DATATYPE_NAPTR_REPLY,/* struct ares_naptr_reply - introduced in 1.7.6 */ + ARES_DATATYPE_SOA_REPLY, /* struct ares_soa_reply - introduced in 1.9.0 */ +#if 0 + ARES_DATATYPE_ADDR6TTL, /* struct ares_addrttl */ + ARES_DATATYPE_ADDRTTL, /* struct ares_addr6ttl */ + ARES_DATATYPE_HOSTENT, /* struct hostent */ + ARES_DATATYPE_OPTIONS, /* struct ares_options */ +#endif + ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */ +} ares_datatype; + +#define ARES_DATATYPE_MARK 0xbead + +/* + * ares_data struct definition is internal to c-ares and shall not + * be exposed by the public API in order to allow future changes + * and extensions to it without breaking ABI. This will be used + * internally by c-ares as the container of multiple types of data + * dynamically allocated for which a reference will be returned + * to the calling application. + * + * c-ares API functions returning a pointer to c-ares internally + * allocated data will actually be returning an interior pointer + * into this ares_data struct. + * + * All this is 'invisible' to the calling application, the only + * requirement is that this kind of data must be free'ed by the + * calling application using ares_free_data() with the pointer + * it has received from a previous c-ares function call. + */ + +struct ares_data { + ares_datatype type; /* Actual data type identifier. */ + unsigned int mark; /* Private ares_data signature. */ + union { + struct ares_txt_reply txt_reply; + struct ares_srv_reply srv_reply; + struct ares_addr_node addr_node; + struct ares_mx_reply mx_reply; + struct ares_naptr_reply naptr_reply; + struct ares_soa_reply soa_reply; + } data; +}; + +void *ares_malloc_data(ares_datatype type); + +ares_datatype ares_get_datatype(void * dataptr); diff -Nru python-gevent-0.13.7/c-ares/ares_destroy.c python-gevent-1.0/c-ares/ares_destroy.c --- python-gevent-0.13.7/c-ares/ares_destroy.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_destroy.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,107 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2011 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include +#include +#include "ares.h" +#include "ares_private.h" + +void ares_destroy_options(struct ares_options *options) +{ + int i; + + if(options->servers) + free(options->servers); + for (i = 0; i < options->ndomains; i++) + free(options->domains[i]); + if(options->domains) + free(options->domains); + if(options->sortlist) + free(options->sortlist); + if(options->lookups) + free(options->lookups); +} + +void ares_destroy(ares_channel channel) +{ + int i; + struct query *query; + struct list_node* list_head; + struct list_node* list_node; + + if (!channel) + return; + + list_head = &(channel->all_queries); + for (list_node = list_head->next; list_node != list_head; ) + { + query = list_node->data; + list_node = list_node->next; /* since we're deleting the query */ + query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); + ares__free_query(query); + } +#ifndef NDEBUG + /* Freeing the query should remove it from all the lists in which it sits, + * so all query lists should be empty now. + */ + assert(ares__is_list_empty(&(channel->all_queries))); + for (i = 0; i < ARES_QID_TABLE_SIZE; i++) + { + assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); + } + for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) + { + assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); + } +#endif + + ares__destroy_servers_state(channel); + + if (channel->domains) { + for (i = 0; i < channel->ndomains; i++) + free(channel->domains[i]); + free(channel->domains); + } + + if(channel->sortlist) + free(channel->sortlist); + + if (channel->lookups) + free(channel->lookups); + + free(channel); +} + +void ares__destroy_servers_state(ares_channel channel) +{ + struct server_state *server; + int i; + + if (channel->servers) + { + for (i = 0; i < channel->nservers; i++) + { + server = &channel->servers[i]; + ares__close_sockets(channel, server); + assert(ares__is_list_empty(&server->queries_to_server)); + } + free(channel->servers); + channel->servers = NULL; + } + channel->nservers = -1; +} diff -Nru python-gevent-0.13.7/c-ares/ares_dns.h python-gevent-1.0/c-ares/ares_dns.h --- python-gevent-0.13.7/c-ares/ares_dns.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_dns.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,103 @@ +#ifndef HEADER_CARES_DNS_H +#define HEADER_CARES_DNS_H + +/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* + * Macro DNS__16BIT reads a network short (16 bit) given in network + * byte order, and returns its value as an unsigned short. + */ +#define DNS__16BIT(p) ((unsigned short)((unsigned int) 0xffff & \ + (((unsigned int)((unsigned char)(p)[0]) << 8U) | \ + ((unsigned int)((unsigned char)(p)[1]))))) + +/* + * Macro DNS__32BIT reads a network long (32 bit) given in network + * byte order, and returns its value as an unsigned int. + */ +#define DNS__32BIT(p) ((unsigned int) \ + (((unsigned int)((unsigned char)(p)[0]) << 24U) | \ + ((unsigned int)((unsigned char)(p)[1]) << 16U) | \ + ((unsigned int)((unsigned char)(p)[2]) << 8U) | \ + ((unsigned int)((unsigned char)(p)[3])))) + +#define DNS__SET16BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \ + ((p)[1] = (unsigned char)((v) & 0xff))) +#define DNS__SET32BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \ + ((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \ + ((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \ + ((p)[3] = (unsigned char)((v) & 0xff))) + +#if 0 +/* we cannot use this approach on systems where we can't access 16/32 bit + data on un-aligned addresses */ +#define DNS__16BIT(p) ntohs(*(unsigned short*)(p)) +#define DNS__32BIT(p) ntohl(*(unsigned long*)(p)) +#define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v) +#define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v) +#endif + +/* Macros for parsing a DNS header */ +#define DNS_HEADER_QID(h) DNS__16BIT(h) +#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) +#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf) +#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1) +#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1) +#define DNS_HEADER_RD(h) ((h)[2] & 0x1) +#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1) +#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7) +#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf) +#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4) +#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6) +#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8) +#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) + +/* Macros for constructing a DNS header */ +#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) +#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3)) +#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2)) +#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1)) +#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1)) +#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4)) +#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf)) +#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) +#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) +#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) +#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) + +/* Macros for parsing the fixed part of a DNS question */ +#define DNS_QUESTION_TYPE(q) DNS__16BIT(q) +#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2) + +/* Macros for constructing the fixed part of a DNS question */ +#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v) +#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v) + +/* Macros for parsing the fixed part of a DNS resource record */ +#define DNS_RR_TYPE(r) DNS__16BIT(r) +#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2) +#define DNS_RR_TTL(r) DNS__32BIT((r) + 4) +#define DNS_RR_LEN(r) DNS__16BIT((r) + 8) + +/* Macros for constructing the fixed part of a DNS resource record */ +#define DNS_RR_SET_TYPE(r, v) DNS__SET16BIT(r, v) +#define DNS_RR_SET_CLASS(r, v) DNS__SET16BIT((r) + 2, v) +#define DNS_RR_SET_TTL(r, v) DNS__SET32BIT((r) + 4, v) +#define DNS_RR_SET_LEN(r, v) DNS__SET16BIT((r) + 8, v) + +#endif /* HEADER_CARES_DNS_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_expand_name.c python-gevent-1.0/c-ares/ares_expand_name.c --- python-gevent-0.13.7/c-ares/ares_expand_name.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_expand_name.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,201 @@ + +/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include "ares.h" +#include "ares_nowarn.h" +#include "ares_private.h" /* for the memdebug */ + +static int name_length(const unsigned char *encoded, const unsigned char *abuf, + int alen); + +/* Expand an RFC1035-encoded domain name given by encoded. The + * containing message is given by abuf and alen. The result given by + * *s, which is set to a NUL-terminated allocated buffer. *enclen is + * set to the length of the encoded name (not the length of the + * expanded name; the goal is to tell the caller how many bytes to + * move forward to get past the encoded name). + * + * In the simple case, an encoded name is a series of labels, each + * composed of a one-byte length (limited to values between 0 and 63 + * inclusive) followed by the label contents. The name is terminated + * by a zero-length label. + * + * In the more complicated case, a label may be terminated by an + * indirection pointer, specified by two bytes with the high bits of + * the first byte (corresponding to INDIR_MASK) set to 11. With the + * two high bits of the first byte stripped off, the indirection + * pointer gives an offset from the beginning of the containing + * message with more labels to decode. Indirection can happen an + * arbitrary number of times, so we have to detect loops. + * + * Since the expanded name uses '.' as a label separator, we use + * backslashes to escape periods or backslashes in the expanded name. + */ + +int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, + int alen, char **s, long *enclen) +{ + int len, indir = 0; + char *q; + const unsigned char *p; + union { + ssize_t sig; + size_t uns; + } nlen; + + nlen.sig = name_length(encoded, abuf, alen); + if (nlen.sig < 0) + return ARES_EBADNAME; + + *s = malloc(nlen.uns + 1); + if (!*s) + return ARES_ENOMEM; + q = *s; + + if (nlen.uns == 0) { + /* RFC2181 says this should be ".": the root of the DNS tree. + * Since this function strips trailing dots though, it becomes "" + */ + q[0] = '\0'; + + /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but + valid) */ + if ((*encoded & INDIR_MASK) == INDIR_MASK) + *enclen = 2L; + else + *enclen = 1L; /* the caller should move one byte to get past this */ + + return ARES_SUCCESS; + } + + /* No error-checking necessary; it was all done by name_length(). */ + p = encoded; + while (*p) + { + if ((*p & INDIR_MASK) == INDIR_MASK) + { + if (!indir) + { + *enclen = aresx_uztosl(p + 2U - encoded); + indir = 1; + } + p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1)); + } + else + { + len = *p; + p++; + while (len--) + { + if (*p == '.' || *p == '\\') + *q++ = '\\'; + *q++ = *p; + p++; + } + *q++ = '.'; + } + } + if (!indir) + *enclen = aresx_uztosl(p + 1U - encoded); + + /* Nuke the trailing period if we wrote one. */ + if (q > *s) + *(q - 1) = 0; + else + *q = 0; /* zero terminate */ + + return ARES_SUCCESS; +} + +/* Return the length of the expansion of an encoded domain name, or + * -1 if the encoding is invalid. + */ +static int name_length(const unsigned char *encoded, const unsigned char *abuf, + int alen) +{ + int n = 0, offset, indir = 0; + + /* Allow the caller to pass us abuf + alen and have us check for it. */ + if (encoded == abuf + alen) + return -1; + + while (*encoded) + { + if ((*encoded & INDIR_MASK) == INDIR_MASK) + { + /* Check the offset and go there. */ + if (encoded + 1 >= abuf + alen) + return -1; + offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1); + if (offset >= alen) + return -1; + encoded = abuf + offset; + + /* If we've seen more indirects than the message length, + * then there's a loop. + */ + if (++indir > alen) + return -1; + } + else + { + offset = *encoded; + if (encoded + offset + 1 >= abuf + alen) + return -1; + encoded++; + while (offset--) + { + n += (*encoded == '.' || *encoded == '\\') ? 2 : 1; + encoded++; + } + n++; + } + } + + /* If there were any labels at all, then the number of dots is one + * less than the number of labels, so subtract one. + */ + return (n) ? n - 1 : n; +} + +/* Like ares_expand_name but returns EBADRESP in case of invalid input. */ +int ares__expand_name_for_response(const unsigned char *encoded, + const unsigned char *abuf, int alen, + char **s, long *enclen) +{ + int status = ares_expand_name(encoded, abuf, alen, s, enclen); + if (status == ARES_EBADNAME) + status = ARES_EBADRESP; + return status; +} diff -Nru python-gevent-0.13.7/c-ares/ares_expand_string.c python-gevent-1.0/c-ares/ares_expand_string.c --- python-gevent-0.13.7/c-ares/ares_expand_string.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_expand_string.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,75 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif + +#include +#include +#include "ares.h" +#include "ares_private.h" /* for the memdebug */ + +/* Simply decodes a length-encoded character string. The first byte of the + * input is the length of the string to be returned and the bytes thereafter + * are the characters of the string. The returned result will be NULL + * terminated. + */ +int ares_expand_string(const unsigned char *encoded, + const unsigned char *abuf, + int alen, + unsigned char **s, + long *enclen) +{ + unsigned char *q; + union { + ssize_t sig; + size_t uns; + } elen; + + if (encoded == abuf+alen) + return ARES_EBADSTR; + + elen.uns = *encoded; + if (encoded+elen.sig+1 > abuf+alen) + return ARES_EBADSTR; + + encoded++; + + *s = malloc(elen.uns+1); + if (*s == NULL) + return ARES_ENOMEM; + q = *s; + strncpy((char *)q, (char *)encoded, elen.uns); + q[elen.uns] = '\0'; + + *s = q; + + *enclen = (long)(elen.sig+1); + + return ARES_SUCCESS; +} + diff -Nru python-gevent-0.13.7/c-ares/ares_fds.c python-gevent-1.0/c-ares/ares_fds.c --- python-gevent-0.13.7/c-ares/ares_fds.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_fds.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,63 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#include "ares.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) +{ + struct server_state *server; + ares_socket_t nfds; + int i; + + /* Are there any active queries? */ + int active_queries = !ares__is_list_empty(&(channel->all_queries)); + + nfds = 0; + for (i = 0; i < channel->nservers; i++) + { + server = &channel->servers[i]; + /* We only need to register interest in UDP sockets if we have + * outstanding queries. + */ + if (active_queries && server->udp_socket != ARES_SOCKET_BAD) + { + FD_SET(server->udp_socket, read_fds); + if (server->udp_socket >= nfds) + nfds = server->udp_socket + 1; + } + /* We always register for TCP events, because we want to know + * when the other side closes the connection, so we don't waste + * time trying to use a broken connection. + */ + if (server->tcp_socket != ARES_SOCKET_BAD) + { + FD_SET(server->tcp_socket, read_fds); + if (server->qhead) + FD_SET(server->tcp_socket, write_fds); + if (server->tcp_socket >= nfds) + nfds = server->tcp_socket + 1; + } + } + return (int)nfds; +} diff -Nru python-gevent-0.13.7/c-ares/ares_free_hostent.c python-gevent-1.0/c-ares/ares_free_hostent.c --- python-gevent-0.13.7/c-ares/ares_free_hostent.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_free_hostent.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include + +#ifdef HAVE_NETDB_H +#include +#endif + +#include "ares.h" +#include "ares_private.h" /* for memdebug */ + +void ares_free_hostent(struct hostent *host) +{ + char **p; + + if (!host) + return; + + free((char *)(host->h_name)); + for (p = host->h_aliases; *p; p++) + free(*p); + free(host->h_aliases); + free(host->h_addr_list[0]); /* no matter if there is one or many entries, + there is only one malloc for all of them */ + free(host->h_addr_list); + free(host); +} diff -Nru python-gevent-0.13.7/c-ares/ares_free_string.c python-gevent-1.0/c-ares/ares_free_string.c --- python-gevent-0.13.7/c-ares/ares_free_string.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_free_string.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,25 @@ + +/* Copyright 2000 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include +#include "ares.h" +#include "ares_private.h" + +void ares_free_string(void *str) +{ + free(str); +} diff -Nru python-gevent-0.13.7/c-ares/ares_getenv.c python-gevent-1.0/c-ares/ares_getenv.c --- python-gevent-0.13.7/c-ares/ares_getenv.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getenv.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,30 @@ + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares_getenv.h" + +#ifndef HAVE_GETENV + +char *ares_getenv(const char *name) +{ +#ifdef _WIN32_WCE + return NULL; +#endif +} + +#endif diff -Nru python-gevent-0.13.7/c-ares/ares_getenv.h python-gevent-1.0/c-ares/ares_getenv.h --- python-gevent-0.13.7/c-ares/ares_getenv.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getenv.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef HEADER_CARES_GETENV_H +#define HEADER_CARES_GETENV_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifndef HAVE_GETENV +extern char *ares_getenv(const char *name); +#endif + +#endif /* HEADER_CARES_GETENV_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_gethostbyaddr.c python-gevent-1.0/c-ares/ares_gethostbyaddr.c --- python-gevent-0.13.7/c-ares/ares_gethostbyaddr.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_gethostbyaddr.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,301 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include + +#include "ares.h" +#include "inet_net_pton.h" +#include "ares_platform.h" +#include "ares_private.h" + +#ifdef WATT32 +#undef WIN32 +#endif + +struct addr_query { + /* Arguments passed to ares_gethostbyaddr() */ + ares_channel channel; + struct ares_addr addr; + ares_host_callback callback; + void *arg; + + const char *remaining_lookups; + int timeouts; +}; + +static void next_lookup(struct addr_query *aquery); +static void addr_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen); +static void end_aquery(struct addr_query *aquery, int status, + struct hostent *host); +static int file_lookup(struct ares_addr *addr, struct hostent **host); +static void ptr_rr_name(char *name, const struct ares_addr *addr); + +void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, + int family, ares_host_callback callback, void *arg) +{ + struct addr_query *aquery; + + if (family != AF_INET && family != AF_INET6) + { + callback(arg, ARES_ENOTIMP, 0, NULL); + return; + } + + if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) || + (family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6))) + { + callback(arg, ARES_ENOTIMP, 0, NULL); + return; + } + + aquery = malloc(sizeof(struct addr_query)); + if (!aquery) + { + callback(arg, ARES_ENOMEM, 0, NULL); + return; + } + aquery->channel = channel; + if (family == AF_INET) + memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4)); + else + memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6)); + aquery->addr.family = family; + aquery->callback = callback; + aquery->arg = arg; + aquery->remaining_lookups = channel->lookups; + aquery->timeouts = 0; + + next_lookup(aquery); +} + +static void next_lookup(struct addr_query *aquery) +{ + const char *p; + char name[128]; + int status; + struct hostent *host; + + for (p = aquery->remaining_lookups; *p; p++) + { + switch (*p) + { + case 'b': + ptr_rr_name(name, &aquery->addr); + aquery->remaining_lookups = p + 1; + ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, + aquery); + return; + case 'f': + status = file_lookup(&aquery->addr, &host); + + /* this status check below previously checked for !ARES_ENOTFOUND, + but we should not assume that this single error code is the one + that can occur, as that is in fact no longer the case */ + if (status == ARES_SUCCESS) + { + end_aquery(aquery, status, host); + return; + } + break; + } + } + end_aquery(aquery, ARES_ENOTFOUND, NULL); +} + +static void addr_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + struct addr_query *aquery = (struct addr_query *) arg; + struct hostent *host; + size_t addrlen; + + aquery->timeouts += timeouts; + if (status == ARES_SUCCESS) + { + if (aquery->addr.family == AF_INET) + { + addrlen = sizeof(aquery->addr.addrV4); + status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, + (int)addrlen, AF_INET, &host); + } + else + { + addrlen = sizeof(aquery->addr.addrV6); + status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, + (int)addrlen, AF_INET6, &host); + } + end_aquery(aquery, status, host); + } + else if (status == ARES_EDESTRUCTION) + end_aquery(aquery, status, NULL); + else + next_lookup(aquery); +} + +static void end_aquery(struct addr_query *aquery, int status, + struct hostent *host) +{ + aquery->callback(aquery->arg, status, aquery->timeouts, host); + if (host) + ares_free_hostent(host); + free(aquery); +} + +static int file_lookup(struct ares_addr *addr, struct hostent **host) +{ + FILE *fp; + int status; + int error; + +#ifdef WIN32 + char PATH_HOSTS[MAX_PATH]; + win_platform platform; + + PATH_HOSTS[0] = '\0'; + + platform = ares__getplatform(); + + if (platform == WIN_NT) { + char tmp[MAX_PATH]; + HKEY hkeyHosts; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, + &hkeyHosts) == ERROR_SUCCESS) + { + DWORD dwLength = MAX_PATH; + RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, + &dwLength); + ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); + RegCloseKey(hkeyHosts); + } + } + else if (platform == WIN_9X) + GetWindowsDirectory(PATH_HOSTS, MAX_PATH); + else + return ARES_ENOTFOUND; + + strcat(PATH_HOSTS, WIN_PATH_HOSTS); + +#elif defined(WATT32) + extern const char *_w32_GetHostsFile (void); + const char *PATH_HOSTS = _w32_GetHostsFile(); + + if (!PATH_HOSTS) + return ARES_ENOTFOUND; +#endif + + fp = fopen(PATH_HOSTS, "r"); + if (!fp) + { + error = ERRNO; + switch(error) + { + case ENOENT: + case ESRCH: + return ARES_ENOTFOUND; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", + PATH_HOSTS)); + *host = NULL; + return ARES_EFILE; + } + } + while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS) + { + if (addr->family != (*host)->h_addrtype) + { + ares_free_hostent(*host); + continue; + } + if (addr->family == AF_INET) + { + if (memcmp((*host)->h_addr, &addr->addrV4, + sizeof(addr->addrV4)) == 0) + break; + } + else if (addr->family == AF_INET6) + { + if (memcmp((*host)->h_addr, &addr->addrV6, + sizeof(addr->addrV6)) == 0) + break; + } + ares_free_hostent(*host); + } + fclose(fp); + if (status == ARES_EOF) + status = ARES_ENOTFOUND; + if (status != ARES_SUCCESS) + *host = NULL; + return status; +} + +static void ptr_rr_name(char *name, const struct ares_addr *addr) +{ + if (addr->family == AF_INET) + { + unsigned long laddr = ntohl(addr->addrV4.s_addr); + unsigned long a1 = (laddr >> 24UL) & 0xFFUL; + unsigned long a2 = (laddr >> 16UL) & 0xFFUL; + unsigned long a3 = (laddr >> 8UL) & 0xFFUL; + unsigned long a4 = laddr & 0xFFUL; + sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); + } + else + { + unsigned char *bytes = (unsigned char *)&addr->addrV6; + /* There are too many arguments to do this in one line using + * minimally C89-compliant compilers */ + sprintf(name, + "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.", + bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4, + bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4, + bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4, + bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4); + sprintf(name+strlen(name), + "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa", + bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4, + bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4, + bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4, + bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4); + } +} diff -Nru python-gevent-0.13.7/c-ares/ares_gethostbyname.c python-gevent-1.0/c-ares/ares_gethostbyname.c --- python-gevent-0.13.7/c-ares/ares_gethostbyname.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_gethostbyname.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,524 @@ + +/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include +#include +#ifdef HAVE_STRINGS_H +#include +#endif + +#include "ares.h" +#include "inet_net_pton.h" +#include "bitncmp.h" +#include "ares_platform.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +#ifdef WATT32 +#undef WIN32 +#endif + +struct host_query { + /* Arguments passed to ares_gethostbyname() */ + ares_channel channel; + char *name; + ares_host_callback callback; + void *arg; + int sent_family; /* this family is what was is being used */ + int want_family; /* this family is what is asked for in the API */ + const char *remaining_lookups; + int timeouts; +}; + +static void next_lookup(struct host_query *hquery, int status_code); +static void host_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen); +static void end_hquery(struct host_query *hquery, int status, + struct hostent *host); +static int fake_hostent(const char *name, int family, + ares_host_callback callback, void *arg); +static int file_lookup(const char *name, int family, struct hostent **host); +static void sort_addresses(struct hostent *host, + const struct apattern *sortlist, int nsort); +static void sort6_addresses(struct hostent *host, + const struct apattern *sortlist, int nsort); +static int get_address_index(const struct in_addr *addr, + const struct apattern *sortlist, int nsort); +static int get6_address_index(const struct ares_in6_addr *addr, + const struct apattern *sortlist, int nsort); + +void ares_gethostbyname(ares_channel channel, const char *name, int family, + ares_host_callback callback, void *arg) +{ + struct host_query *hquery; + + /* Right now we only know how to look up Internet addresses - and unspec + means try both basically. */ + switch (family) { + case AF_INET: + case AF_INET6: + case AF_UNSPEC: + break; + default: + callback(arg, ARES_ENOTIMP, 0, NULL); + return; + } + + if (fake_hostent(name, family, callback, arg)) + return; + + /* Allocate and fill in the host query structure. */ + hquery = malloc(sizeof(struct host_query)); + if (!hquery) + { + callback(arg, ARES_ENOMEM, 0, NULL); + return; + } + hquery->channel = channel; + hquery->name = strdup(name); + hquery->want_family = family; + hquery->sent_family = -1; /* nothing is sent yet */ + if (!hquery->name) { + free(hquery); + callback(arg, ARES_ENOMEM, 0, NULL); + return; + } + hquery->callback = callback; + hquery->arg = arg; + hquery->remaining_lookups = channel->lookups; + hquery->timeouts = 0; + + /* Start performing lookups according to channel->lookups. */ + next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */); +} + +static void next_lookup(struct host_query *hquery, int status_code) +{ + const char *p; + struct hostent *host; + int status = status_code; + + for (p = hquery->remaining_lookups; *p; p++) + { + switch (*p) + { + case 'b': + /* DNS lookup */ + hquery->remaining_lookups = p + 1; + if ((hquery->want_family == AF_INET6) || + (hquery->want_family == AF_UNSPEC)) { + /* if inet6 or unspec, start out with AAAA */ + hquery->sent_family = AF_INET6; + ares_search(hquery->channel, hquery->name, C_IN, T_AAAA, + host_callback, hquery); + } + else { + hquery->sent_family = AF_INET; + ares_search(hquery->channel, hquery->name, C_IN, T_A, + host_callback, hquery); + } + return; + + case 'f': + /* Host file lookup */ + status = file_lookup(hquery->name, hquery->want_family, &host); + + /* this status check below previously checked for !ARES_ENOTFOUND, + but we should not assume that this single error code is the one + that can occur, as that is in fact no longer the case */ + if (status == ARES_SUCCESS) + { + end_hquery(hquery, status, host); + return; + } + status = status_code; /* Use original status code */ + break; + } + } + end_hquery(hquery, status, NULL); +} + +static void host_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + struct host_query *hquery = (struct host_query *) arg; + ares_channel channel = hquery->channel; + struct hostent *host = NULL; + + hquery->timeouts += timeouts; + if (status == ARES_SUCCESS) + { + if (hquery->sent_family == AF_INET) + { + status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL); + if (host && channel->nsort) + sort_addresses(host, channel->sortlist, channel->nsort); + } + else if (hquery->sent_family == AF_INET6) + { + status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL); + if ((status == ARES_ENODATA || status == ARES_EBADRESP) && + hquery->want_family == AF_UNSPEC) { + /* The query returned something but either there were no AAAA + records (e.g. just CNAME) or the response was malformed. Try + looking up A instead. */ + hquery->sent_family = AF_INET; + ares_search(hquery->channel, hquery->name, C_IN, T_A, + host_callback, hquery); + return; + } + if (host && channel->nsort) + sort6_addresses(host, channel->sortlist, channel->nsort); + } + end_hquery(hquery, status, host); + } + else if ((status == ARES_ENODATA || status == ARES_EBADRESP || + status == ARES_ETIMEOUT) && (hquery->sent_family == AF_INET6 && + hquery->want_family == AF_UNSPEC)) + { + /* The AAAA query yielded no useful result. Now look up an A instead. */ + hquery->sent_family = AF_INET; + ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback, + hquery); + } + else if (status == ARES_EDESTRUCTION) + end_hquery(hquery, status, NULL); + else + next_lookup(hquery, status); +} + +static void end_hquery(struct host_query *hquery, int status, + struct hostent *host) +{ + hquery->callback(hquery->arg, status, hquery->timeouts, host); + if (host) + ares_free_hostent(host); + free(hquery->name); + free(hquery); +} + +/* If the name looks like an IP address, fake up a host entry, end the + * query immediately, and return true. Otherwise return false. + */ +static int fake_hostent(const char *name, int family, + ares_host_callback callback, void *arg) +{ + struct hostent hostent; + char *aliases[1] = { NULL }; + char *addrs[2]; + int result = 0; + struct in_addr in; + struct ares_in6_addr in6; + + if (family == AF_INET || family == AF_INET6) + { + /* It only looks like an IP address if it's all numbers and dots. */ + int numdots = 0, valid = 1; + const char *p; + for (p = name; *p; p++) + { + if (!ISDIGIT(*p) && *p != '.') { + valid = 0; + break; + } else if (*p == '.') { + numdots++; + } + } + + /* if we don't have 3 dots, it is illegal + * (although inet_addr doesn't think so). + */ + if (numdots != 3 || !valid) + result = 0; + else + result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1); + + if (result) + family = AF_INET; + } + if (family == AF_INET6) + result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); + + if (!result) + return 0; + + if (family == AF_INET) + { + hostent.h_length = (int)sizeof(struct in_addr); + addrs[0] = (char *)∈ + } + else if (family == AF_INET6) + { + hostent.h_length = (int)sizeof(struct ares_in6_addr); + addrs[0] = (char *)&in6; + } + /* Duplicate the name, to avoid a constness violation. */ + hostent.h_name = strdup(name); + if (!hostent.h_name) + { + callback(arg, ARES_ENOMEM, 0, NULL); + return 1; + } + + /* Fill in the rest of the host structure and terminate the query. */ + addrs[1] = NULL; + hostent.h_aliases = aliases; + hostent.h_addrtype = aresx_sitoss(family); + hostent.h_addr_list = addrs; + callback(arg, ARES_SUCCESS, 0, &hostent); + + free((char *)(hostent.h_name)); + return 1; +} + +/* This is an API method */ +int ares_gethostbyname_file(ares_channel channel, const char *name, + int family, struct hostent **host) +{ + int result; + + /* We only take the channel to ensure that ares_init() been called. */ + if(channel == NULL) + { + /* Anything will do, really. This seems fine, and is consistent with + other error cases. */ + *host = NULL; + return ARES_ENOTFOUND; + } + + /* Just chain to the internal implementation we use here; it's exactly + * what we want. + */ + result = file_lookup(name, family, host); + if(result != ARES_SUCCESS) + { + /* We guarantee a NULL hostent on failure. */ + *host = NULL; + } + return result; +} + +static int file_lookup(const char *name, int family, struct hostent **host) +{ + FILE *fp; + char **alias; + int status; + int error; + +#ifdef WIN32 + char PATH_HOSTS[MAX_PATH]; + win_platform platform; + + PATH_HOSTS[0] = '\0'; + + platform = ares__getplatform(); + + if (platform == WIN_NT) { + char tmp[MAX_PATH]; + HKEY hkeyHosts; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, + &hkeyHosts) == ERROR_SUCCESS) + { + DWORD dwLength = MAX_PATH; + RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, + &dwLength); + ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); + RegCloseKey(hkeyHosts); + } + } + else if (platform == WIN_9X) + GetWindowsDirectory(PATH_HOSTS, MAX_PATH); + else + return ARES_ENOTFOUND; + + strcat(PATH_HOSTS, WIN_PATH_HOSTS); + +#elif defined(WATT32) + extern const char *_w32_GetHostsFile (void); + const char *PATH_HOSTS = _w32_GetHostsFile(); + + if (!PATH_HOSTS) + return ARES_ENOTFOUND; +#endif + + fp = fopen(PATH_HOSTS, "r"); + if (!fp) + { + error = ERRNO; + switch(error) + { + case ENOENT: + case ESRCH: + return ARES_ENOTFOUND; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", + PATH_HOSTS)); + *host = NULL; + return ARES_EFILE; + } + } + while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS) + { + if (strcasecmp((*host)->h_name, name) == 0) + break; + for (alias = (*host)->h_aliases; *alias; alias++) + { + if (strcasecmp(*alias, name) == 0) + break; + } + if (*alias) + break; + ares_free_hostent(*host); + } + fclose(fp); + if (status == ARES_EOF) + status = ARES_ENOTFOUND; + if (status != ARES_SUCCESS) + *host = NULL; + return status; +} + +static void sort_addresses(struct hostent *host, + const struct apattern *sortlist, int nsort) +{ + struct in_addr a1, a2; + int i1, i2, ind1, ind2; + + /* This is a simple insertion sort, not optimized at all. i1 walks + * through the address list, with the loop invariant that everything + * to the left of i1 is sorted. In the loop body, the value at i1 is moved + * back through the list (via i2) until it is in sorted order. + */ + for (i1 = 0; host->h_addr_list[i1]; i1++) + { + memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr)); + ind1 = get_address_index(&a1, sortlist, nsort); + for (i2 = i1 - 1; i2 >= 0; i2--) + { + memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr)); + ind2 = get_address_index(&a2, sortlist, nsort); + if (ind2 <= ind1) + break; + memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr)); + } + memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr)); + } +} + +/* Find the first entry in sortlist which matches addr. Return nsort + * if none of them match. + */ +static int get_address_index(const struct in_addr *addr, + const struct apattern *sortlist, + int nsort) +{ + int i; + + for (i = 0; i < nsort; i++) + { + if (sortlist[i].family != AF_INET) + continue; + if (sortlist[i].type == PATTERN_MASK) + { + if ((addr->s_addr & sortlist[i].mask.addr4.s_addr) + == sortlist[i].addrV4.s_addr) + break; + } + else + { + if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr, + sortlist[i].mask.bits)) + break; + } + } + return i; +} + +static void sort6_addresses(struct hostent *host, + const struct apattern *sortlist, int nsort) +{ + struct ares_in6_addr a1, a2; + int i1, i2, ind1, ind2; + + /* This is a simple insertion sort, not optimized at all. i1 walks + * through the address list, with the loop invariant that everything + * to the left of i1 is sorted. In the loop body, the value at i1 is moved + * back through the list (via i2) until it is in sorted order. + */ + for (i1 = 0; host->h_addr_list[i1]; i1++) + { + memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr)); + ind1 = get6_address_index(&a1, sortlist, nsort); + for (i2 = i1 - 1; i2 >= 0; i2--) + { + memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr)); + ind2 = get6_address_index(&a2, sortlist, nsort); + if (ind2 <= ind1) + break; + memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr)); + } + memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr)); + } +} + +/* Find the first entry in sortlist which matches addr. Return nsort + * if none of them match. + */ +static int get6_address_index(const struct ares_in6_addr *addr, + const struct apattern *sortlist, + int nsort) +{ + int i; + + for (i = 0; i < nsort; i++) + { + if (sortlist[i].family != AF_INET6) + continue; + if (!ares_bitncmp(addr, + &sortlist[i].addrV6, + sortlist[i].mask.bits)) + break; + } + return i; +} diff -Nru python-gevent-0.13.7/c-ares/ares__get_hostent.c python-gevent-1.0/c-ares/ares__get_hostent.c --- python-gevent-0.13.7/c-ares/ares__get_hostent.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares__get_hostent.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,264 @@ + +/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#include "ares.h" +#include "inet_net_pton.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +int ares__get_hostent(FILE *fp, int family, struct hostent **host) +{ + char *line = NULL, *p, *q, **alias; + char *txtaddr, *txthost, *txtalias; + int status; + size_t addrlen, linesize, naliases; + struct ares_addr addr; + struct hostent *hostent = NULL; + + *host = NULL; /* Assume failure */ + + /* Validate family */ + switch (family) { + case AF_INET: + case AF_INET6: + case AF_UNSPEC: + break; + default: + return ARES_EBADFAMILY; + } + + while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) + { + + /* Trim line comment. */ + p = line; + while (*p && (*p != '#')) + p++; + *p = '\0'; + + /* Trim trailing whitespace. */ + q = p - 1; + while ((q >= line) && ISSPACE(*q)) + q--; + *++q = '\0'; + + /* Skip leading whitespace. */ + p = line; + while (*p && ISSPACE(*p)) + p++; + if (!*p) + /* Ignore line if empty. */ + continue; + + /* Pointer to start of IPv4 or IPv6 address part. */ + txtaddr = p; + + /* Advance past address part. */ + while (*p && !ISSPACE(*p)) + p++; + if (!*p) + /* Ignore line if reached end of line. */ + continue; + + /* Null terminate address part. */ + *p = '\0'; + + /* Advance to host name */ + p++; + while (*p && ISSPACE(*p)) + p++; + if (!*p) + /* Ignore line if reached end of line. */ + continue; + + /* Pointer to start of host name. */ + txthost = p; + + /* Advance past host name. */ + while (*p && !ISSPACE(*p)) + p++; + + /* Pointer to start of first alias. */ + txtalias = NULL; + if (*p) + { + q = p + 1; + while (*q && ISSPACE(*q)) + q++; + if (*q) + txtalias = q; + } + + /* Null terminate host name. */ + *p = '\0'; + + /* find out number of aliases. */ + naliases = 0; + if (txtalias) + { + p = txtalias; + while (*p) + { + while (*p && !ISSPACE(*p)) + p++; + while (*p && ISSPACE(*p)) + p++; + naliases++; + } + } + + /* Convert address string to network address for the requested family. */ + addrlen = 0; + addr.family = AF_UNSPEC; + addr.addrV4.s_addr = INADDR_NONE; + if ((family == AF_INET) || (family == AF_UNSPEC)) + { + addr.addrV4.s_addr = inet_addr(txtaddr); + if (addr.addrV4.s_addr != INADDR_NONE) + { + /* Actual network address family and length. */ + addr.family = AF_INET; + addrlen = sizeof(addr.addrV4); + } + } + if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen))) + { + if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0) + { + /* Actual network address family and length. */ + addr.family = AF_INET6; + addrlen = sizeof(addr.addrV6); + } + } + if (!addrlen) + /* Ignore line if invalid address string for the requested family. */ + continue; + + /* + ** Actual address family possible values are AF_INET and AF_INET6 only. + */ + + /* Allocate memory for the hostent structure. */ + hostent = malloc(sizeof(struct hostent)); + if (!hostent) + break; + + /* Initialize fields for out of memory condition. */ + hostent->h_aliases = NULL; + hostent->h_addr_list = NULL; + + /* Copy official host name. */ + hostent->h_name = strdup(txthost); + if (!hostent->h_name) + break; + + /* Copy network address. */ + hostent->h_addr_list = malloc(2 * sizeof(char *)); + if (!hostent->h_addr_list) + break; + hostent->h_addr_list[1] = NULL; + hostent->h_addr_list[0] = malloc(addrlen); + if (!hostent->h_addr_list[0]) + break; + if (addr.family == AF_INET) + memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4)); + else + memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6)); + + /* Copy aliases. */ + hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); + if (!hostent->h_aliases) + break; + alias = hostent->h_aliases; + while (naliases) + *(alias + naliases--) = NULL; + *alias = NULL; + while (txtalias) + { + p = txtalias; + while (*p && !ISSPACE(*p)) + p++; + q = p; + while (*q && ISSPACE(*q)) + q++; + *p = '\0'; + if ((*alias = strdup(txtalias)) == NULL) + break; + alias++; + txtalias = *q ? q : NULL; + } + if (txtalias) + /* Alias memory allocation failure. */ + break; + + /* Copy actual network address family and length. */ + hostent->h_addrtype = aresx_sitoss(addr.family); + hostent->h_length = aresx_uztoss(addrlen); + + /* Free line buffer. */ + free(line); + + /* Return hostent successfully */ + *host = hostent; + return ARES_SUCCESS; + + } + + /* If allocated, free line buffer. */ + if (line) + free(line); + + if (status == ARES_SUCCESS) + { + /* Memory allocation failure; clean up. */ + if (hostent) + { + if (hostent->h_name) + free((char *) hostent->h_name); + if (hostent->h_aliases) + { + for (alias = hostent->h_aliases; *alias; alias++) + free(*alias); + free(hostent->h_aliases); + } + if (hostent->h_addr_list) + { + if (hostent->h_addr_list[0]) + free(hostent->h_addr_list[0]); + free(hostent->h_addr_list); + } + free(hostent); + } + return ARES_ENOMEM; + } + + return status; +} diff -Nru python-gevent-0.13.7/c-ares/ares_getnameinfo.c python-gevent-1.0/c-ares/ares_getnameinfo.c --- python-gevent-0.13.7/c-ares/ares_getnameinfo.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getnameinfo.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,427 @@ + +/* Copyright 2005 by Dominick Meglio + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ +#include "ares_setup.h" + +#ifdef HAVE_GETSERVBYPORT_R +# if !defined(GETSERVBYPORT_R_ARGS) || \ + (GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6) +# error "you MUST specifiy a valid number of arguments for getservbyport_r" +# endif +#endif + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include +#include + +#include "ares.h" +#include "ares_ipv6.h" +#include "inet_ntop.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +struct nameinfo_query { + ares_nameinfo_callback callback; + void *arg; + union { + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; + } addr; + int family; + int flags; + int timeouts; +}; + +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#define IPBUFSIZ \ + (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE) +#else +#define IPBUFSIZ \ + (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")) +#endif + +static void nameinfo_callback(void *arg, int status, int timeouts, + struct hostent *host); +static char *lookup_service(unsigned short port, int flags, + char *buf, size_t buflen); +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid, + char *buf, size_t buflen); +#endif +static char *ares_striendstr(const char *s1, const char *s2); + +void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, + ares_socklen_t salen, + int flags, ares_nameinfo_callback callback, void *arg) +{ + struct sockaddr_in *addr = NULL; + struct sockaddr_in6 *addr6 = NULL; + struct nameinfo_query *niquery; + unsigned int port = 0; + + /* Validate socket address family and length */ + if ((sa->sa_family == AF_INET) && + (salen == sizeof(struct sockaddr_in))) + { + addr = (struct sockaddr_in *)sa; + port = addr->sin_port; + } + else if ((sa->sa_family == AF_INET6) && + (salen == sizeof(struct sockaddr_in6))) + { + addr6 = (struct sockaddr_in6 *)sa; + port = addr6->sin6_port; + } + else + { + callback(arg, ARES_ENOTIMP, 0, NULL, NULL); + return; + } + + /* If neither, assume they want a host */ + if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) + flags |= ARES_NI_LOOKUPHOST; + + /* All they want is a service, no need for DNS */ + if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) + { + char buf[33], *service; + + service = lookup_service((unsigned short)(port & 0xffff), + flags, buf, sizeof(buf)); + callback(arg, ARES_SUCCESS, 0, NULL, service); + return; + } + + /* They want a host lookup */ + if ((flags & ARES_NI_LOOKUPHOST)) + { + /* A numeric host can be handled without DNS */ + if ((flags & ARES_NI_NUMERICHOST)) + { + char ipbuf[IPBUFSIZ]; + char srvbuf[33]; + char *service = NULL; + ipbuf[0] = 0; + + /* Specifying not to lookup a host, but then saying a host + * is required has to be illegal. + */ + if (flags & ARES_NI_NAMEREQD) + { + callback(arg, ARES_EBADFLAGS, 0, NULL, NULL); + return; + } + if (salen == sizeof(struct sockaddr_in6)) + { + ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); + /* If the system supports scope IDs, use it */ +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); +#endif + } + else + { + ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ); + } + /* They also want a service */ + if (flags & ARES_NI_LOOKUPSERVICE) + service = lookup_service((unsigned short)(port & 0xffff), + flags, srvbuf, sizeof(srvbuf)); + callback(arg, ARES_SUCCESS, 0, ipbuf, service); + return; + } + /* This is where a DNS lookup becomes necessary */ + else + { + niquery = malloc(sizeof(struct nameinfo_query)); + if (!niquery) + { + callback(arg, ARES_ENOMEM, 0, NULL, NULL); + return; + } + niquery->callback = callback; + niquery->arg = arg; + niquery->flags = flags; + niquery->timeouts = 0; + if (sa->sa_family == AF_INET) + { + niquery->family = AF_INET; + memcpy(&niquery->addr.addr4, addr, sizeof(niquery->addr.addr4)); + ares_gethostbyaddr(channel, &addr->sin_addr, + sizeof(struct in_addr), AF_INET, + nameinfo_callback, niquery); + } + else + { + niquery->family = AF_INET6; + memcpy(&niquery->addr.addr6, addr6, sizeof(niquery->addr.addr6)); + ares_gethostbyaddr(channel, &addr6->sin6_addr, + sizeof(struct ares_in6_addr), AF_INET6, + nameinfo_callback, niquery); + } + } + } +} + +static void nameinfo_callback(void *arg, int status, int timeouts, + struct hostent *host) +{ + struct nameinfo_query *niquery = (struct nameinfo_query *) arg; + char srvbuf[33]; + char *service = NULL; + + niquery->timeouts += timeouts; + if (status == ARES_SUCCESS) + { + /* They want a service too */ + if (niquery->flags & ARES_NI_LOOKUPSERVICE) + { + if (niquery->family == AF_INET) + service = lookup_service(niquery->addr.addr4.sin_port, + niquery->flags, srvbuf, sizeof(srvbuf)); + else + service = lookup_service(niquery->addr.addr6.sin6_port, + niquery->flags, srvbuf, sizeof(srvbuf)); + } + /* NOFQDN means we have to strip off the domain name portion. We do + this by determining our own domain name, then searching the string + for this domain name and removing it. + */ +#ifdef HAVE_GETHOSTNAME + if (niquery->flags & ARES_NI_NOFQDN) + { + char buf[255]; + char *domain; + gethostname(buf, 255); + if ((domain = strchr(buf, '.')) != NULL) + { + char *end = ares_striendstr(host->h_name, domain); + if (end) + *end = 0; + } + } +#endif + niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, + (char *)(host->h_name), + service); + free(niquery); + return; + } + /* We couldn't find the host, but it's OK, we can use the IP */ + else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD)) + { + char ipbuf[IPBUFSIZ]; + if (niquery->family == AF_INET) + ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, + IPBUFSIZ); + else + { + ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, + IPBUFSIZ); +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, + sizeof(ipbuf)); +#endif + } + /* They want a service too */ + if (niquery->flags & ARES_NI_LOOKUPSERVICE) + { + if (niquery->family == AF_INET) + service = lookup_service(niquery->addr.addr4.sin_port, + niquery->flags, srvbuf, sizeof(srvbuf)); + else + service = lookup_service(niquery->addr.addr6.sin6_port, + niquery->flags, srvbuf, sizeof(srvbuf)); + } + niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, + service); + free(niquery); + return; + } + niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL); + free(niquery); +} + +static char *lookup_service(unsigned short port, int flags, + char *buf, size_t buflen) +{ + const char *proto; + struct servent *sep; +#ifdef HAVE_GETSERVBYPORT_R + struct servent se; +#endif + char tmpbuf[4096]; + + if (port) + { + if (flags & ARES_NI_NUMERICSERV) + sep = NULL; + else + { + if (flags & ARES_NI_UDP) + proto = "udp"; + else if (flags & ARES_NI_SCTP) + proto = "sctp"; + else if (flags & ARES_NI_DCCP) + proto = "dccp"; + else + proto = "tcp"; +#ifdef HAVE_GETSERVBYPORT_R + sep = &se; + memset(tmpbuf, 0, sizeof(tmpbuf)); +#if GETSERVBYPORT_R_ARGS == 6 + if (getservbyport_r(port, proto, &se, (void *)tmpbuf, + sizeof(tmpbuf), &sep) != 0) + sep = NULL; +#elif GETSERVBYPORT_R_ARGS == 5 + sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, + sizeof(tmpbuf)); +#elif GETSERVBYPORT_R_ARGS == 4 + if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0) + sep = NULL; +#else + /* Lets just hope the OS uses TLS! */ + sep = getservbyport(port, proto); +#endif +#else + /* Lets just hope the OS uses TLS! */ +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) + sep = getservbyport(port, (char*)proto); +#else + sep = getservbyport(port, proto); +#endif +#endif + } + if (sep && sep->s_name) + /* get service name */ + strcpy(tmpbuf, sep->s_name); + else + /* get port as a string */ + sprintf(tmpbuf, "%u", (unsigned int)ntohs(port)); + if (strlen(tmpbuf) < buflen) + /* return it if buffer big enough */ + strcpy(buf, tmpbuf); + else + /* avoid reusing previous one */ + buf[0] = '\0'; + return buf; + } + buf[0] = '\0'; + return NULL; +} + +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, + char *buf, size_t buflen) +{ +#ifdef HAVE_IF_INDEXTONAME + int is_ll, is_mcll; +#endif + static const char fmt_u[] = "%u"; + static const char fmt_lu[] = "%lu"; + char tmpbuf[IF_NAMESIZE + 2]; + size_t bufl; + const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))? + fmt_lu:fmt_u; + + tmpbuf[0] = '%'; + +#ifdef HAVE_IF_INDEXTONAME + is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr); + is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr); + if ((flags & ARES_NI_NUMERICSCOPE) || + (!is_ll && !is_mcll)) + { + sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + } + else + { + if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) + sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + } +#else + sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + (void) flags; +#endif + tmpbuf[IF_NAMESIZE + 1] = '\0'; + bufl = strlen(buf); + + if(bufl + strlen(tmpbuf) < buflen) + /* only append the scopeid string if it fits in the target buffer */ + strcpy(&buf[bufl], tmpbuf); +} +#endif + +/* Determines if s1 ends with the string in s2 (case-insensitive) */ +static char *ares_striendstr(const char *s1, const char *s2) +{ + const char *c1, *c2, *c1_begin; + int lo1, lo2; + size_t s1_len = strlen(s1), s2_len = strlen(s2); + + /* If the substr is longer than the full str, it can't match */ + if (s2_len > s1_len) + return NULL; + + /* Jump to the end of s1 minus the length of s2 */ + c1_begin = s1+s1_len-s2_len; + c1 = (const char *)c1_begin; + c2 = s2; + while (c2 < s2+s2_len) + { + lo1 = TOLOWER(*c1); + lo2 = TOLOWER(*c2); + if (lo1 != lo2) + return NULL; + else + { + c1++; + c2++; + } + } + if (c2 == c1 && c2 == NULL) + return (char *)c1_begin; + return NULL; +} diff -Nru python-gevent-0.13.7/c-ares/ares_getopt.c python-gevent-1.0/c-ares/ares_getopt.c --- python-gevent-0.13.7/c-ares/ares_getopt.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getopt.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,122 @@ +/* + * Original file name getopt.c Initial import into the c-ares source tree + * on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with + * the modified BSD license, BSD license without the advertising clause. + * + */ + +/* + * getopt.c -- + * + * Standard UNIX getopt function. Code is from BSD. + * + * Copyright (c) 1987-2001 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * A. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * B. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * C. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* #if !defined(lint) + * static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94"; + * #endif + */ + +#include +#include +#include +#include "ares_getopt.h" + +int opterr = 1, /* if error message should be printed */ + optind = 1; /* index into parent argv vector */ +int optopt = 0; /* character checked for validity */ +static int optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG (char *)"" + +/* + * ares_getopt -- + * Parse argc/argv argument vector. + */ +int +ares_getopt(int nargc, char * const nargv[], const char *ostr) +{ + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + (oli = strchr(ostr, optopt)) == NULL) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return (EOF); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __FILE__, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __FILE__, optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} diff -Nru python-gevent-0.13.7/c-ares/ares_getopt.h python-gevent-1.0/c-ares/ares_getopt.h --- python-gevent-0.13.7/c-ares/ares_getopt.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getopt.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,53 @@ +#ifndef ARES_GETOPT_H +#define ARES_GETOPT_H + +/* + * Copyright (c) 1987-2001 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * A. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * B. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * C. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +int ares_getopt(int nargc, char * const nargv[], const char *ostr); + +#undef optarg +#undef optind +#undef opterr +#undef optopt +#undef optreset + +#define optarg ares_optarg +#define optind ares_optind +#define opterr ares_opterr +#define optopt ares_optopt +#define optreset ares_optreset + +extern char *optarg; +extern int optind; +extern int opterr; +extern int optopt; + +#endif /* ARES_GETOPT_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_getsock.c python-gevent-1.0/c-ares/ares_getsock.c --- python-gevent-0.13.7/c-ares/ares_getsock.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_getsock.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,72 @@ + +/* Copyright (C) 2005 - 2010, Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#include "ares.h" +#include "ares_private.h" + +int ares_getsock(ares_channel channel, + ares_socket_t *socks, + int numsocks) /* size of the 'socks' array */ +{ + struct server_state *server; + int i; + int sockindex=0; + int bitmap = 0; + unsigned int setbits = 0xffffffff; + + /* Are there any active queries? */ + int active_queries = !ares__is_list_empty(&(channel->all_queries)); + + for (i = 0; + (i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM); + i++) + { + server = &channel->servers[i]; + /* We only need to register interest in UDP sockets if we have + * outstanding queries. + */ + if (active_queries && server->udp_socket != ARES_SOCKET_BAD) + { + if(sockindex >= numsocks) + break; + socks[sockindex] = server->udp_socket; + bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); + sockindex++; + } + /* We always register for TCP events, because we want to know + * when the other side closes the connection, so we don't waste + * time trying to use a broken connection. + */ + if (server->tcp_socket != ARES_SOCKET_BAD) + { + if(sockindex >= numsocks) + break; + socks[sockindex] = server->tcp_socket; + bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); + + if (server->qhead && active_queries) + /* then the tcp socket is also writable! */ + bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); + + sockindex++; + } + } + return bitmap; +} diff -Nru python-gevent-0.13.7/c-ares/ares.h python-gevent-1.0/c-ares/ares.h --- python-gevent-0.13.7/c-ares/ares.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,586 @@ + +/* Copyright 1998, 2009 by the Massachusetts Institute of Technology. + * Copyright (C) 2007-2011 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifndef ARES__H +#define ARES__H + +#include "ares_version.h" /* c-ares version defines */ +#include "ares_build.h" /* c-ares build definitions */ +#include "ares_rules.h" /* c-ares rules enforcement */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && \ + !defined(WIN32) && !defined(__SYMBIAN32__) +# define WIN32 +#endif + +#include + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on system that are known to + require it! */ +#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ + defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ + defined(ANDROID) || defined(__ANDROID__) +#include +#endif +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +#include +#endif + +#if defined(WATT32) +# include +# include +# include +#elif defined(_WIN32_WCE) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +#elif defined(WIN32) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#else +# include +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** c-ares external API function linkage decorations. +*/ + +#if !defined(CARES_STATICLIB) && \ + (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) + /* __declspec function decoration for Win32 and Symbian DLL's */ +# if defined(CARES_BUILDING_LIBRARY) +# define CARES_EXTERN __declspec(dllexport) +# else +# define CARES_EXTERN __declspec(dllimport) +# endif +#else + /* visibility function decoration for other cases */ +# if !defined(CARES_SYMBOL_HIDING) || \ + defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) +# define CARES_EXTERN +# else +# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN +# endif +#endif + + +#define ARES_SUCCESS 0 + +/* Server error codes (ARES_ENODATA indicates no relevant answer) */ +#define ARES_ENODATA 1 +#define ARES_EFORMERR 2 +#define ARES_ESERVFAIL 3 +#define ARES_ENOTFOUND 4 +#define ARES_ENOTIMP 5 +#define ARES_EREFUSED 6 + +/* Locally generated error codes */ +#define ARES_EBADQUERY 7 +#define ARES_EBADNAME 8 +#define ARES_EBADFAMILY 9 +#define ARES_EBADRESP 10 +#define ARES_ECONNREFUSED 11 +#define ARES_ETIMEOUT 12 +#define ARES_EOF 13 +#define ARES_EFILE 14 +#define ARES_ENOMEM 15 +#define ARES_EDESTRUCTION 16 +#define ARES_EBADSTR 17 + +/* ares_getnameinfo error codes */ +#define ARES_EBADFLAGS 18 + +/* ares_getaddrinfo error codes */ +#define ARES_ENONAME 19 +#define ARES_EBADHINTS 20 + +/* Uninitialized library error code */ +#define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */ + +/* ares_library_init error codes */ +#define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */ +#define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */ + +/* More error codes */ +#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */ + +/* Flag values */ +#define ARES_FLAG_USEVC (1 << 0) +#define ARES_FLAG_PRIMARY (1 << 1) +#define ARES_FLAG_IGNTC (1 << 2) +#define ARES_FLAG_NORECURSE (1 << 3) +#define ARES_FLAG_STAYOPEN (1 << 4) +#define ARES_FLAG_NOSEARCH (1 << 5) +#define ARES_FLAG_NOALIASES (1 << 6) +#define ARES_FLAG_NOCHECKRESP (1 << 7) +#define ARES_FLAG_EDNS (1 << 8) + +/* Option mask values */ +#define ARES_OPT_FLAGS (1 << 0) +#define ARES_OPT_TIMEOUT (1 << 1) +#define ARES_OPT_TRIES (1 << 2) +#define ARES_OPT_NDOTS (1 << 3) +#define ARES_OPT_UDP_PORT (1 << 4) +#define ARES_OPT_TCP_PORT (1 << 5) +#define ARES_OPT_SERVERS (1 << 6) +#define ARES_OPT_DOMAINS (1 << 7) +#define ARES_OPT_LOOKUPS (1 << 8) +#define ARES_OPT_SOCK_STATE_CB (1 << 9) +#define ARES_OPT_SORTLIST (1 << 10) +#define ARES_OPT_SOCK_SNDBUF (1 << 11) +#define ARES_OPT_SOCK_RCVBUF (1 << 12) +#define ARES_OPT_TIMEOUTMS (1 << 13) +#define ARES_OPT_ROTATE (1 << 14) +#define ARES_OPT_EDNSPSZ (1 << 15) + +/* Nameinfo flag values */ +#define ARES_NI_NOFQDN (1 << 0) +#define ARES_NI_NUMERICHOST (1 << 1) +#define ARES_NI_NAMEREQD (1 << 2) +#define ARES_NI_NUMERICSERV (1 << 3) +#define ARES_NI_DGRAM (1 << 4) +#define ARES_NI_TCP 0 +#define ARES_NI_UDP ARES_NI_DGRAM +#define ARES_NI_SCTP (1 << 5) +#define ARES_NI_DCCP (1 << 6) +#define ARES_NI_NUMERICSCOPE (1 << 7) +#define ARES_NI_LOOKUPHOST (1 << 8) +#define ARES_NI_LOOKUPSERVICE (1 << 9) +/* Reserved for future use */ +#define ARES_NI_IDN (1 << 10) +#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11) +#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12) + +/* Addrinfo flag values */ +#define ARES_AI_CANONNAME (1 << 0) +#define ARES_AI_NUMERICHOST (1 << 1) +#define ARES_AI_PASSIVE (1 << 2) +#define ARES_AI_NUMERICSERV (1 << 3) +#define ARES_AI_V4MAPPED (1 << 4) +#define ARES_AI_ALL (1 << 5) +#define ARES_AI_ADDRCONFIG (1 << 6) +/* Reserved for future use */ +#define ARES_AI_IDN (1 << 10) +#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11) +#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12) +#define ARES_AI_CANONIDN (1 << 13) + +#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \ + ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \ + ARES_AI_ADDRCONFIG) +#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this + many sockets */ +#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num))) +#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ + ARES_GETSOCK_MAXNUM))) + +/* c-ares library initialization flag values */ +#define ARES_LIB_INIT_NONE (0) +#define ARES_LIB_INIT_WIN32 (1 << 0) +#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32) + + +/* + * Typedef our socket type + */ + +#ifndef ares_socket_typedef +#ifdef WIN32 +typedef SOCKET ares_socket_t; +#define ARES_SOCKET_BAD INVALID_SOCKET +#else +typedef int ares_socket_t; +#define ARES_SOCKET_BAD -1 +#endif +#define ares_socket_typedef +#endif /* ares_socket_typedef */ + +typedef void (*ares_sock_state_cb)(void *data, + ares_socket_t socket_fd, + int readable, + int writable); + +struct apattern; + +/* NOTE about the ares_options struct to users and developers. + + This struct will remain looking like this. It will not be extended nor + shrunk in future releases, but all new options will be set by ares_set_*() + options instead of with the ares_init_options() function. + + Eventually (in a galaxy far far away), all options will be settable by + ares_set_*() options and the ares_init_options() function will become + deprecated. + + When new options are added to c-ares, they are not added to this + struct. And they are not "saved" with the ares_save_options() function but + instead we encourage the use of the ares_dup() function. Needless to say, + if you add config options to c-ares you need to make sure ares_dup() + duplicates this new option. + + */ +struct ares_options { + int flags; + int timeout; /* in seconds or milliseconds, depending on options */ + int tries; + int ndots; + unsigned short udp_port; + unsigned short tcp_port; + int socket_send_buffer_size; + int socket_receive_buffer_size; + struct in_addr *servers; + int nservers; + char **domains; + int ndomains; + char *lookups; + ares_sock_state_cb sock_state_cb; + void *sock_state_cb_data; + struct apattern *sortlist; + int nsort; + int ednspsz; +}; + +struct hostent; +struct timeval; +struct sockaddr; +struct ares_channeldata; + +typedef struct ares_channeldata *ares_channel; + +typedef void (*ares_callback)(void *arg, + int status, + int timeouts, + unsigned char *abuf, + int alen); + +typedef void (*ares_host_callback)(void *arg, + int status, + int timeouts, + struct hostent *hostent); + +typedef void (*ares_nameinfo_callback)(void *arg, + int status, + int timeouts, + char *node, + char *service); + +typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd, + int type, + void *data); + +CARES_EXTERN int ares_library_init(int flags); + +CARES_EXTERN void ares_library_cleanup(void); + +CARES_EXTERN const char *ares_version(int *version); + +CARES_EXTERN int ares_init(ares_channel *channelptr); + +CARES_EXTERN int ares_init_options(ares_channel *channelptr, + struct ares_options *options, + int optmask); + +CARES_EXTERN int ares_save_options(ares_channel channel, + struct ares_options *options, + int *optmask); + +CARES_EXTERN void ares_destroy_options(struct ares_options *options); + +CARES_EXTERN int ares_dup(ares_channel *dest, + ares_channel src); + +CARES_EXTERN void ares_destroy(ares_channel channel); + +CARES_EXTERN void ares_cancel(ares_channel channel); + +/* These next 3 configure local binding for the out-going socket + * connection. Use these to specify source IP and/or network device + * on multi-homed systems. + */ +CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip); + +/* local_ip6 should be 16 bytes in length */ +CARES_EXTERN void ares_set_local_ip6(ares_channel channel, + const unsigned char* local_ip6); + +/* local_dev_name should be null terminated. */ +CARES_EXTERN void ares_set_local_dev(ares_channel channel, + const char* local_dev_name); + +CARES_EXTERN void ares_set_socket_callback(ares_channel channel, + ares_sock_create_callback callback, + void *user_data); + +CARES_EXTERN void ares_send(ares_channel channel, + const unsigned char *qbuf, + int qlen, + ares_callback callback, + void *arg); + +CARES_EXTERN void ares_query(ares_channel channel, + const char *name, + int dnsclass, + int type, + ares_callback callback, + void *arg); + +CARES_EXTERN void ares_search(ares_channel channel, + const char *name, + int dnsclass, + int type, + ares_callback callback, + void *arg); + +CARES_EXTERN void ares_gethostbyname(ares_channel channel, + const char *name, + int family, + ares_host_callback callback, + void *arg); + +CARES_EXTERN int ares_gethostbyname_file(ares_channel channel, + const char *name, + int family, + struct hostent **host); + +CARES_EXTERN void ares_gethostbyaddr(ares_channel channel, + const void *addr, + int addrlen, + int family, + ares_host_callback callback, + void *arg); + +CARES_EXTERN void ares_getnameinfo(ares_channel channel, + const struct sockaddr *sa, + ares_socklen_t salen, + int flags, + ares_nameinfo_callback callback, + void *arg); + +CARES_EXTERN int ares_fds(ares_channel channel, + fd_set *read_fds, + fd_set *write_fds); + +CARES_EXTERN int ares_getsock(ares_channel channel, + ares_socket_t *socks, + int numsocks); + +CARES_EXTERN struct timeval *ares_timeout(ares_channel channel, + struct timeval *maxtv, + struct timeval *tv); + +CARES_EXTERN void ares_process(ares_channel channel, + fd_set *read_fds, + fd_set *write_fds); + +CARES_EXTERN void ares_process_fd(ares_channel channel, + ares_socket_t read_fd, + ares_socket_t write_fd); + +CARES_EXTERN int ares_create_query(const char *name, + int dnsclass, + int type, + unsigned short id, + int rd, + unsigned char **buf, + int *buflen, + int max_udp_size); + +CARES_EXTERN int ares_mkquery(const char *name, + int dnsclass, + int type, + unsigned short id, + int rd, + unsigned char **buf, + int *buflen); + +CARES_EXTERN int ares_expand_name(const unsigned char *encoded, + const unsigned char *abuf, + int alen, + char **s, + long *enclen); + +CARES_EXTERN int ares_expand_string(const unsigned char *encoded, + const unsigned char *abuf, + int alen, + unsigned char **s, + long *enclen); + +/* + * NOTE: before c-ares 1.7.0 we would most often use the system in6_addr + * struct below when ares itself was built, but many apps would use this + * private version since the header checked a HAVE_* define for it. Starting + * with 1.7.0 we always declare and use our own to stop relying on the + * system's one. + */ +struct ares_in6_addr { + union { + unsigned char _S6_u8[16]; + } _S6_un; +}; + +struct ares_addrttl { + struct in_addr ipaddr; + int ttl; +}; + +struct ares_addr6ttl { + struct ares_in6_addr ip6addr; + int ttl; +}; + +struct ares_srv_reply { + struct ares_srv_reply *next; + char *host; + unsigned short priority; + unsigned short weight; + unsigned short port; +}; + +struct ares_mx_reply { + struct ares_mx_reply *next; + char *host; + unsigned short priority; +}; + +struct ares_txt_reply { + struct ares_txt_reply *next; + unsigned char *txt; + size_t length; /* length excludes null termination */ +}; + +struct ares_naptr_reply { + struct ares_naptr_reply *next; + unsigned char *flags; + unsigned char *service; + unsigned char *regexp; + char *replacement; + unsigned short order; + unsigned short preference; +}; + +struct ares_soa_reply { + char *nsname; + char *hostmaster; + unsigned int serial; + unsigned int refresh; + unsigned int retry; + unsigned int expire; + unsigned int minttl; +}; + +/* +** Parse the buffer, starting at *abuf and of length alen bytes, previously +** obtained from an ares_search call. Put the results in *host, if nonnull. +** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with +** their TTLs in that array, and set *naddrttls to the number of addresses +** so written. +*/ + +CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf, + int alen, + struct hostent **host, + struct ares_addrttl *addrttls, + int *naddrttls); + +CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf, + int alen, + struct hostent **host, + struct ares_addr6ttl *addrttls, + int *naddrttls); + +CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf, + int alen, + const void *addr, + int addrlen, + int family, + struct hostent **host); + +CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf, + int alen, + struct hostent **host); + +CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf, + int alen, + struct ares_srv_reply** srv_out); + +CARES_EXTERN int ares_parse_mx_reply(const unsigned char* abuf, + int alen, + struct ares_mx_reply** mx_out); + +CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf, + int alen, + struct ares_txt_reply** txt_out); + +CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf, + int alen, + struct ares_naptr_reply** naptr_out); + +CARES_EXTERN int ares_parse_soa_reply(const unsigned char* abuf, + int alen, + struct ares_soa_reply** soa_out); + +CARES_EXTERN void ares_free_string(void *str); + +CARES_EXTERN void ares_free_hostent(struct hostent *host); + +CARES_EXTERN void ares_free_soa(struct ares_soa_reply *soa); + +CARES_EXTERN void ares_free_data(void *dataptr); + +CARES_EXTERN const char *ares_strerror(int code); + +/* TODO: Hold port here as well. */ +struct ares_addr_node { + struct ares_addr_node *next; + int family; + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; +}; + +CARES_EXTERN int ares_set_servers(ares_channel channel, + struct ares_addr_node *servers); + +/* Incomming string format: host[:port][,host[:port]]... */ +CARES_EXTERN int ares_set_servers_csv(ares_channel channel, + const char* servers); + +CARES_EXTERN int ares_get_servers(ares_channel channel, + struct ares_addr_node **servers); + +#ifdef __cplusplus +} +#endif + +#endif /* ARES__H */ diff -Nru python-gevent-0.13.7/c-ares/ares_init.c python-gevent-1.0/c-ares/ares_init.c --- python-gevent-0.13.7/c-ares/ares_init.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_init.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,2023 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2007-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include +#include +#include +#include + +#if defined(ANDROID) || defined(__ANDROID__) +#include +/* From the Bionic sources */ +#define DNS_PROP_NAME_PREFIX "net.dns" +#define MAX_DNS_PROPERTIES 8 +#endif + +#include "ares.h" +#include "inet_ntop.h" +#include "inet_net_pton.h" +#include "ares_library_init.h" +#include "ares_nowarn.h" +#include "ares_platform.h" +#include "ares_private.h" + +#ifdef WATT32 +#undef WIN32 /* Redefined in MingW/MSVC headers */ +#endif + +static int init_by_options(ares_channel channel, + const struct ares_options *options, + int optmask); +static int init_by_environment(ares_channel channel); +static int init_by_resolv_conf(ares_channel channel); +static int init_by_defaults(ares_channel channel); + +#ifndef WATT32 +static int config_nameserver(struct server_state **servers, int *nservers, + char *str); +#endif +static int set_search(ares_channel channel, const char *str); +static int set_options(ares_channel channel, const char *str); +static const char *try_option(const char *p, const char *q, const char *opt); +static int init_id_key(rc4_key* key,int key_data_len); + +#if !defined(WIN32) && !defined(WATT32) && \ + !defined(ANDROID) && !defined(__ANDROID__) +static int sortlist_alloc(struct apattern **sortlist, int *nsort, + struct apattern *pat); +static int ip_addr(const char *s, ssize_t len, struct in_addr *addr); +static void natural_mask(struct apattern *pat); +static int config_domain(ares_channel channel, char *str); +static int config_lookup(ares_channel channel, const char *str, + const char *bindch, const char *filech); +static int config_sortlist(struct apattern **sortlist, int *nsort, + const char *str); +static char *try_config(char *s, const char *opt, char scc); +#endif + +#define ARES_CONFIG_CHECK(x) (x->lookups && x->nsort > -1 && \ + x->nservers > -1 && \ + x->ndomains > -1 && \ + x->ndots > -1 && x->timeout > -1 && \ + x->tries > -1) + +int ares_init(ares_channel *channelptr) +{ + return ares_init_options(channelptr, NULL, 0); +} + +int ares_init_options(ares_channel *channelptr, struct ares_options *options, + int optmask) +{ + ares_channel channel; + int i; + int status = ARES_SUCCESS; + struct timeval now; + +#ifdef CURLDEBUG + const char *env = getenv("CARES_MEMDEBUG"); + + if (env) + curl_memdebug(env); + env = getenv("CARES_MEMLIMIT"); + if (env) { + char *endptr; + long num = strtol(env, &endptr, 10); + if((endptr != env) && (endptr == env + strlen(env)) && (num > 0)) + curl_memlimit(num); + } +#endif + + if (ares_library_initialized() != ARES_SUCCESS) + return ARES_ENOTINITIALIZED; + + channel = malloc(sizeof(struct ares_channeldata)); + if (!channel) { + *channelptr = NULL; + return ARES_ENOMEM; + } + + now = ares__tvnow(); + + /* Set everything to distinguished values so we know they haven't + * been set yet. + */ + channel->flags = -1; + channel->timeout = -1; + channel->tries = -1; + channel->ndots = -1; + channel->rotate = -1; + channel->udp_port = -1; + channel->tcp_port = -1; + channel->ednspsz = -1; + channel->socket_send_buffer_size = -1; + channel->socket_receive_buffer_size = -1; + channel->nservers = -1; + channel->ndomains = -1; + channel->nsort = -1; + channel->tcp_connection_generation = 0; + channel->lookups = NULL; + channel->domains = NULL; + channel->sortlist = NULL; + channel->servers = NULL; + channel->sock_state_cb = NULL; + channel->sock_state_cb_data = NULL; + channel->sock_create_cb = NULL; + channel->sock_create_cb_data = NULL; + + channel->last_server = 0; + channel->last_timeout_processed = (time_t)now.tv_sec; + + memset(&channel->local_dev_name, 0, sizeof(channel->local_dev_name)); + channel->local_ip4 = 0; + memset(&channel->local_ip6, 0, sizeof(channel->local_ip6)); + + /* Initialize our lists of queries */ + ares__init_list_head(&(channel->all_queries)); + for (i = 0; i < ARES_QID_TABLE_SIZE; i++) + { + ares__init_list_head(&(channel->queries_by_qid[i])); + } + for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) + { + ares__init_list_head(&(channel->queries_by_timeout[i])); + } + + /* Initialize configuration by each of the four sources, from highest + * precedence to lowest. + */ + + if (status == ARES_SUCCESS) { + status = init_by_options(channel, options, optmask); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", + ares_strerror(status))); + } + if (status == ARES_SUCCESS) { + status = init_by_environment(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", + ares_strerror(status))); + } + if (status == ARES_SUCCESS) { + status = init_by_resolv_conf(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", + ares_strerror(status))); + } + + /* + * No matter what failed or succeeded, seed defaults to provide + * useful behavior for things that we missed. + */ + status = init_by_defaults(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", + ares_strerror(status))); + + /* Generate random key */ + + if (status == ARES_SUCCESS) { + status = init_id_key(&channel->id_key, ARES_ID_KEY_LEN); + if (status == ARES_SUCCESS) + channel->next_id = ares__generate_new_id(&channel->id_key); + else + DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n", + ares_strerror(status))); + } + + if (status != ARES_SUCCESS) + { + /* Something failed; clean up memory we may have allocated. */ + if (channel->servers) + free(channel->servers); + if (channel->domains) + { + for (i = 0; i < channel->ndomains; i++) + free(channel->domains[i]); + free(channel->domains); + } + if (channel->sortlist) + free(channel->sortlist); + if(channel->lookups) + free(channel->lookups); + free(channel); + return status; + } + + /* Trim to one server if ARES_FLAG_PRIMARY is set. */ + if ((channel->flags & ARES_FLAG_PRIMARY) && channel->nservers > 1) + channel->nservers = 1; + + ares__init_servers_state(channel); + + *channelptr = channel; + return ARES_SUCCESS; +} + +/* ares_dup() duplicates a channel handle with all its options and returns a + new channel handle */ +int ares_dup(ares_channel *dest, ares_channel src) +{ + struct ares_options opts; + struct ares_addr_node *servers; + int ipv6_nservers = 0; + int i, rc; + int optmask; + + *dest = NULL; /* in case of failure return NULL explicitly */ + + /* First get the options supported by the old ares_save_options() function, + which is most of them */ + rc = ares_save_options(src, &opts, &optmask); + if(rc) + return rc; + + /* Then create the new channel with those options */ + rc = ares_init_options(dest, &opts, optmask); + + /* destroy the options copy to not leak any memory */ + ares_destroy_options(&opts); + + if(rc) + return rc; + + /* Now clone the options that ares_save_options() doesn't support. */ + (*dest)->sock_create_cb = src->sock_create_cb; + (*dest)->sock_create_cb_data = src->sock_create_cb_data; + + strncpy((*dest)->local_dev_name, src->local_dev_name, + sizeof(src->local_dev_name)); + (*dest)->local_ip4 = src->local_ip4; + memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6)); + + /* Full name server cloning required when not all are IPv4 */ + for (i = 0; i < src->nservers; i++) + { + if (src->servers[i].addr.family != AF_INET) { + ipv6_nservers++; + break; + } + } + if (ipv6_nservers) { + rc = ares_get_servers(src, &servers); + if (rc != ARES_SUCCESS) + return rc; + rc = ares_set_servers(*dest, servers); + ares_free_data(servers); + if (rc != ARES_SUCCESS) + return rc; + } + + return ARES_SUCCESS; /* everything went fine */ +} + +/* Save options from initialized channel */ +int ares_save_options(ares_channel channel, struct ares_options *options, + int *optmask) +{ + int i, j; + int ipv4_nservers = 0; + + /* Zero everything out */ + memset(options, 0, sizeof(struct ares_options)); + + if (!ARES_CONFIG_CHECK(channel)) + return ARES_ENODATA; + + /* Traditionally the optmask wasn't saved in the channel struct so it was + recreated here. ROTATE is the first option that has no struct field of + its own in the public config struct */ + (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| + ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| + ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| + ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS) | + (channel->optmask & ARES_OPT_ROTATE); + + /* Copy easy stuff */ + options->flags = channel->flags; + + /* We return full millisecond resolution but that's only because we don't + set the ARES_OPT_TIMEOUT anymore, only the new ARES_OPT_TIMEOUTMS */ + options->timeout = channel->timeout; + options->tries = channel->tries; + options->ndots = channel->ndots; + options->udp_port = ntohs(aresx_sitous(channel->udp_port)); + options->tcp_port = ntohs(aresx_sitous(channel->tcp_port)); + options->sock_state_cb = channel->sock_state_cb; + options->sock_state_cb_data = channel->sock_state_cb_data; + + /* Copy IPv4 servers */ + if (channel->nservers) { + for (i = 0; i < channel->nservers; i++) + { + if (channel->servers[i].addr.family == AF_INET) + ipv4_nservers++; + } + if (ipv4_nservers) { + options->servers = malloc(ipv4_nservers * sizeof(struct in_addr)); + if (!options->servers) + return ARES_ENOMEM; + for (i = j = 0; i < channel->nservers; i++) + { + if (channel->servers[i].addr.family == AF_INET) + memcpy(&options->servers[j++], + &channel->servers[i].addr.addrV4, + sizeof(channel->servers[i].addr.addrV4)); + } + } + } + options->nservers = ipv4_nservers; + + /* copy domains */ + if (channel->ndomains) { + options->domains = malloc(channel->ndomains * sizeof(char *)); + if (!options->domains) + return ARES_ENOMEM; + + for (i = 0; i < channel->ndomains; i++) + { + options->ndomains = i; + options->domains[i] = strdup(channel->domains[i]); + if (!options->domains[i]) + return ARES_ENOMEM; + } + } + options->ndomains = channel->ndomains; + + /* copy lookups */ + if (channel->lookups) { + options->lookups = strdup(channel->lookups); + if (!options->lookups && channel->lookups) + return ARES_ENOMEM; + } + + /* copy sortlist */ + if (channel->nsort) { + options->sortlist = malloc(channel->nsort * sizeof(struct apattern)); + if (!options->sortlist) + return ARES_ENOMEM; + for (i = 0; i < channel->nsort; i++) + options->sortlist[i] = channel->sortlist[i]; + } + options->nsort = channel->nsort; + + return ARES_SUCCESS; +} + +static int init_by_options(ares_channel channel, + const struct ares_options *options, + int optmask) +{ + int i; + + /* Easy stuff. */ + if ((optmask & ARES_OPT_FLAGS) && channel->flags == -1) + channel->flags = options->flags; + if ((optmask & ARES_OPT_TIMEOUTMS) && channel->timeout == -1) + channel->timeout = options->timeout; + else if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) + channel->timeout = options->timeout * 1000; + if ((optmask & ARES_OPT_TRIES) && channel->tries == -1) + channel->tries = options->tries; + if ((optmask & ARES_OPT_NDOTS) && channel->ndots == -1) + channel->ndots = options->ndots; + if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1) + channel->rotate = 1; + if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1) + channel->udp_port = htons(options->udp_port); + if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) + channel->tcp_port = htons(options->tcp_port); + if ((optmask & ARES_OPT_SOCK_STATE_CB) && channel->sock_state_cb == NULL) + { + channel->sock_state_cb = options->sock_state_cb; + channel->sock_state_cb_data = options->sock_state_cb_data; + } + if ((optmask & ARES_OPT_SOCK_SNDBUF) + && channel->socket_send_buffer_size == -1) + channel->socket_send_buffer_size = options->socket_send_buffer_size; + if ((optmask & ARES_OPT_SOCK_RCVBUF) + && channel->socket_receive_buffer_size == -1) + channel->socket_receive_buffer_size = options->socket_receive_buffer_size; + + if ((optmask & ARES_OPT_EDNSPSZ) && channel->ednspsz == -1) + channel->ednspsz = options->ednspsz; + + /* Copy the IPv4 servers, if given. */ + if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1) + { + /* Avoid zero size allocations at any cost */ + if (options->nservers > 0) + { + channel->servers = + malloc(options->nservers * sizeof(struct server_state)); + if (!channel->servers) + return ARES_ENOMEM; + for (i = 0; i < options->nservers; i++) + { + channel->servers[i].addr.family = AF_INET; + memcpy(&channel->servers[i].addr.addrV4, + &options->servers[i], + sizeof(channel->servers[i].addr.addrV4)); + } + } + channel->nservers = options->nservers; + } + + /* Copy the domains, if given. Keep channel->ndomains consistent so + * we can clean up in case of error. + */ + if ((optmask & ARES_OPT_DOMAINS) && channel->ndomains == -1) + { + /* Avoid zero size allocations at any cost */ + if (options->ndomains > 0) + { + channel->domains = malloc(options->ndomains * sizeof(char *)); + if (!channel->domains) + return ARES_ENOMEM; + for (i = 0; i < options->ndomains; i++) + { + channel->ndomains = i; + channel->domains[i] = strdup(options->domains[i]); + if (!channel->domains[i]) + return ARES_ENOMEM; + } + } + channel->ndomains = options->ndomains; + } + + /* Set lookups, if given. */ + if ((optmask & ARES_OPT_LOOKUPS) && !channel->lookups) + { + channel->lookups = strdup(options->lookups); + if (!channel->lookups) + return ARES_ENOMEM; + } + + /* copy sortlist */ + if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) && + (options->nsort>0)) { + channel->sortlist = malloc(options->nsort * sizeof(struct apattern)); + if (!channel->sortlist) + return ARES_ENOMEM; + for (i = 0; i < options->nsort; i++) + channel->sortlist[i] = options->sortlist[i]; + channel->nsort = options->nsort; + } + + channel->optmask = optmask; + + return ARES_SUCCESS; +} + +static int init_by_environment(ares_channel channel) +{ + const char *localdomain, *res_options; + int status; + + localdomain = getenv("LOCALDOMAIN"); + if (localdomain && channel->ndomains == -1) + { + status = set_search(channel, localdomain); + if (status != ARES_SUCCESS) + return status; + } + + res_options = getenv("RES_OPTIONS"); + if (res_options) + { + status = set_options(channel, res_options); + if (status != ARES_SUCCESS) + return status; + } + + return ARES_SUCCESS; +} + +#ifdef WIN32 +/* + * get_REG_SZ() + * + * Given a 'hKey' handle to an open registry key and a 'leafKeyName' pointer + * to the name of the registry leaf key to be queried, fetch it's string + * value and return a pointer in *outptr to a newly allocated memory area + * holding it as a null-terminated string. + * + * Returns 0 and nullifies *outptr upon inability to return a string value. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Supported on Windows NT 3.5 and newer. + */ +static int get_REG_SZ(HKEY hKey, const char *leafKeyName, char **outptr) +{ + DWORD size = 0; + int res; + + *outptr = NULL; + + /* Find out size of string stored in registry */ + res = RegQueryValueEx(hKey, leafKeyName, 0, NULL, NULL, &size); + if ((res != ERROR_SUCCESS && res != ERROR_MORE_DATA) || !size) + return 0; + + /* Allocate buffer of indicated size plus one given that string + might have been stored without null termination */ + *outptr = malloc(size+1); + if (!*outptr) + return 0; + + /* Get the value for real */ + res = RegQueryValueEx(hKey, leafKeyName, 0, NULL, + (unsigned char *)*outptr, &size); + if ((res != ERROR_SUCCESS) || (size == 1)) + { + free(*outptr); + *outptr = NULL; + return 0; + } + + /* Null terminate buffer allways */ + *(*outptr + size) = '\0'; + + return 1; +} + +/* + * get_REG_SZ_9X() + * + * Functionally identical to get_REG_SZ() + * + * Supported on Windows 95, 98 and ME. + */ +static int get_REG_SZ_9X(HKEY hKey, const char *leafKeyName, char **outptr) +{ + DWORD dataType = 0; + DWORD size = 0; + int res; + + *outptr = NULL; + + /* Find out size of string stored in registry */ + res = RegQueryValueEx(hKey, leafKeyName, 0, &dataType, NULL, &size); + if ((res != ERROR_SUCCESS && res != ERROR_MORE_DATA) || !size) + return 0; + + /* Allocate buffer of indicated size plus one given that string + might have been stored without null termination */ + *outptr = malloc(size+1); + if (!*outptr) + return 0; + + /* Get the value for real */ + res = RegQueryValueEx(hKey, leafKeyName, 0, &dataType, + (unsigned char *)*outptr, &size); + if ((res != ERROR_SUCCESS) || (size == 1)) + { + free(*outptr); + *outptr = NULL; + return 0; + } + + /* Null terminate buffer allways */ + *(*outptr + size) = '\0'; + + return 1; +} + +/* + * get_enum_REG_SZ() + * + * Given a 'hKeyParent' handle to an open registry key and a 'leafKeyName' + * pointer to the name of the registry leaf key to be queried, parent key + * is enumerated searching in child keys for given leaf key name and its + * associated string value. When located, this returns a pointer in *outptr + * to a newly allocated memory area holding it as a null-terminated string. + * + * Returns 0 and nullifies *outptr upon inability to return a string value. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Supported on Windows NT 3.5 and newer. + */ +static int get_enum_REG_SZ(HKEY hKeyParent, const char *leafKeyName, + char **outptr) +{ + char enumKeyName[256]; + DWORD enumKeyNameBuffSize; + DWORD enumKeyIdx = 0; + HKEY hKeyEnum; + int gotString; + int res; + + *outptr = NULL; + + for(;;) + { + enumKeyNameBuffSize = sizeof(enumKeyName); + res = RegEnumKeyEx(hKeyParent, enumKeyIdx++, enumKeyName, + &enumKeyNameBuffSize, 0, NULL, NULL, NULL); + if (res != ERROR_SUCCESS) + break; + res = RegOpenKeyEx(hKeyParent, enumKeyName, 0, KEY_QUERY_VALUE, + &hKeyEnum); + if (res != ERROR_SUCCESS) + continue; + gotString = get_REG_SZ(hKeyEnum, leafKeyName, outptr); + RegCloseKey(hKeyEnum); + if (gotString) + break; + } + + if (!*outptr) + return 0; + + return 1; +} + +/* + * get_DNS_Registry_9X() + * + * Functionally identical to get_DNS_Registry() + * + * Implementation supports Windows 95, 98 and ME. + */ +static int get_DNS_Registry_9X(char **outptr) +{ + HKEY hKey_VxD_MStcp; + int gotString; + int res; + + *outptr = NULL; + + res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X, 0, KEY_READ, + &hKey_VxD_MStcp); + if (res != ERROR_SUCCESS) + return 0; + + gotString = get_REG_SZ_9X(hKey_VxD_MStcp, NAMESERVER, outptr); + RegCloseKey(hKey_VxD_MStcp); + + if (!gotString || !*outptr) + return 0; + + return 1; +} + +/* + * get_DNS_Registry_NT() + * + * Functionally identical to get_DNS_Registry() + * + * Refs: Microsoft Knowledge Base articles KB120642 and KB314053. + * + * Implementation supports Windows NT 3.5 and newer. + */ +static int get_DNS_Registry_NT(char **outptr) +{ + HKEY hKey_Interfaces = NULL; + HKEY hKey_Tcpip_Parameters; + int gotString; + int res; + + *outptr = NULL; + + res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, + &hKey_Tcpip_Parameters); + if (res != ERROR_SUCCESS) + return 0; + + /* + ** Global DNS settings override adapter specific parameters when both + ** are set. Additionally static DNS settings override DHCP-configured + ** parameters when both are set. + */ + + /* Global DNS static parameters */ + gotString = get_REG_SZ(hKey_Tcpip_Parameters, NAMESERVER, outptr); + if (gotString) + goto done; + + /* Global DNS DHCP-configured parameters */ + gotString = get_REG_SZ(hKey_Tcpip_Parameters, DHCPNAMESERVER, outptr); + if (gotString) + goto done; + + /* Try adapter specific parameters */ + res = RegOpenKeyEx(hKey_Tcpip_Parameters, "Interfaces", 0, + KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, + &hKey_Interfaces); + if (res != ERROR_SUCCESS) + { + hKey_Interfaces = NULL; + goto done; + } + + /* Adapter specific DNS static parameters */ + gotString = get_enum_REG_SZ(hKey_Interfaces, NAMESERVER, outptr); + if (gotString) + goto done; + + /* Adapter specific DNS DHCP-configured parameters */ + gotString = get_enum_REG_SZ(hKey_Interfaces, DHCPNAMESERVER, outptr); + +done: + if (hKey_Interfaces) + RegCloseKey(hKey_Interfaces); + + RegCloseKey(hKey_Tcpip_Parameters); + + if (!gotString || !*outptr) + return 0; + + return 1; +} + +/* + * get_DNS_Registry() + * + * Locates DNS info in the registry. When located, this returns a pointer + * in *outptr to a newly allocated memory area holding a null-terminated + * string with a space or comma seperated list of DNS IP addresses. + * + * Returns 0 and nullifies *outptr upon inability to return DNSes string. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + */ +static int get_DNS_Registry(char **outptr) +{ + win_platform platform; + int gotString = 0; + + *outptr = NULL; + + platform = ares__getplatform(); + + if (platform == WIN_NT) + gotString = get_DNS_Registry_NT(outptr); + else if (platform == WIN_9X) + gotString = get_DNS_Registry_9X(outptr); + + if (!gotString) + return 0; + + return 1; +} + +/* + * commajoin() + * + * RTF code. + */ +static void commajoin(char **dst, const char *src) +{ + char *tmp; + + if (*dst) + { + tmp = malloc(strlen(*dst) + strlen(src) + 2); + if (!tmp) + return; + sprintf(tmp, "%s,%s", *dst, src); + free(*dst); + *dst = tmp; + } + else + { + *dst = malloc(strlen(src) + 1); + if (!*dst) + return; + strcpy(*dst, src); + } +} + +/* + * get_DNS_NetworkParams() + * + * Locates DNS info using GetNetworkParams() function from the Internet + * Protocol Helper (IP Helper) API. When located, this returns a pointer + * in *outptr to a newly allocated memory area holding a null-terminated + * string with a space or comma seperated list of DNS IP addresses. + * + * Returns 0 and nullifies *outptr upon inability to return DNSes string. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Implementation supports Windows 98 and newer. + * + * Note: Ancient PSDK required in order to build a W98 target. + */ +static int get_DNS_NetworkParams(char **outptr) +{ + FIXED_INFO *fi, *newfi; + struct ares_addr namesrvr; + char *txtaddr; + IP_ADDR_STRING *ipAddr; + int res; + DWORD size = sizeof (*fi); + + *outptr = NULL; + + /* Verify run-time availability of GetNetworkParams() */ + if (ares_fpGetNetworkParams == ZERO_NULL) + return 0; + + fi = malloc(size); + if (!fi) + return 0; + + res = (*ares_fpGetNetworkParams) (fi, &size); + if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) + goto done; + + newfi = realloc(fi, size); + if (!newfi) + goto done; + + fi = newfi; + res = (*ares_fpGetNetworkParams) (fi, &size); + if (res != ERROR_SUCCESS) + goto done; + + for (ipAddr = &fi->DnsServerList; ipAddr; ipAddr = ipAddr->Next) + { + txtaddr = &ipAddr->IpAddress.String[0]; + + /* Validate converting textual address to binary format. */ + if (ares_inet_pton(AF_INET, txtaddr, &namesrvr.addrV4) == 1) + { + if ((namesrvr.addrV4.S_un.S_addr == INADDR_ANY) || + (namesrvr.addrV4.S_un.S_addr == INADDR_NONE)) + continue; + } + else if (ares_inet_pton(AF_INET6, txtaddr, &namesrvr.addrV6) == 1) + { + if (memcmp(&namesrvr.addrV6, &ares_in6addr_any, + sizeof(namesrvr.addrV6)) == 0) + continue; + } + else + continue; + + commajoin(outptr, txtaddr); + + if (!*outptr) + break; + } + +done: + if (fi) + free(fi); + + if (!*outptr) + return 0; + + return 1; +} + +/* + * get_DNS_AdaptersAddresses() + * + * Locates DNS info using GetAdaptersAddresses() function from the Internet + * Protocol Helper (IP Helper) API. When located, this returns a pointer + * in *outptr to a newly allocated memory area holding a null-terminated + * string with a space or comma seperated list of DNS IP addresses. + * + * Returns 0 and nullifies *outptr upon inability to return DNSes string. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Implementation supports Windows XP and newer. + */ +#define IPAA_INITIAL_BUF_SZ 15 * 1024 +#define IPAA_MAX_TRIES 3 +static int get_DNS_AdaptersAddresses(char **outptr) +{ + IP_ADAPTER_DNS_SERVER_ADDRESS *ipaDNSAddr; + IP_ADAPTER_ADDRESSES *ipaa, *newipaa, *ipaaEntry; + ULONG ReqBufsz = IPAA_INITIAL_BUF_SZ; + ULONG Bufsz = IPAA_INITIAL_BUF_SZ; + ULONG AddrFlags = 0; + int trying = IPAA_MAX_TRIES; + int res; + + union { + struct sockaddr *sa; + struct sockaddr_in *sa4; + struct sockaddr_in6 *sa6; + } namesrvr; + + char txtaddr[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + + *outptr = NULL; + + /* Verify run-time availability of GetAdaptersAddresses() */ + if (ares_fpGetAdaptersAddresses == ZERO_NULL) + return 0; + + ipaa = malloc(Bufsz); + if (!ipaa) + return 0; + + /* Usually this call suceeds with initial buffer size */ + res = (*ares_fpGetAdaptersAddresses) (AF_UNSPEC, AddrFlags, NULL, + ipaa, &ReqBufsz); + if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) + goto done; + + while ((res == ERROR_BUFFER_OVERFLOW) && (--trying)) + { + if (Bufsz < ReqBufsz) + { + newipaa = realloc(ipaa, ReqBufsz); + if (!newipaa) + goto done; + Bufsz = ReqBufsz; + ipaa = newipaa; + } + res = (*ares_fpGetAdaptersAddresses) (AF_UNSPEC, AddrFlags, NULL, + ipaa, &ReqBufsz); + if (res == ERROR_SUCCESS) + break; + } + if (res != ERROR_SUCCESS) + goto done; + + for (ipaaEntry = ipaa; ipaaEntry; ipaaEntry = ipaaEntry->Next) + { + for (ipaDNSAddr = ipaaEntry->FirstDnsServerAddress; + ipaDNSAddr; + ipaDNSAddr = ipaDNSAddr->Next) + { + namesrvr.sa = ipaDNSAddr->Address.lpSockaddr; + + if (namesrvr.sa->sa_family == AF_INET) + { + if ((namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_ANY) || + (namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_NONE)) + continue; + if (! ares_inet_ntop(AF_INET, &namesrvr.sa4->sin_addr, + txtaddr, sizeof(txtaddr))) + continue; + } + else if (namesrvr.sa->sa_family == AF_INET6) + { + if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, + sizeof(namesrvr.sa6->sin6_addr)) == 0) + continue; + if (! ares_inet_ntop(AF_INET6, &namesrvr.sa6->sin6_addr, + txtaddr, sizeof(txtaddr))) + continue; + } + else + continue; + + commajoin(outptr, txtaddr); + + if (!*outptr) + goto done; + } + } + +done: + if (ipaa) + free(ipaa); + + if (!*outptr) + return 0; + + return 1; +} + +/* + * get_DNS_Windows() + * + * Locates DNS info from Windows employing most suitable methods available at + * run-time no matter which Windows version it is. When located, this returns + * a pointer in *outptr to a newly allocated memory area holding a string with + * a space or comma seperated list of DNS IP addresses, null-terminated. + * + * Returns 0 and nullifies *outptr upon inability to return DNSes string. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Implementation supports Windows 95 and newer. + */ +static int get_DNS_Windows(char **outptr) +{ + /* Try using IP helper API GetAdaptersAddresses() */ + if (get_DNS_AdaptersAddresses(outptr)) + return 1; + + /* Try using IP helper API GetNetworkParams() */ + if (get_DNS_NetworkParams(outptr)) + return 1; + + /* Fall-back to registry information */ + return get_DNS_Registry(outptr); +} +#endif + +static int init_by_resolv_conf(ares_channel channel) +{ +#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(WATT32) + char *line = NULL; +#endif + int status = -1, nservers = 0, nsort = 0; + struct server_state *servers = NULL; + struct apattern *sortlist = NULL; + +#ifdef WIN32 + + if (channel->nservers > -1) /* don't override ARES_OPT_SERVER */ + return ARES_SUCCESS; + + if (get_DNS_Windows(&line)) + { + status = config_nameserver(&servers, &nservers, line); + free(line); + } + + if (status == ARES_SUCCESS) + status = ARES_EOF; + else + /* Catch the case when all the above checks fail (which happens when there + is no network card or the cable is unplugged) */ + status = ARES_EFILE; + +#elif defined(__riscos__) + + /* Under RISC OS, name servers are listed in the + system variable Inet$Resolvers, space separated. */ + + line = getenv("Inet$Resolvers"); + status = ARES_EOF; + if (line) { + char *resolvers = strdup(line), *pos, *space; + + if (!resolvers) + return ARES_ENOMEM; + + pos = resolvers; + do { + space = strchr(pos, ' '); + if (space) + *space = '\0'; + status = config_nameserver(&servers, &nservers, pos); + if (status != ARES_SUCCESS) + break; + pos = space + 1; + } while (space); + + if (status == ARES_SUCCESS) + status = ARES_EOF; + + free(resolvers); + } + +#elif defined(WATT32) + int i; + + sock_init(); + for (i = 0; def_nameservers[i]; i++) + ; + if (i == 0) + return ARES_SUCCESS; /* use localhost DNS server */ + + nservers = i; + servers = calloc(i, sizeof(struct server_state)); + if (!servers) + return ARES_ENOMEM; + + for (i = 0; def_nameservers[i]; i++) + { + servers[i].addr.addrV4.s_addr = htonl(def_nameservers[i]); + servers[i].addr.family = AF_INET; + } + status = ARES_EOF; + +#elif defined(ANDROID) || defined(__ANDROID__) + unsigned int i; + char propname[PROP_NAME_MAX]; + char propvalue[PROP_VALUE_MAX]=""; + + for (i = 1; i <= MAX_DNS_PROPERTIES; i++) { + snprintf(propname, sizeof(propname), "%s%u", DNS_PROP_NAME_PREFIX, i); + if (__system_property_get(propname, propvalue) < 1) { + status = ARES_EOF; + break; + } + status = config_nameserver(&servers, &nservers, propvalue); + if (status != ARES_SUCCESS) + break; + status = ARES_EOF; + } +#else + { + char *p; + FILE *fp; + size_t linesize; + int error; + + /* Don't read resolv.conf and friends if we don't have to */ + if (ARES_CONFIG_CHECK(channel)) + return ARES_SUCCESS; + + fp = fopen(PATH_RESOLV_CONF, "r"); + if (fp) { + while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) + { + if ((p = try_config(line, "domain", ';'))) + status = config_domain(channel, p); + else if ((p = try_config(line, "lookup", ';')) && !channel->lookups) + status = config_lookup(channel, p, "bind", "file"); + else if ((p = try_config(line, "search", ';'))) + status = set_search(channel, p); + else if ((p = try_config(line, "nameserver", ';')) && + channel->nservers == -1) + status = config_nameserver(&servers, &nservers, p); + else if ((p = try_config(line, "sortlist", ';')) && + channel->nsort == -1) + status = config_sortlist(&sortlist, &nsort, p); + else if ((p = try_config(line, "options", ';'))) + status = set_options(channel, p); + else + status = ARES_SUCCESS; + if (status != ARES_SUCCESS) + break; + } + fclose(fp); + } + else { + error = ERRNO; + switch(error) { + case ENOENT: + case ESRCH: + status = ARES_EOF; + break; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF)); + status = ARES_EFILE; + } + } + + if ((status == ARES_EOF) && (!channel->lookups)) { + /* Many systems (Solaris, Linux, BSD's) use nsswitch.conf */ + fp = fopen("/etc/nsswitch.conf", "r"); + if (fp) { + while ((status = ares__read_line(fp, &line, &linesize)) == + ARES_SUCCESS) + { + if ((p = try_config(line, "hosts:", '\0')) && !channel->lookups) + /* ignore errors */ + (void)config_lookup(channel, p, "dns", "files"); + } + fclose(fp); + } + else { + error = ERRNO; + switch(error) { + case ENOENT: + case ESRCH: + status = ARES_EOF; + break; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", + "/etc/nsswitch.conf")); + status = ARES_EFILE; + } + } + } + + if ((status == ARES_EOF) && (!channel->lookups)) { + /* Linux / GNU libc 2.x and possibly others have host.conf */ + fp = fopen("/etc/host.conf", "r"); + if (fp) { + while ((status = ares__read_line(fp, &line, &linesize)) == + ARES_SUCCESS) + { + if ((p = try_config(line, "order", '\0')) && !channel->lookups) + /* ignore errors */ + (void)config_lookup(channel, p, "bind", "hosts"); + } + fclose(fp); + } + else { + error = ERRNO; + switch(error) { + case ENOENT: + case ESRCH: + status = ARES_EOF; + break; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", + "/etc/host.conf")); + status = ARES_EFILE; + } + } + } + + if ((status == ARES_EOF) && (!channel->lookups)) { + /* Tru64 uses /etc/svc.conf */ + fp = fopen("/etc/svc.conf", "r"); + if (fp) { + while ((status = ares__read_line(fp, &line, &linesize)) == + ARES_SUCCESS) + { + if ((p = try_config(line, "hosts=", '\0')) && !channel->lookups) + /* ignore errors */ + (void)config_lookup(channel, p, "bind", "local"); + } + fclose(fp); + } + else { + error = ERRNO; + switch(error) { + case ENOENT: + case ESRCH: + status = ARES_EOF; + break; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/svc.conf")); + status = ARES_EFILE; + } + } + } + + if(line) + free(line); + } + +#endif + + /* Handle errors. */ + if (status != ARES_EOF) + { + if (servers != NULL) + free(servers); + if (sortlist != NULL) + free(sortlist); + return status; + } + + /* If we got any name server entries, fill them in. */ + if (servers) + { + channel->servers = servers; + channel->nservers = nservers; + } + + /* If we got any sortlist entries, fill them in. */ + if (sortlist) + { + channel->sortlist = sortlist; + channel->nsort = nsort; + } + + return ARES_SUCCESS; +} + +static int init_by_defaults(ares_channel channel) +{ + char *hostname = NULL; + int rc = ARES_SUCCESS; +#ifdef HAVE_GETHOSTNAME + char *dot; +#endif + + if (channel->flags == -1) + channel->flags = 0; + if (channel->timeout == -1) + channel->timeout = DEFAULT_TIMEOUT; + if (channel->tries == -1) + channel->tries = DEFAULT_TRIES; + if (channel->ndots == -1) + channel->ndots = 1; + if (channel->rotate == -1) + channel->rotate = 0; + if (channel->udp_port == -1) + channel->udp_port = htons(NAMESERVER_PORT); + if (channel->tcp_port == -1) + channel->tcp_port = htons(NAMESERVER_PORT); + + if (channel->ednspsz == -1) + channel->ednspsz = EDNSPACKETSZ; + + if (channel->nservers == -1) { + /* If nobody specified servers, try a local named. */ + channel->servers = malloc(sizeof(struct server_state)); + if (!channel->servers) { + rc = ARES_ENOMEM; + goto error; + } + channel->servers[0].addr.family = AF_INET; + channel->servers[0].addr.addrV4.s_addr = htonl(INADDR_LOOPBACK); + channel->nservers = 1; + } + +#if defined(USE_WINSOCK) +#define toolong(x) (x == -1) && (SOCKERRNO == WSAEFAULT) +#elif defined(ENAMETOOLONG) +#define toolong(x) (x == -1) && ((SOCKERRNO == ENAMETOOLONG) || \ + (SOCKERRNO == EINVAL)) +#else +#define toolong(x) (x == -1) && (SOCKERRNO == EINVAL) +#endif + + if (channel->ndomains == -1) { + /* Derive a default domain search list from the kernel hostname, + * or set it to empty if the hostname isn't helpful. + */ +#ifndef HAVE_GETHOSTNAME + channel->ndomains = 0; /* default to none */ +#else + GETHOSTNAME_TYPE_ARG2 lenv = 64; + size_t len = 64; + int res; + channel->ndomains = 0; /* default to none */ + + hostname = malloc(len); + if(!hostname) { + rc = ARES_ENOMEM; + goto error; + } + + do { + res = gethostname(hostname, lenv); + + if(toolong(res)) { + char *p; + len *= 2; + lenv *= 2; + p = realloc(hostname, len); + if(!p) { + rc = ARES_ENOMEM; + goto error; + } + hostname = p; + continue; + } + else if(res) { + rc = ARES_EBADNAME; + goto error; + } + + } WHILE_FALSE; + + dot = strchr(hostname, '.'); + if (dot) { + /* a dot was found */ + channel->domains = malloc(sizeof(char *)); + if (!channel->domains) { + rc = ARES_ENOMEM; + goto error; + } + channel->domains[0] = strdup(dot + 1); + if (!channel->domains[0]) { + rc = ARES_ENOMEM; + goto error; + } + channel->ndomains = 1; + } +#endif + } + + if (channel->nsort == -1) { + channel->sortlist = NULL; + channel->nsort = 0; + } + + if (!channel->lookups) { + channel->lookups = strdup("fb"); + if (!channel->lookups) + rc = ARES_ENOMEM; + } + + error: + if(rc) { + if(channel->servers) { + free(channel->servers); + channel->servers = NULL; + } + + if(channel->domains && channel->domains[0]) + free(channel->domains[0]); + if(channel->domains) { + free(channel->domains); + channel->domains = NULL; + } + + if(channel->lookups) { + free(channel->lookups); + channel->lookups = NULL; + } + } + + if(hostname) + free(hostname); + + return rc; +} + +#if !defined(WIN32) && !defined(WATT32) && \ + !defined(ANDROID) && !defined(__ANDROID__) +static int config_domain(ares_channel channel, char *str) +{ + char *q; + + /* Set a single search domain. */ + q = str; + while (*q && !ISSPACE(*q)) + q++; + *q = '\0'; + return set_search(channel, str); +} + +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ +# define vqualifier volatile +#else +# define vqualifier +#endif + +static int config_lookup(ares_channel channel, const char *str, + const char *bindch, const char *filech) +{ + char lookups[3], *l; + const char *vqualifier p; + + /* Set the lookup order. Only the first letter of each work + * is relevant, and it has to be "b" for DNS or "f" for the + * host file. Ignore everything else. + */ + l = lookups; + p = str; + while (*p) + { + if ((*p == *bindch || *p == *filech) && l < lookups + 2) { + if (*p == *bindch) *l++ = 'b'; + else *l++ = 'f'; + } + while (*p && !ISSPACE(*p) && (*p != ',')) + p++; + while (*p && (ISSPACE(*p) || (*p == ','))) + p++; + } + *l = '\0'; + channel->lookups = strdup(lookups); + return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; +} +#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ + +#ifndef WATT32 +static int config_nameserver(struct server_state **servers, int *nservers, + char *str) +{ + struct ares_addr host; + struct server_state *newserv; + char *p, *txtaddr; + /* On Windows, there may be more than one nameserver specified in the same + * registry key, so we parse input as a space or comma seperated list. + */ + for (p = str; p;) + { + /* Skip whitespace and commas. */ + while (*p && (ISSPACE(*p) || (*p == ','))) + p++; + if (!*p) + /* No more input, done. */ + break; + + /* Pointer to start of IPv4 or IPv6 address part. */ + txtaddr = p; + + /* Advance past this address. */ + while (*p && !ISSPACE(*p) && (*p != ',')) + p++; + if (*p) + /* Null terminate this address. */ + *p++ = '\0'; + else + /* Reached end of input, done when this address is processed. */ + p = NULL; + + /* Convert textual address to binary format. */ + if (ares_inet_pton(AF_INET, txtaddr, &host.addrV4) == 1) + host.family = AF_INET; + else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1) + host.family = AF_INET6; + else + continue; + + /* Resize servers state array. */ + newserv = realloc(*servers, (*nservers + 1) * + sizeof(struct server_state)); + if (!newserv) + return ARES_ENOMEM; + + /* Store address data. */ + newserv[*nservers].addr.family = host.family; + if (host.family == AF_INET) + memcpy(&newserv[*nservers].addr.addrV4, &host.addrV4, + sizeof(host.addrV4)); + else + memcpy(&newserv[*nservers].addr.addrV6, &host.addrV6, + sizeof(host.addrV6)); + + /* Update arguments. */ + *servers = newserv; + *nservers += 1; + } + + return ARES_SUCCESS; +} + +#if !defined(WIN32) && !defined(ANDROID) && !defined(__ANDROID__) +static int config_sortlist(struct apattern **sortlist, int *nsort, + const char *str) +{ + struct apattern pat; + const char *q; + + /* Add sortlist entries. */ + while (*str && *str != ';') + { + int bits; + char ipbuf[16], ipbufpfx[32]; + /* Find just the IP */ + q = str; + while (*q && *q != '/' && *q != ';' && !ISSPACE(*q)) + q++; + memcpy(ipbuf, str, q-str); + ipbuf[q-str] = '\0'; + /* Find the prefix */ + if (*q == '/') + { + const char *str2 = q+1; + while (*q && *q != ';' && !ISSPACE(*q)) + q++; + memcpy(ipbufpfx, str, q-str); + ipbufpfx[q-str] = '\0'; + str = str2; + } + else + ipbufpfx[0] = '\0'; + /* Lets see if it is CIDR */ + /* First we'll try IPv6 */ + if ((bits = ares_inet_net_pton(AF_INET6, ipbufpfx[0] ? ipbufpfx : ipbuf, + &pat.addrV6, + sizeof(pat.addrV6))) > 0) + { + pat.type = PATTERN_CIDR; + pat.mask.bits = (unsigned short)bits; + pat.family = AF_INET6; + if (!sortlist_alloc(sortlist, nsort, &pat)) + return ARES_ENOMEM; + } + else if (ipbufpfx[0] && + (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4, + sizeof(pat.addrV4))) > 0) + { + pat.type = PATTERN_CIDR; + pat.mask.bits = (unsigned short)bits; + pat.family = AF_INET; + if (!sortlist_alloc(sortlist, nsort, &pat)) + return ARES_ENOMEM; + } + /* See if it is just a regular IP */ + else if (ip_addr(ipbuf, q-str, &pat.addrV4) == 0) + { + if (ipbufpfx[0]) + { + memcpy(ipbuf, str, q-str); + ipbuf[q-str] = '\0'; + if (ip_addr(ipbuf, q-str, &pat.mask.addr4) != 0) + natural_mask(&pat); + } + else + natural_mask(&pat); + pat.family = AF_INET; + pat.type = PATTERN_MASK; + if (!sortlist_alloc(sortlist, nsort, &pat)) + return ARES_ENOMEM; + } + else + { + while (*q && *q != ';' && !ISSPACE(*q)) + q++; + } + str = q; + while (ISSPACE(*str)) + str++; + } + + return ARES_SUCCESS; +} +#endif /* !WIN32 & !ANDROID & !__ANDROID__ */ +#endif /* !WATT32 */ + +static int set_search(ares_channel channel, const char *str) +{ + int n; + const char *p, *q; + + if(channel->ndomains != -1) { + /* if we already have some domains present, free them first */ + for(n=0; n < channel->ndomains; n++) + free(channel->domains[n]); + free(channel->domains); + channel->domains = NULL; + channel->ndomains = -1; + } + + /* Count the domains given. */ + n = 0; + p = str; + while (*p) + { + while (*p && !ISSPACE(*p)) + p++; + while (ISSPACE(*p)) + p++; + n++; + } + + if (!n) + { + channel->ndomains = 0; + return ARES_SUCCESS; + } + + channel->domains = malloc(n * sizeof(char *)); + if (!channel->domains) + return ARES_ENOMEM; + + /* Now copy the domains. */ + n = 0; + p = str; + while (*p) + { + channel->ndomains = n; + q = p; + while (*q && !ISSPACE(*q)) + q++; + channel->domains[n] = malloc(q - p + 1); + if (!channel->domains[n]) + return ARES_ENOMEM; + memcpy(channel->domains[n], p, q - p); + channel->domains[n][q - p] = 0; + p = q; + while (ISSPACE(*p)) + p++; + n++; + } + channel->ndomains = n; + + return ARES_SUCCESS; +} + +static int set_options(ares_channel channel, const char *str) +{ + const char *p, *q, *val; + + p = str; + while (*p) + { + q = p; + while (*q && !ISSPACE(*q)) + q++; + val = try_option(p, q, "ndots:"); + if (val && channel->ndots == -1) + channel->ndots = aresx_sltosi(strtol(val, NULL, 10)); + val = try_option(p, q, "retrans:"); + if (val && channel->timeout == -1) + channel->timeout = aresx_sltosi(strtol(val, NULL, 10)); + val = try_option(p, q, "retry:"); + if (val && channel->tries == -1) + channel->tries = aresx_sltosi(strtol(val, NULL, 10)); + val = try_option(p, q, "rotate"); + if (val && channel->rotate == -1) + channel->rotate = 1; + p = q; + while (ISSPACE(*p)) + p++; + } + + return ARES_SUCCESS; +} + +static const char *try_option(const char *p, const char *q, const char *opt) +{ + size_t len = strlen(opt); + return ((size_t)(q - p) >= len && !strncmp(p, opt, len)) ? &p[len] : NULL; +} + +#if !defined(WIN32) && !defined(WATT32) && \ + !defined(ANDROID) && !defined(__ANDROID__) +static char *try_config(char *s, const char *opt, char scc) +{ + size_t len; + char *p; + char *q; + + if (!s || !opt) + /* no line or no option */ + return NULL; + + /* Hash '#' character is always used as primary comment char, additionally + a not-NUL secondary comment char will be considered when specified. */ + + /* trim line comment */ + p = s; + if(scc) + while (*p && (*p != '#') && (*p != scc)) + p++; + else + while (*p && (*p != '#')) + p++; + *p = '\0'; + + /* trim trailing whitespace */ + q = p - 1; + while ((q >= s) && ISSPACE(*q)) + q--; + *++q = '\0'; + + /* skip leading whitespace */ + p = s; + while (*p && ISSPACE(*p)) + p++; + + if (!*p) + /* empty line */ + return NULL; + + if ((len = strlen(opt)) == 0) + /* empty option */ + return NULL; + + if (strncmp(p, opt, len) != 0) + /* line and option do not match */ + return NULL; + + /* skip over given option name */ + p += len; + + if (!*p) + /* no option value */ + return NULL; + + if ((opt[len-1] != ':') && (opt[len-1] != '=') && !ISSPACE(*p)) + /* whitespace between option name and value is mandatory + for given option names which do not end with ':' or '=' */ + return NULL; + + /* skip over whitespace */ + while (*p && ISSPACE(*p)) + p++; + + if (!*p) + /* no option value */ + return NULL; + + /* return pointer to option value */ + return p; +} + +static int sortlist_alloc(struct apattern **sortlist, int *nsort, + struct apattern *pat) +{ + struct apattern *newsort; + newsort = realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern)); + if (!newsort) + return 0; + newsort[*nsort] = *pat; + *sortlist = newsort; + (*nsort)++; + return 1; +} + +static int ip_addr(const char *ipbuf, ssize_t len, struct in_addr *addr) +{ + + /* Four octets and three periods yields at most 15 characters. */ + if (len > 15) + return -1; + + addr->s_addr = inet_addr(ipbuf); + if (addr->s_addr == INADDR_NONE && strcmp(ipbuf, "255.255.255.255") != 0) + return -1; + return 0; +} + +static void natural_mask(struct apattern *pat) +{ + struct in_addr addr; + + /* Store a host-byte-order copy of pat in a struct in_addr. Icky, + * but portable. + */ + addr.s_addr = ntohl(pat->addrV4.s_addr); + + /* This is out of date in the CIDR world, but some people might + * still rely on it. + */ + if (IN_CLASSA(addr.s_addr)) + pat->mask.addr4.s_addr = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(addr.s_addr)) + pat->mask.addr4.s_addr = htonl(IN_CLASSB_NET); + else + pat->mask.addr4.s_addr = htonl(IN_CLASSC_NET); +} +#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ + +/* initialize an rc4 key. If possible a cryptographically secure random key + is generated using a suitable function (for example win32's RtlGenRandom as + described in + http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx + otherwise the code defaults to cross-platform albeit less secure mechanism + using rand +*/ +static void randomize_key(unsigned char* key,int key_data_len) +{ + int randomized = 0; + int counter=0; +#ifdef WIN32 + BOOLEAN res; + if (ares_fpSystemFunction036) + { + res = (*ares_fpSystemFunction036) (key, key_data_len); + if (res) + randomized = 1; + } +#else /* !WIN32 */ +#ifdef RANDOM_FILE + FILE *f = fopen(RANDOM_FILE, "rb"); + if(f) { + counter = aresx_uztosi(fread(key, 1, key_data_len, f)); + fclose(f); + } +#endif +#endif /* WIN32 */ + + if (!randomized) { + for (;counterstate[0]; + for(counter = 0; counter < 256; counter++) + /* unnecessary AND but it keeps some compilers happier */ + state[counter] = (unsigned char)(counter & 0xff); + randomize_key(key->state,key_data_len); + key->x = 0; + key->y = 0; + index1 = 0; + index2 = 0; + for(counter = 0; counter < 256; counter++) + { + index2 = (unsigned char)((key_data_ptr[index1] + state[counter] + + index2) % 256); + ARES_SWAP_BYTE(&state[counter], &state[index2]); + + index1 = (unsigned char)((index1 + 1) % key_data_len); + } + free(key_data_ptr); + return ARES_SUCCESS; +} + +unsigned short ares__generate_new_id(rc4_key* key) +{ + unsigned short r=0; + ares__rc4(key, (unsigned char *)&r, sizeof(r)); + return r; +} + +void ares_set_local_ip4(ares_channel channel, unsigned int local_ip) +{ + channel->local_ip4 = local_ip; +} + +/* local_ip6 should be 16 bytes in length */ +void ares_set_local_ip6(ares_channel channel, + const unsigned char* local_ip6) +{ + memcpy(&channel->local_ip6, local_ip6, sizeof(channel->local_ip6)); +} + +/* local_dev_name should be null terminated. */ +void ares_set_local_dev(ares_channel channel, + const char* local_dev_name) +{ + strncpy(channel->local_dev_name, local_dev_name, + sizeof(channel->local_dev_name)); + channel->local_dev_name[sizeof(channel->local_dev_name) - 1] = 0; +} + + +void ares_set_socket_callback(ares_channel channel, + ares_sock_create_callback cb, + void *data) +{ + channel->sock_create_cb = cb; + channel->sock_create_cb_data = data; +} + +void ares__init_servers_state(ares_channel channel) +{ + struct server_state *server; + int i; + + for (i = 0; i < channel->nservers; i++) + { + server = &channel->servers[i]; + server->udp_socket = ARES_SOCKET_BAD; + server->tcp_socket = ARES_SOCKET_BAD; + server->tcp_connection_generation = ++channel->tcp_connection_generation; + server->tcp_lenbuf_pos = 0; + server->tcp_buffer_pos = 0; + server->tcp_buffer = NULL; + server->tcp_length = 0; + server->qhead = NULL; + server->qtail = NULL; + ares__init_list_head(&server->queries_to_server); + server->channel = channel; + server->is_broken = 0; + } +} diff -Nru python-gevent-0.13.7/c-ares/ares_iphlpapi.h python-gevent-1.0/c-ares/ares_iphlpapi.h --- python-gevent-0.13.7/c-ares/ares_iphlpapi.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_iphlpapi.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,221 @@ +#ifndef HEADER_CARES_IPHLPAPI_H +#define HEADER_CARES_IPHLPAPI_H + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004 - 2011 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#if defined(USE_WINSOCK) + +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 22 +#endif + +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 65 +#endif + +/* ---------------------------------- */ +#if !defined(_WS2DEF_) && \ + !defined(__CSADDR_DEFINED__) && \ + !defined(__CSADDR_T_DEFINED) +/* ---------------------------------- */ + +typedef struct _SOCKET_ADDRESS { + LPSOCKADDR lpSockaddr; + INT iSockaddrLength; +} SOCKET_ADDRESS, *PSOCKET_ADDRESS; + +typedef struct _CSADDR_INFO { + SOCKET_ADDRESS LocalAddr; + SOCKET_ADDRESS RemoteAddr; + INT iSocketType; + INT iProtocol; +} CSADDR_INFO, *PCSADDR_INFO; + +/* --------------------------------- */ +#endif /* ! _WS2DEF_ && \ */ +/* ! __CSADDR_DEFINED__ && \ */ +/* ! __CSADDR_T_DEFINED */ +/* --------------------------------- */ + +/* ------------------------------- */ +#if !defined(IP_ADAPTER_DDNS_ENABLED) +/* ------------------------------- */ + +#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x0001 +#define IP_ADAPTER_ADDRESS_TRANSIENT 0x0002 + +#define IP_ADAPTER_DDNS_ENABLED 0x0001 +#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x0002 +#define IP_ADAPTER_DHCP_ENABLED 0x0004 +#define IP_ADAPTER_RECEIVE_ONLY 0x0008 +#define IP_ADAPTER_NO_MULTICAST 0x0010 +#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x0020 + +#define GAA_FLAG_SKIP_UNICAST 0x0001 +#define GAA_FLAG_SKIP_ANYCAST 0x0002 +#define GAA_FLAG_SKIP_MULTICAST 0x0004 +#define GAA_FLAG_SKIP_DNS_SERVER 0x0008 +#define GAA_FLAG_INCLUDE_PREFIX 0x0010 +#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 + +typedef enum { + IpPrefixOriginOther = 0, + IpPrefixOriginManual, + IpPrefixOriginWellKnown, + IpPrefixOriginDhcp, + IpPrefixOriginRouterAdvertisement +} IP_PREFIX_ORIGIN; + +typedef enum { + IpSuffixOriginOther = 0, + IpSuffixOriginManual, + IpSuffixOriginWellKnown, + IpSuffixOriginDhcp, + IpSuffixOriginLinkLayerAddress, + IpSuffixOriginRandom +} IP_SUFFIX_ORIGIN; + +typedef enum { + IpDadStateInvalid = 0, + IpDadStateTentative, + IpDadStateDuplicate, + IpDadStateDeprecated, + IpDadStatePreferred +} IP_DAD_STATE; + +typedef enum { + IfOperStatusUp = 1, + IfOperStatusDown, + IfOperStatusTesting, + IfOperStatusUnknown, + IfOperStatusDormant, + IfOperStatusNotPresent, + IfOperStatusLowerLayerDown +} IF_OPER_STATUS; + +typedef enum { + ScopeLevelInterface = 0x0001, + ScopeLevelLink = 0x0002, + ScopeLevelSubnet = 0x0003, + ScopeLevelAdmin = 0x0004, + ScopeLevelSite = 0x0005, + ScopeLevelOrganization = 0x0008, + ScopeLevelGlobal = 0x000E +} SCOPE_LEVEL; + +typedef struct _IP_ADAPTER_UNICAST_ADDRESS { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Flags; + } s; + } u; + struct _IP_ADAPTER_UNICAST_ADDRESS *Next; + SOCKET_ADDRESS Address; + IP_PREFIX_ORIGIN PrefixOrigin; + IP_SUFFIX_ORIGIN SuffixOrigin; + IP_DAD_STATE DadState; + ULONG ValidLifetime; + ULONG PreferredLifetime; + ULONG LeaseLifetime; +} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS; + +typedef struct _IP_ADAPTER_ANYCAST_ADDRESS { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Flags; + } s; + } u; + struct _IP_ADAPTER_ANYCAST_ADDRESS *Next; + SOCKET_ADDRESS Address; +} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS; + +typedef struct _IP_ADAPTER_MULTICAST_ADDRESS { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Flags; + } s; + } u; + struct _IP_ADAPTER_MULTICAST_ADDRESS *Next; + SOCKET_ADDRESS Address; +} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS; + +typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Reserved; + } s; + } u; + struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next; + SOCKET_ADDRESS Address; +} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS; + +typedef struct _IP_ADAPTER_PREFIX { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Flags; + } s; + } u; + struct _IP_ADAPTER_PREFIX *Next; + SOCKET_ADDRESS Address; + ULONG PrefixLength; +} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX; + +typedef struct _IP_ADAPTER_ADDRESSES { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD IfIndex; + } s; + } u; + struct _IP_ADAPTER_ADDRESSES *Next; + PCHAR AdapterName; + PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress; + PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress; + PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress; + PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress; + PWCHAR DnsSuffix; + PWCHAR Description; + PWCHAR FriendlyName; + BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH]; + DWORD PhysicalAddressLength; + DWORD Flags; + DWORD Mtu; + DWORD IfType; + IF_OPER_STATUS OperStatus; + DWORD Ipv6IfIndex; + DWORD ZoneIndices[16]; + PIP_ADAPTER_PREFIX FirstPrefix; +} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES; + +/* -------------------------------- */ +#endif /* ! IP_ADAPTER_DDNS_ENABLED */ +/* -------------------------------- */ + +#endif /* USE_WINSOCK */ + +#endif /* HEADER_CARES_IPHLPAPI_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_ipv6.h python-gevent-1.0/c-ares/ares_ipv6.h --- python-gevent-0.13.7/c-ares/ares_ipv6.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_ipv6.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,78 @@ + +/* Copyright (C) 2005 by Dominick Meglio + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifndef ARES_IPV6_H +#define ARES_IPV6_H + +#ifndef HAVE_PF_INET6 +#define PF_INET6 AF_INET6 +#endif + +#ifndef HAVE_STRUCT_SOCKADDR_IN6 +struct sockaddr_in6 +{ + unsigned short sin6_family; + unsigned short sin6_port; + unsigned long sin6_flowinfo; + struct ares_in6_addr sin6_addr; + unsigned int sin6_scope_id; +}; +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +struct addrinfo +{ + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ + char *ai_canonname; + struct sockaddr *ai_addr; + struct addrinfo *ai_next; +}; +#endif + +#ifndef NS_IN6ADDRSZ +#if SIZEOF_STRUCT_IN6_ADDR == 0 +/* We cannot have it set to zero, so we pick a fixed value here */ +#define NS_IN6ADDRSZ 16 +#else +#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR +#endif +#endif + +#ifndef NS_INADDRSZ +#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR +#endif + +#ifndef NS_INT16SZ +#define NS_INT16SZ 2 +#endif + +#ifndef IF_NAMESIZE +#ifdef IFNAMSIZ +#define IF_NAMESIZE IFNAMSIZ +#else +#define IF_NAMESIZE 256 +#endif +#endif + +/* Defined in ares_net_pton.c for no particular reason. */ +extern const struct ares_in6_addr ares_in6addr_any; /* :: */ + + +#endif /* ARES_IPV6_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_library_init.c python-gevent-1.0/c-ares/ares_library_init.c --- python-gevent-0.13.7/c-ares/ares_library_init.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_library_init.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,142 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2009 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#include "ares.h" +#include "ares_library_init.h" +#include "ares_private.h" + +/* library-private global and unique instance vars */ + +#ifdef USE_WINSOCK +fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL; +fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL; +fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL; +#endif + +/* library-private global vars with source visibility restricted to this file */ + +static unsigned int ares_initialized; +static int ares_init_flags; + +#ifdef USE_WINSOCK +static HMODULE hnd_iphlpapi; +static HMODULE hnd_advapi32; +#endif + + +static int ares_win32_init(void) +{ +#ifdef USE_WINSOCK + + hnd_iphlpapi = 0; + hnd_iphlpapi = LoadLibrary("iphlpapi.dll"); + if (!hnd_iphlpapi) + return ARES_ELOADIPHLPAPI; + + ares_fpGetNetworkParams = (fpGetNetworkParams_t) + GetProcAddress(hnd_iphlpapi, "GetNetworkParams"); + if (!ares_fpGetNetworkParams) + { + FreeLibrary(hnd_iphlpapi); + return ARES_EADDRGETNETWORKPARAMS; + } + + ares_fpGetAdaptersAddresses = (fpGetAdaptersAddresses_t) + GetProcAddress(hnd_iphlpapi, "GetAdaptersAddresses"); + if (!ares_fpGetAdaptersAddresses) + { + /* This can happen on clients before WinXP, I don't + think it should be an error, unless we don't want to + support Windows 2000 anymore */ + } + + /* + * When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036, + * also known as RtlGenRandom, which is the case for Windows versions prior + * to WinXP then c-ares uses portable rand() function. Then don't error here. + */ + + hnd_advapi32 = 0; + hnd_advapi32 = LoadLibrary("advapi32.dll"); + if (hnd_advapi32) + { + ares_fpSystemFunction036 = (fpSystemFunction036_t) + GetProcAddress(hnd_advapi32, "SystemFunction036"); + } + +#endif + return ARES_SUCCESS; +} + + +static void ares_win32_cleanup(void) +{ +#ifdef USE_WINSOCK + if (hnd_advapi32) + FreeLibrary(hnd_advapi32); + if (hnd_iphlpapi) + FreeLibrary(hnd_iphlpapi); +#endif +} + + +int ares_library_init(int flags) +{ + int res; + + if (ares_initialized) + return ARES_SUCCESS; + ares_initialized++; + + if (flags & ARES_LIB_INIT_WIN32) + { + res = ares_win32_init(); + if (res != ARES_SUCCESS) + return res; + } + + ares_init_flags = flags; + + return ARES_SUCCESS; +} + + +void ares_library_cleanup(void) +{ + if (!ares_initialized) + return; + ares_initialized--; + + if (ares_init_flags & ARES_LIB_INIT_WIN32) + ares_win32_cleanup(); + + ares_init_flags = ARES_LIB_INIT_NONE; +} + + +int ares_library_initialized(void) +{ +#ifdef USE_WINSOCK + if (!ares_initialized) + return ARES_ENOTINITIALIZED; +#endif + return ARES_SUCCESS; +} + + diff -Nru python-gevent-0.13.7/c-ares/ares_library_init.h python-gevent-1.0/c-ares/ares_library_init.h --- python-gevent-0.13.7/c-ares/ares_library_init.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_library_init.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ +#ifndef HEADER_CARES_LIBRARY_INIT_H +#define HEADER_CARES_LIBRARY_INIT_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2011 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef USE_WINSOCK + +#include +#include + +typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); +typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); +typedef ULONG (WINAPI *fpGetAdaptersAddresses_t) ( ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, ULONG* ); + +/* Forward-declaration of variables defined in ares_library_init.c */ +/* that are global and unique instances for whole c-ares library. */ + +extern fpGetNetworkParams_t ares_fpGetNetworkParams; +extern fpSystemFunction036_t ares_fpSystemFunction036; +extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses; + +#endif /* USE_WINSOCK */ + +#endif /* HEADER_CARES_LIBRARY_INIT_H */ + diff -Nru python-gevent-0.13.7/c-ares/ares_llist.c python-gevent-1.0/c-ares/ares_llist.c --- python-gevent-0.13.7/c-ares/ares_llist.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_llist.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,86 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#include "ares.h" +#include "ares_private.h" + +/* Routines for managing doubly-linked circular linked lists with a + * dummy head. + */ + +/* Initialize a new head node */ +void ares__init_list_head(struct list_node* head) { + head->prev = head; + head->next = head; + head->data = NULL; +} + +/* Initialize a list node */ +void ares__init_list_node(struct list_node* node, void* d) { + node->prev = NULL; + node->next = NULL; + node->data = d; +} + +/* Returns true iff the given list is empty */ +int ares__is_list_empty(struct list_node* head) { + return ((head->next == head) && (head->prev == head)); +} + +/* Inserts new_node before old_node */ +void ares__insert_in_list(struct list_node* new_node, + struct list_node* old_node) { + new_node->next = old_node; + new_node->prev = old_node->prev; + old_node->prev->next = new_node; + old_node->prev = new_node; +} + +/* Removes the node from the list it's in, if any */ +void ares__remove_from_list(struct list_node* node) { + if (node->next != NULL) { + node->prev->next = node->next; + node->next->prev = node->prev; + node->prev = NULL; + node->next = NULL; + } +} + +/* Swap the contents of two lists */ +void ares__swap_lists(struct list_node* head_a, + struct list_node* head_b) { + int is_a_empty = ares__is_list_empty(head_a); + int is_b_empty = ares__is_list_empty(head_b); + struct list_node old_a = *head_a; + struct list_node old_b = *head_b; + + if (is_a_empty) { + ares__init_list_head(head_b); + } else { + *head_b = old_a; + old_a.next->prev = head_b; + old_a.prev->next = head_b; + } + if (is_b_empty) { + ares__init_list_head(head_a); + } else { + *head_a = old_b; + old_b.next->prev = head_a; + old_b.prev->next = head_a; + } +} diff -Nru python-gevent-0.13.7/c-ares/ares_llist.h python-gevent-1.0/c-ares/ares_llist.h --- python-gevent-0.13.7/c-ares/ares_llist.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_llist.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ +#ifndef __ARES_LLIST_H +#define __ARES_LLIST_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + +/* Node definition for circular, doubly-linked list */ +struct list_node { + struct list_node *prev; + struct list_node *next; + void* data; +}; + +void ares__init_list_head(struct list_node* head); + +void ares__init_list_node(struct list_node* node, void* d); + +int ares__is_list_empty(struct list_node* head); + +void ares__insert_in_list(struct list_node* new_node, + struct list_node* old_node); + +void ares__remove_from_list(struct list_node* node); + +void ares__swap_lists(struct list_node* head_a, + struct list_node* head_b); + +#endif /* __ARES_LLIST_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_mkquery.c python-gevent-1.0/c-ares/ares_mkquery.c --- python-gevent-0.13.7/c-ares/ares_mkquery.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_mkquery.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,24 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares.h" + +int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, + int rd, unsigned char **buf, int *buflen) +{ + return ares_create_query(name, dnsclass, type, id, rd, buf, buflen, 0); +} diff -Nru python-gevent-0.13.7/c-ares/ares_nowarn.c python-gevent-1.0/c-ares/ares_nowarn.c --- python-gevent-0.13.7/c-ares/ares_nowarn.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_nowarn.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,286 @@ + +/* Copyright (C) 2010-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + +#include "ares_setup.h" + +#ifdef HAVE_ASSERT_H +# include +#endif + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#endif /* __INTEL_COMPILER && __unix__ */ + +#define BUILDING_ARES_NOWARN_C 1 + +#include "ares_nowarn.h" + +#if (SIZEOF_SHORT == 2) +# define CARES_MASK_SSHORT 0x7FFF +# define CARES_MASK_USHORT 0xFFFF +#elif (SIZEOF_SHORT == 4) +# define CARES_MASK_SSHORT 0x7FFFFFFF +# define CARES_MASK_USHORT 0xFFFFFFFF +#elif (SIZEOF_SHORT == 8) +# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF +# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_SHORT not defined" +#endif + +#if (SIZEOF_INT == 2) +# define CARES_MASK_SINT 0x7FFF +# define CARES_MASK_UINT 0xFFFF +#elif (SIZEOF_INT == 4) +# define CARES_MASK_SINT 0x7FFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFF +#elif (SIZEOF_INT == 8) +# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF +#elif (SIZEOF_INT == 16) +# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_INT not defined" +#endif + +#if (CARES_SIZEOF_LONG == 2) +# define CARES_MASK_SLONG 0x7FFFL +# define CARES_MASK_ULONG 0xFFFFUL +#elif (CARES_SIZEOF_LONG == 4) +# define CARES_MASK_SLONG 0x7FFFFFFFL +# define CARES_MASK_ULONG 0xFFFFFFFFUL +#elif (CARES_SIZEOF_LONG == 8) +# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFL +# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL +#elif (CARES_SIZEOF_LONG == 16) +# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL +# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL +#else +# error "CARES_SIZEOF_LONG not defined" +#endif + +/* +** unsigned size_t to signed long +*/ + +long aresx_uztosl(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (long)(uznum & (size_t) CARES_MASK_SLONG); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned size_t to signed int +*/ + +int aresx_uztosi(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (int)(uznum & (size_t) CARES_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned size_t to signed short +*/ + +short aresx_uztoss(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (short)(uznum & (size_t) CARES_MASK_SSHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed int to signed short +*/ + +short aresx_sitoss(int sinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sinum >= 0); + return (short)(sinum & (int) CARES_MASK_SSHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to signed int +*/ + +int aresx_sltosi(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(slnum >= 0); + return (int)(slnum & (long) CARES_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed ssize_t to signed int +*/ + +int aresx_sztosi(ssize_t sznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sznum >= 0); + return (int)(sznum & (ssize_t) CARES_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed ssize_t to unsigned int +*/ + +unsigned int aresx_sztoui(ssize_t sznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sznum >= 0); + return (unsigned int)(sznum & (ssize_t) CARES_MASK_UINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed int to unsigned short +*/ + +unsigned short aresx_sitous(int sinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sinum >= 0); + return (unsigned short)(sinum & (int) CARES_MASK_USHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int aresx_FD_ISSET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + return FD_ISSET(fd, fdset); + #pragma warning(pop) +} + +void aresx_FD_SET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + FD_SET(fd, fdset); + #pragma warning(pop) +} + +void aresx_FD_ZERO(fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:593) /* variable was set but never used */ + FD_ZERO(fdset); + #pragma warning(pop) +} + +unsigned short aresx_htons(unsigned short usnum) +{ +#if (__INTEL_COMPILER == 910) && defined(__i386__) + return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); +#else + #pragma warning(push) + #pragma warning(disable:810) /* conversion may lose significant bits */ + return htons(usnum); + #pragma warning(pop) +#endif +} + +unsigned short aresx_ntohs(unsigned short usnum) +{ +#if (__INTEL_COMPILER == 910) && defined(__i386__) + return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); +#else + #pragma warning(push) + #pragma warning(disable:810) /* conversion may lose significant bits */ + return ntohs(usnum); + #pragma warning(pop) +#endif +} + +#endif /* __INTEL_COMPILER && __unix__ */ diff -Nru python-gevent-0.13.7/c-ares/ares_nowarn.h python-gevent-1.0/c-ares/ares_nowarn.h --- python-gevent-0.13.7/c-ares/ares_nowarn.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_nowarn.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,61 @@ +#ifndef HEADER_CARES_NOWARN_H +#define HEADER_CARES_NOWARN_H + + +/* Copyright (C) 2010-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +long aresx_uztosl(size_t uznum); +int aresx_uztosi(size_t uznum); +short aresx_uztoss(size_t uznum); + +short aresx_sitoss(int sinum); + +int aresx_sltosi(long slnum); + +int aresx_sztosi(ssize_t sznum); + +unsigned int aresx_sztoui(ssize_t sznum); + +unsigned short aresx_sitous(int sinum); + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int aresx_FD_ISSET(int fd, fd_set *fdset); + +void aresx_FD_SET(int fd, fd_set *fdset); + +void aresx_FD_ZERO(fd_set *fdset); + +unsigned short aresx_htons(unsigned short usnum); + +unsigned short aresx_ntohs(unsigned short usnum); + +#ifndef BUILDING_ARES_NOWARN_C +# undef FD_ISSET +# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b)) +# undef FD_SET +# define FD_SET(a,b) aresx_FD_SET((a),(b)) +# undef FD_ZERO +# define FD_ZERO(a) aresx_FD_ZERO((a)) +# undef htons +# define htons(a) aresx_htons((a)) +# undef ntohs +# define ntohs(a) aresx_ntohs((a)) +#endif + +#endif /* __INTEL_COMPILER && __unix__ */ + +#endif /* HEADER_CARES_NOWARN_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_options.c python-gevent-1.0/c-ares/ares_options.c --- python-gevent-0.13.7/c-ares/ares_options.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_options.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,248 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2008-2011 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + +#include "ares_setup.h" + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#include "ares.h" +#include "ares_data.h" +#include "inet_net_pton.h" +#include "ares_private.h" + + +int ares_get_servers(ares_channel channel, + struct ares_addr_node **servers) +{ + struct ares_addr_node *srvr_head = NULL; + struct ares_addr_node *srvr_last = NULL; + struct ares_addr_node *srvr_curr; + int status = ARES_SUCCESS; + int i; + + if (!channel) + return ARES_ENODATA; + + for (i = 0; i < channel->nservers; i++) + { + /* Allocate storage for this server node appending it to the list */ + srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_NODE); + if (!srvr_curr) + { + status = ARES_ENOMEM; + break; + } + if (srvr_last) + { + srvr_last->next = srvr_curr; + } + else + { + srvr_head = srvr_curr; + } + srvr_last = srvr_curr; + + /* Fill this server node data */ + srvr_curr->family = channel->servers[i].addr.family; + if (srvr_curr->family == AF_INET) + memcpy(&srvr_curr->addrV4, &channel->servers[i].addr.addrV4, + sizeof(srvr_curr->addrV4)); + else + memcpy(&srvr_curr->addrV6, &channel->servers[i].addr.addrV6, + sizeof(srvr_curr->addrV6)); + } + + if (status != ARES_SUCCESS) + { + if (srvr_head) + { + ares_free_data(srvr_head); + srvr_head = NULL; + } + } + + *servers = srvr_head; + + return status; +} + + +int ares_set_servers(ares_channel channel, + struct ares_addr_node *servers) +{ + struct ares_addr_node *srvr; + int num_srvrs = 0; + int i; + + if (ares_library_initialized() != ARES_SUCCESS) + return ARES_ENOTINITIALIZED; + + if (!channel) + return ARES_ENODATA; + + ares__destroy_servers_state(channel); + + for (srvr = servers; srvr; srvr = srvr->next) + { + num_srvrs++; + } + + if (num_srvrs > 0) + { + /* Allocate storage for servers state */ + channel->servers = malloc(num_srvrs * sizeof(struct server_state)); + if (!channel->servers) + { + return ARES_ENOMEM; + } + channel->nservers = num_srvrs; + /* Fill servers state address data */ + for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) + { + channel->servers[i].addr.family = srvr->family; + if (srvr->family == AF_INET) + memcpy(&channel->servers[i].addr.addrV4, &srvr->addrV4, + sizeof(srvr->addrV4)); + else + memcpy(&channel->servers[i].addr.addrV6, &srvr->addrV6, + sizeof(srvr->addrV6)); + } + /* Initialize servers state remaining data */ + ares__init_servers_state(channel); + } + + return ARES_SUCCESS; +} + +/* Incomming string format: host[:port][,host[:port]]... */ +int ares_set_servers_csv(ares_channel channel, + const char* _csv) +{ + size_t i; + char* csv = NULL; + char* ptr; + char* start_host; + int rv = ARES_SUCCESS; + struct ares_addr_node *servers = NULL; + struct ares_addr_node *last = NULL; + + if (ares_library_initialized() != ARES_SUCCESS) + return ARES_ENOTINITIALIZED; + + if (!channel) + return ARES_ENODATA; + + ares__destroy_servers_state(channel); + + i = strlen(_csv); + if (i == 0) + return ARES_SUCCESS; /* blank all servers */ + + csv = malloc(i + 2); + strcpy(csv, _csv); + if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */ + csv[i] = ','; + csv[i+1] = 0; + } + + start_host = csv; + for (ptr = csv; *ptr; ptr++) { + if (*ptr == ',') { + char* pp = ptr - 1; + struct in_addr in4; + struct ares_in6_addr in6; + struct ares_addr_node *s = NULL; + + *ptr = 0; /* null terminate host:port string */ + /* Got an entry..see if port was specified. */ + while (pp > start_host) { + if (*pp == ':') + break; /* yes */ + if (!ISDIGIT(*pp)) { + /* Found end of digits before we found :, so wasn't a port */ + pp = ptr; + break; + } + pp--; + } + if ((pp != start_host) && ((pp + 1) < ptr)) { + /* Found it. Parse over the port number */ + (void)strtol(pp + 1, NULL, 10); + *pp = 0; /* null terminate host */ + } + /* resolve host, try ipv4 first, rslt is in network byte order */ + rv = ares_inet_pton(AF_INET, start_host, &in4); + if (!rv) { + /* Ok, try IPv6 then */ + rv = ares_inet_pton(AF_INET6, start_host, &in6); + if (!rv) { + rv = ARES_EBADSTR; + goto out; + } + /* was ipv6, add new server */ + s = malloc(sizeof(*s)); + if (!s) { + rv = ARES_ENOMEM; + goto out; + } + s->family = AF_INET6; + memcpy(&s->addr, &in6, sizeof(struct ares_in6_addr)); + } + else { + /* was ipv4, add new server */ + s = malloc(sizeof(*s)); + if (!s) { + rv = ARES_ENOMEM; + goto out; + } + s->family = AF_INET; + memcpy(&s->addr, &in4, sizeof(struct in_addr)); + } + if (s) { + /* TODO: Add port to ares_addr_node and assign it here. */ + + s->next = NULL; + if (last) { + last->next = s; + } + else { + servers = s; + last = s; + } + } + + /* Set up for next one */ + start_host = ptr + 1; + } + } + + rv = ares_set_servers(channel, servers); + + out: + if (csv) + free(csv); + while (servers) { + struct ares_addr_node *s = servers; + servers = servers->next; + free(s); + } + + return rv; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_aaaa_reply.c python-gevent-1.0/c-ares/ares_parse_aaaa_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_aaaa_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_aaaa_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,261 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright 2005 Dominick Meglio + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include +#include +#ifdef HAVE_LIMITS_H +# include +#endif + +#include "ares.h" +#include "ares_dns.h" +#include "inet_net_pton.h" +#include "ares_private.h" + +int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, + struct hostent **host, struct ares_addr6ttl *addrttls, + int *naddrttls) +{ + unsigned int qdcount, ancount; + int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs; + int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */ + int naliases; + long len; + const unsigned char *aptr; + char *hostname, *rr_name, *rr_data, **aliases; + struct ares_in6_addr *addrs; + struct hostent *hostent; + const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0; + + /* Set *host to NULL for all failure cases. */ + if (host) + *host = NULL; + /* Same with *naddrttls. */ + if (naddrttls) + *naddrttls = 0; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + if (qdcount != 1) + return ARES_EBADRESP; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free(hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Allocate addresses and aliases; ancount gives an upper bound for both. */ + if (host) + { + addrs = malloc(ancount * sizeof(struct ares_in6_addr)); + if (!addrs) + { + free(hostname); + return ARES_ENOMEM; + } + aliases = malloc((ancount + 1) * sizeof(char *)); + if (!aliases) + { + free(hostname); + free(addrs); + return ARES_ENOMEM; + } + } + else + { + addrs = NULL; + aliases = NULL; + } + naddrs = 0; + naliases = 0; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < (int)ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + break; + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE(aptr); + rr_class = DNS_RR_CLASS(aptr); + rr_len = DNS_RR_LEN(aptr); + rr_ttl = DNS_RR_TTL(aptr); + aptr += RRFIXEDSZ; + + if (rr_class == C_IN && rr_type == T_AAAA + && rr_len == sizeof(struct ares_in6_addr) + && strcasecmp(rr_name, hostname) == 0) + { + if (addrs) + { + if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + memcpy(&addrs[naddrs], aptr, sizeof(struct ares_in6_addr)); + } + if (naddrs < max_addr_ttls) + { + struct ares_addr6ttl * const at = &addrttls[naddrs]; + if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + memcpy(&at->ip6addr, aptr, sizeof(struct ares_in6_addr)); + at->ttl = rr_ttl; + } + naddrs++; + status = ARES_SUCCESS; + } + + if (rr_class == C_IN && rr_type == T_CNAME) + { + /* Record the RR name as an alias. */ + if (aliases) + aliases[naliases] = rr_name; + else + free(rr_name); + naliases++; + + /* Decode the RR data and replace the hostname with it. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, + &len); + if (status != ARES_SUCCESS) + break; + free(hostname); + hostname = rr_data; + + /* Take the min of the TTLs we see in the CNAME chain. */ + if (cname_ttl > rr_ttl) + cname_ttl = rr_ttl; + } + else + free(rr_name); + + aptr += rr_len; + if (aptr > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + } + + /* the check for naliases to be zero is to make sure CNAME responses + don't get caught here */ + if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0) + status = ARES_ENODATA; + if (status == ARES_SUCCESS) + { + /* We got our answer. */ + if (naddrttls) + { + const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls; + for (i = 0; i < n; i++) + { + /* Ensure that each A TTL is no larger than the CNAME TTL. */ + if (addrttls[i].ttl > cname_ttl) + addrttls[i].ttl = cname_ttl; + } + *naddrttls = n; + } + if (aliases) + aliases[naliases] = NULL; + if (host) + { + /* Allocate memory to build the host entry. */ + hostent = malloc(sizeof(struct hostent)); + if (hostent) + { + hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *)); + if (hostent->h_addr_list) + { + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + hostent->h_aliases = aliases; + hostent->h_addrtype = AF_INET6; + hostent->h_length = sizeof(struct ares_in6_addr); + for (i = 0; i < naddrs; i++) + hostent->h_addr_list[i] = (char *) &addrs[i]; + hostent->h_addr_list[naddrs] = NULL; + *host = hostent; + return ARES_SUCCESS; + } + free(hostent); + } + status = ARES_ENOMEM; + } + } + if (aliases) + { + for (i = 0; i < naliases; i++) + free(aliases[i]); + free(aliases); + } + free(addrs); + free(hostname); + return status; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_a_reply.c python-gevent-1.0/c-ares/ares_parse_a_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_a_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_a_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,263 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include +#include +#ifdef HAVE_LIMITS_H +# include +#endif + +#include "ares.h" +#include "ares_dns.h" +#include "ares_private.h" + +int ares_parse_a_reply(const unsigned char *abuf, int alen, + struct hostent **host, + struct ares_addrttl *addrttls, int *naddrttls) +{ + unsigned int qdcount, ancount; + int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs; + int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */ + int naliases; + long len; + const unsigned char *aptr; + char *hostname, *rr_name, *rr_data, **aliases; + struct in_addr *addrs; + struct hostent *hostent; + const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0; + + /* Set *host to NULL for all failure cases. */ + if (host) + *host = NULL; + /* Same with *naddrttls. */ + if (naddrttls) + *naddrttls = 0; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + if (qdcount != 1) + return ARES_EBADRESP; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free(hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + if (host) + { + /* Allocate addresses and aliases; ancount gives an upper bound for + both. */ + addrs = malloc(ancount * sizeof(struct in_addr)); + if (!addrs) + { + free(hostname); + return ARES_ENOMEM; + } + aliases = malloc((ancount + 1) * sizeof(char *)); + if (!aliases) + { + free(hostname); + free(addrs); + return ARES_ENOMEM; + } + } + else + { + addrs = NULL; + aliases = NULL; + } + + naddrs = 0; + naliases = 0; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < (int)ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + break; + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE(aptr); + rr_class = DNS_RR_CLASS(aptr); + rr_len = DNS_RR_LEN(aptr); + rr_ttl = DNS_RR_TTL(aptr); + aptr += RRFIXEDSZ; + + if (rr_class == C_IN && rr_type == T_A + && rr_len == sizeof(struct in_addr) + && strcasecmp(rr_name, hostname) == 0) + { + if (addrs) + { + if (aptr + sizeof(struct in_addr) > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr)); + } + if (naddrs < max_addr_ttls) + { + struct ares_addrttl * const at = &addrttls[naddrs]; + if (aptr + sizeof(struct in_addr) > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + memcpy(&at->ipaddr, aptr, sizeof(struct in_addr)); + at->ttl = rr_ttl; + } + naddrs++; + status = ARES_SUCCESS; + } + + if (rr_class == C_IN && rr_type == T_CNAME) + { + /* Record the RR name as an alias. */ + if (aliases) + aliases[naliases] = rr_name; + else + free(rr_name); + naliases++; + + /* Decode the RR data and replace the hostname with it. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, + &len); + if (status != ARES_SUCCESS) + break; + free(hostname); + hostname = rr_data; + + /* Take the min of the TTLs we see in the CNAME chain. */ + if (cname_ttl > rr_ttl) + cname_ttl = rr_ttl; + } + else + free(rr_name); + + aptr += rr_len; + if (aptr > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + } + + if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0) + /* the check for naliases to be zero is to make sure CNAME responses + don't get caught here */ + status = ARES_ENODATA; + if (status == ARES_SUCCESS) + { + /* We got our answer. */ + if (naddrttls) + { + const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls; + for (i = 0; i < n; i++) + { + /* Ensure that each A TTL is no larger than the CNAME TTL. */ + if (addrttls[i].ttl > cname_ttl) + addrttls[i].ttl = cname_ttl; + } + *naddrttls = n; + } + if (aliases) + aliases[naliases] = NULL; + if (host) + { + /* Allocate memory to build the host entry. */ + hostent = malloc(sizeof(struct hostent)); + if (hostent) + { + hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *)); + if (hostent->h_addr_list) + { + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + hostent->h_aliases = aliases; + hostent->h_addrtype = AF_INET; + hostent->h_length = sizeof(struct in_addr); + for (i = 0; i < naddrs; i++) + hostent->h_addr_list[i] = (char *) &addrs[i]; + hostent->h_addr_list[naddrs] = NULL; + if (!naddrs && addrs) + free(addrs); + *host = hostent; + return ARES_SUCCESS; + } + free(hostent); + } + status = ARES_ENOMEM; + } + } + if (aliases) + { + for (i = 0; i < naliases; i++) + free(aliases[i]); + free(aliases); + } + free(addrs); + free(hostname); + return status; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_mx_reply.c python-gevent-1.0/c-ares/ares_parse_mx_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_mx_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_mx_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,170 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2010 Jeremy Lal + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +int +ares_parse_mx_reply (const unsigned char *abuf, int alen, + struct ares_mx_reply **mx_out) +{ + unsigned int qdcount, ancount, i; + const unsigned char *aptr, *vptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_mx_reply *mx_head = NULL; + struct ares_mx_reply *mx_last = NULL; + struct ares_mx_reply *mx_curr; + + /* Set *mx_out to NULL for all failure cases. */ + *mx_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + + /* Check if we are really looking at a MX record */ + if (rr_class == C_IN && rr_type == T_MX) + { + /* parse the MX record itself */ + if (rr_len < 2) + { + status = ARES_EBADRESP; + break; + } + + /* Allocate storage for this MX answer appending it to the list */ + mx_curr = ares_malloc_data(ARES_DATATYPE_MX_REPLY); + if (!mx_curr) + { + status = ARES_ENOMEM; + break; + } + if (mx_last) + { + mx_last->next = mx_curr; + } + else + { + mx_head = mx_curr; + } + mx_last = mx_curr; + + vptr = aptr; + mx_curr->priority = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + + status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len); + if (status != ARES_SUCCESS) + break; + } + + /* Don't lose memory in the next iteration */ + free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + free (hostname); + if (rr_name) + free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (mx_head) + ares_free_data (mx_head); + return status; + } + + /* everything looks fine, return the data */ + *mx_out = mx_head; + + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_naptr_reply.c python-gevent-1.0/c-ares/ares_parse_naptr_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_naptr_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_naptr_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,188 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2009 by Jakub Hrozek + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +/* AIX portability check */ +#ifndef T_NAPTR + #define T_NAPTR 35 /* naming authority pointer */ +#endif + +int +ares_parse_naptr_reply (const unsigned char *abuf, int alen, + struct ares_naptr_reply **naptr_out) +{ + unsigned int qdcount, ancount, i; + const unsigned char *aptr, *vptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_naptr_reply *naptr_head = NULL; + struct ares_naptr_reply *naptr_last = NULL; + struct ares_naptr_reply *naptr_curr; + + /* Set *naptr_out to NULL for all failure cases. */ + *naptr_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + + /* Check if we are really looking at a NAPTR record */ + if (rr_class == C_IN && rr_type == T_NAPTR) + { + /* parse the NAPTR record itself */ + + /* Allocate storage for this NAPTR answer appending it to the list */ + naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); + if (!naptr_curr) + { + status = ARES_ENOMEM; + break; + } + if (naptr_last) + { + naptr_last->next = naptr_curr; + } + else + { + naptr_head = naptr_curr; + } + naptr_last = naptr_curr; + + vptr = aptr; + naptr_curr->order = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + naptr_curr->preference = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->flags, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->service, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->regexp, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_name(vptr, abuf, alen, &naptr_curr->replacement, &len); + if (status != ARES_SUCCESS) + break; + } + + /* Don't lose memory in the next iteration */ + free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + free (hostname); + if (rr_name) + free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (naptr_head) + ares_free_data (naptr_head); + return status; + } + + /* everything looks fine, return the data */ + *naptr_out = naptr_head; + + return ARES_SUCCESS; +} + diff -Nru python-gevent-0.13.7/c-ares/ares_parse_ns_reply.c python-gevent-1.0/c-ares/ares_parse_ns_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_ns_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_ns_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,182 @@ +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* + * ares_parse_ns_reply created by Vlad Dinulescu + * on behalf of AVIRA Gmbh - http://www.avira.com + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_private.h" + +int ares_parse_ns_reply( const unsigned char* abuf, int alen, + struct hostent** host ) +{ + unsigned int qdcount, ancount; + int status, i, rr_type, rr_class, rr_len; + int nameservers_num; + long len; + const unsigned char *aptr; + char* hostname, *rr_name, *rr_data, **nameservers; + struct hostent *hostent; + + /* Set *host to NULL for all failure cases. */ + *host = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if ( alen < HFIXEDSZ ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT( abuf ); + ancount = DNS_HEADER_ANCOUNT( abuf ); + if ( qdcount != 1 ) + return ARES_EBADRESP; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len); + if ( status != ARES_SUCCESS ) + return status; + if ( aptr + len + QFIXEDSZ > abuf + alen ) + { + free( hostname ); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Allocate nameservers array; ancount gives an upper bound */ + nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) ); + if ( !nameservers ) + { + free( hostname ); + return ARES_ENOMEM; + } + nameservers_num = 0; + + /* Examine each answer resource record (RR) in turn. */ + for ( i = 0; i < ( int ) ancount; i++ ) + { + /* Decode the RR up to the data field. */ + status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len ); + if ( status != ARES_SUCCESS ) + break; + aptr += len; + if ( aptr + RRFIXEDSZ > abuf + alen ) + { + status = ARES_EBADRESP; + free(rr_name); + break; + } + rr_type = DNS_RR_TYPE( aptr ); + rr_class = DNS_RR_CLASS( aptr ); + rr_len = DNS_RR_LEN( aptr ); + aptr += RRFIXEDSZ; + + if ( rr_class == C_IN && rr_type == T_NS ) + { + /* Decode the RR data and add it to the nameservers list */ + status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data, + &len); + if ( status != ARES_SUCCESS ) + { + free(rr_name); + break; + } + + nameservers[nameservers_num] = malloc(strlen(rr_data)+1); + + if (nameservers[nameservers_num]==NULL) + { + free(rr_name); + free(rr_data); + status=ARES_ENOMEM; + break; + } + strcpy(nameservers[nameservers_num],rr_data); + free(rr_data); + + nameservers_num++; + } + + free( rr_name ); + + aptr += rr_len; + if ( aptr > abuf + alen ) + { + status = ARES_EBADRESP; + break; + } + } + + if ( status == ARES_SUCCESS && nameservers_num == 0 ) + { + status = ARES_ENODATA; + } + if ( status == ARES_SUCCESS ) + { + /* We got our answer. Allocate memory to build the host entry. */ + nameservers[nameservers_num] = NULL; + hostent = malloc( sizeof( struct hostent ) ); + if ( hostent ) + { + hostent->h_addr_list = malloc( 1 * sizeof( char * ) ); + if ( hostent->h_addr_list ) + { + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + hostent->h_aliases = nameservers; + hostent->h_addrtype = AF_INET; + hostent->h_length = sizeof( struct in_addr ); + hostent->h_addr_list[0] = NULL; + *host = hostent; + return ARES_SUCCESS; + } + free( hostent ); + } + status = ARES_ENOMEM; + } + for ( i = 0; i < nameservers_num; i++ ) + free( nameservers[i] ); + free( nameservers ); + free( hostname ); + return status; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_ptr_reply.c python-gevent-1.0/c-ares/ares_parse_ptr_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_ptr_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_ptr_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,218 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, + int addrlen, int family, struct hostent **host) +{ + unsigned int qdcount, ancount; + int status, i, rr_type, rr_class, rr_len; + long len; + const unsigned char *aptr; + char *ptrname, *hostname, *rr_name, *rr_data; + struct hostent *hostent; + int aliascnt = 0; + int alias_alloc = 8; + char ** aliases; + + /* Set *host to NULL for all failure cases. */ + *host = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + if (qdcount != 1) + return ARES_EBADRESP; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len); + if (status != ARES_SUCCESS) + return status; + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free(ptrname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + hostname = NULL; + aliases = malloc(alias_alloc * sizeof(char *)); + if (!aliases) + { + free(ptrname); + return ARES_ENOMEM; + } + for (i = 0; i < (int)ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + break; + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + free(rr_name); + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE(aptr); + rr_class = DNS_RR_CLASS(aptr); + rr_len = DNS_RR_LEN(aptr); + aptr += RRFIXEDSZ; + + if (rr_class == C_IN && rr_type == T_PTR + && strcasecmp(rr_name, ptrname) == 0) + { + /* Decode the RR data and set hostname to it. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, + &len); + if (status != ARES_SUCCESS) + { + free(rr_name); + break; + } + if (hostname) + free(hostname); + hostname = rr_data; + aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char)); + if (!aliases[aliascnt]) + { + free(rr_name); + status = ARES_ENOMEM; + break; + } + strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1); + aliascnt++; + if (aliascnt >= alias_alloc) { + char **ptr; + alias_alloc *= 2; + ptr = realloc(aliases, alias_alloc * sizeof(char *)); + if(!ptr) { + free(rr_name); + status = ARES_ENOMEM; + break; + } + aliases = ptr; + } + } + + if (rr_class == C_IN && rr_type == T_CNAME) + { + /* Decode the RR data and replace ptrname with it. */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, + &len); + if (status != ARES_SUCCESS) + { + free(rr_name); + break; + } + free(ptrname); + ptrname = rr_data; + } + + free(rr_name); + aptr += rr_len; + if (aptr > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + } + + if (status == ARES_SUCCESS && !hostname) + status = ARES_ENODATA; + if (status == ARES_SUCCESS) + { + /* We got our answer. Allocate memory to build the host entry. */ + hostent = malloc(sizeof(struct hostent)); + if (hostent) + { + hostent->h_addr_list = malloc(2 * sizeof(char *)); + if (hostent->h_addr_list) + { + hostent->h_addr_list[0] = malloc(addrlen); + if (hostent->h_addr_list[0]) + { + hostent->h_aliases = malloc((aliascnt+1) * sizeof (char *)); + if (hostent->h_aliases) + { + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + for (i=0 ; ih_aliases[i] = aliases[i]; + hostent->h_aliases[aliascnt] = NULL; + hostent->h_addrtype = aresx_sitoss(family); + hostent->h_length = aresx_sitoss(addrlen); + memcpy(hostent->h_addr_list[0], addr, addrlen); + hostent->h_addr_list[1] = NULL; + *host = hostent; + free(aliases); + free(ptrname); + return ARES_SUCCESS; + } + free(hostent->h_addr_list[0]); + } + free(hostent->h_addr_list); + } + free(hostent); + } + status = ARES_ENOMEM; + } + for (i=0 ; i + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +int +ares_parse_soa_reply(const unsigned char *abuf, int alen, + struct ares_soa_reply **soa_out) +{ + const unsigned char *aptr; + long len; + char *qname = NULL, *rr_name = NULL; + struct ares_soa_reply *soa = NULL; + int qdcount, ancount; + int status; + + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* parse message header */ + qdcount = DNS_HEADER_QDCOUNT(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + if (qdcount != 1 || ancount != 1) + return ARES_EBADRESP; + aptr = abuf + HFIXEDSZ; + + /* query name */ + status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len); + if (status != ARES_SUCCESS) + goto failed_stat; + aptr += len; + + /* skip qtype & qclass */ + if (aptr + QFIXEDSZ > abuf + alen) + goto failed; + aptr += QFIXEDSZ; + + /* rr_name */ + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + goto failed_stat; + aptr += len; + + /* skip rr_type, rr_class, rr_ttl, rr_rdlen */ + if (aptr + RRFIXEDSZ > abuf + alen) + goto failed; + aptr += RRFIXEDSZ; + + /* allocate result struct */ + soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY); + if (!soa) + return ARES_ENOMEM; + + /* nsname */ + status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, &len); + if (status != ARES_SUCCESS) + goto failed_stat; + aptr += len; + + /* hostmaster */ + status = ares__expand_name_for_response(aptr, abuf, alen, &soa->hostmaster, &len); + if (status != ARES_SUCCESS) + goto failed_stat; + aptr += len; + + /* integer fields */ + if (aptr + 5 * 4 > abuf + alen) + goto failed; + soa->serial = DNS__32BIT(aptr + 0 * 4); + soa->refresh = DNS__32BIT(aptr + 1 * 4); + soa->retry = DNS__32BIT(aptr + 2 * 4); + soa->expire = DNS__32BIT(aptr + 3 * 4); + soa->minttl = DNS__32BIT(aptr + 4 * 4); + + free(qname); + free(rr_name); + + *soa_out = soa; + + return ARES_SUCCESS; + +failed: + status = ARES_EBADRESP; + +failed_stat: + ares_free_data(soa); + if (qname) + free(qname); + if (rr_name) + free(rr_name); + return status; +} + diff -Nru python-gevent-0.13.7/c-ares/ares_parse_srv_reply.c python-gevent-1.0/c-ares/ares_parse_srv_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_srv_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_srv_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,179 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2009 by Jakub Hrozek + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +/* AIX portability check */ +#ifndef T_SRV +# define T_SRV 33 /* server selection */ +#endif + +int +ares_parse_srv_reply (const unsigned char *abuf, int alen, + struct ares_srv_reply **srv_out) +{ + unsigned int qdcount, ancount, i; + const unsigned char *aptr, *vptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_srv_reply *srv_head = NULL; + struct ares_srv_reply *srv_last = NULL; + struct ares_srv_reply *srv_curr; + + /* Set *srv_out to NULL for all failure cases. */ + *srv_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + + /* Check if we are really looking at a SRV record */ + if (rr_class == C_IN && rr_type == T_SRV) + { + /* parse the SRV record itself */ + if (rr_len < 6) + { + status = ARES_EBADRESP; + break; + } + + /* Allocate storage for this SRV answer appending it to the list */ + srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY); + if (!srv_curr) + { + status = ARES_ENOMEM; + break; + } + if (srv_last) + { + srv_last->next = srv_curr; + } + else + { + srv_head = srv_curr; + } + srv_last = srv_curr; + + vptr = aptr; + srv_curr->priority = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + srv_curr->weight = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + srv_curr->port = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + + status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len); + if (status != ARES_SUCCESS) + break; + } + + /* Don't lose memory in the next iteration */ + free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + free (hostname); + if (rr_name) + free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (srv_head) + ares_free_data (srv_head); + return status; + } + + /* everything looks fine, return the data */ + *srv_out = srv_head; + + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_parse_txt_reply.c python-gevent-1.0/c-ares/ares_parse_txt_reply.c --- python-gevent-0.13.7/c-ares/ares_parse_txt_reply.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_parse_txt_reply.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,201 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2009 by Jakub Hrozek + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include +#include + +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +int +ares_parse_txt_reply (const unsigned char *abuf, int alen, + struct ares_txt_reply **txt_out) +{ + size_t substr_len, str_len; + unsigned int qdcount, ancount, i; + const unsigned char *aptr; + const unsigned char *strptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_txt_reply *txt_head = NULL; + struct ares_txt_reply *txt_last = NULL; + struct ares_txt_reply *txt_curr; + + /* Set *txt_out to NULL for all failure cases. */ + *txt_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + + /* Check if we are really looking at a TXT record */ + if (rr_class == C_IN && rr_type == T_TXT) + { + /* Allocate storage for this TXT answer appending it to the list */ + txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY); + if (!txt_curr) + { + status = ARES_ENOMEM; + break; + } + if (txt_last) + { + txt_last->next = txt_curr; + } + else + { + txt_head = txt_curr; + } + txt_last = txt_curr; + + /* + * There may be multiple substrings in a single TXT record. Each + * substring may be up to 255 characters in length, with a + * "length byte" indicating the size of the substring payload. + * RDATA contains both the length-bytes and payloads of all + * substrings contained therein. + */ + + /* Compute total length to allow a single memory allocation */ + strptr = aptr; + while (strptr < (aptr + rr_len)) + { + substr_len = (unsigned char)*strptr; + txt_curr->length += substr_len; + strptr += substr_len + 1; + } + + /* Including null byte */ + txt_curr->txt = malloc (txt_curr->length + 1); + if (txt_curr->txt == NULL) + { + status = ARES_ENOMEM; + break; + } + + /* Step through the list of substrings, concatenating them */ + str_len = 0; + strptr = aptr; + while (strptr < (aptr + rr_len)) + { + substr_len = (unsigned char)*strptr; + strptr++; + memcpy ((char *) txt_curr->txt + str_len, strptr, substr_len); + str_len += substr_len; + strptr += substr_len; + } + /* Make sure we NULL-terminate */ + *((char *) txt_curr->txt + txt_curr->length) = '\0'; + } + + /* Don't lose memory in the next iteration */ + free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + free (hostname); + if (rr_name) + free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (txt_head) + ares_free_data (txt_head); + return status; + } + + /* everything looks fine, return the data */ + *txt_out = txt_head; + + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_platform.c python-gevent-1.0/c-ares/ares_platform.c --- python-gevent-0.13.7/c-ares/ares_platform.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_platform.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,11035 @@ + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004 - 2011 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#include "ares.h" +#include "ares_platform.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +#if defined(WIN32) && !defined(MSDOS) + +#define V_PLATFORM_WIN32s 0 +#define V_PLATFORM_WIN32_WINDOWS 1 +#define V_PLATFORM_WIN32_NT 2 +#define V_PLATFORM_WIN32_CE 3 + +win_platform ares__getplatform(void) +{ + OSVERSIONINFOEX OsvEx; + + memset(&OsvEx, 0, sizeof(OsvEx)); + OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if (!GetVersionEx((void *)&OsvEx)) + { + memset(&OsvEx, 0, sizeof(OsvEx)); + OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (!GetVersionEx((void *)&OsvEx)) + return WIN_UNKNOWN; + } + + switch(OsvEx.dwPlatformId) + { + case V_PLATFORM_WIN32s: + return WIN_3X; + + case V_PLATFORM_WIN32_WINDOWS: + return WIN_9X; + + case V_PLATFORM_WIN32_NT: + return WIN_NT; + + case V_PLATFORM_WIN32_CE: + return WIN_CE; + + default: + return WIN_UNKNOWN; + } +} + +#endif /* WIN32 && ! MSDOS */ + +#if defined(_WIN32_WCE) + +/* IANA Well Known Ports are in range 0-1023 */ +#define USE_IANA_WELL_KNOWN_PORTS 1 + +/* IANA Registered Ports are in range 1024-49151 */ +#define USE_IANA_REGISTERED_PORTS 1 + +struct pvt_servent { + char *s_name; + char **s_aliases; + unsigned short s_port; + char *s_proto; +}; + +/* + * Ref: http://www.iana.org/assignments/port-numbers + */ + +static struct pvt_servent IANAports[] = { +#ifdef USE_IANA_WELL_KNOWN_PORTS +{"tcpmux", {NULL}, 1, "tcp"}, +{"tcpmux", {NULL}, 1, "udp"}, +{"compressnet", {NULL}, 2, "tcp"}, +{"compressnet", {NULL}, 2, "udp"}, +{"compressnet", {NULL}, 3, "tcp"}, +{"compressnet", {NULL}, 3, "udp"}, +{"rje", {NULL}, 5, "tcp"}, +{"rje", {NULL}, 5, "udp"}, +{"echo", {NULL}, 7, "tcp"}, +{"echo", {NULL}, 7, "udp"}, +{"discard", {NULL}, 9, "tcp"}, +{"discard", {NULL}, 9, "udp"}, +{"discard", {NULL}, 9, "sctp"}, +{"discard", {NULL}, 9, "dccp"}, +{"systat", {NULL}, 11, "tcp"}, +{"systat", {NULL}, 11, "udp"}, +{"daytime", {NULL}, 13, "tcp"}, +{"daytime", {NULL}, 13, "udp"}, +{"qotd", {NULL}, 17, "tcp"}, +{"qotd", {NULL}, 17, "udp"}, +{"msp", {NULL}, 18, "tcp"}, +{"msp", {NULL}, 18, "udp"}, +{"chargen", {NULL}, 19, "tcp"}, +{"chargen", {NULL}, 19, "udp"}, +{"ftp-data", {NULL}, 20, "tcp"}, +{"ftp-data", {NULL}, 20, "udp"}, +{"ftp-data", {NULL}, 20, "sctp"}, +{"ftp", {NULL}, 21, "tcp"}, +{"ftp", {NULL}, 21, "udp"}, +{"ftp", {NULL}, 21, "sctp"}, +{"ssh", {NULL}, 22, "tcp"}, +{"ssh", {NULL}, 22, "udp"}, +{"ssh", {NULL}, 22, "sctp"}, +{"telnet", {NULL}, 23, "tcp"}, +{"telnet", {NULL}, 23, "udp"}, +{"smtp", {NULL}, 25, "tcp"}, +{"smtp", {NULL}, 25, "udp"}, +{"nsw-fe", {NULL}, 27, "tcp"}, +{"nsw-fe", {NULL}, 27, "udp"}, +{"msg-icp", {NULL}, 29, "tcp"}, +{"msg-icp", {NULL}, 29, "udp"}, +{"msg-auth", {NULL}, 31, "tcp"}, +{"msg-auth", {NULL}, 31, "udp"}, +{"dsp", {NULL}, 33, "tcp"}, +{"dsp", {NULL}, 33, "udp"}, +{"time", {NULL}, 37, "tcp"}, +{"time", {NULL}, 37, "udp"}, +{"rap", {NULL}, 38, "tcp"}, +{"rap", {NULL}, 38, "udp"}, +{"rlp", {NULL}, 39, "tcp"}, +{"rlp", {NULL}, 39, "udp"}, +{"graphics", {NULL}, 41, "tcp"}, +{"graphics", {NULL}, 41, "udp"}, +{"name", {NULL}, 42, "tcp"}, +{"name", {NULL}, 42, "udp"}, +{"nameserver", {NULL}, 42, "tcp"}, +{"nameserver", {NULL}, 42, "udp"}, +{"nicname", {NULL}, 43, "tcp"}, +{"nicname", {NULL}, 43, "udp"}, +{"mpm-flags", {NULL}, 44, "tcp"}, +{"mpm-flags", {NULL}, 44, "udp"}, +{"mpm", {NULL}, 45, "tcp"}, +{"mpm", {NULL}, 45, "udp"}, +{"mpm-snd", {NULL}, 46, "tcp"}, +{"mpm-snd", {NULL}, 46, "udp"}, +{"ni-ftp", {NULL}, 47, "tcp"}, +{"ni-ftp", {NULL}, 47, "udp"}, +{"auditd", {NULL}, 48, "tcp"}, +{"auditd", {NULL}, 48, "udp"}, +{"tacacs", {NULL}, 49, "tcp"}, +{"tacacs", {NULL}, 49, "udp"}, +{"re-mail-ck", {NULL}, 50, "tcp"}, +{"re-mail-ck", {NULL}, 50, "udp"}, +{"la-maint", {NULL}, 51, "tcp"}, +{"la-maint", {NULL}, 51, "udp"}, +{"xns-time", {NULL}, 52, "tcp"}, +{"xns-time", {NULL}, 52, "udp"}, +{"domain", {NULL}, 53, "tcp"}, +{"domain", {NULL}, 53, "udp"}, +{"xns-ch", {NULL}, 54, "tcp"}, +{"xns-ch", {NULL}, 54, "udp"}, +{"isi-gl", {NULL}, 55, "tcp"}, +{"isi-gl", {NULL}, 55, "udp"}, +{"xns-auth", {NULL}, 56, "tcp"}, +{"xns-auth", {NULL}, 56, "udp"}, +{"xns-mail", {NULL}, 58, "tcp"}, +{"xns-mail", {NULL}, 58, "udp"}, +{"ni-mail", {NULL}, 61, "tcp"}, +{"ni-mail", {NULL}, 61, "udp"}, +{"acas", {NULL}, 62, "tcp"}, +{"acas", {NULL}, 62, "udp"}, +{"whois++", {NULL}, 63, "tcp"}, +{"whois++", {NULL}, 63, "udp"}, +{"covia", {NULL}, 64, "tcp"}, +{"covia", {NULL}, 64, "udp"}, +{"tacacs-ds", {NULL}, 65, "tcp"}, +{"tacacs-ds", {NULL}, 65, "udp"}, +{"sql*net", {NULL}, 66, "tcp"}, +{"sql*net", {NULL}, 66, "udp"}, +{"bootps", {NULL}, 67, "tcp"}, +{"bootps", {NULL}, 67, "udp"}, +{"bootpc", {NULL}, 68, "tcp"}, +{"bootpc", {NULL}, 68, "udp"}, +{"tftp", {NULL}, 69, "tcp"}, +{"tftp", {NULL}, 69, "udp"}, +{"gopher", {NULL}, 70, "tcp"}, +{"gopher", {NULL}, 70, "udp"}, +{"netrjs-1", {NULL}, 71, "tcp"}, +{"netrjs-1", {NULL}, 71, "udp"}, +{"netrjs-2", {NULL}, 72, "tcp"}, +{"netrjs-2", {NULL}, 72, "udp"}, +{"netrjs-3", {NULL}, 73, "tcp"}, +{"netrjs-3", {NULL}, 73, "udp"}, +{"netrjs-4", {NULL}, 74, "tcp"}, +{"netrjs-4", {NULL}, 74, "udp"}, +{"deos", {NULL}, 76, "tcp"}, +{"deos", {NULL}, 76, "udp"}, +{"vettcp", {NULL}, 78, "tcp"}, +{"vettcp", {NULL}, 78, "udp"}, +{"finger", {NULL}, 79, "tcp"}, +{"finger", {NULL}, 79, "udp"}, +{"http", {NULL}, 80, "tcp"}, +{"http", {NULL}, 80, "udp"}, +{"www", {NULL}, 80, "tcp"}, +{"www", {NULL}, 80, "udp"}, +{"www-http", {NULL}, 80, "tcp"}, +{"www-http", {NULL}, 80, "udp"}, +{"http", {NULL}, 80, "sctp"}, +{"xfer", {NULL}, 82, "tcp"}, +{"xfer", {NULL}, 82, "udp"}, +{"mit-ml-dev", {NULL}, 83, "tcp"}, +{"mit-ml-dev", {NULL}, 83, "udp"}, +{"ctf", {NULL}, 84, "tcp"}, +{"ctf", {NULL}, 84, "udp"}, +{"mit-ml-dev", {NULL}, 85, "tcp"}, +{"mit-ml-dev", {NULL}, 85, "udp"}, +{"mfcobol", {NULL}, 86, "tcp"}, +{"mfcobol", {NULL}, 86, "udp"}, +{"kerberos", {NULL}, 88, "tcp"}, +{"kerberos", {NULL}, 88, "udp"}, +{"su-mit-tg", {NULL}, 89, "tcp"}, +{"su-mit-tg", {NULL}, 89, "udp"}, +{"dnsix", {NULL}, 90, "tcp"}, +{"dnsix", {NULL}, 90, "udp"}, +{"mit-dov", {NULL}, 91, "tcp"}, +{"mit-dov", {NULL}, 91, "udp"}, +{"npp", {NULL}, 92, "tcp"}, +{"npp", {NULL}, 92, "udp"}, +{"dcp", {NULL}, 93, "tcp"}, +{"dcp", {NULL}, 93, "udp"}, +{"objcall", {NULL}, 94, "tcp"}, +{"objcall", {NULL}, 94, "udp"}, +{"supdup", {NULL}, 95, "tcp"}, +{"supdup", {NULL}, 95, "udp"}, +{"dixie", {NULL}, 96, "tcp"}, +{"dixie", {NULL}, 96, "udp"}, +{"swift-rvf", {NULL}, 97, "tcp"}, +{"swift-rvf", {NULL}, 97, "udp"}, +{"tacnews", {NULL}, 98, "tcp"}, +{"tacnews", {NULL}, 98, "udp"}, +{"metagram", {NULL}, 99, "tcp"}, +{"metagram", {NULL}, 99, "udp"}, +{"newacct", {NULL}, 100, "tcp"}, +{"hostname", {NULL}, 101, "tcp"}, +{"hostname", {NULL}, 101, "udp"}, +{"iso-tsap", {NULL}, 102, "tcp"}, +{"iso-tsap", {NULL}, 102, "udp"}, +{"gppitnp", {NULL}, 103, "tcp"}, +{"gppitnp", {NULL}, 103, "udp"}, +{"acr-nema", {NULL}, 104, "tcp"}, +{"acr-nema", {NULL}, 104, "udp"}, +{"cso", {NULL}, 105, "tcp"}, +{"cso", {NULL}, 105, "udp"}, +{"csnet-ns", {NULL}, 105, "tcp"}, +{"csnet-ns", {NULL}, 105, "udp"}, +{"3com-tsmux", {NULL}, 106, "tcp"}, +{"3com-tsmux", {NULL}, 106, "udp"}, +{"rtelnet", {NULL}, 107, "tcp"}, +{"rtelnet", {NULL}, 107, "udp"}, +{"snagas", {NULL}, 108, "tcp"}, +{"snagas", {NULL}, 108, "udp"}, +{"pop2", {NULL}, 109, "tcp"}, +{"pop2", {NULL}, 109, "udp"}, +{"pop3", {NULL}, 110, "tcp"}, +{"pop3", {NULL}, 110, "udp"}, +{"sunrpc", {NULL}, 111, "tcp"}, +{"sunrpc", {NULL}, 111, "udp"}, +{"mcidas", {NULL}, 112, "tcp"}, +{"mcidas", {NULL}, 112, "udp"}, +{"ident", {NULL}, 113, "tcp"}, +{"auth", {NULL}, 113, "tcp"}, +{"auth", {NULL}, 113, "udp"}, +{"sftp", {NULL}, 115, "tcp"}, +{"sftp", {NULL}, 115, "udp"}, +{"ansanotify", {NULL}, 116, "tcp"}, +{"ansanotify", {NULL}, 116, "udp"}, +{"uucp-path", {NULL}, 117, "tcp"}, +{"uucp-path", {NULL}, 117, "udp"}, +{"sqlserv", {NULL}, 118, "tcp"}, +{"sqlserv", {NULL}, 118, "udp"}, +{"nntp", {NULL}, 119, "tcp"}, +{"nntp", {NULL}, 119, "udp"}, +{"cfdptkt", {NULL}, 120, "tcp"}, +{"cfdptkt", {NULL}, 120, "udp"}, +{"erpc", {NULL}, 121, "tcp"}, +{"erpc", {NULL}, 121, "udp"}, +{"smakynet", {NULL}, 122, "tcp"}, +{"smakynet", {NULL}, 122, "udp"}, +{"ntp", {NULL}, 123, "tcp"}, +{"ntp", {NULL}, 123, "udp"}, +{"ansatrader", {NULL}, 124, "tcp"}, +{"ansatrader", {NULL}, 124, "udp"}, +{"locus-map", {NULL}, 125, "tcp"}, +{"locus-map", {NULL}, 125, "udp"}, +{"nxedit", {NULL}, 126, "tcp"}, +{"nxedit", {NULL}, 126, "udp"}, +{"locus-con", {NULL}, 127, "tcp"}, +{"locus-con", {NULL}, 127, "udp"}, +{"gss-xlicen", {NULL}, 128, "tcp"}, +{"gss-xlicen", {NULL}, 128, "udp"}, +{"pwdgen", {NULL}, 129, "tcp"}, +{"pwdgen", {NULL}, 129, "udp"}, +{"cisco-fna", {NULL}, 130, "tcp"}, +{"cisco-fna", {NULL}, 130, "udp"}, +{"cisco-tna", {NULL}, 131, "tcp"}, +{"cisco-tna", {NULL}, 131, "udp"}, +{"cisco-sys", {NULL}, 132, "tcp"}, +{"cisco-sys", {NULL}, 132, "udp"}, +{"statsrv", {NULL}, 133, "tcp"}, +{"statsrv", {NULL}, 133, "udp"}, +{"ingres-net", {NULL}, 134, "tcp"}, +{"ingres-net", {NULL}, 134, "udp"}, +{"epmap", {NULL}, 135, "tcp"}, +{"epmap", {NULL}, 135, "udp"}, +{"profile", {NULL}, 136, "tcp"}, +{"profile", {NULL}, 136, "udp"}, +{"netbios-ns", {NULL}, 137, "tcp"}, +{"netbios-ns", {NULL}, 137, "udp"}, +{"netbios-dgm", {NULL}, 138, "tcp"}, +{"netbios-dgm", {NULL}, 138, "udp"}, +{"netbios-ssn", {NULL}, 139, "tcp"}, +{"netbios-ssn", {NULL}, 139, "udp"}, +{"emfis-data", {NULL}, 140, "tcp"}, +{"emfis-data", {NULL}, 140, "udp"}, +{"emfis-cntl", {NULL}, 141, "tcp"}, +{"emfis-cntl", {NULL}, 141, "udp"}, +{"bl-idm", {NULL}, 142, "tcp"}, +{"bl-idm", {NULL}, 142, "udp"}, +{"imap", {NULL}, 143, "tcp"}, +{"imap", {NULL}, 143, "udp"}, +{"uma", {NULL}, 144, "tcp"}, +{"uma", {NULL}, 144, "udp"}, +{"uaac", {NULL}, 145, "tcp"}, +{"uaac", {NULL}, 145, "udp"}, +{"iso-tp0", {NULL}, 146, "tcp"}, +{"iso-tp0", {NULL}, 146, "udp"}, +{"iso-ip", {NULL}, 147, "tcp"}, +{"iso-ip", {NULL}, 147, "udp"}, +{"jargon", {NULL}, 148, "tcp"}, +{"jargon", {NULL}, 148, "udp"}, +{"aed-512", {NULL}, 149, "tcp"}, +{"aed-512", {NULL}, 149, "udp"}, +{"sql-net", {NULL}, 150, "tcp"}, +{"sql-net", {NULL}, 150, "udp"}, +{"hems", {NULL}, 151, "tcp"}, +{"hems", {NULL}, 151, "udp"}, +{"bftp", {NULL}, 152, "tcp"}, +{"bftp", {NULL}, 152, "udp"}, +{"sgmp", {NULL}, 153, "tcp"}, +{"sgmp", {NULL}, 153, "udp"}, +{"netsc-prod", {NULL}, 154, "tcp"}, +{"netsc-prod", {NULL}, 154, "udp"}, +{"netsc-dev", {NULL}, 155, "tcp"}, +{"netsc-dev", {NULL}, 155, "udp"}, +{"sqlsrv", {NULL}, 156, "tcp"}, +{"sqlsrv", {NULL}, 156, "udp"}, +{"knet-cmp", {NULL}, 157, "tcp"}, +{"knet-cmp", {NULL}, 157, "udp"}, +{"pcmail-srv", {NULL}, 158, "tcp"}, +{"pcmail-srv", {NULL}, 158, "udp"}, +{"nss-routing", {NULL}, 159, "tcp"}, +{"nss-routing", {NULL}, 159, "udp"}, +{"sgmp-traps", {NULL}, 160, "tcp"}, +{"sgmp-traps", {NULL}, 160, "udp"}, +{"snmp", {NULL}, 161, "tcp"}, +{"snmp", {NULL}, 161, "udp"}, +{"snmptrap", {NULL}, 162, "tcp"}, +{"snmptrap", {NULL}, 162, "udp"}, +{"cmip-man", {NULL}, 163, "tcp"}, +{"cmip-man", {NULL}, 163, "udp"}, +{"cmip-agent", {NULL}, 164, "tcp"}, +{"cmip-agent", {NULL}, 164, "udp"}, +{"xns-courier", {NULL}, 165, "tcp"}, +{"xns-courier", {NULL}, 165, "udp"}, +{"s-net", {NULL}, 166, "tcp"}, +{"s-net", {NULL}, 166, "udp"}, +{"namp", {NULL}, 167, "tcp"}, +{"namp", {NULL}, 167, "udp"}, +{"rsvd", {NULL}, 168, "tcp"}, +{"rsvd", {NULL}, 168, "udp"}, +{"send", {NULL}, 169, "tcp"}, +{"send", {NULL}, 169, "udp"}, +{"print-srv", {NULL}, 170, "tcp"}, +{"print-srv", {NULL}, 170, "udp"}, +{"multiplex", {NULL}, 171, "tcp"}, +{"multiplex", {NULL}, 171, "udp"}, +{"cl/1", {NULL}, 172, "tcp"}, +{"cl/1", {NULL}, 172, "udp"}, +{"xyplex-mux", {NULL}, 173, "tcp"}, +{"xyplex-mux", {NULL}, 173, "udp"}, +{"mailq", {NULL}, 174, "tcp"}, +{"mailq", {NULL}, 174, "udp"}, +{"vmnet", {NULL}, 175, "tcp"}, +{"vmnet", {NULL}, 175, "udp"}, +{"genrad-mux", {NULL}, 176, "tcp"}, +{"genrad-mux", {NULL}, 176, "udp"}, +{"xdmcp", {NULL}, 177, "tcp"}, +{"xdmcp", {NULL}, 177, "udp"}, +{"nextstep", {NULL}, 178, "tcp"}, +{"nextstep", {NULL}, 178, "udp"}, +{"bgp", {NULL}, 179, "tcp"}, +{"bgp", {NULL}, 179, "udp"}, +{"bgp", {NULL}, 179, "sctp"}, +{"ris", {NULL}, 180, "tcp"}, +{"ris", {NULL}, 180, "udp"}, +{"unify", {NULL}, 181, "tcp"}, +{"unify", {NULL}, 181, "udp"}, +{"audit", {NULL}, 182, "tcp"}, +{"audit", {NULL}, 182, "udp"}, +{"ocbinder", {NULL}, 183, "tcp"}, +{"ocbinder", {NULL}, 183, "udp"}, +{"ocserver", {NULL}, 184, "tcp"}, +{"ocserver", {NULL}, 184, "udp"}, +{"remote-kis", {NULL}, 185, "tcp"}, +{"remote-kis", {NULL}, 185, "udp"}, +{"kis", {NULL}, 186, "tcp"}, +{"kis", {NULL}, 186, "udp"}, +{"aci", {NULL}, 187, "tcp"}, +{"aci", {NULL}, 187, "udp"}, +{"mumps", {NULL}, 188, "tcp"}, +{"mumps", {NULL}, 188, "udp"}, +{"qft", {NULL}, 189, "tcp"}, +{"qft", {NULL}, 189, "udp"}, +{"gacp", {NULL}, 190, "tcp"}, +{"gacp", {NULL}, 190, "udp"}, +{"prospero", {NULL}, 191, "tcp"}, +{"prospero", {NULL}, 191, "udp"}, +{"osu-nms", {NULL}, 192, "tcp"}, +{"osu-nms", {NULL}, 192, "udp"}, +{"srmp", {NULL}, 193, "tcp"}, +{"srmp", {NULL}, 193, "udp"}, +{"irc", {NULL}, 194, "tcp"}, +{"irc", {NULL}, 194, "udp"}, +{"dn6-nlm-aud", {NULL}, 195, "tcp"}, +{"dn6-nlm-aud", {NULL}, 195, "udp"}, +{"dn6-smm-red", {NULL}, 196, "tcp"}, +{"dn6-smm-red", {NULL}, 196, "udp"}, +{"dls", {NULL}, 197, "tcp"}, +{"dls", {NULL}, 197, "udp"}, +{"dls-mon", {NULL}, 198, "tcp"}, +{"dls-mon", {NULL}, 198, "udp"}, +{"smux", {NULL}, 199, "tcp"}, +{"smux", {NULL}, 199, "udp"}, +{"src", {NULL}, 200, "tcp"}, +{"src", {NULL}, 200, "udp"}, +{"at-rtmp", {NULL}, 201, "tcp"}, +{"at-rtmp", {NULL}, 201, "udp"}, +{"at-nbp", {NULL}, 202, "tcp"}, +{"at-nbp", {NULL}, 202, "udp"}, +{"at-3", {NULL}, 203, "tcp"}, +{"at-3", {NULL}, 203, "udp"}, +{"at-echo", {NULL}, 204, "tcp"}, +{"at-echo", {NULL}, 204, "udp"}, +{"at-5", {NULL}, 205, "tcp"}, +{"at-5", {NULL}, 205, "udp"}, +{"at-zis", {NULL}, 206, "tcp"}, +{"at-zis", {NULL}, 206, "udp"}, +{"at-7", {NULL}, 207, "tcp"}, +{"at-7", {NULL}, 207, "udp"}, +{"at-8", {NULL}, 208, "tcp"}, +{"at-8", {NULL}, 208, "udp"}, +{"qmtp", {NULL}, 209, "tcp"}, +{"qmtp", {NULL}, 209, "udp"}, +{"z39.50", {NULL}, 210, "tcp"}, +{"z39.50", {NULL}, 210, "udp"}, +{"914c/g", {NULL}, 211, "tcp"}, +{"914c/g", {NULL}, 211, "udp"}, +{"anet", {NULL}, 212, "tcp"}, +{"anet", {NULL}, 212, "udp"}, +{"ipx", {NULL}, 213, "tcp"}, +{"ipx", {NULL}, 213, "udp"}, +{"vmpwscs", {NULL}, 214, "tcp"}, +{"vmpwscs", {NULL}, 214, "udp"}, +{"softpc", {NULL}, 215, "tcp"}, +{"softpc", {NULL}, 215, "udp"}, +{"CAIlic", {NULL}, 216, "tcp"}, +{"CAIlic", {NULL}, 216, "udp"}, +{"dbase", {NULL}, 217, "tcp"}, +{"dbase", {NULL}, 217, "udp"}, +{"mpp", {NULL}, 218, "tcp"}, +{"mpp", {NULL}, 218, "udp"}, +{"uarps", {NULL}, 219, "tcp"}, +{"uarps", {NULL}, 219, "udp"}, +{"imap3", {NULL}, 220, "tcp"}, +{"imap3", {NULL}, 220, "udp"}, +{"fln-spx", {NULL}, 221, "tcp"}, +{"fln-spx", {NULL}, 221, "udp"}, +{"rsh-spx", {NULL}, 222, "tcp"}, +{"rsh-spx", {NULL}, 222, "udp"}, +{"cdc", {NULL}, 223, "tcp"}, +{"cdc", {NULL}, 223, "udp"}, +{"masqdialer", {NULL}, 224, "tcp"}, +{"masqdialer", {NULL}, 224, "udp"}, +{"direct", {NULL}, 242, "tcp"}, +{"direct", {NULL}, 242, "udp"}, +{"sur-meas", {NULL}, 243, "tcp"}, +{"sur-meas", {NULL}, 243, "udp"}, +{"inbusiness", {NULL}, 244, "tcp"}, +{"inbusiness", {NULL}, 244, "udp"}, +{"link", {NULL}, 245, "tcp"}, +{"link", {NULL}, 245, "udp"}, +{"dsp3270", {NULL}, 246, "tcp"}, +{"dsp3270", {NULL}, 246, "udp"}, +{"subntbcst_tftp", {NULL}, 247, "tcp"}, +{"subntbcst_tftp", {NULL}, 247, "udp"}, +{"bhfhs", {NULL}, 248, "tcp"}, +{"bhfhs", {NULL}, 248, "udp"}, +{"rap", {NULL}, 256, "tcp"}, +{"rap", {NULL}, 256, "udp"}, +{"set", {NULL}, 257, "tcp"}, +{"set", {NULL}, 257, "udp"}, +{"esro-gen", {NULL}, 259, "tcp"}, +{"esro-gen", {NULL}, 259, "udp"}, +{"openport", {NULL}, 260, "tcp"}, +{"openport", {NULL}, 260, "udp"}, +{"nsiiops", {NULL}, 261, "tcp"}, +{"nsiiops", {NULL}, 261, "udp"}, +{"arcisdms", {NULL}, 262, "tcp"}, +{"arcisdms", {NULL}, 262, "udp"}, +{"hdap", {NULL}, 263, "tcp"}, +{"hdap", {NULL}, 263, "udp"}, +{"bgmp", {NULL}, 264, "tcp"}, +{"bgmp", {NULL}, 264, "udp"}, +{"x-bone-ctl", {NULL}, 265, "tcp"}, +{"x-bone-ctl", {NULL}, 265, "udp"}, +{"sst", {NULL}, 266, "tcp"}, +{"sst", {NULL}, 266, "udp"}, +{"td-service", {NULL}, 267, "tcp"}, +{"td-service", {NULL}, 267, "udp"}, +{"td-replica", {NULL}, 268, "tcp"}, +{"td-replica", {NULL}, 268, "udp"}, +{"manet", {NULL}, 269, "tcp"}, +{"manet", {NULL}, 269, "udp"}, +{"gist", {NULL}, 270, "udp"}, +{"http-mgmt", {NULL}, 280, "tcp"}, +{"http-mgmt", {NULL}, 280, "udp"}, +{"personal-link", {NULL}, 281, "tcp"}, +{"personal-link", {NULL}, 281, "udp"}, +{"cableport-ax", {NULL}, 282, "tcp"}, +{"cableport-ax", {NULL}, 282, "udp"}, +{"rescap", {NULL}, 283, "tcp"}, +{"rescap", {NULL}, 283, "udp"}, +{"corerjd", {NULL}, 284, "tcp"}, +{"corerjd", {NULL}, 284, "udp"}, +{"fxp", {NULL}, 286, "tcp"}, +{"fxp", {NULL}, 286, "udp"}, +{"k-block", {NULL}, 287, "tcp"}, +{"k-block", {NULL}, 287, "udp"}, +{"novastorbakcup", {NULL}, 308, "tcp"}, +{"novastorbakcup", {NULL}, 308, "udp"}, +{"entrusttime", {NULL}, 309, "tcp"}, +{"entrusttime", {NULL}, 309, "udp"}, +{"bhmds", {NULL}, 310, "tcp"}, +{"bhmds", {NULL}, 310, "udp"}, +{"asip-webadmin", {NULL}, 311, "tcp"}, +{"asip-webadmin", {NULL}, 311, "udp"}, +{"vslmp", {NULL}, 312, "tcp"}, +{"vslmp", {NULL}, 312, "udp"}, +{"magenta-logic", {NULL}, 313, "tcp"}, +{"magenta-logic", {NULL}, 313, "udp"}, +{"opalis-robot", {NULL}, 314, "tcp"}, +{"opalis-robot", {NULL}, 314, "udp"}, +{"dpsi", {NULL}, 315, "tcp"}, +{"dpsi", {NULL}, 315, "udp"}, +{"decauth", {NULL}, 316, "tcp"}, +{"decauth", {NULL}, 316, "udp"}, +{"zannet", {NULL}, 317, "tcp"}, +{"zannet", {NULL}, 317, "udp"}, +{"pkix-timestamp", {NULL}, 318, "tcp"}, +{"pkix-timestamp", {NULL}, 318, "udp"}, +{"ptp-event", {NULL}, 319, "tcp"}, +{"ptp-event", {NULL}, 319, "udp"}, +{"ptp-general", {NULL}, 320, "tcp"}, +{"ptp-general", {NULL}, 320, "udp"}, +{"pip", {NULL}, 321, "tcp"}, +{"pip", {NULL}, 321, "udp"}, +{"rtsps", {NULL}, 322, "tcp"}, +{"rtsps", {NULL}, 322, "udp"}, +{"texar", {NULL}, 333, "tcp"}, +{"texar", {NULL}, 333, "udp"}, +{"pdap", {NULL}, 344, "tcp"}, +{"pdap", {NULL}, 344, "udp"}, +{"pawserv", {NULL}, 345, "tcp"}, +{"pawserv", {NULL}, 345, "udp"}, +{"zserv", {NULL}, 346, "tcp"}, +{"zserv", {NULL}, 346, "udp"}, +{"fatserv", {NULL}, 347, "tcp"}, +{"fatserv", {NULL}, 347, "udp"}, +{"csi-sgwp", {NULL}, 348, "tcp"}, +{"csi-sgwp", {NULL}, 348, "udp"}, +{"mftp", {NULL}, 349, "tcp"}, +{"mftp", {NULL}, 349, "udp"}, +{"matip-type-a", {NULL}, 350, "tcp"}, +{"matip-type-a", {NULL}, 350, "udp"}, +{"matip-type-b", {NULL}, 351, "tcp"}, +{"matip-type-b", {NULL}, 351, "udp"}, +{"bhoetty", {NULL}, 351, "tcp"}, +{"bhoetty", {NULL}, 351, "udp"}, +{"dtag-ste-sb", {NULL}, 352, "tcp"}, +{"dtag-ste-sb", {NULL}, 352, "udp"}, +{"bhoedap4", {NULL}, 352, "tcp"}, +{"bhoedap4", {NULL}, 352, "udp"}, +{"ndsauth", {NULL}, 353, "tcp"}, +{"ndsauth", {NULL}, 353, "udp"}, +{"bh611", {NULL}, 354, "tcp"}, +{"bh611", {NULL}, 354, "udp"}, +{"datex-asn", {NULL}, 355, "tcp"}, +{"datex-asn", {NULL}, 355, "udp"}, +{"cloanto-net-1", {NULL}, 356, "tcp"}, +{"cloanto-net-1", {NULL}, 356, "udp"}, +{"bhevent", {NULL}, 357, "tcp"}, +{"bhevent", {NULL}, 357, "udp"}, +{"shrinkwrap", {NULL}, 358, "tcp"}, +{"shrinkwrap", {NULL}, 358, "udp"}, +{"nsrmp", {NULL}, 359, "tcp"}, +{"nsrmp", {NULL}, 359, "udp"}, +{"scoi2odialog", {NULL}, 360, "tcp"}, +{"scoi2odialog", {NULL}, 360, "udp"}, +{"semantix", {NULL}, 361, "tcp"}, +{"semantix", {NULL}, 361, "udp"}, +{"srssend", {NULL}, 362, "tcp"}, +{"srssend", {NULL}, 362, "udp"}, +{"rsvp_tunnel", {NULL}, 363, "tcp"}, +{"rsvp_tunnel", {NULL}, 363, "udp"}, +{"aurora-cmgr", {NULL}, 364, "tcp"}, +{"aurora-cmgr", {NULL}, 364, "udp"}, +{"dtk", {NULL}, 365, "tcp"}, +{"dtk", {NULL}, 365, "udp"}, +{"odmr", {NULL}, 366, "tcp"}, +{"odmr", {NULL}, 366, "udp"}, +{"mortgageware", {NULL}, 367, "tcp"}, +{"mortgageware", {NULL}, 367, "udp"}, +{"qbikgdp", {NULL}, 368, "tcp"}, +{"qbikgdp", {NULL}, 368, "udp"}, +{"rpc2portmap", {NULL}, 369, "tcp"}, +{"rpc2portmap", {NULL}, 369, "udp"}, +{"codaauth2", {NULL}, 370, "tcp"}, +{"codaauth2", {NULL}, 370, "udp"}, +{"clearcase", {NULL}, 371, "tcp"}, +{"clearcase", {NULL}, 371, "udp"}, +{"ulistproc", {NULL}, 372, "tcp"}, +{"ulistproc", {NULL}, 372, "udp"}, +{"legent-1", {NULL}, 373, "tcp"}, +{"legent-1", {NULL}, 373, "udp"}, +{"legent-2", {NULL}, 374, "tcp"}, +{"legent-2", {NULL}, 374, "udp"}, +{"hassle", {NULL}, 375, "tcp"}, +{"hassle", {NULL}, 375, "udp"}, +{"nip", {NULL}, 376, "tcp"}, +{"nip", {NULL}, 376, "udp"}, +{"tnETOS", {NULL}, 377, "tcp"}, +{"tnETOS", {NULL}, 377, "udp"}, +{"dsETOS", {NULL}, 378, "tcp"}, +{"dsETOS", {NULL}, 378, "udp"}, +{"is99c", {NULL}, 379, "tcp"}, +{"is99c", {NULL}, 379, "udp"}, +{"is99s", {NULL}, 380, "tcp"}, +{"is99s", {NULL}, 380, "udp"}, +{"hp-collector", {NULL}, 381, "tcp"}, +{"hp-collector", {NULL}, 381, "udp"}, +{"hp-managed-node", {NULL}, 382, "tcp"}, +{"hp-managed-node", {NULL}, 382, "udp"}, +{"hp-alarm-mgr", {NULL}, 383, "tcp"}, +{"hp-alarm-mgr", {NULL}, 383, "udp"}, +{"arns", {NULL}, 384, "tcp"}, +{"arns", {NULL}, 384, "udp"}, +{"ibm-app", {NULL}, 385, "tcp"}, +{"ibm-app", {NULL}, 385, "udp"}, +{"asa", {NULL}, 386, "tcp"}, +{"asa", {NULL}, 386, "udp"}, +{"aurp", {NULL}, 387, "tcp"}, +{"aurp", {NULL}, 387, "udp"}, +{"unidata-ldm", {NULL}, 388, "tcp"}, +{"unidata-ldm", {NULL}, 388, "udp"}, +{"ldap", {NULL}, 389, "tcp"}, +{"ldap", {NULL}, 389, "udp"}, +{"uis", {NULL}, 390, "tcp"}, +{"uis", {NULL}, 390, "udp"}, +{"synotics-relay", {NULL}, 391, "tcp"}, +{"synotics-relay", {NULL}, 391, "udp"}, +{"synotics-broker", {NULL}, 392, "tcp"}, +{"synotics-broker", {NULL}, 392, "udp"}, +{"meta5", {NULL}, 393, "tcp"}, +{"meta5", {NULL}, 393, "udp"}, +{"embl-ndt", {NULL}, 394, "tcp"}, +{"embl-ndt", {NULL}, 394, "udp"}, +{"netcp", {NULL}, 395, "tcp"}, +{"netcp", {NULL}, 395, "udp"}, +{"netware-ip", {NULL}, 396, "tcp"}, +{"netware-ip", {NULL}, 396, "udp"}, +{"mptn", {NULL}, 397, "tcp"}, +{"mptn", {NULL}, 397, "udp"}, +{"kryptolan", {NULL}, 398, "tcp"}, +{"kryptolan", {NULL}, 398, "udp"}, +{"iso-tsap-c2", {NULL}, 399, "tcp"}, +{"iso-tsap-c2", {NULL}, 399, "udp"}, +{"osb-sd", {NULL}, 400, "tcp"}, +{"osb-sd", {NULL}, 400, "udp"}, +{"ups", {NULL}, 401, "tcp"}, +{"ups", {NULL}, 401, "udp"}, +{"genie", {NULL}, 402, "tcp"}, +{"genie", {NULL}, 402, "udp"}, +{"decap", {NULL}, 403, "tcp"}, +{"decap", {NULL}, 403, "udp"}, +{"nced", {NULL}, 404, "tcp"}, +{"nced", {NULL}, 404, "udp"}, +{"ncld", {NULL}, 405, "tcp"}, +{"ncld", {NULL}, 405, "udp"}, +{"imsp", {NULL}, 406, "tcp"}, +{"imsp", {NULL}, 406, "udp"}, +{"timbuktu", {NULL}, 407, "tcp"}, +{"timbuktu", {NULL}, 407, "udp"}, +{"prm-sm", {NULL}, 408, "tcp"}, +{"prm-sm", {NULL}, 408, "udp"}, +{"prm-nm", {NULL}, 409, "tcp"}, +{"prm-nm", {NULL}, 409, "udp"}, +{"decladebug", {NULL}, 410, "tcp"}, +{"decladebug", {NULL}, 410, "udp"}, +{"rmt", {NULL}, 411, "tcp"}, +{"rmt", {NULL}, 411, "udp"}, +{"synoptics-trap", {NULL}, 412, "tcp"}, +{"synoptics-trap", {NULL}, 412, "udp"}, +{"smsp", {NULL}, 413, "tcp"}, +{"smsp", {NULL}, 413, "udp"}, +{"infoseek", {NULL}, 414, "tcp"}, +{"infoseek", {NULL}, 414, "udp"}, +{"bnet", {NULL}, 415, "tcp"}, +{"bnet", {NULL}, 415, "udp"}, +{"silverplatter", {NULL}, 416, "tcp"}, +{"silverplatter", {NULL}, 416, "udp"}, +{"onmux", {NULL}, 417, "tcp"}, +{"onmux", {NULL}, 417, "udp"}, +{"hyper-g", {NULL}, 418, "tcp"}, +{"hyper-g", {NULL}, 418, "udp"}, +{"ariel1", {NULL}, 419, "tcp"}, +{"ariel1", {NULL}, 419, "udp"}, +{"smpte", {NULL}, 420, "tcp"}, +{"smpte", {NULL}, 420, "udp"}, +{"ariel2", {NULL}, 421, "tcp"}, +{"ariel2", {NULL}, 421, "udp"}, +{"ariel3", {NULL}, 422, "tcp"}, +{"ariel3", {NULL}, 422, "udp"}, +{"opc-job-start", {NULL}, 423, "tcp"}, +{"opc-job-start", {NULL}, 423, "udp"}, +{"opc-job-track", {NULL}, 424, "tcp"}, +{"opc-job-track", {NULL}, 424, "udp"}, +{"icad-el", {NULL}, 425, "tcp"}, +{"icad-el", {NULL}, 425, "udp"}, +{"smartsdp", {NULL}, 426, "tcp"}, +{"smartsdp", {NULL}, 426, "udp"}, +{"svrloc", {NULL}, 427, "tcp"}, +{"svrloc", {NULL}, 427, "udp"}, +{"ocs_cmu", {NULL}, 428, "tcp"}, +{"ocs_cmu", {NULL}, 428, "udp"}, +{"ocs_amu", {NULL}, 429, "tcp"}, +{"ocs_amu", {NULL}, 429, "udp"}, +{"utmpsd", {NULL}, 430, "tcp"}, +{"utmpsd", {NULL}, 430, "udp"}, +{"utmpcd", {NULL}, 431, "tcp"}, +{"utmpcd", {NULL}, 431, "udp"}, +{"iasd", {NULL}, 432, "tcp"}, +{"iasd", {NULL}, 432, "udp"}, +{"nnsp", {NULL}, 433, "tcp"}, +{"nnsp", {NULL}, 433, "udp"}, +{"mobileip-agent", {NULL}, 434, "tcp"}, +{"mobileip-agent", {NULL}, 434, "udp"}, +{"mobilip-mn", {NULL}, 435, "tcp"}, +{"mobilip-mn", {NULL}, 435, "udp"}, +{"dna-cml", {NULL}, 436, "tcp"}, +{"dna-cml", {NULL}, 436, "udp"}, +{"comscm", {NULL}, 437, "tcp"}, +{"comscm", {NULL}, 437, "udp"}, +{"dsfgw", {NULL}, 438, "tcp"}, +{"dsfgw", {NULL}, 438, "udp"}, +{"dasp", {NULL}, 439, "tcp"}, +{"dasp", {NULL}, 439, "udp"}, +{"sgcp", {NULL}, 440, "tcp"}, +{"sgcp", {NULL}, 440, "udp"}, +{"decvms-sysmgt", {NULL}, 441, "tcp"}, +{"decvms-sysmgt", {NULL}, 441, "udp"}, +{"cvc_hostd", {NULL}, 442, "tcp"}, +{"cvc_hostd", {NULL}, 442, "udp"}, +{"https", {NULL}, 443, "tcp"}, +{"https", {NULL}, 443, "udp"}, +{"https", {NULL}, 443, "sctp"}, +{"snpp", {NULL}, 444, "tcp"}, +{"snpp", {NULL}, 444, "udp"}, +{"microsoft-ds", {NULL}, 445, "tcp"}, +{"microsoft-ds", {NULL}, 445, "udp"}, +{"ddm-rdb", {NULL}, 446, "tcp"}, +{"ddm-rdb", {NULL}, 446, "udp"}, +{"ddm-dfm", {NULL}, 447, "tcp"}, +{"ddm-dfm", {NULL}, 447, "udp"}, +{"ddm-ssl", {NULL}, 448, "tcp"}, +{"ddm-ssl", {NULL}, 448, "udp"}, +{"as-servermap", {NULL}, 449, "tcp"}, +{"as-servermap", {NULL}, 449, "udp"}, +{"tserver", {NULL}, 450, "tcp"}, +{"tserver", {NULL}, 450, "udp"}, +{"sfs-smp-net", {NULL}, 451, "tcp"}, +{"sfs-smp-net", {NULL}, 451, "udp"}, +{"sfs-config", {NULL}, 452, "tcp"}, +{"sfs-config", {NULL}, 452, "udp"}, +{"creativeserver", {NULL}, 453, "tcp"}, +{"creativeserver", {NULL}, 453, "udp"}, +{"contentserver", {NULL}, 454, "tcp"}, +{"contentserver", {NULL}, 454, "udp"}, +{"creativepartnr", {NULL}, 455, "tcp"}, +{"creativepartnr", {NULL}, 455, "udp"}, +{"macon-tcp", {NULL}, 456, "tcp"}, +{"macon-udp", {NULL}, 456, "udp"}, +{"scohelp", {NULL}, 457, "tcp"}, +{"scohelp", {NULL}, 457, "udp"}, +{"appleqtc", {NULL}, 458, "tcp"}, +{"appleqtc", {NULL}, 458, "udp"}, +{"ampr-rcmd", {NULL}, 459, "tcp"}, +{"ampr-rcmd", {NULL}, 459, "udp"}, +{"skronk", {NULL}, 460, "tcp"}, +{"skronk", {NULL}, 460, "udp"}, +{"datasurfsrv", {NULL}, 461, "tcp"}, +{"datasurfsrv", {NULL}, 461, "udp"}, +{"datasurfsrvsec", {NULL}, 462, "tcp"}, +{"datasurfsrvsec", {NULL}, 462, "udp"}, +{"alpes", {NULL}, 463, "tcp"}, +{"alpes", {NULL}, 463, "udp"}, +{"kpasswd", {NULL}, 464, "tcp"}, +{"kpasswd", {NULL}, 464, "udp"}, +{"urd", {NULL}, 465, "tcp"}, +{"igmpv3lite", {NULL}, 465, "udp"}, +{"digital-vrc", {NULL}, 466, "tcp"}, +{"digital-vrc", {NULL}, 466, "udp"}, +{"mylex-mapd", {NULL}, 467, "tcp"}, +{"mylex-mapd", {NULL}, 467, "udp"}, +{"photuris", {NULL}, 468, "tcp"}, +{"photuris", {NULL}, 468, "udp"}, +{"rcp", {NULL}, 469, "tcp"}, +{"rcp", {NULL}, 469, "udp"}, +{"scx-proxy", {NULL}, 470, "tcp"}, +{"scx-proxy", {NULL}, 470, "udp"}, +{"mondex", {NULL}, 471, "tcp"}, +{"mondex", {NULL}, 471, "udp"}, +{"ljk-login", {NULL}, 472, "tcp"}, +{"ljk-login", {NULL}, 472, "udp"}, +{"hybrid-pop", {NULL}, 473, "tcp"}, +{"hybrid-pop", {NULL}, 473, "udp"}, +{"tn-tl-w1", {NULL}, 474, "tcp"}, +{"tn-tl-w2", {NULL}, 474, "udp"}, +{"tcpnethaspsrv", {NULL}, 475, "tcp"}, +{"tcpnethaspsrv", {NULL}, 475, "udp"}, +{"tn-tl-fd1", {NULL}, 476, "tcp"}, +{"tn-tl-fd1", {NULL}, 476, "udp"}, +{"ss7ns", {NULL}, 477, "tcp"}, +{"ss7ns", {NULL}, 477, "udp"}, +{"spsc", {NULL}, 478, "tcp"}, +{"spsc", {NULL}, 478, "udp"}, +{"iafserver", {NULL}, 479, "tcp"}, +{"iafserver", {NULL}, 479, "udp"}, +{"iafdbase", {NULL}, 480, "tcp"}, +{"iafdbase", {NULL}, 480, "udp"}, +{"ph", {NULL}, 481, "tcp"}, +{"ph", {NULL}, 481, "udp"}, +{"bgs-nsi", {NULL}, 482, "tcp"}, +{"bgs-nsi", {NULL}, 482, "udp"}, +{"ulpnet", {NULL}, 483, "tcp"}, +{"ulpnet", {NULL}, 483, "udp"}, +{"integra-sme", {NULL}, 484, "tcp"}, +{"integra-sme", {NULL}, 484, "udp"}, +{"powerburst", {NULL}, 485, "tcp"}, +{"powerburst", {NULL}, 485, "udp"}, +{"avian", {NULL}, 486, "tcp"}, +{"avian", {NULL}, 486, "udp"}, +{"saft", {NULL}, 487, "tcp"}, +{"saft", {NULL}, 487, "udp"}, +{"gss-http", {NULL}, 488, "tcp"}, +{"gss-http", {NULL}, 488, "udp"}, +{"nest-protocol", {NULL}, 489, "tcp"}, +{"nest-protocol", {NULL}, 489, "udp"}, +{"micom-pfs", {NULL}, 490, "tcp"}, +{"micom-pfs", {NULL}, 490, "udp"}, +{"go-login", {NULL}, 491, "tcp"}, +{"go-login", {NULL}, 491, "udp"}, +{"ticf-1", {NULL}, 492, "tcp"}, +{"ticf-1", {NULL}, 492, "udp"}, +{"ticf-2", {NULL}, 493, "tcp"}, +{"ticf-2", {NULL}, 493, "udp"}, +{"pov-ray", {NULL}, 494, "tcp"}, +{"pov-ray", {NULL}, 494, "udp"}, +{"intecourier", {NULL}, 495, "tcp"}, +{"intecourier", {NULL}, 495, "udp"}, +{"pim-rp-disc", {NULL}, 496, "tcp"}, +{"pim-rp-disc", {NULL}, 496, "udp"}, +{"dantz", {NULL}, 497, "tcp"}, +{"dantz", {NULL}, 497, "udp"}, +{"siam", {NULL}, 498, "tcp"}, +{"siam", {NULL}, 498, "udp"}, +{"iso-ill", {NULL}, 499, "tcp"}, +{"iso-ill", {NULL}, 499, "udp"}, +{"isakmp", {NULL}, 500, "tcp"}, +{"isakmp", {NULL}, 500, "udp"}, +{"stmf", {NULL}, 501, "tcp"}, +{"stmf", {NULL}, 501, "udp"}, +{"asa-appl-proto", {NULL}, 502, "tcp"}, +{"asa-appl-proto", {NULL}, 502, "udp"}, +{"intrinsa", {NULL}, 503, "tcp"}, +{"intrinsa", {NULL}, 503, "udp"}, +{"citadel", {NULL}, 504, "tcp"}, +{"citadel", {NULL}, 504, "udp"}, +{"mailbox-lm", {NULL}, 505, "tcp"}, +{"mailbox-lm", {NULL}, 505, "udp"}, +{"ohimsrv", {NULL}, 506, "tcp"}, +{"ohimsrv", {NULL}, 506, "udp"}, +{"crs", {NULL}, 507, "tcp"}, +{"crs", {NULL}, 507, "udp"}, +{"xvttp", {NULL}, 508, "tcp"}, +{"xvttp", {NULL}, 508, "udp"}, +{"snare", {NULL}, 509, "tcp"}, +{"snare", {NULL}, 509, "udp"}, +{"fcp", {NULL}, 510, "tcp"}, +{"fcp", {NULL}, 510, "udp"}, +{"passgo", {NULL}, 511, "tcp"}, +{"passgo", {NULL}, 511, "udp"}, +{"exec", {NULL}, 512, "tcp"}, +{"comsat", {NULL}, 512, "udp"}, +{"biff", {NULL}, 512, "udp"}, +{"login", {NULL}, 513, "tcp"}, +{"who", {NULL}, 513, "udp"}, +{"shell", {NULL}, 514, "tcp"}, +{"syslog", {NULL}, 514, "udp"}, +{"printer", {NULL}, 515, "tcp"}, +{"printer", {NULL}, 515, "udp"}, +{"videotex", {NULL}, 516, "tcp"}, +{"videotex", {NULL}, 516, "udp"}, +{"talk", {NULL}, 517, "tcp"}, +{"talk", {NULL}, 517, "udp"}, +{"ntalk", {NULL}, 518, "tcp"}, +{"ntalk", {NULL}, 518, "udp"}, +{"utime", {NULL}, 519, "tcp"}, +{"utime", {NULL}, 519, "udp"}, +{"efs", {NULL}, 520, "tcp"}, +{"router", {NULL}, 520, "udp"}, +{"ripng", {NULL}, 521, "tcp"}, +{"ripng", {NULL}, 521, "udp"}, +{"ulp", {NULL}, 522, "tcp"}, +{"ulp", {NULL}, 522, "udp"}, +{"ibm-db2", {NULL}, 523, "tcp"}, +{"ibm-db2", {NULL}, 523, "udp"}, +{"ncp", {NULL}, 524, "tcp"}, +{"ncp", {NULL}, 524, "udp"}, +{"timed", {NULL}, 525, "tcp"}, +{"timed", {NULL}, 525, "udp"}, +{"tempo", {NULL}, 526, "tcp"}, +{"tempo", {NULL}, 526, "udp"}, +{"stx", {NULL}, 527, "tcp"}, +{"stx", {NULL}, 527, "udp"}, +{"custix", {NULL}, 528, "tcp"}, +{"custix", {NULL}, 528, "udp"}, +{"irc-serv", {NULL}, 529, "tcp"}, +{"irc-serv", {NULL}, 529, "udp"}, +{"courier", {NULL}, 530, "tcp"}, +{"courier", {NULL}, 530, "udp"}, +{"conference", {NULL}, 531, "tcp"}, +{"conference", {NULL}, 531, "udp"}, +{"netnews", {NULL}, 532, "tcp"}, +{"netnews", {NULL}, 532, "udp"}, +{"netwall", {NULL}, 533, "tcp"}, +{"netwall", {NULL}, 533, "udp"}, +{"windream", {NULL}, 534, "tcp"}, +{"windream", {NULL}, 534, "udp"}, +{"iiop", {NULL}, 535, "tcp"}, +{"iiop", {NULL}, 535, "udp"}, +{"opalis-rdv", {NULL}, 536, "tcp"}, +{"opalis-rdv", {NULL}, 536, "udp"}, +{"nmsp", {NULL}, 537, "tcp"}, +{"nmsp", {NULL}, 537, "udp"}, +{"gdomap", {NULL}, 538, "tcp"}, +{"gdomap", {NULL}, 538, "udp"}, +{"apertus-ldp", {NULL}, 539, "tcp"}, +{"apertus-ldp", {NULL}, 539, "udp"}, +{"uucp", {NULL}, 540, "tcp"}, +{"uucp", {NULL}, 540, "udp"}, +{"uucp-rlogin", {NULL}, 541, "tcp"}, +{"uucp-rlogin", {NULL}, 541, "udp"}, +{"commerce", {NULL}, 542, "tcp"}, +{"commerce", {NULL}, 542, "udp"}, +{"klogin", {NULL}, 543, "tcp"}, +{"klogin", {NULL}, 543, "udp"}, +{"kshell", {NULL}, 544, "tcp"}, +{"kshell", {NULL}, 544, "udp"}, +{"appleqtcsrvr", {NULL}, 545, "tcp"}, +{"appleqtcsrvr", {NULL}, 545, "udp"}, +{"dhcpv6-client", {NULL}, 546, "tcp"}, +{"dhcpv6-client", {NULL}, 546, "udp"}, +{"dhcpv6-server", {NULL}, 547, "tcp"}, +{"dhcpv6-server", {NULL}, 547, "udp"}, +{"afpovertcp", {NULL}, 548, "tcp"}, +{"afpovertcp", {NULL}, 548, "udp"}, +{"idfp", {NULL}, 549, "tcp"}, +{"idfp", {NULL}, 549, "udp"}, +{"new-rwho", {NULL}, 550, "tcp"}, +{"new-rwho", {NULL}, 550, "udp"}, +{"cybercash", {NULL}, 551, "tcp"}, +{"cybercash", {NULL}, 551, "udp"}, +{"devshr-nts", {NULL}, 552, "tcp"}, +{"devshr-nts", {NULL}, 552, "udp"}, +{"pirp", {NULL}, 553, "tcp"}, +{"pirp", {NULL}, 553, "udp"}, +{"rtsp", {NULL}, 554, "tcp"}, +{"rtsp", {NULL}, 554, "udp"}, +{"dsf", {NULL}, 555, "tcp"}, +{"dsf", {NULL}, 555, "udp"}, +{"remotefs", {NULL}, 556, "tcp"}, +{"remotefs", {NULL}, 556, "udp"}, +{"openvms-sysipc", {NULL}, 557, "tcp"}, +{"openvms-sysipc", {NULL}, 557, "udp"}, +{"sdnskmp", {NULL}, 558, "tcp"}, +{"sdnskmp", {NULL}, 558, "udp"}, +{"teedtap", {NULL}, 559, "tcp"}, +{"teedtap", {NULL}, 559, "udp"}, +{"rmonitor", {NULL}, 560, "tcp"}, +{"rmonitor", {NULL}, 560, "udp"}, +{"monitor", {NULL}, 561, "tcp"}, +{"monitor", {NULL}, 561, "udp"}, +{"chshell", {NULL}, 562, "tcp"}, +{"chshell", {NULL}, 562, "udp"}, +{"nntps", {NULL}, 563, "tcp"}, +{"nntps", {NULL}, 563, "udp"}, +{"9pfs", {NULL}, 564, "tcp"}, +{"9pfs", {NULL}, 564, "udp"}, +{"whoami", {NULL}, 565, "tcp"}, +{"whoami", {NULL}, 565, "udp"}, +{"streettalk", {NULL}, 566, "tcp"}, +{"streettalk", {NULL}, 566, "udp"}, +{"banyan-rpc", {NULL}, 567, "tcp"}, +{"banyan-rpc", {NULL}, 567, "udp"}, +{"ms-shuttle", {NULL}, 568, "tcp"}, +{"ms-shuttle", {NULL}, 568, "udp"}, +{"ms-rome", {NULL}, 569, "tcp"}, +{"ms-rome", {NULL}, 569, "udp"}, +{"meter", {NULL}, 570, "tcp"}, +{"meter", {NULL}, 570, "udp"}, +{"meter", {NULL}, 571, "tcp"}, +{"meter", {NULL}, 571, "udp"}, +{"sonar", {NULL}, 572, "tcp"}, +{"sonar", {NULL}, 572, "udp"}, +{"banyan-vip", {NULL}, 573, "tcp"}, +{"banyan-vip", {NULL}, 573, "udp"}, +{"ftp-agent", {NULL}, 574, "tcp"}, +{"ftp-agent", {NULL}, 574, "udp"}, +{"vemmi", {NULL}, 575, "tcp"}, +{"vemmi", {NULL}, 575, "udp"}, +{"ipcd", {NULL}, 576, "tcp"}, +{"ipcd", {NULL}, 576, "udp"}, +{"vnas", {NULL}, 577, "tcp"}, +{"vnas", {NULL}, 577, "udp"}, +{"ipdd", {NULL}, 578, "tcp"}, +{"ipdd", {NULL}, 578, "udp"}, +{"decbsrv", {NULL}, 579, "tcp"}, +{"decbsrv", {NULL}, 579, "udp"}, +{"sntp-heartbeat", {NULL}, 580, "tcp"}, +{"sntp-heartbeat", {NULL}, 580, "udp"}, +{"bdp", {NULL}, 581, "tcp"}, +{"bdp", {NULL}, 581, "udp"}, +{"scc-security", {NULL}, 582, "tcp"}, +{"scc-security", {NULL}, 582, "udp"}, +{"philips-vc", {NULL}, 583, "tcp"}, +{"philips-vc", {NULL}, 583, "udp"}, +{"keyserver", {NULL}, 584, "tcp"}, +{"keyserver", {NULL}, 584, "udp"}, +{"password-chg", {NULL}, 586, "tcp"}, +{"password-chg", {NULL}, 586, "udp"}, +{"submission", {NULL}, 587, "tcp"}, +{"submission", {NULL}, 587, "udp"}, +{"cal", {NULL}, 588, "tcp"}, +{"cal", {NULL}, 588, "udp"}, +{"eyelink", {NULL}, 589, "tcp"}, +{"eyelink", {NULL}, 589, "udp"}, +{"tns-cml", {NULL}, 590, "tcp"}, +{"tns-cml", {NULL}, 590, "udp"}, +{"http-alt", {NULL}, 591, "tcp"}, +{"http-alt", {NULL}, 591, "udp"}, +{"eudora-set", {NULL}, 592, "tcp"}, +{"eudora-set", {NULL}, 592, "udp"}, +{"http-rpc-epmap", {NULL}, 593, "tcp"}, +{"http-rpc-epmap", {NULL}, 593, "udp"}, +{"tpip", {NULL}, 594, "tcp"}, +{"tpip", {NULL}, 594, "udp"}, +{"cab-protocol", {NULL}, 595, "tcp"}, +{"cab-protocol", {NULL}, 595, "udp"}, +{"smsd", {NULL}, 596, "tcp"}, +{"smsd", {NULL}, 596, "udp"}, +{"ptcnameservice", {NULL}, 597, "tcp"}, +{"ptcnameservice", {NULL}, 597, "udp"}, +{"sco-websrvrmg3", {NULL}, 598, "tcp"}, +{"sco-websrvrmg3", {NULL}, 598, "udp"}, +{"acp", {NULL}, 599, "tcp"}, +{"acp", {NULL}, 599, "udp"}, +{"ipcserver", {NULL}, 600, "tcp"}, +{"ipcserver", {NULL}, 600, "udp"}, +{"syslog-conn", {NULL}, 601, "tcp"}, +{"syslog-conn", {NULL}, 601, "udp"}, +{"xmlrpc-beep", {NULL}, 602, "tcp"}, +{"xmlrpc-beep", {NULL}, 602, "udp"}, +{"idxp", {NULL}, 603, "tcp"}, +{"idxp", {NULL}, 603, "udp"}, +{"tunnel", {NULL}, 604, "tcp"}, +{"tunnel", {NULL}, 604, "udp"}, +{"soap-beep", {NULL}, 605, "tcp"}, +{"soap-beep", {NULL}, 605, "udp"}, +{"urm", {NULL}, 606, "tcp"}, +{"urm", {NULL}, 606, "udp"}, +{"nqs", {NULL}, 607, "tcp"}, +{"nqs", {NULL}, 607, "udp"}, +{"sift-uft", {NULL}, 608, "tcp"}, +{"sift-uft", {NULL}, 608, "udp"}, +{"npmp-trap", {NULL}, 609, "tcp"}, +{"npmp-trap", {NULL}, 609, "udp"}, +{"npmp-local", {NULL}, 610, "tcp"}, +{"npmp-local", {NULL}, 610, "udp"}, +{"npmp-gui", {NULL}, 611, "tcp"}, +{"npmp-gui", {NULL}, 611, "udp"}, +{"hmmp-ind", {NULL}, 612, "tcp"}, +{"hmmp-ind", {NULL}, 612, "udp"}, +{"hmmp-op", {NULL}, 613, "tcp"}, +{"hmmp-op", {NULL}, 613, "udp"}, +{"sshell", {NULL}, 614, "tcp"}, +{"sshell", {NULL}, 614, "udp"}, +{"sco-inetmgr", {NULL}, 615, "tcp"}, +{"sco-inetmgr", {NULL}, 615, "udp"}, +{"sco-sysmgr", {NULL}, 616, "tcp"}, +{"sco-sysmgr", {NULL}, 616, "udp"}, +{"sco-dtmgr", {NULL}, 617, "tcp"}, +{"sco-dtmgr", {NULL}, 617, "udp"}, +{"dei-icda", {NULL}, 618, "tcp"}, +{"dei-icda", {NULL}, 618, "udp"}, +{"compaq-evm", {NULL}, 619, "tcp"}, +{"compaq-evm", {NULL}, 619, "udp"}, +{"sco-websrvrmgr", {NULL}, 620, "tcp"}, +{"sco-websrvrmgr", {NULL}, 620, "udp"}, +{"escp-ip", {NULL}, 621, "tcp"}, +{"escp-ip", {NULL}, 621, "udp"}, +{"collaborator", {NULL}, 622, "tcp"}, +{"collaborator", {NULL}, 622, "udp"}, +{"oob-ws-http", {NULL}, 623, "tcp"}, +{"asf-rmcp", {NULL}, 623, "udp"}, +{"cryptoadmin", {NULL}, 624, "tcp"}, +{"cryptoadmin", {NULL}, 624, "udp"}, +{"dec_dlm", {NULL}, 625, "tcp"}, +{"dec_dlm", {NULL}, 625, "udp"}, +{"asia", {NULL}, 626, "tcp"}, +{"asia", {NULL}, 626, "udp"}, +{"passgo-tivoli", {NULL}, 627, "tcp"}, +{"passgo-tivoli", {NULL}, 627, "udp"}, +{"qmqp", {NULL}, 628, "tcp"}, +{"qmqp", {NULL}, 628, "udp"}, +{"3com-amp3", {NULL}, 629, "tcp"}, +{"3com-amp3", {NULL}, 629, "udp"}, +{"rda", {NULL}, 630, "tcp"}, +{"rda", {NULL}, 630, "udp"}, +{"ipp", {NULL}, 631, "tcp"}, +{"ipp", {NULL}, 631, "udp"}, +{"bmpp", {NULL}, 632, "tcp"}, +{"bmpp", {NULL}, 632, "udp"}, +{"servstat", {NULL}, 633, "tcp"}, +{"servstat", {NULL}, 633, "udp"}, +{"ginad", {NULL}, 634, "tcp"}, +{"ginad", {NULL}, 634, "udp"}, +{"rlzdbase", {NULL}, 635, "tcp"}, +{"rlzdbase", {NULL}, 635, "udp"}, +{"ldaps", {NULL}, 636, "tcp"}, +{"ldaps", {NULL}, 636, "udp"}, +{"lanserver", {NULL}, 637, "tcp"}, +{"lanserver", {NULL}, 637, "udp"}, +{"mcns-sec", {NULL}, 638, "tcp"}, +{"mcns-sec", {NULL}, 638, "udp"}, +{"msdp", {NULL}, 639, "tcp"}, +{"msdp", {NULL}, 639, "udp"}, +{"entrust-sps", {NULL}, 640, "tcp"}, +{"entrust-sps", {NULL}, 640, "udp"}, +{"repcmd", {NULL}, 641, "tcp"}, +{"repcmd", {NULL}, 641, "udp"}, +{"esro-emsdp", {NULL}, 642, "tcp"}, +{"esro-emsdp", {NULL}, 642, "udp"}, +{"sanity", {NULL}, 643, "tcp"}, +{"sanity", {NULL}, 643, "udp"}, +{"dwr", {NULL}, 644, "tcp"}, +{"dwr", {NULL}, 644, "udp"}, +{"pssc", {NULL}, 645, "tcp"}, +{"pssc", {NULL}, 645, "udp"}, +{"ldp", {NULL}, 646, "tcp"}, +{"ldp", {NULL}, 646, "udp"}, +{"dhcp-failover", {NULL}, 647, "tcp"}, +{"dhcp-failover", {NULL}, 647, "udp"}, +{"rrp", {NULL}, 648, "tcp"}, +{"rrp", {NULL}, 648, "udp"}, +{"cadview-3d", {NULL}, 649, "tcp"}, +{"cadview-3d", {NULL}, 649, "udp"}, +{"obex", {NULL}, 650, "tcp"}, +{"obex", {NULL}, 650, "udp"}, +{"ieee-mms", {NULL}, 651, "tcp"}, +{"ieee-mms", {NULL}, 651, "udp"}, +{"hello-port", {NULL}, 652, "tcp"}, +{"hello-port", {NULL}, 652, "udp"}, +{"repscmd", {NULL}, 653, "tcp"}, +{"repscmd", {NULL}, 653, "udp"}, +{"aodv", {NULL}, 654, "tcp"}, +{"aodv", {NULL}, 654, "udp"}, +{"tinc", {NULL}, 655, "tcp"}, +{"tinc", {NULL}, 655, "udp"}, +{"spmp", {NULL}, 656, "tcp"}, +{"spmp", {NULL}, 656, "udp"}, +{"rmc", {NULL}, 657, "tcp"}, +{"rmc", {NULL}, 657, "udp"}, +{"tenfold", {NULL}, 658, "tcp"}, +{"tenfold", {NULL}, 658, "udp"}, +{"mac-srvr-admin", {NULL}, 660, "tcp"}, +{"mac-srvr-admin", {NULL}, 660, "udp"}, +{"hap", {NULL}, 661, "tcp"}, +{"hap", {NULL}, 661, "udp"}, +{"pftp", {NULL}, 662, "tcp"}, +{"pftp", {NULL}, 662, "udp"}, +{"purenoise", {NULL}, 663, "tcp"}, +{"purenoise", {NULL}, 663, "udp"}, +{"oob-ws-https", {NULL}, 664, "tcp"}, +{"asf-secure-rmcp", {NULL}, 664, "udp"}, +{"sun-dr", {NULL}, 665, "tcp"}, +{"sun-dr", {NULL}, 665, "udp"}, +{"mdqs", {NULL}, 666, "tcp"}, +{"mdqs", {NULL}, 666, "udp"}, +{"doom", {NULL}, 666, "tcp"}, +{"doom", {NULL}, 666, "udp"}, +{"disclose", {NULL}, 667, "tcp"}, +{"disclose", {NULL}, 667, "udp"}, +{"mecomm", {NULL}, 668, "tcp"}, +{"mecomm", {NULL}, 668, "udp"}, +{"meregister", {NULL}, 669, "tcp"}, +{"meregister", {NULL}, 669, "udp"}, +{"vacdsm-sws", {NULL}, 670, "tcp"}, +{"vacdsm-sws", {NULL}, 670, "udp"}, +{"vacdsm-app", {NULL}, 671, "tcp"}, +{"vacdsm-app", {NULL}, 671, "udp"}, +{"vpps-qua", {NULL}, 672, "tcp"}, +{"vpps-qua", {NULL}, 672, "udp"}, +{"cimplex", {NULL}, 673, "tcp"}, +{"cimplex", {NULL}, 673, "udp"}, +{"acap", {NULL}, 674, "tcp"}, +{"acap", {NULL}, 674, "udp"}, +{"dctp", {NULL}, 675, "tcp"}, +{"dctp", {NULL}, 675, "udp"}, +{"vpps-via", {NULL}, 676, "tcp"}, +{"vpps-via", {NULL}, 676, "udp"}, +{"vpp", {NULL}, 677, "tcp"}, +{"vpp", {NULL}, 677, "udp"}, +{"ggf-ncp", {NULL}, 678, "tcp"}, +{"ggf-ncp", {NULL}, 678, "udp"}, +{"mrm", {NULL}, 679, "tcp"}, +{"mrm", {NULL}, 679, "udp"}, +{"entrust-aaas", {NULL}, 680, "tcp"}, +{"entrust-aaas", {NULL}, 680, "udp"}, +{"entrust-aams", {NULL}, 681, "tcp"}, +{"entrust-aams", {NULL}, 681, "udp"}, +{"xfr", {NULL}, 682, "tcp"}, +{"xfr", {NULL}, 682, "udp"}, +{"corba-iiop", {NULL}, 683, "tcp"}, +{"corba-iiop", {NULL}, 683, "udp"}, +{"corba-iiop-ssl", {NULL}, 684, "tcp"}, +{"corba-iiop-ssl", {NULL}, 684, "udp"}, +{"mdc-portmapper", {NULL}, 685, "tcp"}, +{"mdc-portmapper", {NULL}, 685, "udp"}, +{"hcp-wismar", {NULL}, 686, "tcp"}, +{"hcp-wismar", {NULL}, 686, "udp"}, +{"asipregistry", {NULL}, 687, "tcp"}, +{"asipregistry", {NULL}, 687, "udp"}, +{"realm-rusd", {NULL}, 688, "tcp"}, +{"realm-rusd", {NULL}, 688, "udp"}, +{"nmap", {NULL}, 689, "tcp"}, +{"nmap", {NULL}, 689, "udp"}, +{"vatp", {NULL}, 690, "tcp"}, +{"vatp", {NULL}, 690, "udp"}, +{"msexch-routing", {NULL}, 691, "tcp"}, +{"msexch-routing", {NULL}, 691, "udp"}, +{"hyperwave-isp", {NULL}, 692, "tcp"}, +{"hyperwave-isp", {NULL}, 692, "udp"}, +{"connendp", {NULL}, 693, "tcp"}, +{"connendp", {NULL}, 693, "udp"}, +{"ha-cluster", {NULL}, 694, "tcp"}, +{"ha-cluster", {NULL}, 694, "udp"}, +{"ieee-mms-ssl", {NULL}, 695, "tcp"}, +{"ieee-mms-ssl", {NULL}, 695, "udp"}, +{"rushd", {NULL}, 696, "tcp"}, +{"rushd", {NULL}, 696, "udp"}, +{"uuidgen", {NULL}, 697, "tcp"}, +{"uuidgen", {NULL}, 697, "udp"}, +{"olsr", {NULL}, 698, "tcp"}, +{"olsr", {NULL}, 698, "udp"}, +{"accessnetwork", {NULL}, 699, "tcp"}, +{"accessnetwork", {NULL}, 699, "udp"}, +{"epp", {NULL}, 700, "tcp"}, +{"epp", {NULL}, 700, "udp"}, +{"lmp", {NULL}, 701, "tcp"}, +{"lmp", {NULL}, 701, "udp"}, +{"iris-beep", {NULL}, 702, "tcp"}, +{"iris-beep", {NULL}, 702, "udp"}, +{"elcsd", {NULL}, 704, "tcp"}, +{"elcsd", {NULL}, 704, "udp"}, +{"agentx", {NULL}, 705, "tcp"}, +{"agentx", {NULL}, 705, "udp"}, +{"silc", {NULL}, 706, "tcp"}, +{"silc", {NULL}, 706, "udp"}, +{"borland-dsj", {NULL}, 707, "tcp"}, +{"borland-dsj", {NULL}, 707, "udp"}, +{"entrust-kmsh", {NULL}, 709, "tcp"}, +{"entrust-kmsh", {NULL}, 709, "udp"}, +{"entrust-ash", {NULL}, 710, "tcp"}, +{"entrust-ash", {NULL}, 710, "udp"}, +{"cisco-tdp", {NULL}, 711, "tcp"}, +{"cisco-tdp", {NULL}, 711, "udp"}, +{"tbrpf", {NULL}, 712, "tcp"}, +{"tbrpf", {NULL}, 712, "udp"}, +{"iris-xpc", {NULL}, 713, "tcp"}, +{"iris-xpc", {NULL}, 713, "udp"}, +{"iris-xpcs", {NULL}, 714, "tcp"}, +{"iris-xpcs", {NULL}, 714, "udp"}, +{"iris-lwz", {NULL}, 715, "tcp"}, +{"iris-lwz", {NULL}, 715, "udp"}, +{"pana", {NULL}, 716, "udp"}, +{"netviewdm1", {NULL}, 729, "tcp"}, +{"netviewdm1", {NULL}, 729, "udp"}, +{"netviewdm2", {NULL}, 730, "tcp"}, +{"netviewdm2", {NULL}, 730, "udp"}, +{"netviewdm3", {NULL}, 731, "tcp"}, +{"netviewdm3", {NULL}, 731, "udp"}, +{"netgw", {NULL}, 741, "tcp"}, +{"netgw", {NULL}, 741, "udp"}, +{"netrcs", {NULL}, 742, "tcp"}, +{"netrcs", {NULL}, 742, "udp"}, +{"flexlm", {NULL}, 744, "tcp"}, +{"flexlm", {NULL}, 744, "udp"}, +{"fujitsu-dev", {NULL}, 747, "tcp"}, +{"fujitsu-dev", {NULL}, 747, "udp"}, +{"ris-cm", {NULL}, 748, "tcp"}, +{"ris-cm", {NULL}, 748, "udp"}, +{"kerberos-adm", {NULL}, 749, "tcp"}, +{"kerberos-adm", {NULL}, 749, "udp"}, +{"rfile", {NULL}, 750, "tcp"}, +{"loadav", {NULL}, 750, "udp"}, +{"kerberos-iv", {NULL}, 750, "udp"}, +{"pump", {NULL}, 751, "tcp"}, +{"pump", {NULL}, 751, "udp"}, +{"qrh", {NULL}, 752, "tcp"}, +{"qrh", {NULL}, 752, "udp"}, +{"rrh", {NULL}, 753, "tcp"}, +{"rrh", {NULL}, 753, "udp"}, +{"tell", {NULL}, 754, "tcp"}, +{"tell", {NULL}, 754, "udp"}, +{"nlogin", {NULL}, 758, "tcp"}, +{"nlogin", {NULL}, 758, "udp"}, +{"con", {NULL}, 759, "tcp"}, +{"con", {NULL}, 759, "udp"}, +{"ns", {NULL}, 760, "tcp"}, +{"ns", {NULL}, 760, "udp"}, +{"rxe", {NULL}, 761, "tcp"}, +{"rxe", {NULL}, 761, "udp"}, +{"quotad", {NULL}, 762, "tcp"}, +{"quotad", {NULL}, 762, "udp"}, +{"cycleserv", {NULL}, 763, "tcp"}, +{"cycleserv", {NULL}, 763, "udp"}, +{"omserv", {NULL}, 764, "tcp"}, +{"omserv", {NULL}, 764, "udp"}, +{"webster", {NULL}, 765, "tcp"}, +{"webster", {NULL}, 765, "udp"}, +{"phonebook", {NULL}, 767, "tcp"}, +{"phonebook", {NULL}, 767, "udp"}, +{"vid", {NULL}, 769, "tcp"}, +{"vid", {NULL}, 769, "udp"}, +{"cadlock", {NULL}, 770, "tcp"}, +{"cadlock", {NULL}, 770, "udp"}, +{"rtip", {NULL}, 771, "tcp"}, +{"rtip", {NULL}, 771, "udp"}, +{"cycleserv2", {NULL}, 772, "tcp"}, +{"cycleserv2", {NULL}, 772, "udp"}, +{"submit", {NULL}, 773, "tcp"}, +{"notify", {NULL}, 773, "udp"}, +{"rpasswd", {NULL}, 774, "tcp"}, +{"acmaint_dbd", {NULL}, 774, "udp"}, +{"entomb", {NULL}, 775, "tcp"}, +{"acmaint_transd", {NULL}, 775, "udp"}, +{"wpages", {NULL}, 776, "tcp"}, +{"wpages", {NULL}, 776, "udp"}, +{"multiling-http", {NULL}, 777, "tcp"}, +{"multiling-http", {NULL}, 777, "udp"}, +{"wpgs", {NULL}, 780, "tcp"}, +{"wpgs", {NULL}, 780, "udp"}, +{"mdbs_daemon", {NULL}, 800, "tcp"}, +{"mdbs_daemon", {NULL}, 800, "udp"}, +{"device", {NULL}, 801, "tcp"}, +{"device", {NULL}, 801, "udp"}, +{"fcp-udp", {NULL}, 810, "tcp"}, +{"fcp-udp", {NULL}, 810, "udp"}, +{"itm-mcell-s", {NULL}, 828, "tcp"}, +{"itm-mcell-s", {NULL}, 828, "udp"}, +{"pkix-3-ca-ra", {NULL}, 829, "tcp"}, +{"pkix-3-ca-ra", {NULL}, 829, "udp"}, +{"netconf-ssh", {NULL}, 830, "tcp"}, +{"netconf-ssh", {NULL}, 830, "udp"}, +{"netconf-beep", {NULL}, 831, "tcp"}, +{"netconf-beep", {NULL}, 831, "udp"}, +{"netconfsoaphttp", {NULL}, 832, "tcp"}, +{"netconfsoaphttp", {NULL}, 832, "udp"}, +{"netconfsoapbeep", {NULL}, 833, "tcp"}, +{"netconfsoapbeep", {NULL}, 833, "udp"}, +{"dhcp-failover2", {NULL}, 847, "tcp"}, +{"dhcp-failover2", {NULL}, 847, "udp"}, +{"gdoi", {NULL}, 848, "tcp"}, +{"gdoi", {NULL}, 848, "udp"}, +{"iscsi", {NULL}, 860, "tcp"}, +{"iscsi", {NULL}, 860, "udp"}, +{"owamp-control", {NULL}, 861, "tcp"}, +{"owamp-control", {NULL}, 861, "udp"}, +{"twamp-control", {NULL}, 862, "tcp"}, +{"twamp-control", {NULL}, 862, "udp"}, +{"rsync", {NULL}, 873, "tcp"}, +{"rsync", {NULL}, 873, "udp"}, +{"iclcnet-locate", {NULL}, 886, "tcp"}, +{"iclcnet-locate", {NULL}, 886, "udp"}, +{"iclcnet_svinfo", {NULL}, 887, "tcp"}, +{"iclcnet_svinfo", {NULL}, 887, "udp"}, +{"accessbuilder", {NULL}, 888, "tcp"}, +{"accessbuilder", {NULL}, 888, "udp"}, +{"cddbp", {NULL}, 888, "tcp"}, +{"omginitialrefs", {NULL}, 900, "tcp"}, +{"omginitialrefs", {NULL}, 900, "udp"}, +{"smpnameres", {NULL}, 901, "tcp"}, +{"smpnameres", {NULL}, 901, "udp"}, +{"ideafarm-door", {NULL}, 902, "tcp"}, +{"ideafarm-door", {NULL}, 902, "udp"}, +{"ideafarm-panic", {NULL}, 903, "tcp"}, +{"ideafarm-panic", {NULL}, 903, "udp"}, +{"kink", {NULL}, 910, "tcp"}, +{"kink", {NULL}, 910, "udp"}, +{"xact-backup", {NULL}, 911, "tcp"}, +{"xact-backup", {NULL}, 911, "udp"}, +{"apex-mesh", {NULL}, 912, "tcp"}, +{"apex-mesh", {NULL}, 912, "udp"}, +{"apex-edge", {NULL}, 913, "tcp"}, +{"apex-edge", {NULL}, 913, "udp"}, +{"ftps-data", {NULL}, 989, "tcp"}, +{"ftps-data", {NULL}, 989, "udp"}, +{"ftps", {NULL}, 990, "tcp"}, +{"ftps", {NULL}, 990, "udp"}, +{"nas", {NULL}, 991, "tcp"}, +{"nas", {NULL}, 991, "udp"}, +{"telnets", {NULL}, 992, "tcp"}, +{"telnets", {NULL}, 992, "udp"}, +{"imaps", {NULL}, 993, "tcp"}, +{"imaps", {NULL}, 993, "udp"}, +{"ircs", {NULL}, 994, "tcp"}, +{"ircs", {NULL}, 994, "udp"}, +{"pop3s", {NULL}, 995, "tcp"}, +{"pop3s", {NULL}, 995, "udp"}, +{"vsinet", {NULL}, 996, "tcp"}, +{"vsinet", {NULL}, 996, "udp"}, +{"maitrd", {NULL}, 997, "tcp"}, +{"maitrd", {NULL}, 997, "udp"}, +{"busboy", {NULL}, 998, "tcp"}, +{"puparp", {NULL}, 998, "udp"}, +{"garcon", {NULL}, 999, "tcp"}, +{"applix", {NULL}, 999, "udp"}, +{"puprouter", {NULL}, 999, "tcp"}, +{"puprouter", {NULL}, 999, "udp"}, +{"cadlock2", {NULL}, 1000, "tcp"}, +{"cadlock2", {NULL}, 1000, "udp"}, +{"surf", {NULL}, 1010, "tcp"}, +{"surf", {NULL}, 1010, "udp"}, +{"exp1", {NULL}, 1021, "tcp"}, +{"exp1", {NULL}, 1021, "udp"}, +{"exp2", {NULL}, 1022, "tcp"}, +{"exp2", {NULL}, 1022, "udp"}, +#endif /* USE_IANA_WELL_KNOWN_PORTS */ +#ifdef USE_IANA_REGISTERED_PORTS +{"blackjack", {NULL}, 1025, "tcp"}, +{"blackjack", {NULL}, 1025, "udp"}, +{"cap", {NULL}, 1026, "tcp"}, +{"cap", {NULL}, 1026, "udp"}, +{"solid-mux", {NULL}, 1029, "tcp"}, +{"solid-mux", {NULL}, 1029, "udp"}, +{"iad1", {NULL}, 1030, "tcp"}, +{"iad1", {NULL}, 1030, "udp"}, +{"iad2", {NULL}, 1031, "tcp"}, +{"iad2", {NULL}, 1031, "udp"}, +{"iad3", {NULL}, 1032, "tcp"}, +{"iad3", {NULL}, 1032, "udp"}, +{"netinfo-local", {NULL}, 1033, "tcp"}, +{"netinfo-local", {NULL}, 1033, "udp"}, +{"activesync", {NULL}, 1034, "tcp"}, +{"activesync", {NULL}, 1034, "udp"}, +{"mxxrlogin", {NULL}, 1035, "tcp"}, +{"mxxrlogin", {NULL}, 1035, "udp"}, +{"nsstp", {NULL}, 1036, "tcp"}, +{"nsstp", {NULL}, 1036, "udp"}, +{"ams", {NULL}, 1037, "tcp"}, +{"ams", {NULL}, 1037, "udp"}, +{"mtqp", {NULL}, 1038, "tcp"}, +{"mtqp", {NULL}, 1038, "udp"}, +{"sbl", {NULL}, 1039, "tcp"}, +{"sbl", {NULL}, 1039, "udp"}, +{"netarx", {NULL}, 1040, "tcp"}, +{"netarx", {NULL}, 1040, "udp"}, +{"danf-ak2", {NULL}, 1041, "tcp"}, +{"danf-ak2", {NULL}, 1041, "udp"}, +{"afrog", {NULL}, 1042, "tcp"}, +{"afrog", {NULL}, 1042, "udp"}, +{"boinc-client", {NULL}, 1043, "tcp"}, +{"boinc-client", {NULL}, 1043, "udp"}, +{"dcutility", {NULL}, 1044, "tcp"}, +{"dcutility", {NULL}, 1044, "udp"}, +{"fpitp", {NULL}, 1045, "tcp"}, +{"fpitp", {NULL}, 1045, "udp"}, +{"wfremotertm", {NULL}, 1046, "tcp"}, +{"wfremotertm", {NULL}, 1046, "udp"}, +{"neod1", {NULL}, 1047, "tcp"}, +{"neod1", {NULL}, 1047, "udp"}, +{"neod2", {NULL}, 1048, "tcp"}, +{"neod2", {NULL}, 1048, "udp"}, +{"td-postman", {NULL}, 1049, "tcp"}, +{"td-postman", {NULL}, 1049, "udp"}, +{"cma", {NULL}, 1050, "tcp"}, +{"cma", {NULL}, 1050, "udp"}, +{"optima-vnet", {NULL}, 1051, "tcp"}, +{"optima-vnet", {NULL}, 1051, "udp"}, +{"ddt", {NULL}, 1052, "tcp"}, +{"ddt", {NULL}, 1052, "udp"}, +{"remote-as", {NULL}, 1053, "tcp"}, +{"remote-as", {NULL}, 1053, "udp"}, +{"brvread", {NULL}, 1054, "tcp"}, +{"brvread", {NULL}, 1054, "udp"}, +{"ansyslmd", {NULL}, 1055, "tcp"}, +{"ansyslmd", {NULL}, 1055, "udp"}, +{"vfo", {NULL}, 1056, "tcp"}, +{"vfo", {NULL}, 1056, "udp"}, +{"startron", {NULL}, 1057, "tcp"}, +{"startron", {NULL}, 1057, "udp"}, +{"nim", {NULL}, 1058, "tcp"}, +{"nim", {NULL}, 1058, "udp"}, +{"nimreg", {NULL}, 1059, "tcp"}, +{"nimreg", {NULL}, 1059, "udp"}, +{"polestar", {NULL}, 1060, "tcp"}, +{"polestar", {NULL}, 1060, "udp"}, +{"kiosk", {NULL}, 1061, "tcp"}, +{"kiosk", {NULL}, 1061, "udp"}, +{"veracity", {NULL}, 1062, "tcp"}, +{"veracity", {NULL}, 1062, "udp"}, +{"kyoceranetdev", {NULL}, 1063, "tcp"}, +{"kyoceranetdev", {NULL}, 1063, "udp"}, +{"jstel", {NULL}, 1064, "tcp"}, +{"jstel", {NULL}, 1064, "udp"}, +{"syscomlan", {NULL}, 1065, "tcp"}, +{"syscomlan", {NULL}, 1065, "udp"}, +{"fpo-fns", {NULL}, 1066, "tcp"}, +{"fpo-fns", {NULL}, 1066, "udp"}, +{"instl_boots", {NULL}, 1067, "tcp"}, +{"instl_boots", {NULL}, 1067, "udp"}, +{"instl_bootc", {NULL}, 1068, "tcp"}, +{"instl_bootc", {NULL}, 1068, "udp"}, +{"cognex-insight", {NULL}, 1069, "tcp"}, +{"cognex-insight", {NULL}, 1069, "udp"}, +{"gmrupdateserv", {NULL}, 1070, "tcp"}, +{"gmrupdateserv", {NULL}, 1070, "udp"}, +{"bsquare-voip", {NULL}, 1071, "tcp"}, +{"bsquare-voip", {NULL}, 1071, "udp"}, +{"cardax", {NULL}, 1072, "tcp"}, +{"cardax", {NULL}, 1072, "udp"}, +{"bridgecontrol", {NULL}, 1073, "tcp"}, +{"bridgecontrol", {NULL}, 1073, "udp"}, +{"warmspotMgmt", {NULL}, 1074, "tcp"}, +{"warmspotMgmt", {NULL}, 1074, "udp"}, +{"rdrmshc", {NULL}, 1075, "tcp"}, +{"rdrmshc", {NULL}, 1075, "udp"}, +{"dab-sti-c", {NULL}, 1076, "tcp"}, +{"dab-sti-c", {NULL}, 1076, "udp"}, +{"imgames", {NULL}, 1077, "tcp"}, +{"imgames", {NULL}, 1077, "udp"}, +{"avocent-proxy", {NULL}, 1078, "tcp"}, +{"avocent-proxy", {NULL}, 1078, "udp"}, +{"asprovatalk", {NULL}, 1079, "tcp"}, +{"asprovatalk", {NULL}, 1079, "udp"}, +{"socks", {NULL}, 1080, "tcp"}, +{"socks", {NULL}, 1080, "udp"}, +{"pvuniwien", {NULL}, 1081, "tcp"}, +{"pvuniwien", {NULL}, 1081, "udp"}, +{"amt-esd-prot", {NULL}, 1082, "tcp"}, +{"amt-esd-prot", {NULL}, 1082, "udp"}, +{"ansoft-lm-1", {NULL}, 1083, "tcp"}, +{"ansoft-lm-1", {NULL}, 1083, "udp"}, +{"ansoft-lm-2", {NULL}, 1084, "tcp"}, +{"ansoft-lm-2", {NULL}, 1084, "udp"}, +{"webobjects", {NULL}, 1085, "tcp"}, +{"webobjects", {NULL}, 1085, "udp"}, +{"cplscrambler-lg", {NULL}, 1086, "tcp"}, +{"cplscrambler-lg", {NULL}, 1086, "udp"}, +{"cplscrambler-in", {NULL}, 1087, "tcp"}, +{"cplscrambler-in", {NULL}, 1087, "udp"}, +{"cplscrambler-al", {NULL}, 1088, "tcp"}, +{"cplscrambler-al", {NULL}, 1088, "udp"}, +{"ff-annunc", {NULL}, 1089, "tcp"}, +{"ff-annunc", {NULL}, 1089, "udp"}, +{"ff-fms", {NULL}, 1090, "tcp"}, +{"ff-fms", {NULL}, 1090, "udp"}, +{"ff-sm", {NULL}, 1091, "tcp"}, +{"ff-sm", {NULL}, 1091, "udp"}, +{"obrpd", {NULL}, 1092, "tcp"}, +{"obrpd", {NULL}, 1092, "udp"}, +{"proofd", {NULL}, 1093, "tcp"}, +{"proofd", {NULL}, 1093, "udp"}, +{"rootd", {NULL}, 1094, "tcp"}, +{"rootd", {NULL}, 1094, "udp"}, +{"nicelink", {NULL}, 1095, "tcp"}, +{"nicelink", {NULL}, 1095, "udp"}, +{"cnrprotocol", {NULL}, 1096, "tcp"}, +{"cnrprotocol", {NULL}, 1096, "udp"}, +{"sunclustermgr", {NULL}, 1097, "tcp"}, +{"sunclustermgr", {NULL}, 1097, "udp"}, +{"rmiactivation", {NULL}, 1098, "tcp"}, +{"rmiactivation", {NULL}, 1098, "udp"}, +{"rmiregistry", {NULL}, 1099, "tcp"}, +{"rmiregistry", {NULL}, 1099, "udp"}, +{"mctp", {NULL}, 1100, "tcp"}, +{"mctp", {NULL}, 1100, "udp"}, +{"pt2-discover", {NULL}, 1101, "tcp"}, +{"pt2-discover", {NULL}, 1101, "udp"}, +{"adobeserver-1", {NULL}, 1102, "tcp"}, +{"adobeserver-1", {NULL}, 1102, "udp"}, +{"adobeserver-2", {NULL}, 1103, "tcp"}, +{"adobeserver-2", {NULL}, 1103, "udp"}, +{"xrl", {NULL}, 1104, "tcp"}, +{"xrl", {NULL}, 1104, "udp"}, +{"ftranhc", {NULL}, 1105, "tcp"}, +{"ftranhc", {NULL}, 1105, "udp"}, +{"isoipsigport-1", {NULL}, 1106, "tcp"}, +{"isoipsigport-1", {NULL}, 1106, "udp"}, +{"isoipsigport-2", {NULL}, 1107, "tcp"}, +{"isoipsigport-2", {NULL}, 1107, "udp"}, +{"ratio-adp", {NULL}, 1108, "tcp"}, +{"ratio-adp", {NULL}, 1108, "udp"}, +{"webadmstart", {NULL}, 1110, "tcp"}, +{"nfsd-keepalive", {NULL}, 1110, "udp"}, +{"lmsocialserver", {NULL}, 1111, "tcp"}, +{"lmsocialserver", {NULL}, 1111, "udp"}, +{"icp", {NULL}, 1112, "tcp"}, +{"icp", {NULL}, 1112, "udp"}, +{"ltp-deepspace", {NULL}, 1113, "tcp"}, +{"ltp-deepspace", {NULL}, 1113, "udp"}, +{"mini-sql", {NULL}, 1114, "tcp"}, +{"mini-sql", {NULL}, 1114, "udp"}, +{"ardus-trns", {NULL}, 1115, "tcp"}, +{"ardus-trns", {NULL}, 1115, "udp"}, +{"ardus-cntl", {NULL}, 1116, "tcp"}, +{"ardus-cntl", {NULL}, 1116, "udp"}, +{"ardus-mtrns", {NULL}, 1117, "tcp"}, +{"ardus-mtrns", {NULL}, 1117, "udp"}, +{"sacred", {NULL}, 1118, "tcp"}, +{"sacred", {NULL}, 1118, "udp"}, +{"bnetgame", {NULL}, 1119, "tcp"}, +{"bnetgame", {NULL}, 1119, "udp"}, +{"bnetfile", {NULL}, 1120, "tcp"}, +{"bnetfile", {NULL}, 1120, "udp"}, +{"rmpp", {NULL}, 1121, "tcp"}, +{"rmpp", {NULL}, 1121, "udp"}, +{"availant-mgr", {NULL}, 1122, "tcp"}, +{"availant-mgr", {NULL}, 1122, "udp"}, +{"murray", {NULL}, 1123, "tcp"}, +{"murray", {NULL}, 1123, "udp"}, +{"hpvmmcontrol", {NULL}, 1124, "tcp"}, +{"hpvmmcontrol", {NULL}, 1124, "udp"}, +{"hpvmmagent", {NULL}, 1125, "tcp"}, +{"hpvmmagent", {NULL}, 1125, "udp"}, +{"hpvmmdata", {NULL}, 1126, "tcp"}, +{"hpvmmdata", {NULL}, 1126, "udp"}, +{"kwdb-commn", {NULL}, 1127, "tcp"}, +{"kwdb-commn", {NULL}, 1127, "udp"}, +{"saphostctrl", {NULL}, 1128, "tcp"}, +{"saphostctrl", {NULL}, 1128, "udp"}, +{"saphostctrls", {NULL}, 1129, "tcp"}, +{"saphostctrls", {NULL}, 1129, "udp"}, +{"casp", {NULL}, 1130, "tcp"}, +{"casp", {NULL}, 1130, "udp"}, +{"caspssl", {NULL}, 1131, "tcp"}, +{"caspssl", {NULL}, 1131, "udp"}, +{"kvm-via-ip", {NULL}, 1132, "tcp"}, +{"kvm-via-ip", {NULL}, 1132, "udp"}, +{"dfn", {NULL}, 1133, "tcp"}, +{"dfn", {NULL}, 1133, "udp"}, +{"aplx", {NULL}, 1134, "tcp"}, +{"aplx", {NULL}, 1134, "udp"}, +{"omnivision", {NULL}, 1135, "tcp"}, +{"omnivision", {NULL}, 1135, "udp"}, +{"hhb-gateway", {NULL}, 1136, "tcp"}, +{"hhb-gateway", {NULL}, 1136, "udp"}, +{"trim", {NULL}, 1137, "tcp"}, +{"trim", {NULL}, 1137, "udp"}, +{"encrypted_admin", {NULL}, 1138, "tcp"}, +{"encrypted_admin", {NULL}, 1138, "udp"}, +{"evm", {NULL}, 1139, "tcp"}, +{"evm", {NULL}, 1139, "udp"}, +{"autonoc", {NULL}, 1140, "tcp"}, +{"autonoc", {NULL}, 1140, "udp"}, +{"mxomss", {NULL}, 1141, "tcp"}, +{"mxomss", {NULL}, 1141, "udp"}, +{"edtools", {NULL}, 1142, "tcp"}, +{"edtools", {NULL}, 1142, "udp"}, +{"imyx", {NULL}, 1143, "tcp"}, +{"imyx", {NULL}, 1143, "udp"}, +{"fuscript", {NULL}, 1144, "tcp"}, +{"fuscript", {NULL}, 1144, "udp"}, +{"x9-icue", {NULL}, 1145, "tcp"}, +{"x9-icue", {NULL}, 1145, "udp"}, +{"audit-transfer", {NULL}, 1146, "tcp"}, +{"audit-transfer", {NULL}, 1146, "udp"}, +{"capioverlan", {NULL}, 1147, "tcp"}, +{"capioverlan", {NULL}, 1147, "udp"}, +{"elfiq-repl", {NULL}, 1148, "tcp"}, +{"elfiq-repl", {NULL}, 1148, "udp"}, +{"bvtsonar", {NULL}, 1149, "tcp"}, +{"bvtsonar", {NULL}, 1149, "udp"}, +{"blaze", {NULL}, 1150, "tcp"}, +{"blaze", {NULL}, 1150, "udp"}, +{"unizensus", {NULL}, 1151, "tcp"}, +{"unizensus", {NULL}, 1151, "udp"}, +{"winpoplanmess", {NULL}, 1152, "tcp"}, +{"winpoplanmess", {NULL}, 1152, "udp"}, +{"c1222-acse", {NULL}, 1153, "tcp"}, +{"c1222-acse", {NULL}, 1153, "udp"}, +{"resacommunity", {NULL}, 1154, "tcp"}, +{"resacommunity", {NULL}, 1154, "udp"}, +{"nfa", {NULL}, 1155, "tcp"}, +{"nfa", {NULL}, 1155, "udp"}, +{"iascontrol-oms", {NULL}, 1156, "tcp"}, +{"iascontrol-oms", {NULL}, 1156, "udp"}, +{"iascontrol", {NULL}, 1157, "tcp"}, +{"iascontrol", {NULL}, 1157, "udp"}, +{"dbcontrol-oms", {NULL}, 1158, "tcp"}, +{"dbcontrol-oms", {NULL}, 1158, "udp"}, +{"oracle-oms", {NULL}, 1159, "tcp"}, +{"oracle-oms", {NULL}, 1159, "udp"}, +{"olsv", {NULL}, 1160, "tcp"}, +{"olsv", {NULL}, 1160, "udp"}, +{"health-polling", {NULL}, 1161, "tcp"}, +{"health-polling", {NULL}, 1161, "udp"}, +{"health-trap", {NULL}, 1162, "tcp"}, +{"health-trap", {NULL}, 1162, "udp"}, +{"sddp", {NULL}, 1163, "tcp"}, +{"sddp", {NULL}, 1163, "udp"}, +{"qsm-proxy", {NULL}, 1164, "tcp"}, +{"qsm-proxy", {NULL}, 1164, "udp"}, +{"qsm-gui", {NULL}, 1165, "tcp"}, +{"qsm-gui", {NULL}, 1165, "udp"}, +{"qsm-remote", {NULL}, 1166, "tcp"}, +{"qsm-remote", {NULL}, 1166, "udp"}, +{"cisco-ipsla", {NULL}, 1167, "tcp"}, +{"cisco-ipsla", {NULL}, 1167, "udp"}, +{"cisco-ipsla", {NULL}, 1167, "sctp"}, +{"vchat", {NULL}, 1168, "tcp"}, +{"vchat", {NULL}, 1168, "udp"}, +{"tripwire", {NULL}, 1169, "tcp"}, +{"tripwire", {NULL}, 1169, "udp"}, +{"atc-lm", {NULL}, 1170, "tcp"}, +{"atc-lm", {NULL}, 1170, "udp"}, +{"atc-appserver", {NULL}, 1171, "tcp"}, +{"atc-appserver", {NULL}, 1171, "udp"}, +{"dnap", {NULL}, 1172, "tcp"}, +{"dnap", {NULL}, 1172, "udp"}, +{"d-cinema-rrp", {NULL}, 1173, "tcp"}, +{"d-cinema-rrp", {NULL}, 1173, "udp"}, +{"fnet-remote-ui", {NULL}, 1174, "tcp"}, +{"fnet-remote-ui", {NULL}, 1174, "udp"}, +{"dossier", {NULL}, 1175, "tcp"}, +{"dossier", {NULL}, 1175, "udp"}, +{"indigo-server", {NULL}, 1176, "tcp"}, +{"indigo-server", {NULL}, 1176, "udp"}, +{"dkmessenger", {NULL}, 1177, "tcp"}, +{"dkmessenger", {NULL}, 1177, "udp"}, +{"sgi-storman", {NULL}, 1178, "tcp"}, +{"sgi-storman", {NULL}, 1178, "udp"}, +{"b2n", {NULL}, 1179, "tcp"}, +{"b2n", {NULL}, 1179, "udp"}, +{"mc-client", {NULL}, 1180, "tcp"}, +{"mc-client", {NULL}, 1180, "udp"}, +{"3comnetman", {NULL}, 1181, "tcp"}, +{"3comnetman", {NULL}, 1181, "udp"}, +{"accelenet", {NULL}, 1182, "tcp"}, +{"accelenet-data", {NULL}, 1182, "udp"}, +{"llsurfup-http", {NULL}, 1183, "tcp"}, +{"llsurfup-http", {NULL}, 1183, "udp"}, +{"llsurfup-https", {NULL}, 1184, "tcp"}, +{"llsurfup-https", {NULL}, 1184, "udp"}, +{"catchpole", {NULL}, 1185, "tcp"}, +{"catchpole", {NULL}, 1185, "udp"}, +{"mysql-cluster", {NULL}, 1186, "tcp"}, +{"mysql-cluster", {NULL}, 1186, "udp"}, +{"alias", {NULL}, 1187, "tcp"}, +{"alias", {NULL}, 1187, "udp"}, +{"hp-webadmin", {NULL}, 1188, "tcp"}, +{"hp-webadmin", {NULL}, 1188, "udp"}, +{"unet", {NULL}, 1189, "tcp"}, +{"unet", {NULL}, 1189, "udp"}, +{"commlinx-avl", {NULL}, 1190, "tcp"}, +{"commlinx-avl", {NULL}, 1190, "udp"}, +{"gpfs", {NULL}, 1191, "tcp"}, +{"gpfs", {NULL}, 1191, "udp"}, +{"caids-sensor", {NULL}, 1192, "tcp"}, +{"caids-sensor", {NULL}, 1192, "udp"}, +{"fiveacross", {NULL}, 1193, "tcp"}, +{"fiveacross", {NULL}, 1193, "udp"}, +{"openvpn", {NULL}, 1194, "tcp"}, +{"openvpn", {NULL}, 1194, "udp"}, +{"rsf-1", {NULL}, 1195, "tcp"}, +{"rsf-1", {NULL}, 1195, "udp"}, +{"netmagic", {NULL}, 1196, "tcp"}, +{"netmagic", {NULL}, 1196, "udp"}, +{"carrius-rshell", {NULL}, 1197, "tcp"}, +{"carrius-rshell", {NULL}, 1197, "udp"}, +{"cajo-discovery", {NULL}, 1198, "tcp"}, +{"cajo-discovery", {NULL}, 1198, "udp"}, +{"dmidi", {NULL}, 1199, "tcp"}, +{"dmidi", {NULL}, 1199, "udp"}, +{"scol", {NULL}, 1200, "tcp"}, +{"scol", {NULL}, 1200, "udp"}, +{"nucleus-sand", {NULL}, 1201, "tcp"}, +{"nucleus-sand", {NULL}, 1201, "udp"}, +{"caiccipc", {NULL}, 1202, "tcp"}, +{"caiccipc", {NULL}, 1202, "udp"}, +{"ssslic-mgr", {NULL}, 1203, "tcp"}, +{"ssslic-mgr", {NULL}, 1203, "udp"}, +{"ssslog-mgr", {NULL}, 1204, "tcp"}, +{"ssslog-mgr", {NULL}, 1204, "udp"}, +{"accord-mgc", {NULL}, 1205, "tcp"}, +{"accord-mgc", {NULL}, 1205, "udp"}, +{"anthony-data", {NULL}, 1206, "tcp"}, +{"anthony-data", {NULL}, 1206, "udp"}, +{"metasage", {NULL}, 1207, "tcp"}, +{"metasage", {NULL}, 1207, "udp"}, +{"seagull-ais", {NULL}, 1208, "tcp"}, +{"seagull-ais", {NULL}, 1208, "udp"}, +{"ipcd3", {NULL}, 1209, "tcp"}, +{"ipcd3", {NULL}, 1209, "udp"}, +{"eoss", {NULL}, 1210, "tcp"}, +{"eoss", {NULL}, 1210, "udp"}, +{"groove-dpp", {NULL}, 1211, "tcp"}, +{"groove-dpp", {NULL}, 1211, "udp"}, +{"lupa", {NULL}, 1212, "tcp"}, +{"lupa", {NULL}, 1212, "udp"}, +{"mpc-lifenet", {NULL}, 1213, "tcp"}, +{"mpc-lifenet", {NULL}, 1213, "udp"}, +{"kazaa", {NULL}, 1214, "tcp"}, +{"kazaa", {NULL}, 1214, "udp"}, +{"scanstat-1", {NULL}, 1215, "tcp"}, +{"scanstat-1", {NULL}, 1215, "udp"}, +{"etebac5", {NULL}, 1216, "tcp"}, +{"etebac5", {NULL}, 1216, "udp"}, +{"hpss-ndapi", {NULL}, 1217, "tcp"}, +{"hpss-ndapi", {NULL}, 1217, "udp"}, +{"aeroflight-ads", {NULL}, 1218, "tcp"}, +{"aeroflight-ads", {NULL}, 1218, "udp"}, +{"aeroflight-ret", {NULL}, 1219, "tcp"}, +{"aeroflight-ret", {NULL}, 1219, "udp"}, +{"qt-serveradmin", {NULL}, 1220, "tcp"}, +{"qt-serveradmin", {NULL}, 1220, "udp"}, +{"sweetware-apps", {NULL}, 1221, "tcp"}, +{"sweetware-apps", {NULL}, 1221, "udp"}, +{"nerv", {NULL}, 1222, "tcp"}, +{"nerv", {NULL}, 1222, "udp"}, +{"tgp", {NULL}, 1223, "tcp"}, +{"tgp", {NULL}, 1223, "udp"}, +{"vpnz", {NULL}, 1224, "tcp"}, +{"vpnz", {NULL}, 1224, "udp"}, +{"slinkysearch", {NULL}, 1225, "tcp"}, +{"slinkysearch", {NULL}, 1225, "udp"}, +{"stgxfws", {NULL}, 1226, "tcp"}, +{"stgxfws", {NULL}, 1226, "udp"}, +{"dns2go", {NULL}, 1227, "tcp"}, +{"dns2go", {NULL}, 1227, "udp"}, +{"florence", {NULL}, 1228, "tcp"}, +{"florence", {NULL}, 1228, "udp"}, +{"zented", {NULL}, 1229, "tcp"}, +{"zented", {NULL}, 1229, "udp"}, +{"periscope", {NULL}, 1230, "tcp"}, +{"periscope", {NULL}, 1230, "udp"}, +{"menandmice-lpm", {NULL}, 1231, "tcp"}, +{"menandmice-lpm", {NULL}, 1231, "udp"}, +{"univ-appserver", {NULL}, 1233, "tcp"}, +{"univ-appserver", {NULL}, 1233, "udp"}, +{"search-agent", {NULL}, 1234, "tcp"}, +{"search-agent", {NULL}, 1234, "udp"}, +{"mosaicsyssvc1", {NULL}, 1235, "tcp"}, +{"mosaicsyssvc1", {NULL}, 1235, "udp"}, +{"bvcontrol", {NULL}, 1236, "tcp"}, +{"bvcontrol", {NULL}, 1236, "udp"}, +{"tsdos390", {NULL}, 1237, "tcp"}, +{"tsdos390", {NULL}, 1237, "udp"}, +{"hacl-qs", {NULL}, 1238, "tcp"}, +{"hacl-qs", {NULL}, 1238, "udp"}, +{"nmsd", {NULL}, 1239, "tcp"}, +{"nmsd", {NULL}, 1239, "udp"}, +{"instantia", {NULL}, 1240, "tcp"}, +{"instantia", {NULL}, 1240, "udp"}, +{"nessus", {NULL}, 1241, "tcp"}, +{"nessus", {NULL}, 1241, "udp"}, +{"nmasoverip", {NULL}, 1242, "tcp"}, +{"nmasoverip", {NULL}, 1242, "udp"}, +{"serialgateway", {NULL}, 1243, "tcp"}, +{"serialgateway", {NULL}, 1243, "udp"}, +{"isbconference1", {NULL}, 1244, "tcp"}, +{"isbconference1", {NULL}, 1244, "udp"}, +{"isbconference2", {NULL}, 1245, "tcp"}, +{"isbconference2", {NULL}, 1245, "udp"}, +{"payrouter", {NULL}, 1246, "tcp"}, +{"payrouter", {NULL}, 1246, "udp"}, +{"visionpyramid", {NULL}, 1247, "tcp"}, +{"visionpyramid", {NULL}, 1247, "udp"}, +{"hermes", {NULL}, 1248, "tcp"}, +{"hermes", {NULL}, 1248, "udp"}, +{"mesavistaco", {NULL}, 1249, "tcp"}, +{"mesavistaco", {NULL}, 1249, "udp"}, +{"swldy-sias", {NULL}, 1250, "tcp"}, +{"swldy-sias", {NULL}, 1250, "udp"}, +{"servergraph", {NULL}, 1251, "tcp"}, +{"servergraph", {NULL}, 1251, "udp"}, +{"bspne-pcc", {NULL}, 1252, "tcp"}, +{"bspne-pcc", {NULL}, 1252, "udp"}, +{"q55-pcc", {NULL}, 1253, "tcp"}, +{"q55-pcc", {NULL}, 1253, "udp"}, +{"de-noc", {NULL}, 1254, "tcp"}, +{"de-noc", {NULL}, 1254, "udp"}, +{"de-cache-query", {NULL}, 1255, "tcp"}, +{"de-cache-query", {NULL}, 1255, "udp"}, +{"de-server", {NULL}, 1256, "tcp"}, +{"de-server", {NULL}, 1256, "udp"}, +{"shockwave2", {NULL}, 1257, "tcp"}, +{"shockwave2", {NULL}, 1257, "udp"}, +{"opennl", {NULL}, 1258, "tcp"}, +{"opennl", {NULL}, 1258, "udp"}, +{"opennl-voice", {NULL}, 1259, "tcp"}, +{"opennl-voice", {NULL}, 1259, "udp"}, +{"ibm-ssd", {NULL}, 1260, "tcp"}, +{"ibm-ssd", {NULL}, 1260, "udp"}, +{"mpshrsv", {NULL}, 1261, "tcp"}, +{"mpshrsv", {NULL}, 1261, "udp"}, +{"qnts-orb", {NULL}, 1262, "tcp"}, +{"qnts-orb", {NULL}, 1262, "udp"}, +{"dka", {NULL}, 1263, "tcp"}, +{"dka", {NULL}, 1263, "udp"}, +{"prat", {NULL}, 1264, "tcp"}, +{"prat", {NULL}, 1264, "udp"}, +{"dssiapi", {NULL}, 1265, "tcp"}, +{"dssiapi", {NULL}, 1265, "udp"}, +{"dellpwrappks", {NULL}, 1266, "tcp"}, +{"dellpwrappks", {NULL}, 1266, "udp"}, +{"epc", {NULL}, 1267, "tcp"}, +{"epc", {NULL}, 1267, "udp"}, +{"propel-msgsys", {NULL}, 1268, "tcp"}, +{"propel-msgsys", {NULL}, 1268, "udp"}, +{"watilapp", {NULL}, 1269, "tcp"}, +{"watilapp", {NULL}, 1269, "udp"}, +{"opsmgr", {NULL}, 1270, "tcp"}, +{"opsmgr", {NULL}, 1270, "udp"}, +{"excw", {NULL}, 1271, "tcp"}, +{"excw", {NULL}, 1271, "udp"}, +{"cspmlockmgr", {NULL}, 1272, "tcp"}, +{"cspmlockmgr", {NULL}, 1272, "udp"}, +{"emc-gateway", {NULL}, 1273, "tcp"}, +{"emc-gateway", {NULL}, 1273, "udp"}, +{"t1distproc", {NULL}, 1274, "tcp"}, +{"t1distproc", {NULL}, 1274, "udp"}, +{"ivcollector", {NULL}, 1275, "tcp"}, +{"ivcollector", {NULL}, 1275, "udp"}, +{"ivmanager", {NULL}, 1276, "tcp"}, +{"ivmanager", {NULL}, 1276, "udp"}, +{"miva-mqs", {NULL}, 1277, "tcp"}, +{"miva-mqs", {NULL}, 1277, "udp"}, +{"dellwebadmin-1", {NULL}, 1278, "tcp"}, +{"dellwebadmin-1", {NULL}, 1278, "udp"}, +{"dellwebadmin-2", {NULL}, 1279, "tcp"}, +{"dellwebadmin-2", {NULL}, 1279, "udp"}, +{"pictrography", {NULL}, 1280, "tcp"}, +{"pictrography", {NULL}, 1280, "udp"}, +{"healthd", {NULL}, 1281, "tcp"}, +{"healthd", {NULL}, 1281, "udp"}, +{"emperion", {NULL}, 1282, "tcp"}, +{"emperion", {NULL}, 1282, "udp"}, +{"productinfo", {NULL}, 1283, "tcp"}, +{"productinfo", {NULL}, 1283, "udp"}, +{"iee-qfx", {NULL}, 1284, "tcp"}, +{"iee-qfx", {NULL}, 1284, "udp"}, +{"neoiface", {NULL}, 1285, "tcp"}, +{"neoiface", {NULL}, 1285, "udp"}, +{"netuitive", {NULL}, 1286, "tcp"}, +{"netuitive", {NULL}, 1286, "udp"}, +{"routematch", {NULL}, 1287, "tcp"}, +{"routematch", {NULL}, 1287, "udp"}, +{"navbuddy", {NULL}, 1288, "tcp"}, +{"navbuddy", {NULL}, 1288, "udp"}, +{"jwalkserver", {NULL}, 1289, "tcp"}, +{"jwalkserver", {NULL}, 1289, "udp"}, +{"winjaserver", {NULL}, 1290, "tcp"}, +{"winjaserver", {NULL}, 1290, "udp"}, +{"seagulllms", {NULL}, 1291, "tcp"}, +{"seagulllms", {NULL}, 1291, "udp"}, +{"dsdn", {NULL}, 1292, "tcp"}, +{"dsdn", {NULL}, 1292, "udp"}, +{"pkt-krb-ipsec", {NULL}, 1293, "tcp"}, +{"pkt-krb-ipsec", {NULL}, 1293, "udp"}, +{"cmmdriver", {NULL}, 1294, "tcp"}, +{"cmmdriver", {NULL}, 1294, "udp"}, +{"ehtp", {NULL}, 1295, "tcp"}, +{"ehtp", {NULL}, 1295, "udp"}, +{"dproxy", {NULL}, 1296, "tcp"}, +{"dproxy", {NULL}, 1296, "udp"}, +{"sdproxy", {NULL}, 1297, "tcp"}, +{"sdproxy", {NULL}, 1297, "udp"}, +{"lpcp", {NULL}, 1298, "tcp"}, +{"lpcp", {NULL}, 1298, "udp"}, +{"hp-sci", {NULL}, 1299, "tcp"}, +{"hp-sci", {NULL}, 1299, "udp"}, +{"h323hostcallsc", {NULL}, 1300, "tcp"}, +{"h323hostcallsc", {NULL}, 1300, "udp"}, +{"ci3-software-1", {NULL}, 1301, "tcp"}, +{"ci3-software-1", {NULL}, 1301, "udp"}, +{"ci3-software-2", {NULL}, 1302, "tcp"}, +{"ci3-software-2", {NULL}, 1302, "udp"}, +{"sftsrv", {NULL}, 1303, "tcp"}, +{"sftsrv", {NULL}, 1303, "udp"}, +{"boomerang", {NULL}, 1304, "tcp"}, +{"boomerang", {NULL}, 1304, "udp"}, +{"pe-mike", {NULL}, 1305, "tcp"}, +{"pe-mike", {NULL}, 1305, "udp"}, +{"re-conn-proto", {NULL}, 1306, "tcp"}, +{"re-conn-proto", {NULL}, 1306, "udp"}, +{"pacmand", {NULL}, 1307, "tcp"}, +{"pacmand", {NULL}, 1307, "udp"}, +{"odsi", {NULL}, 1308, "tcp"}, +{"odsi", {NULL}, 1308, "udp"}, +{"jtag-server", {NULL}, 1309, "tcp"}, +{"jtag-server", {NULL}, 1309, "udp"}, +{"husky", {NULL}, 1310, "tcp"}, +{"husky", {NULL}, 1310, "udp"}, +{"rxmon", {NULL}, 1311, "tcp"}, +{"rxmon", {NULL}, 1311, "udp"}, +{"sti-envision", {NULL}, 1312, "tcp"}, +{"sti-envision", {NULL}, 1312, "udp"}, +{"bmc_patroldb", {NULL}, 1313, "tcp"}, +{"bmc_patroldb", {NULL}, 1313, "udp"}, +{"pdps", {NULL}, 1314, "tcp"}, +{"pdps", {NULL}, 1314, "udp"}, +{"els", {NULL}, 1315, "tcp"}, +{"els", {NULL}, 1315, "udp"}, +{"exbit-escp", {NULL}, 1316, "tcp"}, +{"exbit-escp", {NULL}, 1316, "udp"}, +{"vrts-ipcserver", {NULL}, 1317, "tcp"}, +{"vrts-ipcserver", {NULL}, 1317, "udp"}, +{"krb5gatekeeper", {NULL}, 1318, "tcp"}, +{"krb5gatekeeper", {NULL}, 1318, "udp"}, +{"amx-icsp", {NULL}, 1319, "tcp"}, +{"amx-icsp", {NULL}, 1319, "udp"}, +{"amx-axbnet", {NULL}, 1320, "tcp"}, +{"amx-axbnet", {NULL}, 1320, "udp"}, +{"pip", {NULL}, 1321, "tcp"}, +{"pip", {NULL}, 1321, "udp"}, +{"novation", {NULL}, 1322, "tcp"}, +{"novation", {NULL}, 1322, "udp"}, +{"brcd", {NULL}, 1323, "tcp"}, +{"brcd", {NULL}, 1323, "udp"}, +{"delta-mcp", {NULL}, 1324, "tcp"}, +{"delta-mcp", {NULL}, 1324, "udp"}, +{"dx-instrument", {NULL}, 1325, "tcp"}, +{"dx-instrument", {NULL}, 1325, "udp"}, +{"wimsic", {NULL}, 1326, "tcp"}, +{"wimsic", {NULL}, 1326, "udp"}, +{"ultrex", {NULL}, 1327, "tcp"}, +{"ultrex", {NULL}, 1327, "udp"}, +{"ewall", {NULL}, 1328, "tcp"}, +{"ewall", {NULL}, 1328, "udp"}, +{"netdb-export", {NULL}, 1329, "tcp"}, +{"netdb-export", {NULL}, 1329, "udp"}, +{"streetperfect", {NULL}, 1330, "tcp"}, +{"streetperfect", {NULL}, 1330, "udp"}, +{"intersan", {NULL}, 1331, "tcp"}, +{"intersan", {NULL}, 1331, "udp"}, +{"pcia-rxp-b", {NULL}, 1332, "tcp"}, +{"pcia-rxp-b", {NULL}, 1332, "udp"}, +{"passwrd-policy", {NULL}, 1333, "tcp"}, +{"passwrd-policy", {NULL}, 1333, "udp"}, +{"writesrv", {NULL}, 1334, "tcp"}, +{"writesrv", {NULL}, 1334, "udp"}, +{"digital-notary", {NULL}, 1335, "tcp"}, +{"digital-notary", {NULL}, 1335, "udp"}, +{"ischat", {NULL}, 1336, "tcp"}, +{"ischat", {NULL}, 1336, "udp"}, +{"menandmice-dns", {NULL}, 1337, "tcp"}, +{"menandmice-dns", {NULL}, 1337, "udp"}, +{"wmc-log-svc", {NULL}, 1338, "tcp"}, +{"wmc-log-svc", {NULL}, 1338, "udp"}, +{"kjtsiteserver", {NULL}, 1339, "tcp"}, +{"kjtsiteserver", {NULL}, 1339, "udp"}, +{"naap", {NULL}, 1340, "tcp"}, +{"naap", {NULL}, 1340, "udp"}, +{"qubes", {NULL}, 1341, "tcp"}, +{"qubes", {NULL}, 1341, "udp"}, +{"esbroker", {NULL}, 1342, "tcp"}, +{"esbroker", {NULL}, 1342, "udp"}, +{"re101", {NULL}, 1343, "tcp"}, +{"re101", {NULL}, 1343, "udp"}, +{"icap", {NULL}, 1344, "tcp"}, +{"icap", {NULL}, 1344, "udp"}, +{"vpjp", {NULL}, 1345, "tcp"}, +{"vpjp", {NULL}, 1345, "udp"}, +{"alta-ana-lm", {NULL}, 1346, "tcp"}, +{"alta-ana-lm", {NULL}, 1346, "udp"}, +{"bbn-mmc", {NULL}, 1347, "tcp"}, +{"bbn-mmc", {NULL}, 1347, "udp"}, +{"bbn-mmx", {NULL}, 1348, "tcp"}, +{"bbn-mmx", {NULL}, 1348, "udp"}, +{"sbook", {NULL}, 1349, "tcp"}, +{"sbook", {NULL}, 1349, "udp"}, +{"editbench", {NULL}, 1350, "tcp"}, +{"editbench", {NULL}, 1350, "udp"}, +{"equationbuilder", {NULL}, 1351, "tcp"}, +{"equationbuilder", {NULL}, 1351, "udp"}, +{"lotusnote", {NULL}, 1352, "tcp"}, +{"lotusnote", {NULL}, 1352, "udp"}, +{"relief", {NULL}, 1353, "tcp"}, +{"relief", {NULL}, 1353, "udp"}, +{"XSIP-network", {NULL}, 1354, "tcp"}, +{"XSIP-network", {NULL}, 1354, "udp"}, +{"intuitive-edge", {NULL}, 1355, "tcp"}, +{"intuitive-edge", {NULL}, 1355, "udp"}, +{"cuillamartin", {NULL}, 1356, "tcp"}, +{"cuillamartin", {NULL}, 1356, "udp"}, +{"pegboard", {NULL}, 1357, "tcp"}, +{"pegboard", {NULL}, 1357, "udp"}, +{"connlcli", {NULL}, 1358, "tcp"}, +{"connlcli", {NULL}, 1358, "udp"}, +{"ftsrv", {NULL}, 1359, "tcp"}, +{"ftsrv", {NULL}, 1359, "udp"}, +{"mimer", {NULL}, 1360, "tcp"}, +{"mimer", {NULL}, 1360, "udp"}, +{"linx", {NULL}, 1361, "tcp"}, +{"linx", {NULL}, 1361, "udp"}, +{"timeflies", {NULL}, 1362, "tcp"}, +{"timeflies", {NULL}, 1362, "udp"}, +{"ndm-requester", {NULL}, 1363, "tcp"}, +{"ndm-requester", {NULL}, 1363, "udp"}, +{"ndm-server", {NULL}, 1364, "tcp"}, +{"ndm-server", {NULL}, 1364, "udp"}, +{"adapt-sna", {NULL}, 1365, "tcp"}, +{"adapt-sna", {NULL}, 1365, "udp"}, +{"netware-csp", {NULL}, 1366, "tcp"}, +{"netware-csp", {NULL}, 1366, "udp"}, +{"dcs", {NULL}, 1367, "tcp"}, +{"dcs", {NULL}, 1367, "udp"}, +{"screencast", {NULL}, 1368, "tcp"}, +{"screencast", {NULL}, 1368, "udp"}, +{"gv-us", {NULL}, 1369, "tcp"}, +{"gv-us", {NULL}, 1369, "udp"}, +{"us-gv", {NULL}, 1370, "tcp"}, +{"us-gv", {NULL}, 1370, "udp"}, +{"fc-cli", {NULL}, 1371, "tcp"}, +{"fc-cli", {NULL}, 1371, "udp"}, +{"fc-ser", {NULL}, 1372, "tcp"}, +{"fc-ser", {NULL}, 1372, "udp"}, +{"chromagrafx", {NULL}, 1373, "tcp"}, +{"chromagrafx", {NULL}, 1373, "udp"}, +{"molly", {NULL}, 1374, "tcp"}, +{"molly", {NULL}, 1374, "udp"}, +{"bytex", {NULL}, 1375, "tcp"}, +{"bytex", {NULL}, 1375, "udp"}, +{"ibm-pps", {NULL}, 1376, "tcp"}, +{"ibm-pps", {NULL}, 1376, "udp"}, +{"cichlid", {NULL}, 1377, "tcp"}, +{"cichlid", {NULL}, 1377, "udp"}, +{"elan", {NULL}, 1378, "tcp"}, +{"elan", {NULL}, 1378, "udp"}, +{"dbreporter", {NULL}, 1379, "tcp"}, +{"dbreporter", {NULL}, 1379, "udp"}, +{"telesis-licman", {NULL}, 1380, "tcp"}, +{"telesis-licman", {NULL}, 1380, "udp"}, +{"apple-licman", {NULL}, 1381, "tcp"}, +{"apple-licman", {NULL}, 1381, "udp"}, +{"udt_os", {NULL}, 1382, "tcp"}, +{"udt_os", {NULL}, 1382, "udp"}, +{"gwha", {NULL}, 1383, "tcp"}, +{"gwha", {NULL}, 1383, "udp"}, +{"os-licman", {NULL}, 1384, "tcp"}, +{"os-licman", {NULL}, 1384, "udp"}, +{"atex_elmd", {NULL}, 1385, "tcp"}, +{"atex_elmd", {NULL}, 1385, "udp"}, +{"checksum", {NULL}, 1386, "tcp"}, +{"checksum", {NULL}, 1386, "udp"}, +{"cadsi-lm", {NULL}, 1387, "tcp"}, +{"cadsi-lm", {NULL}, 1387, "udp"}, +{"objective-dbc", {NULL}, 1388, "tcp"}, +{"objective-dbc", {NULL}, 1388, "udp"}, +{"iclpv-dm", {NULL}, 1389, "tcp"}, +{"iclpv-dm", {NULL}, 1389, "udp"}, +{"iclpv-sc", {NULL}, 1390, "tcp"}, +{"iclpv-sc", {NULL}, 1390, "udp"}, +{"iclpv-sas", {NULL}, 1391, "tcp"}, +{"iclpv-sas", {NULL}, 1391, "udp"}, +{"iclpv-pm", {NULL}, 1392, "tcp"}, +{"iclpv-pm", {NULL}, 1392, "udp"}, +{"iclpv-nls", {NULL}, 1393, "tcp"}, +{"iclpv-nls", {NULL}, 1393, "udp"}, +{"iclpv-nlc", {NULL}, 1394, "tcp"}, +{"iclpv-nlc", {NULL}, 1394, "udp"}, +{"iclpv-wsm", {NULL}, 1395, "tcp"}, +{"iclpv-wsm", {NULL}, 1395, "udp"}, +{"dvl-activemail", {NULL}, 1396, "tcp"}, +{"dvl-activemail", {NULL}, 1396, "udp"}, +{"audio-activmail", {NULL}, 1397, "tcp"}, +{"audio-activmail", {NULL}, 1397, "udp"}, +{"video-activmail", {NULL}, 1398, "tcp"}, +{"video-activmail", {NULL}, 1398, "udp"}, +{"cadkey-licman", {NULL}, 1399, "tcp"}, +{"cadkey-licman", {NULL}, 1399, "udp"}, +{"cadkey-tablet", {NULL}, 1400, "tcp"}, +{"cadkey-tablet", {NULL}, 1400, "udp"}, +{"goldleaf-licman", {NULL}, 1401, "tcp"}, +{"goldleaf-licman", {NULL}, 1401, "udp"}, +{"prm-sm-np", {NULL}, 1402, "tcp"}, +{"prm-sm-np", {NULL}, 1402, "udp"}, +{"prm-nm-np", {NULL}, 1403, "tcp"}, +{"prm-nm-np", {NULL}, 1403, "udp"}, +{"igi-lm", {NULL}, 1404, "tcp"}, +{"igi-lm", {NULL}, 1404, "udp"}, +{"ibm-res", {NULL}, 1405, "tcp"}, +{"ibm-res", {NULL}, 1405, "udp"}, +{"netlabs-lm", {NULL}, 1406, "tcp"}, +{"netlabs-lm", {NULL}, 1406, "udp"}, +{"dbsa-lm", {NULL}, 1407, "tcp"}, +{"dbsa-lm", {NULL}, 1407, "udp"}, +{"sophia-lm", {NULL}, 1408, "tcp"}, +{"sophia-lm", {NULL}, 1408, "udp"}, +{"here-lm", {NULL}, 1409, "tcp"}, +{"here-lm", {NULL}, 1409, "udp"}, +{"hiq", {NULL}, 1410, "tcp"}, +{"hiq", {NULL}, 1410, "udp"}, +{"af", {NULL}, 1411, "tcp"}, +{"af", {NULL}, 1411, "udp"}, +{"innosys", {NULL}, 1412, "tcp"}, +{"innosys", {NULL}, 1412, "udp"}, +{"innosys-acl", {NULL}, 1413, "tcp"}, +{"innosys-acl", {NULL}, 1413, "udp"}, +{"ibm-mqseries", {NULL}, 1414, "tcp"}, +{"ibm-mqseries", {NULL}, 1414, "udp"}, +{"dbstar", {NULL}, 1415, "tcp"}, +{"dbstar", {NULL}, 1415, "udp"}, +{"novell-lu6.2", {NULL}, 1416, "tcp"}, +{"novell-lu6.2", {NULL}, 1416, "udp"}, +{"timbuktu-srv1", {NULL}, 1417, "tcp"}, +{"timbuktu-srv1", {NULL}, 1417, "udp"}, +{"timbuktu-srv2", {NULL}, 1418, "tcp"}, +{"timbuktu-srv2", {NULL}, 1418, "udp"}, +{"timbuktu-srv3", {NULL}, 1419, "tcp"}, +{"timbuktu-srv3", {NULL}, 1419, "udp"}, +{"timbuktu-srv4", {NULL}, 1420, "tcp"}, +{"timbuktu-srv4", {NULL}, 1420, "udp"}, +{"gandalf-lm", {NULL}, 1421, "tcp"}, +{"gandalf-lm", {NULL}, 1421, "udp"}, +{"autodesk-lm", {NULL}, 1422, "tcp"}, +{"autodesk-lm", {NULL}, 1422, "udp"}, +{"essbase", {NULL}, 1423, "tcp"}, +{"essbase", {NULL}, 1423, "udp"}, +{"hybrid", {NULL}, 1424, "tcp"}, +{"hybrid", {NULL}, 1424, "udp"}, +{"zion-lm", {NULL}, 1425, "tcp"}, +{"zion-lm", {NULL}, 1425, "udp"}, +{"sais", {NULL}, 1426, "tcp"}, +{"sais", {NULL}, 1426, "udp"}, +{"mloadd", {NULL}, 1427, "tcp"}, +{"mloadd", {NULL}, 1427, "udp"}, +{"informatik-lm", {NULL}, 1428, "tcp"}, +{"informatik-lm", {NULL}, 1428, "udp"}, +{"nms", {NULL}, 1429, "tcp"}, +{"nms", {NULL}, 1429, "udp"}, +{"tpdu", {NULL}, 1430, "tcp"}, +{"tpdu", {NULL}, 1430, "udp"}, +{"rgtp", {NULL}, 1431, "tcp"}, +{"rgtp", {NULL}, 1431, "udp"}, +{"blueberry-lm", {NULL}, 1432, "tcp"}, +{"blueberry-lm", {NULL}, 1432, "udp"}, +{"ms-sql-s", {NULL}, 1433, "tcp"}, +{"ms-sql-s", {NULL}, 1433, "udp"}, +{"ms-sql-m", {NULL}, 1434, "tcp"}, +{"ms-sql-m", {NULL}, 1434, "udp"}, +{"ibm-cics", {NULL}, 1435, "tcp"}, +{"ibm-cics", {NULL}, 1435, "udp"}, +{"saism", {NULL}, 1436, "tcp"}, +{"saism", {NULL}, 1436, "udp"}, +{"tabula", {NULL}, 1437, "tcp"}, +{"tabula", {NULL}, 1437, "udp"}, +{"eicon-server", {NULL}, 1438, "tcp"}, +{"eicon-server", {NULL}, 1438, "udp"}, +{"eicon-x25", {NULL}, 1439, "tcp"}, +{"eicon-x25", {NULL}, 1439, "udp"}, +{"eicon-slp", {NULL}, 1440, "tcp"}, +{"eicon-slp", {NULL}, 1440, "udp"}, +{"cadis-1", {NULL}, 1441, "tcp"}, +{"cadis-1", {NULL}, 1441, "udp"}, +{"cadis-2", {NULL}, 1442, "tcp"}, +{"cadis-2", {NULL}, 1442, "udp"}, +{"ies-lm", {NULL}, 1443, "tcp"}, +{"ies-lm", {NULL}, 1443, "udp"}, +{"marcam-lm", {NULL}, 1444, "tcp"}, +{"marcam-lm", {NULL}, 1444, "udp"}, +{"proxima-lm", {NULL}, 1445, "tcp"}, +{"proxima-lm", {NULL}, 1445, "udp"}, +{"ora-lm", {NULL}, 1446, "tcp"}, +{"ora-lm", {NULL}, 1446, "udp"}, +{"apri-lm", {NULL}, 1447, "tcp"}, +{"apri-lm", {NULL}, 1447, "udp"}, +{"oc-lm", {NULL}, 1448, "tcp"}, +{"oc-lm", {NULL}, 1448, "udp"}, +{"peport", {NULL}, 1449, "tcp"}, +{"peport", {NULL}, 1449, "udp"}, +{"dwf", {NULL}, 1450, "tcp"}, +{"dwf", {NULL}, 1450, "udp"}, +{"infoman", {NULL}, 1451, "tcp"}, +{"infoman", {NULL}, 1451, "udp"}, +{"gtegsc-lm", {NULL}, 1452, "tcp"}, +{"gtegsc-lm", {NULL}, 1452, "udp"}, +{"genie-lm", {NULL}, 1453, "tcp"}, +{"genie-lm", {NULL}, 1453, "udp"}, +{"interhdl_elmd", {NULL}, 1454, "tcp"}, +{"interhdl_elmd", {NULL}, 1454, "udp"}, +{"esl-lm", {NULL}, 1455, "tcp"}, +{"esl-lm", {NULL}, 1455, "udp"}, +{"dca", {NULL}, 1456, "tcp"}, +{"dca", {NULL}, 1456, "udp"}, +{"valisys-lm", {NULL}, 1457, "tcp"}, +{"valisys-lm", {NULL}, 1457, "udp"}, +{"nrcabq-lm", {NULL}, 1458, "tcp"}, +{"nrcabq-lm", {NULL}, 1458, "udp"}, +{"proshare1", {NULL}, 1459, "tcp"}, +{"proshare1", {NULL}, 1459, "udp"}, +{"proshare2", {NULL}, 1460, "tcp"}, +{"proshare2", {NULL}, 1460, "udp"}, +{"ibm_wrless_lan", {NULL}, 1461, "tcp"}, +{"ibm_wrless_lan", {NULL}, 1461, "udp"}, +{"world-lm", {NULL}, 1462, "tcp"}, +{"world-lm", {NULL}, 1462, "udp"}, +{"nucleus", {NULL}, 1463, "tcp"}, +{"nucleus", {NULL}, 1463, "udp"}, +{"msl_lmd", {NULL}, 1464, "tcp"}, +{"msl_lmd", {NULL}, 1464, "udp"}, +{"pipes", {NULL}, 1465, "tcp"}, +{"pipes", {NULL}, 1465, "udp"}, +{"oceansoft-lm", {NULL}, 1466, "tcp"}, +{"oceansoft-lm", {NULL}, 1466, "udp"}, +{"csdmbase", {NULL}, 1467, "tcp"}, +{"csdmbase", {NULL}, 1467, "udp"}, +{"csdm", {NULL}, 1468, "tcp"}, +{"csdm", {NULL}, 1468, "udp"}, +{"aal-lm", {NULL}, 1469, "tcp"}, +{"aal-lm", {NULL}, 1469, "udp"}, +{"uaiact", {NULL}, 1470, "tcp"}, +{"uaiact", {NULL}, 1470, "udp"}, +{"csdmbase", {NULL}, 1471, "tcp"}, +{"csdmbase", {NULL}, 1471, "udp"}, +{"csdm", {NULL}, 1472, "tcp"}, +{"csdm", {NULL}, 1472, "udp"}, +{"openmath", {NULL}, 1473, "tcp"}, +{"openmath", {NULL}, 1473, "udp"}, +{"telefinder", {NULL}, 1474, "tcp"}, +{"telefinder", {NULL}, 1474, "udp"}, +{"taligent-lm", {NULL}, 1475, "tcp"}, +{"taligent-lm", {NULL}, 1475, "udp"}, +{"clvm-cfg", {NULL}, 1476, "tcp"}, +{"clvm-cfg", {NULL}, 1476, "udp"}, +{"ms-sna-server", {NULL}, 1477, "tcp"}, +{"ms-sna-server", {NULL}, 1477, "udp"}, +{"ms-sna-base", {NULL}, 1478, "tcp"}, +{"ms-sna-base", {NULL}, 1478, "udp"}, +{"dberegister", {NULL}, 1479, "tcp"}, +{"dberegister", {NULL}, 1479, "udp"}, +{"pacerforum", {NULL}, 1480, "tcp"}, +{"pacerforum", {NULL}, 1480, "udp"}, +{"airs", {NULL}, 1481, "tcp"}, +{"airs", {NULL}, 1481, "udp"}, +{"miteksys-lm", {NULL}, 1482, "tcp"}, +{"miteksys-lm", {NULL}, 1482, "udp"}, +{"afs", {NULL}, 1483, "tcp"}, +{"afs", {NULL}, 1483, "udp"}, +{"confluent", {NULL}, 1484, "tcp"}, +{"confluent", {NULL}, 1484, "udp"}, +{"lansource", {NULL}, 1485, "tcp"}, +{"lansource", {NULL}, 1485, "udp"}, +{"nms_topo_serv", {NULL}, 1486, "tcp"}, +{"nms_topo_serv", {NULL}, 1486, "udp"}, +{"localinfosrvr", {NULL}, 1487, "tcp"}, +{"localinfosrvr", {NULL}, 1487, "udp"}, +{"docstor", {NULL}, 1488, "tcp"}, +{"docstor", {NULL}, 1488, "udp"}, +{"dmdocbroker", {NULL}, 1489, "tcp"}, +{"dmdocbroker", {NULL}, 1489, "udp"}, +{"insitu-conf", {NULL}, 1490, "tcp"}, +{"insitu-conf", {NULL}, 1490, "udp"}, +{"stone-design-1", {NULL}, 1492, "tcp"}, +{"stone-design-1", {NULL}, 1492, "udp"}, +{"netmap_lm", {NULL}, 1493, "tcp"}, +{"netmap_lm", {NULL}, 1493, "udp"}, +{"ica", {NULL}, 1494, "tcp"}, +{"ica", {NULL}, 1494, "udp"}, +{"cvc", {NULL}, 1495, "tcp"}, +{"cvc", {NULL}, 1495, "udp"}, +{"liberty-lm", {NULL}, 1496, "tcp"}, +{"liberty-lm", {NULL}, 1496, "udp"}, +{"rfx-lm", {NULL}, 1497, "tcp"}, +{"rfx-lm", {NULL}, 1497, "udp"}, +{"sybase-sqlany", {NULL}, 1498, "tcp"}, +{"sybase-sqlany", {NULL}, 1498, "udp"}, +{"fhc", {NULL}, 1499, "tcp"}, +{"fhc", {NULL}, 1499, "udp"}, +{"vlsi-lm", {NULL}, 1500, "tcp"}, +{"vlsi-lm", {NULL}, 1500, "udp"}, +{"saiscm", {NULL}, 1501, "tcp"}, +{"saiscm", {NULL}, 1501, "udp"}, +{"shivadiscovery", {NULL}, 1502, "tcp"}, +{"shivadiscovery", {NULL}, 1502, "udp"}, +{"imtc-mcs", {NULL}, 1503, "tcp"}, +{"imtc-mcs", {NULL}, 1503, "udp"}, +{"evb-elm", {NULL}, 1504, "tcp"}, +{"evb-elm", {NULL}, 1504, "udp"}, +{"funkproxy", {NULL}, 1505, "tcp"}, +{"funkproxy", {NULL}, 1505, "udp"}, +{"utcd", {NULL}, 1506, "tcp"}, +{"utcd", {NULL}, 1506, "udp"}, +{"symplex", {NULL}, 1507, "tcp"}, +{"symplex", {NULL}, 1507, "udp"}, +{"diagmond", {NULL}, 1508, "tcp"}, +{"diagmond", {NULL}, 1508, "udp"}, +{"robcad-lm", {NULL}, 1509, "tcp"}, +{"robcad-lm", {NULL}, 1509, "udp"}, +{"mvx-lm", {NULL}, 1510, "tcp"}, +{"mvx-lm", {NULL}, 1510, "udp"}, +{"3l-l1", {NULL}, 1511, "tcp"}, +{"3l-l1", {NULL}, 1511, "udp"}, +{"wins", {NULL}, 1512, "tcp"}, +{"wins", {NULL}, 1512, "udp"}, +{"fujitsu-dtc", {NULL}, 1513, "tcp"}, +{"fujitsu-dtc", {NULL}, 1513, "udp"}, +{"fujitsu-dtcns", {NULL}, 1514, "tcp"}, +{"fujitsu-dtcns", {NULL}, 1514, "udp"}, +{"ifor-protocol", {NULL}, 1515, "tcp"}, +{"ifor-protocol", {NULL}, 1515, "udp"}, +{"vpad", {NULL}, 1516, "tcp"}, +{"vpad", {NULL}, 1516, "udp"}, +{"vpac", {NULL}, 1517, "tcp"}, +{"vpac", {NULL}, 1517, "udp"}, +{"vpvd", {NULL}, 1518, "tcp"}, +{"vpvd", {NULL}, 1518, "udp"}, +{"vpvc", {NULL}, 1519, "tcp"}, +{"vpvc", {NULL}, 1519, "udp"}, +{"atm-zip-office", {NULL}, 1520, "tcp"}, +{"atm-zip-office", {NULL}, 1520, "udp"}, +{"ncube-lm", {NULL}, 1521, "tcp"}, +{"ncube-lm", {NULL}, 1521, "udp"}, +{"ricardo-lm", {NULL}, 1522, "tcp"}, +{"ricardo-lm", {NULL}, 1522, "udp"}, +{"cichild-lm", {NULL}, 1523, "tcp"}, +{"cichild-lm", {NULL}, 1523, "udp"}, +{"ingreslock", {NULL}, 1524, "tcp"}, +{"ingreslock", {NULL}, 1524, "udp"}, +{"orasrv", {NULL}, 1525, "tcp"}, +{"orasrv", {NULL}, 1525, "udp"}, +{"prospero-np", {NULL}, 1525, "tcp"}, +{"prospero-np", {NULL}, 1525, "udp"}, +{"pdap-np", {NULL}, 1526, "tcp"}, +{"pdap-np", {NULL}, 1526, "udp"}, +{"tlisrv", {NULL}, 1527, "tcp"}, +{"tlisrv", {NULL}, 1527, "udp"}, +{"coauthor", {NULL}, 1529, "tcp"}, +{"coauthor", {NULL}, 1529, "udp"}, +{"rap-service", {NULL}, 1530, "tcp"}, +{"rap-service", {NULL}, 1530, "udp"}, +{"rap-listen", {NULL}, 1531, "tcp"}, +{"rap-listen", {NULL}, 1531, "udp"}, +{"miroconnect", {NULL}, 1532, "tcp"}, +{"miroconnect", {NULL}, 1532, "udp"}, +{"virtual-places", {NULL}, 1533, "tcp"}, +{"virtual-places", {NULL}, 1533, "udp"}, +{"micromuse-lm", {NULL}, 1534, "tcp"}, +{"micromuse-lm", {NULL}, 1534, "udp"}, +{"ampr-info", {NULL}, 1535, "tcp"}, +{"ampr-info", {NULL}, 1535, "udp"}, +{"ampr-inter", {NULL}, 1536, "tcp"}, +{"ampr-inter", {NULL}, 1536, "udp"}, +{"sdsc-lm", {NULL}, 1537, "tcp"}, +{"sdsc-lm", {NULL}, 1537, "udp"}, +{"3ds-lm", {NULL}, 1538, "tcp"}, +{"3ds-lm", {NULL}, 1538, "udp"}, +{"intellistor-lm", {NULL}, 1539, "tcp"}, +{"intellistor-lm", {NULL}, 1539, "udp"}, +{"rds", {NULL}, 1540, "tcp"}, +{"rds", {NULL}, 1540, "udp"}, +{"rds2", {NULL}, 1541, "tcp"}, +{"rds2", {NULL}, 1541, "udp"}, +{"gridgen-elmd", {NULL}, 1542, "tcp"}, +{"gridgen-elmd", {NULL}, 1542, "udp"}, +{"simba-cs", {NULL}, 1543, "tcp"}, +{"simba-cs", {NULL}, 1543, "udp"}, +{"aspeclmd", {NULL}, 1544, "tcp"}, +{"aspeclmd", {NULL}, 1544, "udp"}, +{"vistium-share", {NULL}, 1545, "tcp"}, +{"vistium-share", {NULL}, 1545, "udp"}, +{"abbaccuray", {NULL}, 1546, "tcp"}, +{"abbaccuray", {NULL}, 1546, "udp"}, +{"laplink", {NULL}, 1547, "tcp"}, +{"laplink", {NULL}, 1547, "udp"}, +{"axon-lm", {NULL}, 1548, "tcp"}, +{"axon-lm", {NULL}, 1548, "udp"}, +{"shivahose", {NULL}, 1549, "tcp"}, +{"shivasound", {NULL}, 1549, "udp"}, +{"3m-image-lm", {NULL}, 1550, "tcp"}, +{"3m-image-lm", {NULL}, 1550, "udp"}, +{"hecmtl-db", {NULL}, 1551, "tcp"}, +{"hecmtl-db", {NULL}, 1551, "udp"}, +{"pciarray", {NULL}, 1552, "tcp"}, +{"pciarray", {NULL}, 1552, "udp"}, +{"sna-cs", {NULL}, 1553, "tcp"}, +{"sna-cs", {NULL}, 1553, "udp"}, +{"caci-lm", {NULL}, 1554, "tcp"}, +{"caci-lm", {NULL}, 1554, "udp"}, +{"livelan", {NULL}, 1555, "tcp"}, +{"livelan", {NULL}, 1555, "udp"}, +{"veritas_pbx", {NULL}, 1556, "tcp"}, +{"veritas_pbx", {NULL}, 1556, "udp"}, +{"arbortext-lm", {NULL}, 1557, "tcp"}, +{"arbortext-lm", {NULL}, 1557, "udp"}, +{"xingmpeg", {NULL}, 1558, "tcp"}, +{"xingmpeg", {NULL}, 1558, "udp"}, +{"web2host", {NULL}, 1559, "tcp"}, +{"web2host", {NULL}, 1559, "udp"}, +{"asci-val", {NULL}, 1560, "tcp"}, +{"asci-val", {NULL}, 1560, "udp"}, +{"facilityview", {NULL}, 1561, "tcp"}, +{"facilityview", {NULL}, 1561, "udp"}, +{"pconnectmgr", {NULL}, 1562, "tcp"}, +{"pconnectmgr", {NULL}, 1562, "udp"}, +{"cadabra-lm", {NULL}, 1563, "tcp"}, +{"cadabra-lm", {NULL}, 1563, "udp"}, +{"pay-per-view", {NULL}, 1564, "tcp"}, +{"pay-per-view", {NULL}, 1564, "udp"}, +{"winddlb", {NULL}, 1565, "tcp"}, +{"winddlb", {NULL}, 1565, "udp"}, +{"corelvideo", {NULL}, 1566, "tcp"}, +{"corelvideo", {NULL}, 1566, "udp"}, +{"jlicelmd", {NULL}, 1567, "tcp"}, +{"jlicelmd", {NULL}, 1567, "udp"}, +{"tsspmap", {NULL}, 1568, "tcp"}, +{"tsspmap", {NULL}, 1568, "udp"}, +{"ets", {NULL}, 1569, "tcp"}, +{"ets", {NULL}, 1569, "udp"}, +{"orbixd", {NULL}, 1570, "tcp"}, +{"orbixd", {NULL}, 1570, "udp"}, +{"rdb-dbs-disp", {NULL}, 1571, "tcp"}, +{"rdb-dbs-disp", {NULL}, 1571, "udp"}, +{"chip-lm", {NULL}, 1572, "tcp"}, +{"chip-lm", {NULL}, 1572, "udp"}, +{"itscomm-ns", {NULL}, 1573, "tcp"}, +{"itscomm-ns", {NULL}, 1573, "udp"}, +{"mvel-lm", {NULL}, 1574, "tcp"}, +{"mvel-lm", {NULL}, 1574, "udp"}, +{"oraclenames", {NULL}, 1575, "tcp"}, +{"oraclenames", {NULL}, 1575, "udp"}, +{"moldflow-lm", {NULL}, 1576, "tcp"}, +{"moldflow-lm", {NULL}, 1576, "udp"}, +{"hypercube-lm", {NULL}, 1577, "tcp"}, +{"hypercube-lm", {NULL}, 1577, "udp"}, +{"jacobus-lm", {NULL}, 1578, "tcp"}, +{"jacobus-lm", {NULL}, 1578, "udp"}, +{"ioc-sea-lm", {NULL}, 1579, "tcp"}, +{"ioc-sea-lm", {NULL}, 1579, "udp"}, +{"tn-tl-r1", {NULL}, 1580, "tcp"}, +{"tn-tl-r2", {NULL}, 1580, "udp"}, +{"mil-2045-47001", {NULL}, 1581, "tcp"}, +{"mil-2045-47001", {NULL}, 1581, "udp"}, +{"msims", {NULL}, 1582, "tcp"}, +{"msims", {NULL}, 1582, "udp"}, +{"simbaexpress", {NULL}, 1583, "tcp"}, +{"simbaexpress", {NULL}, 1583, "udp"}, +{"tn-tl-fd2", {NULL}, 1584, "tcp"}, +{"tn-tl-fd2", {NULL}, 1584, "udp"}, +{"intv", {NULL}, 1585, "tcp"}, +{"intv", {NULL}, 1585, "udp"}, +{"ibm-abtact", {NULL}, 1586, "tcp"}, +{"ibm-abtact", {NULL}, 1586, "udp"}, +{"pra_elmd", {NULL}, 1587, "tcp"}, +{"pra_elmd", {NULL}, 1587, "udp"}, +{"triquest-lm", {NULL}, 1588, "tcp"}, +{"triquest-lm", {NULL}, 1588, "udp"}, +{"vqp", {NULL}, 1589, "tcp"}, +{"vqp", {NULL}, 1589, "udp"}, +{"gemini-lm", {NULL}, 1590, "tcp"}, +{"gemini-lm", {NULL}, 1590, "udp"}, +{"ncpm-pm", {NULL}, 1591, "tcp"}, +{"ncpm-pm", {NULL}, 1591, "udp"}, +{"commonspace", {NULL}, 1592, "tcp"}, +{"commonspace", {NULL}, 1592, "udp"}, +{"mainsoft-lm", {NULL}, 1593, "tcp"}, +{"mainsoft-lm", {NULL}, 1593, "udp"}, +{"sixtrak", {NULL}, 1594, "tcp"}, +{"sixtrak", {NULL}, 1594, "udp"}, +{"radio", {NULL}, 1595, "tcp"}, +{"radio", {NULL}, 1595, "udp"}, +{"radio-sm", {NULL}, 1596, "tcp"}, +{"radio-bc", {NULL}, 1596, "udp"}, +{"orbplus-iiop", {NULL}, 1597, "tcp"}, +{"orbplus-iiop", {NULL}, 1597, "udp"}, +{"picknfs", {NULL}, 1598, "tcp"}, +{"picknfs", {NULL}, 1598, "udp"}, +{"simbaservices", {NULL}, 1599, "tcp"}, +{"simbaservices", {NULL}, 1599, "udp"}, +{"issd", {NULL}, 1600, "tcp"}, +{"issd", {NULL}, 1600, "udp"}, +{"aas", {NULL}, 1601, "tcp"}, +{"aas", {NULL}, 1601, "udp"}, +{"inspect", {NULL}, 1602, "tcp"}, +{"inspect", {NULL}, 1602, "udp"}, +{"picodbc", {NULL}, 1603, "tcp"}, +{"picodbc", {NULL}, 1603, "udp"}, +{"icabrowser", {NULL}, 1604, "tcp"}, +{"icabrowser", {NULL}, 1604, "udp"}, +{"slp", {NULL}, 1605, "tcp"}, +{"slp", {NULL}, 1605, "udp"}, +{"slm-api", {NULL}, 1606, "tcp"}, +{"slm-api", {NULL}, 1606, "udp"}, +{"stt", {NULL}, 1607, "tcp"}, +{"stt", {NULL}, 1607, "udp"}, +{"smart-lm", {NULL}, 1608, "tcp"}, +{"smart-lm", {NULL}, 1608, "udp"}, +{"isysg-lm", {NULL}, 1609, "tcp"}, +{"isysg-lm", {NULL}, 1609, "udp"}, +{"taurus-wh", {NULL}, 1610, "tcp"}, +{"taurus-wh", {NULL}, 1610, "udp"}, +{"ill", {NULL}, 1611, "tcp"}, +{"ill", {NULL}, 1611, "udp"}, +{"netbill-trans", {NULL}, 1612, "tcp"}, +{"netbill-trans", {NULL}, 1612, "udp"}, +{"netbill-keyrep", {NULL}, 1613, "tcp"}, +{"netbill-keyrep", {NULL}, 1613, "udp"}, +{"netbill-cred", {NULL}, 1614, "tcp"}, +{"netbill-cred", {NULL}, 1614, "udp"}, +{"netbill-auth", {NULL}, 1615, "tcp"}, +{"netbill-auth", {NULL}, 1615, "udp"}, +{"netbill-prod", {NULL}, 1616, "tcp"}, +{"netbill-prod", {NULL}, 1616, "udp"}, +{"nimrod-agent", {NULL}, 1617, "tcp"}, +{"nimrod-agent", {NULL}, 1617, "udp"}, +{"skytelnet", {NULL}, 1618, "tcp"}, +{"skytelnet", {NULL}, 1618, "udp"}, +{"xs-openstorage", {NULL}, 1619, "tcp"}, +{"xs-openstorage", {NULL}, 1619, "udp"}, +{"faxportwinport", {NULL}, 1620, "tcp"}, +{"faxportwinport", {NULL}, 1620, "udp"}, +{"softdataphone", {NULL}, 1621, "tcp"}, +{"softdataphone", {NULL}, 1621, "udp"}, +{"ontime", {NULL}, 1622, "tcp"}, +{"ontime", {NULL}, 1622, "udp"}, +{"jaleosnd", {NULL}, 1623, "tcp"}, +{"jaleosnd", {NULL}, 1623, "udp"}, +{"udp-sr-port", {NULL}, 1624, "tcp"}, +{"udp-sr-port", {NULL}, 1624, "udp"}, +{"svs-omagent", {NULL}, 1625, "tcp"}, +{"svs-omagent", {NULL}, 1625, "udp"}, +{"shockwave", {NULL}, 1626, "tcp"}, +{"shockwave", {NULL}, 1626, "udp"}, +{"t128-gateway", {NULL}, 1627, "tcp"}, +{"t128-gateway", {NULL}, 1627, "udp"}, +{"lontalk-norm", {NULL}, 1628, "tcp"}, +{"lontalk-norm", {NULL}, 1628, "udp"}, +{"lontalk-urgnt", {NULL}, 1629, "tcp"}, +{"lontalk-urgnt", {NULL}, 1629, "udp"}, +{"oraclenet8cman", {NULL}, 1630, "tcp"}, +{"oraclenet8cman", {NULL}, 1630, "udp"}, +{"visitview", {NULL}, 1631, "tcp"}, +{"visitview", {NULL}, 1631, "udp"}, +{"pammratc", {NULL}, 1632, "tcp"}, +{"pammratc", {NULL}, 1632, "udp"}, +{"pammrpc", {NULL}, 1633, "tcp"}, +{"pammrpc", {NULL}, 1633, "udp"}, +{"loaprobe", {NULL}, 1634, "tcp"}, +{"loaprobe", {NULL}, 1634, "udp"}, +{"edb-server1", {NULL}, 1635, "tcp"}, +{"edb-server1", {NULL}, 1635, "udp"}, +{"isdc", {NULL}, 1636, "tcp"}, +{"isdc", {NULL}, 1636, "udp"}, +{"islc", {NULL}, 1637, "tcp"}, +{"islc", {NULL}, 1637, "udp"}, +{"ismc", {NULL}, 1638, "tcp"}, +{"ismc", {NULL}, 1638, "udp"}, +{"cert-initiator", {NULL}, 1639, "tcp"}, +{"cert-initiator", {NULL}, 1639, "udp"}, +{"cert-responder", {NULL}, 1640, "tcp"}, +{"cert-responder", {NULL}, 1640, "udp"}, +{"invision", {NULL}, 1641, "tcp"}, +{"invision", {NULL}, 1641, "udp"}, +{"isis-am", {NULL}, 1642, "tcp"}, +{"isis-am", {NULL}, 1642, "udp"}, +{"isis-ambc", {NULL}, 1643, "tcp"}, +{"isis-ambc", {NULL}, 1643, "udp"}, +{"saiseh", {NULL}, 1644, "tcp"}, +{"sightline", {NULL}, 1645, "tcp"}, +{"sightline", {NULL}, 1645, "udp"}, +{"sa-msg-port", {NULL}, 1646, "tcp"}, +{"sa-msg-port", {NULL}, 1646, "udp"}, +{"rsap", {NULL}, 1647, "tcp"}, +{"rsap", {NULL}, 1647, "udp"}, +{"concurrent-lm", {NULL}, 1648, "tcp"}, +{"concurrent-lm", {NULL}, 1648, "udp"}, +{"kermit", {NULL}, 1649, "tcp"}, +{"kermit", {NULL}, 1649, "udp"}, +{"nkd", {NULL}, 1650, "tcp"}, +{"nkd", {NULL}, 1650, "udp"}, +{"shiva_confsrvr", {NULL}, 1651, "tcp"}, +{"shiva_confsrvr", {NULL}, 1651, "udp"}, +{"xnmp", {NULL}, 1652, "tcp"}, +{"xnmp", {NULL}, 1652, "udp"}, +{"alphatech-lm", {NULL}, 1653, "tcp"}, +{"alphatech-lm", {NULL}, 1653, "udp"}, +{"stargatealerts", {NULL}, 1654, "tcp"}, +{"stargatealerts", {NULL}, 1654, "udp"}, +{"dec-mbadmin", {NULL}, 1655, "tcp"}, +{"dec-mbadmin", {NULL}, 1655, "udp"}, +{"dec-mbadmin-h", {NULL}, 1656, "tcp"}, +{"dec-mbadmin-h", {NULL}, 1656, "udp"}, +{"fujitsu-mmpdc", {NULL}, 1657, "tcp"}, +{"fujitsu-mmpdc", {NULL}, 1657, "udp"}, +{"sixnetudr", {NULL}, 1658, "tcp"}, +{"sixnetudr", {NULL}, 1658, "udp"}, +{"sg-lm", {NULL}, 1659, "tcp"}, +{"sg-lm", {NULL}, 1659, "udp"}, +{"skip-mc-gikreq", {NULL}, 1660, "tcp"}, +{"skip-mc-gikreq", {NULL}, 1660, "udp"}, +{"netview-aix-1", {NULL}, 1661, "tcp"}, +{"netview-aix-1", {NULL}, 1661, "udp"}, +{"netview-aix-2", {NULL}, 1662, "tcp"}, +{"netview-aix-2", {NULL}, 1662, "udp"}, +{"netview-aix-3", {NULL}, 1663, "tcp"}, +{"netview-aix-3", {NULL}, 1663, "udp"}, +{"netview-aix-4", {NULL}, 1664, "tcp"}, +{"netview-aix-4", {NULL}, 1664, "udp"}, +{"netview-aix-5", {NULL}, 1665, "tcp"}, +{"netview-aix-5", {NULL}, 1665, "udp"}, +{"netview-aix-6", {NULL}, 1666, "tcp"}, +{"netview-aix-6", {NULL}, 1666, "udp"}, +{"netview-aix-7", {NULL}, 1667, "tcp"}, +{"netview-aix-7", {NULL}, 1667, "udp"}, +{"netview-aix-8", {NULL}, 1668, "tcp"}, +{"netview-aix-8", {NULL}, 1668, "udp"}, +{"netview-aix-9", {NULL}, 1669, "tcp"}, +{"netview-aix-9", {NULL}, 1669, "udp"}, +{"netview-aix-10", {NULL}, 1670, "tcp"}, +{"netview-aix-10", {NULL}, 1670, "udp"}, +{"netview-aix-11", {NULL}, 1671, "tcp"}, +{"netview-aix-11", {NULL}, 1671, "udp"}, +{"netview-aix-12", {NULL}, 1672, "tcp"}, +{"netview-aix-12", {NULL}, 1672, "udp"}, +{"proshare-mc-1", {NULL}, 1673, "tcp"}, +{"proshare-mc-1", {NULL}, 1673, "udp"}, +{"proshare-mc-2", {NULL}, 1674, "tcp"}, +{"proshare-mc-2", {NULL}, 1674, "udp"}, +{"pdp", {NULL}, 1675, "tcp"}, +{"pdp", {NULL}, 1675, "udp"}, +{"netcomm1", {NULL}, 1676, "tcp"}, +{"netcomm2", {NULL}, 1676, "udp"}, +{"groupwise", {NULL}, 1677, "tcp"}, +{"groupwise", {NULL}, 1677, "udp"}, +{"prolink", {NULL}, 1678, "tcp"}, +{"prolink", {NULL}, 1678, "udp"}, +{"darcorp-lm", {NULL}, 1679, "tcp"}, +{"darcorp-lm", {NULL}, 1679, "udp"}, +{"microcom-sbp", {NULL}, 1680, "tcp"}, +{"microcom-sbp", {NULL}, 1680, "udp"}, +{"sd-elmd", {NULL}, 1681, "tcp"}, +{"sd-elmd", {NULL}, 1681, "udp"}, +{"lanyon-lantern", {NULL}, 1682, "tcp"}, +{"lanyon-lantern", {NULL}, 1682, "udp"}, +{"ncpm-hip", {NULL}, 1683, "tcp"}, +{"ncpm-hip", {NULL}, 1683, "udp"}, +{"snaresecure", {NULL}, 1684, "tcp"}, +{"snaresecure", {NULL}, 1684, "udp"}, +{"n2nremote", {NULL}, 1685, "tcp"}, +{"n2nremote", {NULL}, 1685, "udp"}, +{"cvmon", {NULL}, 1686, "tcp"}, +{"cvmon", {NULL}, 1686, "udp"}, +{"nsjtp-ctrl", {NULL}, 1687, "tcp"}, +{"nsjtp-ctrl", {NULL}, 1687, "udp"}, +{"nsjtp-data", {NULL}, 1688, "tcp"}, +{"nsjtp-data", {NULL}, 1688, "udp"}, +{"firefox", {NULL}, 1689, "tcp"}, +{"firefox", {NULL}, 1689, "udp"}, +{"ng-umds", {NULL}, 1690, "tcp"}, +{"ng-umds", {NULL}, 1690, "udp"}, +{"empire-empuma", {NULL}, 1691, "tcp"}, +{"empire-empuma", {NULL}, 1691, "udp"}, +{"sstsys-lm", {NULL}, 1692, "tcp"}, +{"sstsys-lm", {NULL}, 1692, "udp"}, +{"rrirtr", {NULL}, 1693, "tcp"}, +{"rrirtr", {NULL}, 1693, "udp"}, +{"rrimwm", {NULL}, 1694, "tcp"}, +{"rrimwm", {NULL}, 1694, "udp"}, +{"rrilwm", {NULL}, 1695, "tcp"}, +{"rrilwm", {NULL}, 1695, "udp"}, +{"rrifmm", {NULL}, 1696, "tcp"}, +{"rrifmm", {NULL}, 1696, "udp"}, +{"rrisat", {NULL}, 1697, "tcp"}, +{"rrisat", {NULL}, 1697, "udp"}, +{"rsvp-encap-1", {NULL}, 1698, "tcp"}, +{"rsvp-encap-1", {NULL}, 1698, "udp"}, +{"rsvp-encap-2", {NULL}, 1699, "tcp"}, +{"rsvp-encap-2", {NULL}, 1699, "udp"}, +{"mps-raft", {NULL}, 1700, "tcp"}, +{"mps-raft", {NULL}, 1700, "udp"}, +{"l2f", {NULL}, 1701, "tcp"}, +{"l2f", {NULL}, 1701, "udp"}, +{"l2tp", {NULL}, 1701, "tcp"}, +{"l2tp", {NULL}, 1701, "udp"}, +{"deskshare", {NULL}, 1702, "tcp"}, +{"deskshare", {NULL}, 1702, "udp"}, +{"hb-engine", {NULL}, 1703, "tcp"}, +{"hb-engine", {NULL}, 1703, "udp"}, +{"bcs-broker", {NULL}, 1704, "tcp"}, +{"bcs-broker", {NULL}, 1704, "udp"}, +{"slingshot", {NULL}, 1705, "tcp"}, +{"slingshot", {NULL}, 1705, "udp"}, +{"jetform", {NULL}, 1706, "tcp"}, +{"jetform", {NULL}, 1706, "udp"}, +{"vdmplay", {NULL}, 1707, "tcp"}, +{"vdmplay", {NULL}, 1707, "udp"}, +{"gat-lmd", {NULL}, 1708, "tcp"}, +{"gat-lmd", {NULL}, 1708, "udp"}, +{"centra", {NULL}, 1709, "tcp"}, +{"centra", {NULL}, 1709, "udp"}, +{"impera", {NULL}, 1710, "tcp"}, +{"impera", {NULL}, 1710, "udp"}, +{"pptconference", {NULL}, 1711, "tcp"}, +{"pptconference", {NULL}, 1711, "udp"}, +{"registrar", {NULL}, 1712, "tcp"}, +{"registrar", {NULL}, 1712, "udp"}, +{"conferencetalk", {NULL}, 1713, "tcp"}, +{"conferencetalk", {NULL}, 1713, "udp"}, +{"sesi-lm", {NULL}, 1714, "tcp"}, +{"sesi-lm", {NULL}, 1714, "udp"}, +{"houdini-lm", {NULL}, 1715, "tcp"}, +{"houdini-lm", {NULL}, 1715, "udp"}, +{"xmsg", {NULL}, 1716, "tcp"}, +{"xmsg", {NULL}, 1716, "udp"}, +{"fj-hdnet", {NULL}, 1717, "tcp"}, +{"fj-hdnet", {NULL}, 1717, "udp"}, +{"h323gatedisc", {NULL}, 1718, "tcp"}, +{"h323gatedisc", {NULL}, 1718, "udp"}, +{"h323gatestat", {NULL}, 1719, "tcp"}, +{"h323gatestat", {NULL}, 1719, "udp"}, +{"h323hostcall", {NULL}, 1720, "tcp"}, +{"h323hostcall", {NULL}, 1720, "udp"}, +{"caicci", {NULL}, 1721, "tcp"}, +{"caicci", {NULL}, 1721, "udp"}, +{"hks-lm", {NULL}, 1722, "tcp"}, +{"hks-lm", {NULL}, 1722, "udp"}, +{"pptp", {NULL}, 1723, "tcp"}, +{"pptp", {NULL}, 1723, "udp"}, +{"csbphonemaster", {NULL}, 1724, "tcp"}, +{"csbphonemaster", {NULL}, 1724, "udp"}, +{"iden-ralp", {NULL}, 1725, "tcp"}, +{"iden-ralp", {NULL}, 1725, "udp"}, +{"iberiagames", {NULL}, 1726, "tcp"}, +{"iberiagames", {NULL}, 1726, "udp"}, +{"winddx", {NULL}, 1727, "tcp"}, +{"winddx", {NULL}, 1727, "udp"}, +{"telindus", {NULL}, 1728, "tcp"}, +{"telindus", {NULL}, 1728, "udp"}, +{"citynl", {NULL}, 1729, "tcp"}, +{"citynl", {NULL}, 1729, "udp"}, +{"roketz", {NULL}, 1730, "tcp"}, +{"roketz", {NULL}, 1730, "udp"}, +{"msiccp", {NULL}, 1731, "tcp"}, +{"msiccp", {NULL}, 1731, "udp"}, +{"proxim", {NULL}, 1732, "tcp"}, +{"proxim", {NULL}, 1732, "udp"}, +{"siipat", {NULL}, 1733, "tcp"}, +{"siipat", {NULL}, 1733, "udp"}, +{"cambertx-lm", {NULL}, 1734, "tcp"}, +{"cambertx-lm", {NULL}, 1734, "udp"}, +{"privatechat", {NULL}, 1735, "tcp"}, +{"privatechat", {NULL}, 1735, "udp"}, +{"street-stream", {NULL}, 1736, "tcp"}, +{"street-stream", {NULL}, 1736, "udp"}, +{"ultimad", {NULL}, 1737, "tcp"}, +{"ultimad", {NULL}, 1737, "udp"}, +{"gamegen1", {NULL}, 1738, "tcp"}, +{"gamegen1", {NULL}, 1738, "udp"}, +{"webaccess", {NULL}, 1739, "tcp"}, +{"webaccess", {NULL}, 1739, "udp"}, +{"encore", {NULL}, 1740, "tcp"}, +{"encore", {NULL}, 1740, "udp"}, +{"cisco-net-mgmt", {NULL}, 1741, "tcp"}, +{"cisco-net-mgmt", {NULL}, 1741, "udp"}, +{"3Com-nsd", {NULL}, 1742, "tcp"}, +{"3Com-nsd", {NULL}, 1742, "udp"}, +{"cinegrfx-lm", {NULL}, 1743, "tcp"}, +{"cinegrfx-lm", {NULL}, 1743, "udp"}, +{"ncpm-ft", {NULL}, 1744, "tcp"}, +{"ncpm-ft", {NULL}, 1744, "udp"}, +{"remote-winsock", {NULL}, 1745, "tcp"}, +{"remote-winsock", {NULL}, 1745, "udp"}, +{"ftrapid-1", {NULL}, 1746, "tcp"}, +{"ftrapid-1", {NULL}, 1746, "udp"}, +{"ftrapid-2", {NULL}, 1747, "tcp"}, +{"ftrapid-2", {NULL}, 1747, "udp"}, +{"oracle-em1", {NULL}, 1748, "tcp"}, +{"oracle-em1", {NULL}, 1748, "udp"}, +{"aspen-services", {NULL}, 1749, "tcp"}, +{"aspen-services", {NULL}, 1749, "udp"}, +{"sslp", {NULL}, 1750, "tcp"}, +{"sslp", {NULL}, 1750, "udp"}, +{"swiftnet", {NULL}, 1751, "tcp"}, +{"swiftnet", {NULL}, 1751, "udp"}, +{"lofr-lm", {NULL}, 1752, "tcp"}, +{"lofr-lm", {NULL}, 1752, "udp"}, +{"oracle-em2", {NULL}, 1754, "tcp"}, +{"oracle-em2", {NULL}, 1754, "udp"}, +{"ms-streaming", {NULL}, 1755, "tcp"}, +{"ms-streaming", {NULL}, 1755, "udp"}, +{"capfast-lmd", {NULL}, 1756, "tcp"}, +{"capfast-lmd", {NULL}, 1756, "udp"}, +{"cnhrp", {NULL}, 1757, "tcp"}, +{"cnhrp", {NULL}, 1757, "udp"}, +{"tftp-mcast", {NULL}, 1758, "tcp"}, +{"tftp-mcast", {NULL}, 1758, "udp"}, +{"spss-lm", {NULL}, 1759, "tcp"}, +{"spss-lm", {NULL}, 1759, "udp"}, +{"www-ldap-gw", {NULL}, 1760, "tcp"}, +{"www-ldap-gw", {NULL}, 1760, "udp"}, +{"cft-0", {NULL}, 1761, "tcp"}, +{"cft-0", {NULL}, 1761, "udp"}, +{"cft-1", {NULL}, 1762, "tcp"}, +{"cft-1", {NULL}, 1762, "udp"}, +{"cft-2", {NULL}, 1763, "tcp"}, +{"cft-2", {NULL}, 1763, "udp"}, +{"cft-3", {NULL}, 1764, "tcp"}, +{"cft-3", {NULL}, 1764, "udp"}, +{"cft-4", {NULL}, 1765, "tcp"}, +{"cft-4", {NULL}, 1765, "udp"}, +{"cft-5", {NULL}, 1766, "tcp"}, +{"cft-5", {NULL}, 1766, "udp"}, +{"cft-6", {NULL}, 1767, "tcp"}, +{"cft-6", {NULL}, 1767, "udp"}, +{"cft-7", {NULL}, 1768, "tcp"}, +{"cft-7", {NULL}, 1768, "udp"}, +{"bmc-net-adm", {NULL}, 1769, "tcp"}, +{"bmc-net-adm", {NULL}, 1769, "udp"}, +{"bmc-net-svc", {NULL}, 1770, "tcp"}, +{"bmc-net-svc", {NULL}, 1770, "udp"}, +{"vaultbase", {NULL}, 1771, "tcp"}, +{"vaultbase", {NULL}, 1771, "udp"}, +{"essweb-gw", {NULL}, 1772, "tcp"}, +{"essweb-gw", {NULL}, 1772, "udp"}, +{"kmscontrol", {NULL}, 1773, "tcp"}, +{"kmscontrol", {NULL}, 1773, "udp"}, +{"global-dtserv", {NULL}, 1774, "tcp"}, +{"global-dtserv", {NULL}, 1774, "udp"}, +{"femis", {NULL}, 1776, "tcp"}, +{"femis", {NULL}, 1776, "udp"}, +{"powerguardian", {NULL}, 1777, "tcp"}, +{"powerguardian", {NULL}, 1777, "udp"}, +{"prodigy-intrnet", {NULL}, 1778, "tcp"}, +{"prodigy-intrnet", {NULL}, 1778, "udp"}, +{"pharmasoft", {NULL}, 1779, "tcp"}, +{"pharmasoft", {NULL}, 1779, "udp"}, +{"dpkeyserv", {NULL}, 1780, "tcp"}, +{"dpkeyserv", {NULL}, 1780, "udp"}, +{"answersoft-lm", {NULL}, 1781, "tcp"}, +{"answersoft-lm", {NULL}, 1781, "udp"}, +{"hp-hcip", {NULL}, 1782, "tcp"}, +{"hp-hcip", {NULL}, 1782, "udp"}, +{"finle-lm", {NULL}, 1784, "tcp"}, +{"finle-lm", {NULL}, 1784, "udp"}, +{"windlm", {NULL}, 1785, "tcp"}, +{"windlm", {NULL}, 1785, "udp"}, +{"funk-logger", {NULL}, 1786, "tcp"}, +{"funk-logger", {NULL}, 1786, "udp"}, +{"funk-license", {NULL}, 1787, "tcp"}, +{"funk-license", {NULL}, 1787, "udp"}, +{"psmond", {NULL}, 1788, "tcp"}, +{"psmond", {NULL}, 1788, "udp"}, +{"hello", {NULL}, 1789, "tcp"}, +{"hello", {NULL}, 1789, "udp"}, +{"nmsp", {NULL}, 1790, "tcp"}, +{"nmsp", {NULL}, 1790, "udp"}, +{"ea1", {NULL}, 1791, "tcp"}, +{"ea1", {NULL}, 1791, "udp"}, +{"ibm-dt-2", {NULL}, 1792, "tcp"}, +{"ibm-dt-2", {NULL}, 1792, "udp"}, +{"rsc-robot", {NULL}, 1793, "tcp"}, +{"rsc-robot", {NULL}, 1793, "udp"}, +{"cera-bcm", {NULL}, 1794, "tcp"}, +{"cera-bcm", {NULL}, 1794, "udp"}, +{"dpi-proxy", {NULL}, 1795, "tcp"}, +{"dpi-proxy", {NULL}, 1795, "udp"}, +{"vocaltec-admin", {NULL}, 1796, "tcp"}, +{"vocaltec-admin", {NULL}, 1796, "udp"}, +{"uma", {NULL}, 1797, "tcp"}, +{"uma", {NULL}, 1797, "udp"}, +{"etp", {NULL}, 1798, "tcp"}, +{"etp", {NULL}, 1798, "udp"}, +{"netrisk", {NULL}, 1799, "tcp"}, +{"netrisk", {NULL}, 1799, "udp"}, +{"ansys-lm", {NULL}, 1800, "tcp"}, +{"ansys-lm", {NULL}, 1800, "udp"}, +{"msmq", {NULL}, 1801, "tcp"}, +{"msmq", {NULL}, 1801, "udp"}, +{"concomp1", {NULL}, 1802, "tcp"}, +{"concomp1", {NULL}, 1802, "udp"}, +{"hp-hcip-gwy", {NULL}, 1803, "tcp"}, +{"hp-hcip-gwy", {NULL}, 1803, "udp"}, +{"enl", {NULL}, 1804, "tcp"}, +{"enl", {NULL}, 1804, "udp"}, +{"enl-name", {NULL}, 1805, "tcp"}, +{"enl-name", {NULL}, 1805, "udp"}, +{"musiconline", {NULL}, 1806, "tcp"}, +{"musiconline", {NULL}, 1806, "udp"}, +{"fhsp", {NULL}, 1807, "tcp"}, +{"fhsp", {NULL}, 1807, "udp"}, +{"oracle-vp2", {NULL}, 1808, "tcp"}, +{"oracle-vp2", {NULL}, 1808, "udp"}, +{"oracle-vp1", {NULL}, 1809, "tcp"}, +{"oracle-vp1", {NULL}, 1809, "udp"}, +{"jerand-lm", {NULL}, 1810, "tcp"}, +{"jerand-lm", {NULL}, 1810, "udp"}, +{"scientia-sdb", {NULL}, 1811, "tcp"}, +{"scientia-sdb", {NULL}, 1811, "udp"}, +{"radius", {NULL}, 1812, "tcp"}, +{"radius", {NULL}, 1812, "udp"}, +{"radius-acct", {NULL}, 1813, "tcp"}, +{"radius-acct", {NULL}, 1813, "udp"}, +{"tdp-suite", {NULL}, 1814, "tcp"}, +{"tdp-suite", {NULL}, 1814, "udp"}, +{"mmpft", {NULL}, 1815, "tcp"}, +{"mmpft", {NULL}, 1815, "udp"}, +{"harp", {NULL}, 1816, "tcp"}, +{"harp", {NULL}, 1816, "udp"}, +{"rkb-oscs", {NULL}, 1817, "tcp"}, +{"rkb-oscs", {NULL}, 1817, "udp"}, +{"etftp", {NULL}, 1818, "tcp"}, +{"etftp", {NULL}, 1818, "udp"}, +{"plato-lm", {NULL}, 1819, "tcp"}, +{"plato-lm", {NULL}, 1819, "udp"}, +{"mcagent", {NULL}, 1820, "tcp"}, +{"mcagent", {NULL}, 1820, "udp"}, +{"donnyworld", {NULL}, 1821, "tcp"}, +{"donnyworld", {NULL}, 1821, "udp"}, +{"es-elmd", {NULL}, 1822, "tcp"}, +{"es-elmd", {NULL}, 1822, "udp"}, +{"unisys-lm", {NULL}, 1823, "tcp"}, +{"unisys-lm", {NULL}, 1823, "udp"}, +{"metrics-pas", {NULL}, 1824, "tcp"}, +{"metrics-pas", {NULL}, 1824, "udp"}, +{"direcpc-video", {NULL}, 1825, "tcp"}, +{"direcpc-video", {NULL}, 1825, "udp"}, +{"ardt", {NULL}, 1826, "tcp"}, +{"ardt", {NULL}, 1826, "udp"}, +{"asi", {NULL}, 1827, "tcp"}, +{"asi", {NULL}, 1827, "udp"}, +{"itm-mcell-u", {NULL}, 1828, "tcp"}, +{"itm-mcell-u", {NULL}, 1828, "udp"}, +{"optika-emedia", {NULL}, 1829, "tcp"}, +{"optika-emedia", {NULL}, 1829, "udp"}, +{"net8-cman", {NULL}, 1830, "tcp"}, +{"net8-cman", {NULL}, 1830, "udp"}, +{"myrtle", {NULL}, 1831, "tcp"}, +{"myrtle", {NULL}, 1831, "udp"}, +{"tht-treasure", {NULL}, 1832, "tcp"}, +{"tht-treasure", {NULL}, 1832, "udp"}, +{"udpradio", {NULL}, 1833, "tcp"}, +{"udpradio", {NULL}, 1833, "udp"}, +{"ardusuni", {NULL}, 1834, "tcp"}, +{"ardusuni", {NULL}, 1834, "udp"}, +{"ardusmul", {NULL}, 1835, "tcp"}, +{"ardusmul", {NULL}, 1835, "udp"}, +{"ste-smsc", {NULL}, 1836, "tcp"}, +{"ste-smsc", {NULL}, 1836, "udp"}, +{"csoft1", {NULL}, 1837, "tcp"}, +{"csoft1", {NULL}, 1837, "udp"}, +{"talnet", {NULL}, 1838, "tcp"}, +{"talnet", {NULL}, 1838, "udp"}, +{"netopia-vo1", {NULL}, 1839, "tcp"}, +{"netopia-vo1", {NULL}, 1839, "udp"}, +{"netopia-vo2", {NULL}, 1840, "tcp"}, +{"netopia-vo2", {NULL}, 1840, "udp"}, +{"netopia-vo3", {NULL}, 1841, "tcp"}, +{"netopia-vo3", {NULL}, 1841, "udp"}, +{"netopia-vo4", {NULL}, 1842, "tcp"}, +{"netopia-vo4", {NULL}, 1842, "udp"}, +{"netopia-vo5", {NULL}, 1843, "tcp"}, +{"netopia-vo5", {NULL}, 1843, "udp"}, +{"direcpc-dll", {NULL}, 1844, "tcp"}, +{"direcpc-dll", {NULL}, 1844, "udp"}, +{"altalink", {NULL}, 1845, "tcp"}, +{"altalink", {NULL}, 1845, "udp"}, +{"tunstall-pnc", {NULL}, 1846, "tcp"}, +{"tunstall-pnc", {NULL}, 1846, "udp"}, +{"slp-notify", {NULL}, 1847, "tcp"}, +{"slp-notify", {NULL}, 1847, "udp"}, +{"fjdocdist", {NULL}, 1848, "tcp"}, +{"fjdocdist", {NULL}, 1848, "udp"}, +{"alpha-sms", {NULL}, 1849, "tcp"}, +{"alpha-sms", {NULL}, 1849, "udp"}, +{"gsi", {NULL}, 1850, "tcp"}, +{"gsi", {NULL}, 1850, "udp"}, +{"ctcd", {NULL}, 1851, "tcp"}, +{"ctcd", {NULL}, 1851, "udp"}, +{"virtual-time", {NULL}, 1852, "tcp"}, +{"virtual-time", {NULL}, 1852, "udp"}, +{"vids-avtp", {NULL}, 1853, "tcp"}, +{"vids-avtp", {NULL}, 1853, "udp"}, +{"buddy-draw", {NULL}, 1854, "tcp"}, +{"buddy-draw", {NULL}, 1854, "udp"}, +{"fiorano-rtrsvc", {NULL}, 1855, "tcp"}, +{"fiorano-rtrsvc", {NULL}, 1855, "udp"}, +{"fiorano-msgsvc", {NULL}, 1856, "tcp"}, +{"fiorano-msgsvc", {NULL}, 1856, "udp"}, +{"datacaptor", {NULL}, 1857, "tcp"}, +{"datacaptor", {NULL}, 1857, "udp"}, +{"privateark", {NULL}, 1858, "tcp"}, +{"privateark", {NULL}, 1858, "udp"}, +{"gammafetchsvr", {NULL}, 1859, "tcp"}, +{"gammafetchsvr", {NULL}, 1859, "udp"}, +{"sunscalar-svc", {NULL}, 1860, "tcp"}, +{"sunscalar-svc", {NULL}, 1860, "udp"}, +{"lecroy-vicp", {NULL}, 1861, "tcp"}, +{"lecroy-vicp", {NULL}, 1861, "udp"}, +{"mysql-cm-agent", {NULL}, 1862, "tcp"}, +{"mysql-cm-agent", {NULL}, 1862, "udp"}, +{"msnp", {NULL}, 1863, "tcp"}, +{"msnp", {NULL}, 1863, "udp"}, +{"paradym-31port", {NULL}, 1864, "tcp"}, +{"paradym-31port", {NULL}, 1864, "udp"}, +{"entp", {NULL}, 1865, "tcp"}, +{"entp", {NULL}, 1865, "udp"}, +{"swrmi", {NULL}, 1866, "tcp"}, +{"swrmi", {NULL}, 1866, "udp"}, +{"udrive", {NULL}, 1867, "tcp"}, +{"udrive", {NULL}, 1867, "udp"}, +{"viziblebrowser", {NULL}, 1868, "tcp"}, +{"viziblebrowser", {NULL}, 1868, "udp"}, +{"transact", {NULL}, 1869, "tcp"}, +{"transact", {NULL}, 1869, "udp"}, +{"sunscalar-dns", {NULL}, 1870, "tcp"}, +{"sunscalar-dns", {NULL}, 1870, "udp"}, +{"canocentral0", {NULL}, 1871, "tcp"}, +{"canocentral0", {NULL}, 1871, "udp"}, +{"canocentral1", {NULL}, 1872, "tcp"}, +{"canocentral1", {NULL}, 1872, "udp"}, +{"fjmpjps", {NULL}, 1873, "tcp"}, +{"fjmpjps", {NULL}, 1873, "udp"}, +{"fjswapsnp", {NULL}, 1874, "tcp"}, +{"fjswapsnp", {NULL}, 1874, "udp"}, +{"westell-stats", {NULL}, 1875, "tcp"}, +{"westell-stats", {NULL}, 1875, "udp"}, +{"ewcappsrv", {NULL}, 1876, "tcp"}, +{"ewcappsrv", {NULL}, 1876, "udp"}, +{"hp-webqosdb", {NULL}, 1877, "tcp"}, +{"hp-webqosdb", {NULL}, 1877, "udp"}, +{"drmsmc", {NULL}, 1878, "tcp"}, +{"drmsmc", {NULL}, 1878, "udp"}, +{"nettgain-nms", {NULL}, 1879, "tcp"}, +{"nettgain-nms", {NULL}, 1879, "udp"}, +{"vsat-control", {NULL}, 1880, "tcp"}, +{"vsat-control", {NULL}, 1880, "udp"}, +{"ibm-mqseries2", {NULL}, 1881, "tcp"}, +{"ibm-mqseries2", {NULL}, 1881, "udp"}, +{"ecsqdmn", {NULL}, 1882, "tcp"}, +{"ecsqdmn", {NULL}, 1882, "udp"}, +{"ibm-mqisdp", {NULL}, 1883, "tcp"}, +{"ibm-mqisdp", {NULL}, 1883, "udp"}, +{"idmaps", {NULL}, 1884, "tcp"}, +{"idmaps", {NULL}, 1884, "udp"}, +{"vrtstrapserver", {NULL}, 1885, "tcp"}, +{"vrtstrapserver", {NULL}, 1885, "udp"}, +{"leoip", {NULL}, 1886, "tcp"}, +{"leoip", {NULL}, 1886, "udp"}, +{"filex-lport", {NULL}, 1887, "tcp"}, +{"filex-lport", {NULL}, 1887, "udp"}, +{"ncconfig", {NULL}, 1888, "tcp"}, +{"ncconfig", {NULL}, 1888, "udp"}, +{"unify-adapter", {NULL}, 1889, "tcp"}, +{"unify-adapter", {NULL}, 1889, "udp"}, +{"wilkenlistener", {NULL}, 1890, "tcp"}, +{"wilkenlistener", {NULL}, 1890, "udp"}, +{"childkey-notif", {NULL}, 1891, "tcp"}, +{"childkey-notif", {NULL}, 1891, "udp"}, +{"childkey-ctrl", {NULL}, 1892, "tcp"}, +{"childkey-ctrl", {NULL}, 1892, "udp"}, +{"elad", {NULL}, 1893, "tcp"}, +{"elad", {NULL}, 1893, "udp"}, +{"o2server-port", {NULL}, 1894, "tcp"}, +{"o2server-port", {NULL}, 1894, "udp"}, +{"b-novative-ls", {NULL}, 1896, "tcp"}, +{"b-novative-ls", {NULL}, 1896, "udp"}, +{"metaagent", {NULL}, 1897, "tcp"}, +{"metaagent", {NULL}, 1897, "udp"}, +{"cymtec-port", {NULL}, 1898, "tcp"}, +{"cymtec-port", {NULL}, 1898, "udp"}, +{"mc2studios", {NULL}, 1899, "tcp"}, +{"mc2studios", {NULL}, 1899, "udp"}, +{"ssdp", {NULL}, 1900, "tcp"}, +{"ssdp", {NULL}, 1900, "udp"}, +{"fjicl-tep-a", {NULL}, 1901, "tcp"}, +{"fjicl-tep-a", {NULL}, 1901, "udp"}, +{"fjicl-tep-b", {NULL}, 1902, "tcp"}, +{"fjicl-tep-b", {NULL}, 1902, "udp"}, +{"linkname", {NULL}, 1903, "tcp"}, +{"linkname", {NULL}, 1903, "udp"}, +{"fjicl-tep-c", {NULL}, 1904, "tcp"}, +{"fjicl-tep-c", {NULL}, 1904, "udp"}, +{"sugp", {NULL}, 1905, "tcp"}, +{"sugp", {NULL}, 1905, "udp"}, +{"tpmd", {NULL}, 1906, "tcp"}, +{"tpmd", {NULL}, 1906, "udp"}, +{"intrastar", {NULL}, 1907, "tcp"}, +{"intrastar", {NULL}, 1907, "udp"}, +{"dawn", {NULL}, 1908, "tcp"}, +{"dawn", {NULL}, 1908, "udp"}, +{"global-wlink", {NULL}, 1909, "tcp"}, +{"global-wlink", {NULL}, 1909, "udp"}, +{"ultrabac", {NULL}, 1910, "tcp"}, +{"ultrabac", {NULL}, 1910, "udp"}, +{"mtp", {NULL}, 1911, "tcp"}, +{"mtp", {NULL}, 1911, "udp"}, +{"rhp-iibp", {NULL}, 1912, "tcp"}, +{"rhp-iibp", {NULL}, 1912, "udp"}, +{"armadp", {NULL}, 1913, "tcp"}, +{"armadp", {NULL}, 1913, "udp"}, +{"elm-momentum", {NULL}, 1914, "tcp"}, +{"elm-momentum", {NULL}, 1914, "udp"}, +{"facelink", {NULL}, 1915, "tcp"}, +{"facelink", {NULL}, 1915, "udp"}, +{"persona", {NULL}, 1916, "tcp"}, +{"persona", {NULL}, 1916, "udp"}, +{"noagent", {NULL}, 1917, "tcp"}, +{"noagent", {NULL}, 1917, "udp"}, +{"can-nds", {NULL}, 1918, "tcp"}, +{"can-nds", {NULL}, 1918, "udp"}, +{"can-dch", {NULL}, 1919, "tcp"}, +{"can-dch", {NULL}, 1919, "udp"}, +{"can-ferret", {NULL}, 1920, "tcp"}, +{"can-ferret", {NULL}, 1920, "udp"}, +{"noadmin", {NULL}, 1921, "tcp"}, +{"noadmin", {NULL}, 1921, "udp"}, +{"tapestry", {NULL}, 1922, "tcp"}, +{"tapestry", {NULL}, 1922, "udp"}, +{"spice", {NULL}, 1923, "tcp"}, +{"spice", {NULL}, 1923, "udp"}, +{"xiip", {NULL}, 1924, "tcp"}, +{"xiip", {NULL}, 1924, "udp"}, +{"discovery-port", {NULL}, 1925, "tcp"}, +{"discovery-port", {NULL}, 1925, "udp"}, +{"egs", {NULL}, 1926, "tcp"}, +{"egs", {NULL}, 1926, "udp"}, +{"videte-cipc", {NULL}, 1927, "tcp"}, +{"videte-cipc", {NULL}, 1927, "udp"}, +{"emsd-port", {NULL}, 1928, "tcp"}, +{"emsd-port", {NULL}, 1928, "udp"}, +{"bandwiz-system", {NULL}, 1929, "tcp"}, +{"bandwiz-system", {NULL}, 1929, "udp"}, +{"driveappserver", {NULL}, 1930, "tcp"}, +{"driveappserver", {NULL}, 1930, "udp"}, +{"amdsched", {NULL}, 1931, "tcp"}, +{"amdsched", {NULL}, 1931, "udp"}, +{"ctt-broker", {NULL}, 1932, "tcp"}, +{"ctt-broker", {NULL}, 1932, "udp"}, +{"xmapi", {NULL}, 1933, "tcp"}, +{"xmapi", {NULL}, 1933, "udp"}, +{"xaapi", {NULL}, 1934, "tcp"}, +{"xaapi", {NULL}, 1934, "udp"}, +{"macromedia-fcs", {NULL}, 1935, "tcp"}, +{"macromedia-fcs", {NULL}, 1935, "udp"}, +{"jetcmeserver", {NULL}, 1936, "tcp"}, +{"jetcmeserver", {NULL}, 1936, "udp"}, +{"jwserver", {NULL}, 1937, "tcp"}, +{"jwserver", {NULL}, 1937, "udp"}, +{"jwclient", {NULL}, 1938, "tcp"}, +{"jwclient", {NULL}, 1938, "udp"}, +{"jvserver", {NULL}, 1939, "tcp"}, +{"jvserver", {NULL}, 1939, "udp"}, +{"jvclient", {NULL}, 1940, "tcp"}, +{"jvclient", {NULL}, 1940, "udp"}, +{"dic-aida", {NULL}, 1941, "tcp"}, +{"dic-aida", {NULL}, 1941, "udp"}, +{"res", {NULL}, 1942, "tcp"}, +{"res", {NULL}, 1942, "udp"}, +{"beeyond-media", {NULL}, 1943, "tcp"}, +{"beeyond-media", {NULL}, 1943, "udp"}, +{"close-combat", {NULL}, 1944, "tcp"}, +{"close-combat", {NULL}, 1944, "udp"}, +{"dialogic-elmd", {NULL}, 1945, "tcp"}, +{"dialogic-elmd", {NULL}, 1945, "udp"}, +{"tekpls", {NULL}, 1946, "tcp"}, +{"tekpls", {NULL}, 1946, "udp"}, +{"sentinelsrm", {NULL}, 1947, "tcp"}, +{"sentinelsrm", {NULL}, 1947, "udp"}, +{"eye2eye", {NULL}, 1948, "tcp"}, +{"eye2eye", {NULL}, 1948, "udp"}, +{"ismaeasdaqlive", {NULL}, 1949, "tcp"}, +{"ismaeasdaqlive", {NULL}, 1949, "udp"}, +{"ismaeasdaqtest", {NULL}, 1950, "tcp"}, +{"ismaeasdaqtest", {NULL}, 1950, "udp"}, +{"bcs-lmserver", {NULL}, 1951, "tcp"}, +{"bcs-lmserver", {NULL}, 1951, "udp"}, +{"mpnjsc", {NULL}, 1952, "tcp"}, +{"mpnjsc", {NULL}, 1952, "udp"}, +{"rapidbase", {NULL}, 1953, "tcp"}, +{"rapidbase", {NULL}, 1953, "udp"}, +{"abr-api", {NULL}, 1954, "tcp"}, +{"abr-api", {NULL}, 1954, "udp"}, +{"abr-secure", {NULL}, 1955, "tcp"}, +{"abr-secure", {NULL}, 1955, "udp"}, +{"vrtl-vmf-ds", {NULL}, 1956, "tcp"}, +{"vrtl-vmf-ds", {NULL}, 1956, "udp"}, +{"unix-status", {NULL}, 1957, "tcp"}, +{"unix-status", {NULL}, 1957, "udp"}, +{"dxadmind", {NULL}, 1958, "tcp"}, +{"dxadmind", {NULL}, 1958, "udp"}, +{"simp-all", {NULL}, 1959, "tcp"}, +{"simp-all", {NULL}, 1959, "udp"}, +{"nasmanager", {NULL}, 1960, "tcp"}, +{"nasmanager", {NULL}, 1960, "udp"}, +{"bts-appserver", {NULL}, 1961, "tcp"}, +{"bts-appserver", {NULL}, 1961, "udp"}, +{"biap-mp", {NULL}, 1962, "tcp"}, +{"biap-mp", {NULL}, 1962, "udp"}, +{"webmachine", {NULL}, 1963, "tcp"}, +{"webmachine", {NULL}, 1963, "udp"}, +{"solid-e-engine", {NULL}, 1964, "tcp"}, +{"solid-e-engine", {NULL}, 1964, "udp"}, +{"tivoli-npm", {NULL}, 1965, "tcp"}, +{"tivoli-npm", {NULL}, 1965, "udp"}, +{"slush", {NULL}, 1966, "tcp"}, +{"slush", {NULL}, 1966, "udp"}, +{"sns-quote", {NULL}, 1967, "tcp"}, +{"sns-quote", {NULL}, 1967, "udp"}, +{"lipsinc", {NULL}, 1968, "tcp"}, +{"lipsinc", {NULL}, 1968, "udp"}, +{"lipsinc1", {NULL}, 1969, "tcp"}, +{"lipsinc1", {NULL}, 1969, "udp"}, +{"netop-rc", {NULL}, 1970, "tcp"}, +{"netop-rc", {NULL}, 1970, "udp"}, +{"netop-school", {NULL}, 1971, "tcp"}, +{"netop-school", {NULL}, 1971, "udp"}, +{"intersys-cache", {NULL}, 1972, "tcp"}, +{"intersys-cache", {NULL}, 1972, "udp"}, +{"dlsrap", {NULL}, 1973, "tcp"}, +{"dlsrap", {NULL}, 1973, "udp"}, +{"drp", {NULL}, 1974, "tcp"}, +{"drp", {NULL}, 1974, "udp"}, +{"tcoflashagent", {NULL}, 1975, "tcp"}, +{"tcoflashagent", {NULL}, 1975, "udp"}, +{"tcoregagent", {NULL}, 1976, "tcp"}, +{"tcoregagent", {NULL}, 1976, "udp"}, +{"tcoaddressbook", {NULL}, 1977, "tcp"}, +{"tcoaddressbook", {NULL}, 1977, "udp"}, +{"unisql", {NULL}, 1978, "tcp"}, +{"unisql", {NULL}, 1978, "udp"}, +{"unisql-java", {NULL}, 1979, "tcp"}, +{"unisql-java", {NULL}, 1979, "udp"}, +{"pearldoc-xact", {NULL}, 1980, "tcp"}, +{"pearldoc-xact", {NULL}, 1980, "udp"}, +{"p2pq", {NULL}, 1981, "tcp"}, +{"p2pq", {NULL}, 1981, "udp"}, +{"estamp", {NULL}, 1982, "tcp"}, +{"estamp", {NULL}, 1982, "udp"}, +{"lhtp", {NULL}, 1983, "tcp"}, +{"lhtp", {NULL}, 1983, "udp"}, +{"bb", {NULL}, 1984, "tcp"}, +{"bb", {NULL}, 1984, "udp"}, +{"hsrp", {NULL}, 1985, "tcp"}, +{"hsrp", {NULL}, 1985, "udp"}, +{"licensedaemon", {NULL}, 1986, "tcp"}, +{"licensedaemon", {NULL}, 1986, "udp"}, +{"tr-rsrb-p1", {NULL}, 1987, "tcp"}, +{"tr-rsrb-p1", {NULL}, 1987, "udp"}, +{"tr-rsrb-p2", {NULL}, 1988, "tcp"}, +{"tr-rsrb-p2", {NULL}, 1988, "udp"}, +{"tr-rsrb-p3", {NULL}, 1989, "tcp"}, +{"tr-rsrb-p3", {NULL}, 1989, "udp"}, +{"mshnet", {NULL}, 1989, "tcp"}, +{"mshnet", {NULL}, 1989, "udp"}, +{"stun-p1", {NULL}, 1990, "tcp"}, +{"stun-p1", {NULL}, 1990, "udp"}, +{"stun-p2", {NULL}, 1991, "tcp"}, +{"stun-p2", {NULL}, 1991, "udp"}, +{"stun-p3", {NULL}, 1992, "tcp"}, +{"stun-p3", {NULL}, 1992, "udp"}, +{"ipsendmsg", {NULL}, 1992, "tcp"}, +{"ipsendmsg", {NULL}, 1992, "udp"}, +{"snmp-tcp-port", {NULL}, 1993, "tcp"}, +{"snmp-tcp-port", {NULL}, 1993, "udp"}, +{"stun-port", {NULL}, 1994, "tcp"}, +{"stun-port", {NULL}, 1994, "udp"}, +{"perf-port", {NULL}, 1995, "tcp"}, +{"perf-port", {NULL}, 1995, "udp"}, +{"tr-rsrb-port", {NULL}, 1996, "tcp"}, +{"tr-rsrb-port", {NULL}, 1996, "udp"}, +{"gdp-port", {NULL}, 1997, "tcp"}, +{"gdp-port", {NULL}, 1997, "udp"}, +{"x25-svc-port", {NULL}, 1998, "tcp"}, +{"x25-svc-port", {NULL}, 1998, "udp"}, +{"tcp-id-port", {NULL}, 1999, "tcp"}, +{"tcp-id-port", {NULL}, 1999, "udp"}, +{"cisco-sccp", {NULL}, 2000, "tcp"}, +{"cisco-sccp", {NULL}, 2000, "udp"}, +{"dc", {NULL}, 2001, "tcp"}, +{"wizard", {NULL}, 2001, "udp"}, +{"globe", {NULL}, 2002, "tcp"}, +{"globe", {NULL}, 2002, "udp"}, +{"brutus", {NULL}, 2003, "tcp"}, +{"brutus", {NULL}, 2003, "udp"}, +{"mailbox", {NULL}, 2004, "tcp"}, +{"emce", {NULL}, 2004, "udp"}, +{"berknet", {NULL}, 2005, "tcp"}, +{"oracle", {NULL}, 2005, "udp"}, +{"invokator", {NULL}, 2006, "tcp"}, +{"raid-cd", {NULL}, 2006, "udp"}, +{"dectalk", {NULL}, 2007, "tcp"}, +{"raid-am", {NULL}, 2007, "udp"}, +{"conf", {NULL}, 2008, "tcp"}, +{"terminaldb", {NULL}, 2008, "udp"}, +{"news", {NULL}, 2009, "tcp"}, +{"whosockami", {NULL}, 2009, "udp"}, +{"search", {NULL}, 2010, "tcp"}, +{"pipe_server", {NULL}, 2010, "udp"}, +{"raid-cc", {NULL}, 2011, "tcp"}, +{"servserv", {NULL}, 2011, "udp"}, +{"ttyinfo", {NULL}, 2012, "tcp"}, +{"raid-ac", {NULL}, 2012, "udp"}, +{"raid-am", {NULL}, 2013, "tcp"}, +{"raid-cd", {NULL}, 2013, "udp"}, +{"troff", {NULL}, 2014, "tcp"}, +{"raid-sf", {NULL}, 2014, "udp"}, +{"cypress", {NULL}, 2015, "tcp"}, +{"raid-cs", {NULL}, 2015, "udp"}, +{"bootserver", {NULL}, 2016, "tcp"}, +{"bootserver", {NULL}, 2016, "udp"}, +{"cypress-stat", {NULL}, 2017, "tcp"}, +{"bootclient", {NULL}, 2017, "udp"}, +{"terminaldb", {NULL}, 2018, "tcp"}, +{"rellpack", {NULL}, 2018, "udp"}, +{"whosockami", {NULL}, 2019, "tcp"}, +{"about", {NULL}, 2019, "udp"}, +{"xinupageserver", {NULL}, 2020, "tcp"}, +{"xinupageserver", {NULL}, 2020, "udp"}, +{"servexec", {NULL}, 2021, "tcp"}, +{"xinuexpansion1", {NULL}, 2021, "udp"}, +{"down", {NULL}, 2022, "tcp"}, +{"xinuexpansion2", {NULL}, 2022, "udp"}, +{"xinuexpansion3", {NULL}, 2023, "tcp"}, +{"xinuexpansion3", {NULL}, 2023, "udp"}, +{"xinuexpansion4", {NULL}, 2024, "tcp"}, +{"xinuexpansion4", {NULL}, 2024, "udp"}, +{"ellpack", {NULL}, 2025, "tcp"}, +{"xribs", {NULL}, 2025, "udp"}, +{"scrabble", {NULL}, 2026, "tcp"}, +{"scrabble", {NULL}, 2026, "udp"}, +{"shadowserver", {NULL}, 2027, "tcp"}, +{"shadowserver", {NULL}, 2027, "udp"}, +{"submitserver", {NULL}, 2028, "tcp"}, +{"submitserver", {NULL}, 2028, "udp"}, +{"hsrpv6", {NULL}, 2029, "tcp"}, +{"hsrpv6", {NULL}, 2029, "udp"}, +{"device2", {NULL}, 2030, "tcp"}, +{"device2", {NULL}, 2030, "udp"}, +{"mobrien-chat", {NULL}, 2031, "tcp"}, +{"mobrien-chat", {NULL}, 2031, "udp"}, +{"blackboard", {NULL}, 2032, "tcp"}, +{"blackboard", {NULL}, 2032, "udp"}, +{"glogger", {NULL}, 2033, "tcp"}, +{"glogger", {NULL}, 2033, "udp"}, +{"scoremgr", {NULL}, 2034, "tcp"}, +{"scoremgr", {NULL}, 2034, "udp"}, +{"imsldoc", {NULL}, 2035, "tcp"}, +{"imsldoc", {NULL}, 2035, "udp"}, +{"e-dpnet", {NULL}, 2036, "tcp"}, +{"e-dpnet", {NULL}, 2036, "udp"}, +{"applus", {NULL}, 2037, "tcp"}, +{"applus", {NULL}, 2037, "udp"}, +{"objectmanager", {NULL}, 2038, "tcp"}, +{"objectmanager", {NULL}, 2038, "udp"}, +{"prizma", {NULL}, 2039, "tcp"}, +{"prizma", {NULL}, 2039, "udp"}, +{"lam", {NULL}, 2040, "tcp"}, +{"lam", {NULL}, 2040, "udp"}, +{"interbase", {NULL}, 2041, "tcp"}, +{"interbase", {NULL}, 2041, "udp"}, +{"isis", {NULL}, 2042, "tcp"}, +{"isis", {NULL}, 2042, "udp"}, +{"isis-bcast", {NULL}, 2043, "tcp"}, +{"isis-bcast", {NULL}, 2043, "udp"}, +{"rimsl", {NULL}, 2044, "tcp"}, +{"rimsl", {NULL}, 2044, "udp"}, +{"cdfunc", {NULL}, 2045, "tcp"}, +{"cdfunc", {NULL}, 2045, "udp"}, +{"sdfunc", {NULL}, 2046, "tcp"}, +{"sdfunc", {NULL}, 2046, "udp"}, +{"dls", {NULL}, 2047, "tcp"}, +{"dls", {NULL}, 2047, "udp"}, +{"dls-monitor", {NULL}, 2048, "tcp"}, +{"dls-monitor", {NULL}, 2048, "udp"}, +{"shilp", {NULL}, 2049, "tcp"}, +{"shilp", {NULL}, 2049, "udp"}, +{"nfs", {NULL}, 2049, "tcp"}, +{"nfs", {NULL}, 2049, "udp"}, +{"nfs", {NULL}, 2049, "sctp"}, +{"av-emb-config", {NULL}, 2050, "tcp"}, +{"av-emb-config", {NULL}, 2050, "udp"}, +{"epnsdp", {NULL}, 2051, "tcp"}, +{"epnsdp", {NULL}, 2051, "udp"}, +{"clearvisn", {NULL}, 2052, "tcp"}, +{"clearvisn", {NULL}, 2052, "udp"}, +{"lot105-ds-upd", {NULL}, 2053, "tcp"}, +{"lot105-ds-upd", {NULL}, 2053, "udp"}, +{"weblogin", {NULL}, 2054, "tcp"}, +{"weblogin", {NULL}, 2054, "udp"}, +{"iop", {NULL}, 2055, "tcp"}, +{"iop", {NULL}, 2055, "udp"}, +{"omnisky", {NULL}, 2056, "tcp"}, +{"omnisky", {NULL}, 2056, "udp"}, +{"rich-cp", {NULL}, 2057, "tcp"}, +{"rich-cp", {NULL}, 2057, "udp"}, +{"newwavesearch", {NULL}, 2058, "tcp"}, +{"newwavesearch", {NULL}, 2058, "udp"}, +{"bmc-messaging", {NULL}, 2059, "tcp"}, +{"bmc-messaging", {NULL}, 2059, "udp"}, +{"teleniumdaemon", {NULL}, 2060, "tcp"}, +{"teleniumdaemon", {NULL}, 2060, "udp"}, +{"netmount", {NULL}, 2061, "tcp"}, +{"netmount", {NULL}, 2061, "udp"}, +{"icg-swp", {NULL}, 2062, "tcp"}, +{"icg-swp", {NULL}, 2062, "udp"}, +{"icg-bridge", {NULL}, 2063, "tcp"}, +{"icg-bridge", {NULL}, 2063, "udp"}, +{"icg-iprelay", {NULL}, 2064, "tcp"}, +{"icg-iprelay", {NULL}, 2064, "udp"}, +{"dlsrpn", {NULL}, 2065, "tcp"}, +{"dlsrpn", {NULL}, 2065, "udp"}, +{"aura", {NULL}, 2066, "tcp"}, +{"aura", {NULL}, 2066, "udp"}, +{"dlswpn", {NULL}, 2067, "tcp"}, +{"dlswpn", {NULL}, 2067, "udp"}, +{"avauthsrvprtcl", {NULL}, 2068, "tcp"}, +{"avauthsrvprtcl", {NULL}, 2068, "udp"}, +{"event-port", {NULL}, 2069, "tcp"}, +{"event-port", {NULL}, 2069, "udp"}, +{"ah-esp-encap", {NULL}, 2070, "tcp"}, +{"ah-esp-encap", {NULL}, 2070, "udp"}, +{"acp-port", {NULL}, 2071, "tcp"}, +{"acp-port", {NULL}, 2071, "udp"}, +{"msync", {NULL}, 2072, "tcp"}, +{"msync", {NULL}, 2072, "udp"}, +{"gxs-data-port", {NULL}, 2073, "tcp"}, +{"gxs-data-port", {NULL}, 2073, "udp"}, +{"vrtl-vmf-sa", {NULL}, 2074, "tcp"}, +{"vrtl-vmf-sa", {NULL}, 2074, "udp"}, +{"newlixengine", {NULL}, 2075, "tcp"}, +{"newlixengine", {NULL}, 2075, "udp"}, +{"newlixconfig", {NULL}, 2076, "tcp"}, +{"newlixconfig", {NULL}, 2076, "udp"}, +{"tsrmagt", {NULL}, 2077, "tcp"}, +{"tsrmagt", {NULL}, 2077, "udp"}, +{"tpcsrvr", {NULL}, 2078, "tcp"}, +{"tpcsrvr", {NULL}, 2078, "udp"}, +{"idware-router", {NULL}, 2079, "tcp"}, +{"idware-router", {NULL}, 2079, "udp"}, +{"autodesk-nlm", {NULL}, 2080, "tcp"}, +{"autodesk-nlm", {NULL}, 2080, "udp"}, +{"kme-trap-port", {NULL}, 2081, "tcp"}, +{"kme-trap-port", {NULL}, 2081, "udp"}, +{"infowave", {NULL}, 2082, "tcp"}, +{"infowave", {NULL}, 2082, "udp"}, +{"radsec", {NULL}, 2083, "tcp"}, +{"radsec", {NULL}, 2083, "udp"}, +{"sunclustergeo", {NULL}, 2084, "tcp"}, +{"sunclustergeo", {NULL}, 2084, "udp"}, +{"ada-cip", {NULL}, 2085, "tcp"}, +{"ada-cip", {NULL}, 2085, "udp"}, +{"gnunet", {NULL}, 2086, "tcp"}, +{"gnunet", {NULL}, 2086, "udp"}, +{"eli", {NULL}, 2087, "tcp"}, +{"eli", {NULL}, 2087, "udp"}, +{"ip-blf", {NULL}, 2088, "tcp"}, +{"ip-blf", {NULL}, 2088, "udp"}, +{"sep", {NULL}, 2089, "tcp"}, +{"sep", {NULL}, 2089, "udp"}, +{"lrp", {NULL}, 2090, "tcp"}, +{"lrp", {NULL}, 2090, "udp"}, +{"prp", {NULL}, 2091, "tcp"}, +{"prp", {NULL}, 2091, "udp"}, +{"descent3", {NULL}, 2092, "tcp"}, +{"descent3", {NULL}, 2092, "udp"}, +{"nbx-cc", {NULL}, 2093, "tcp"}, +{"nbx-cc", {NULL}, 2093, "udp"}, +{"nbx-au", {NULL}, 2094, "tcp"}, +{"nbx-au", {NULL}, 2094, "udp"}, +{"nbx-ser", {NULL}, 2095, "tcp"}, +{"nbx-ser", {NULL}, 2095, "udp"}, +{"nbx-dir", {NULL}, 2096, "tcp"}, +{"nbx-dir", {NULL}, 2096, "udp"}, +{"jetformpreview", {NULL}, 2097, "tcp"}, +{"jetformpreview", {NULL}, 2097, "udp"}, +{"dialog-port", {NULL}, 2098, "tcp"}, +{"dialog-port", {NULL}, 2098, "udp"}, +{"h2250-annex-g", {NULL}, 2099, "tcp"}, +{"h2250-annex-g", {NULL}, 2099, "udp"}, +{"amiganetfs", {NULL}, 2100, "tcp"}, +{"amiganetfs", {NULL}, 2100, "udp"}, +{"rtcm-sc104", {NULL}, 2101, "tcp"}, +{"rtcm-sc104", {NULL}, 2101, "udp"}, +{"zephyr-srv", {NULL}, 2102, "tcp"}, +{"zephyr-srv", {NULL}, 2102, "udp"}, +{"zephyr-clt", {NULL}, 2103, "tcp"}, +{"zephyr-clt", {NULL}, 2103, "udp"}, +{"zephyr-hm", {NULL}, 2104, "tcp"}, +{"zephyr-hm", {NULL}, 2104, "udp"}, +{"minipay", {NULL}, 2105, "tcp"}, +{"minipay", {NULL}, 2105, "udp"}, +{"mzap", {NULL}, 2106, "tcp"}, +{"mzap", {NULL}, 2106, "udp"}, +{"bintec-admin", {NULL}, 2107, "tcp"}, +{"bintec-admin", {NULL}, 2107, "udp"}, +{"comcam", {NULL}, 2108, "tcp"}, +{"comcam", {NULL}, 2108, "udp"}, +{"ergolight", {NULL}, 2109, "tcp"}, +{"ergolight", {NULL}, 2109, "udp"}, +{"umsp", {NULL}, 2110, "tcp"}, +{"umsp", {NULL}, 2110, "udp"}, +{"dsatp", {NULL}, 2111, "tcp"}, +{"dsatp", {NULL}, 2111, "udp"}, +{"idonix-metanet", {NULL}, 2112, "tcp"}, +{"idonix-metanet", {NULL}, 2112, "udp"}, +{"hsl-storm", {NULL}, 2113, "tcp"}, +{"hsl-storm", {NULL}, 2113, "udp"}, +{"newheights", {NULL}, 2114, "tcp"}, +{"newheights", {NULL}, 2114, "udp"}, +{"kdm", {NULL}, 2115, "tcp"}, +{"kdm", {NULL}, 2115, "udp"}, +{"ccowcmr", {NULL}, 2116, "tcp"}, +{"ccowcmr", {NULL}, 2116, "udp"}, +{"mentaclient", {NULL}, 2117, "tcp"}, +{"mentaclient", {NULL}, 2117, "udp"}, +{"mentaserver", {NULL}, 2118, "tcp"}, +{"mentaserver", {NULL}, 2118, "udp"}, +{"gsigatekeeper", {NULL}, 2119, "tcp"}, +{"gsigatekeeper", {NULL}, 2119, "udp"}, +{"qencp", {NULL}, 2120, "tcp"}, +{"qencp", {NULL}, 2120, "udp"}, +{"scientia-ssdb", {NULL}, 2121, "tcp"}, +{"scientia-ssdb", {NULL}, 2121, "udp"}, +{"caupc-remote", {NULL}, 2122, "tcp"}, +{"caupc-remote", {NULL}, 2122, "udp"}, +{"gtp-control", {NULL}, 2123, "tcp"}, +{"gtp-control", {NULL}, 2123, "udp"}, +{"elatelink", {NULL}, 2124, "tcp"}, +{"elatelink", {NULL}, 2124, "udp"}, +{"lockstep", {NULL}, 2125, "tcp"}, +{"lockstep", {NULL}, 2125, "udp"}, +{"pktcable-cops", {NULL}, 2126, "tcp"}, +{"pktcable-cops", {NULL}, 2126, "udp"}, +{"index-pc-wb", {NULL}, 2127, "tcp"}, +{"index-pc-wb", {NULL}, 2127, "udp"}, +{"net-steward", {NULL}, 2128, "tcp"}, +{"net-steward", {NULL}, 2128, "udp"}, +{"cs-live", {NULL}, 2129, "tcp"}, +{"cs-live", {NULL}, 2129, "udp"}, +{"xds", {NULL}, 2130, "tcp"}, +{"xds", {NULL}, 2130, "udp"}, +{"avantageb2b", {NULL}, 2131, "tcp"}, +{"avantageb2b", {NULL}, 2131, "udp"}, +{"solera-epmap", {NULL}, 2132, "tcp"}, +{"solera-epmap", {NULL}, 2132, "udp"}, +{"zymed-zpp", {NULL}, 2133, "tcp"}, +{"zymed-zpp", {NULL}, 2133, "udp"}, +{"avenue", {NULL}, 2134, "tcp"}, +{"avenue", {NULL}, 2134, "udp"}, +{"gris", {NULL}, 2135, "tcp"}, +{"gris", {NULL}, 2135, "udp"}, +{"appworxsrv", {NULL}, 2136, "tcp"}, +{"appworxsrv", {NULL}, 2136, "udp"}, +{"connect", {NULL}, 2137, "tcp"}, +{"connect", {NULL}, 2137, "udp"}, +{"unbind-cluster", {NULL}, 2138, "tcp"}, +{"unbind-cluster", {NULL}, 2138, "udp"}, +{"ias-auth", {NULL}, 2139, "tcp"}, +{"ias-auth", {NULL}, 2139, "udp"}, +{"ias-reg", {NULL}, 2140, "tcp"}, +{"ias-reg", {NULL}, 2140, "udp"}, +{"ias-admind", {NULL}, 2141, "tcp"}, +{"ias-admind", {NULL}, 2141, "udp"}, +{"tdmoip", {NULL}, 2142, "tcp"}, +{"tdmoip", {NULL}, 2142, "udp"}, +{"lv-jc", {NULL}, 2143, "tcp"}, +{"lv-jc", {NULL}, 2143, "udp"}, +{"lv-ffx", {NULL}, 2144, "tcp"}, +{"lv-ffx", {NULL}, 2144, "udp"}, +{"lv-pici", {NULL}, 2145, "tcp"}, +{"lv-pici", {NULL}, 2145, "udp"}, +{"lv-not", {NULL}, 2146, "tcp"}, +{"lv-not", {NULL}, 2146, "udp"}, +{"lv-auth", {NULL}, 2147, "tcp"}, +{"lv-auth", {NULL}, 2147, "udp"}, +{"veritas-ucl", {NULL}, 2148, "tcp"}, +{"veritas-ucl", {NULL}, 2148, "udp"}, +{"acptsys", {NULL}, 2149, "tcp"}, +{"acptsys", {NULL}, 2149, "udp"}, +{"dynamic3d", {NULL}, 2150, "tcp"}, +{"dynamic3d", {NULL}, 2150, "udp"}, +{"docent", {NULL}, 2151, "tcp"}, +{"docent", {NULL}, 2151, "udp"}, +{"gtp-user", {NULL}, 2152, "tcp"}, +{"gtp-user", {NULL}, 2152, "udp"}, +{"ctlptc", {NULL}, 2153, "tcp"}, +{"ctlptc", {NULL}, 2153, "udp"}, +{"stdptc", {NULL}, 2154, "tcp"}, +{"stdptc", {NULL}, 2154, "udp"}, +{"brdptc", {NULL}, 2155, "tcp"}, +{"brdptc", {NULL}, 2155, "udp"}, +{"trp", {NULL}, 2156, "tcp"}, +{"trp", {NULL}, 2156, "udp"}, +{"xnds", {NULL}, 2157, "tcp"}, +{"xnds", {NULL}, 2157, "udp"}, +{"touchnetplus", {NULL}, 2158, "tcp"}, +{"touchnetplus", {NULL}, 2158, "udp"}, +{"gdbremote", {NULL}, 2159, "tcp"}, +{"gdbremote", {NULL}, 2159, "udp"}, +{"apc-2160", {NULL}, 2160, "tcp"}, +{"apc-2160", {NULL}, 2160, "udp"}, +{"apc-2161", {NULL}, 2161, "tcp"}, +{"apc-2161", {NULL}, 2161, "udp"}, +{"navisphere", {NULL}, 2162, "tcp"}, +{"navisphere", {NULL}, 2162, "udp"}, +{"navisphere-sec", {NULL}, 2163, "tcp"}, +{"navisphere-sec", {NULL}, 2163, "udp"}, +{"ddns-v3", {NULL}, 2164, "tcp"}, +{"ddns-v3", {NULL}, 2164, "udp"}, +{"x-bone-api", {NULL}, 2165, "tcp"}, +{"x-bone-api", {NULL}, 2165, "udp"}, +{"iwserver", {NULL}, 2166, "tcp"}, +{"iwserver", {NULL}, 2166, "udp"}, +{"raw-serial", {NULL}, 2167, "tcp"}, +{"raw-serial", {NULL}, 2167, "udp"}, +{"easy-soft-mux", {NULL}, 2168, "tcp"}, +{"easy-soft-mux", {NULL}, 2168, "udp"}, +{"brain", {NULL}, 2169, "tcp"}, +{"brain", {NULL}, 2169, "udp"}, +{"eyetv", {NULL}, 2170, "tcp"}, +{"eyetv", {NULL}, 2170, "udp"}, +{"msfw-storage", {NULL}, 2171, "tcp"}, +{"msfw-storage", {NULL}, 2171, "udp"}, +{"msfw-s-storage", {NULL}, 2172, "tcp"}, +{"msfw-s-storage", {NULL}, 2172, "udp"}, +{"msfw-replica", {NULL}, 2173, "tcp"}, +{"msfw-replica", {NULL}, 2173, "udp"}, +{"msfw-array", {NULL}, 2174, "tcp"}, +{"msfw-array", {NULL}, 2174, "udp"}, +{"airsync", {NULL}, 2175, "tcp"}, +{"airsync", {NULL}, 2175, "udp"}, +{"rapi", {NULL}, 2176, "tcp"}, +{"rapi", {NULL}, 2176, "udp"}, +{"qwave", {NULL}, 2177, "tcp"}, +{"qwave", {NULL}, 2177, "udp"}, +{"bitspeer", {NULL}, 2178, "tcp"}, +{"bitspeer", {NULL}, 2178, "udp"}, +{"vmrdp", {NULL}, 2179, "tcp"}, +{"vmrdp", {NULL}, 2179, "udp"}, +{"mc-gt-srv", {NULL}, 2180, "tcp"}, +{"mc-gt-srv", {NULL}, 2180, "udp"}, +{"eforward", {NULL}, 2181, "tcp"}, +{"eforward", {NULL}, 2181, "udp"}, +{"cgn-stat", {NULL}, 2182, "tcp"}, +{"cgn-stat", {NULL}, 2182, "udp"}, +{"cgn-config", {NULL}, 2183, "tcp"}, +{"cgn-config", {NULL}, 2183, "udp"}, +{"nvd", {NULL}, 2184, "tcp"}, +{"nvd", {NULL}, 2184, "udp"}, +{"onbase-dds", {NULL}, 2185, "tcp"}, +{"onbase-dds", {NULL}, 2185, "udp"}, +{"gtaua", {NULL}, 2186, "tcp"}, +{"gtaua", {NULL}, 2186, "udp"}, +{"ssmc", {NULL}, 2187, "tcp"}, +{"ssmd", {NULL}, 2187, "udp"}, +{"tivoconnect", {NULL}, 2190, "tcp"}, +{"tivoconnect", {NULL}, 2190, "udp"}, +{"tvbus", {NULL}, 2191, "tcp"}, +{"tvbus", {NULL}, 2191, "udp"}, +{"asdis", {NULL}, 2192, "tcp"}, +{"asdis", {NULL}, 2192, "udp"}, +{"drwcs", {NULL}, 2193, "tcp"}, +{"drwcs", {NULL}, 2193, "udp"}, +{"mnp-exchange", {NULL}, 2197, "tcp"}, +{"mnp-exchange", {NULL}, 2197, "udp"}, +{"onehome-remote", {NULL}, 2198, "tcp"}, +{"onehome-remote", {NULL}, 2198, "udp"}, +{"onehome-help", {NULL}, 2199, "tcp"}, +{"onehome-help", {NULL}, 2199, "udp"}, +{"ici", {NULL}, 2200, "tcp"}, +{"ici", {NULL}, 2200, "udp"}, +{"ats", {NULL}, 2201, "tcp"}, +{"ats", {NULL}, 2201, "udp"}, +{"imtc-map", {NULL}, 2202, "tcp"}, +{"imtc-map", {NULL}, 2202, "udp"}, +{"b2-runtime", {NULL}, 2203, "tcp"}, +{"b2-runtime", {NULL}, 2203, "udp"}, +{"b2-license", {NULL}, 2204, "tcp"}, +{"b2-license", {NULL}, 2204, "udp"}, +{"jps", {NULL}, 2205, "tcp"}, +{"jps", {NULL}, 2205, "udp"}, +{"hpocbus", {NULL}, 2206, "tcp"}, +{"hpocbus", {NULL}, 2206, "udp"}, +{"hpssd", {NULL}, 2207, "tcp"}, +{"hpssd", {NULL}, 2207, "udp"}, +{"hpiod", {NULL}, 2208, "tcp"}, +{"hpiod", {NULL}, 2208, "udp"}, +{"rimf-ps", {NULL}, 2209, "tcp"}, +{"rimf-ps", {NULL}, 2209, "udp"}, +{"noaaport", {NULL}, 2210, "tcp"}, +{"noaaport", {NULL}, 2210, "udp"}, +{"emwin", {NULL}, 2211, "tcp"}, +{"emwin", {NULL}, 2211, "udp"}, +{"leecoposserver", {NULL}, 2212, "tcp"}, +{"leecoposserver", {NULL}, 2212, "udp"}, +{"kali", {NULL}, 2213, "tcp"}, +{"kali", {NULL}, 2213, "udp"}, +{"rpi", {NULL}, 2214, "tcp"}, +{"rpi", {NULL}, 2214, "udp"}, +{"ipcore", {NULL}, 2215, "tcp"}, +{"ipcore", {NULL}, 2215, "udp"}, +{"vtu-comms", {NULL}, 2216, "tcp"}, +{"vtu-comms", {NULL}, 2216, "udp"}, +{"gotodevice", {NULL}, 2217, "tcp"}, +{"gotodevice", {NULL}, 2217, "udp"}, +{"bounzza", {NULL}, 2218, "tcp"}, +{"bounzza", {NULL}, 2218, "udp"}, +{"netiq-ncap", {NULL}, 2219, "tcp"}, +{"netiq-ncap", {NULL}, 2219, "udp"}, +{"netiq", {NULL}, 2220, "tcp"}, +{"netiq", {NULL}, 2220, "udp"}, +{"rockwell-csp1", {NULL}, 2221, "tcp"}, +{"rockwell-csp1", {NULL}, 2221, "udp"}, +{"EtherNet/IP-1", {NULL}, 2222, "tcp"}, +{"EtherNet/IP-1", {NULL}, 2222, "udp"}, +{"rockwell-csp2", {NULL}, 2223, "tcp"}, +{"rockwell-csp2", {NULL}, 2223, "udp"}, +{"efi-mg", {NULL}, 2224, "tcp"}, +{"efi-mg", {NULL}, 2224, "udp"}, +{"rcip-itu", {NULL}, 2225, "tcp"}, +{"rcip-itu", {NULL}, 2225, "sctp"}, +{"di-drm", {NULL}, 2226, "tcp"}, +{"di-drm", {NULL}, 2226, "udp"}, +{"di-msg", {NULL}, 2227, "tcp"}, +{"di-msg", {NULL}, 2227, "udp"}, +{"ehome-ms", {NULL}, 2228, "tcp"}, +{"ehome-ms", {NULL}, 2228, "udp"}, +{"datalens", {NULL}, 2229, "tcp"}, +{"datalens", {NULL}, 2229, "udp"}, +{"queueadm", {NULL}, 2230, "tcp"}, +{"queueadm", {NULL}, 2230, "udp"}, +{"wimaxasncp", {NULL}, 2231, "tcp"}, +{"wimaxasncp", {NULL}, 2231, "udp"}, +{"ivs-video", {NULL}, 2232, "tcp"}, +{"ivs-video", {NULL}, 2232, "udp"}, +{"infocrypt", {NULL}, 2233, "tcp"}, +{"infocrypt", {NULL}, 2233, "udp"}, +{"directplay", {NULL}, 2234, "tcp"}, +{"directplay", {NULL}, 2234, "udp"}, +{"sercomm-wlink", {NULL}, 2235, "tcp"}, +{"sercomm-wlink", {NULL}, 2235, "udp"}, +{"nani", {NULL}, 2236, "tcp"}, +{"nani", {NULL}, 2236, "udp"}, +{"optech-port1-lm", {NULL}, 2237, "tcp"}, +{"optech-port1-lm", {NULL}, 2237, "udp"}, +{"aviva-sna", {NULL}, 2238, "tcp"}, +{"aviva-sna", {NULL}, 2238, "udp"}, +{"imagequery", {NULL}, 2239, "tcp"}, +{"imagequery", {NULL}, 2239, "udp"}, +{"recipe", {NULL}, 2240, "tcp"}, +{"recipe", {NULL}, 2240, "udp"}, +{"ivsd", {NULL}, 2241, "tcp"}, +{"ivsd", {NULL}, 2241, "udp"}, +{"foliocorp", {NULL}, 2242, "tcp"}, +{"foliocorp", {NULL}, 2242, "udp"}, +{"magicom", {NULL}, 2243, "tcp"}, +{"magicom", {NULL}, 2243, "udp"}, +{"nmsserver", {NULL}, 2244, "tcp"}, +{"nmsserver", {NULL}, 2244, "udp"}, +{"hao", {NULL}, 2245, "tcp"}, +{"hao", {NULL}, 2245, "udp"}, +{"pc-mta-addrmap", {NULL}, 2246, "tcp"}, +{"pc-mta-addrmap", {NULL}, 2246, "udp"}, +{"antidotemgrsvr", {NULL}, 2247, "tcp"}, +{"antidotemgrsvr", {NULL}, 2247, "udp"}, +{"ums", {NULL}, 2248, "tcp"}, +{"ums", {NULL}, 2248, "udp"}, +{"rfmp", {NULL}, 2249, "tcp"}, +{"rfmp", {NULL}, 2249, "udp"}, +{"remote-collab", {NULL}, 2250, "tcp"}, +{"remote-collab", {NULL}, 2250, "udp"}, +{"dif-port", {NULL}, 2251, "tcp"}, +{"dif-port", {NULL}, 2251, "udp"}, +{"njenet-ssl", {NULL}, 2252, "tcp"}, +{"njenet-ssl", {NULL}, 2252, "udp"}, +{"dtv-chan-req", {NULL}, 2253, "tcp"}, +{"dtv-chan-req", {NULL}, 2253, "udp"}, +{"seispoc", {NULL}, 2254, "tcp"}, +{"seispoc", {NULL}, 2254, "udp"}, +{"vrtp", {NULL}, 2255, "tcp"}, +{"vrtp", {NULL}, 2255, "udp"}, +{"pcc-mfp", {NULL}, 2256, "tcp"}, +{"pcc-mfp", {NULL}, 2256, "udp"}, +{"simple-tx-rx", {NULL}, 2257, "tcp"}, +{"simple-tx-rx", {NULL}, 2257, "udp"}, +{"rcts", {NULL}, 2258, "tcp"}, +{"rcts", {NULL}, 2258, "udp"}, +{"acd-pm", {NULL}, 2259, "tcp"}, +{"acd-pm", {NULL}, 2259, "udp"}, +{"apc-2260", {NULL}, 2260, "tcp"}, +{"apc-2260", {NULL}, 2260, "udp"}, +{"comotionmaster", {NULL}, 2261, "tcp"}, +{"comotionmaster", {NULL}, 2261, "udp"}, +{"comotionback", {NULL}, 2262, "tcp"}, +{"comotionback", {NULL}, 2262, "udp"}, +{"ecwcfg", {NULL}, 2263, "tcp"}, +{"ecwcfg", {NULL}, 2263, "udp"}, +{"apx500api-1", {NULL}, 2264, "tcp"}, +{"apx500api-1", {NULL}, 2264, "udp"}, +{"apx500api-2", {NULL}, 2265, "tcp"}, +{"apx500api-2", {NULL}, 2265, "udp"}, +{"mfserver", {NULL}, 2266, "tcp"}, +{"mfserver", {NULL}, 2266, "udp"}, +{"ontobroker", {NULL}, 2267, "tcp"}, +{"ontobroker", {NULL}, 2267, "udp"}, +{"amt", {NULL}, 2268, "tcp"}, +{"amt", {NULL}, 2268, "udp"}, +{"mikey", {NULL}, 2269, "tcp"}, +{"mikey", {NULL}, 2269, "udp"}, +{"starschool", {NULL}, 2270, "tcp"}, +{"starschool", {NULL}, 2270, "udp"}, +{"mmcals", {NULL}, 2271, "tcp"}, +{"mmcals", {NULL}, 2271, "udp"}, +{"mmcal", {NULL}, 2272, "tcp"}, +{"mmcal", {NULL}, 2272, "udp"}, +{"mysql-im", {NULL}, 2273, "tcp"}, +{"mysql-im", {NULL}, 2273, "udp"}, +{"pcttunnell", {NULL}, 2274, "tcp"}, +{"pcttunnell", {NULL}, 2274, "udp"}, +{"ibridge-data", {NULL}, 2275, "tcp"}, +{"ibridge-data", {NULL}, 2275, "udp"}, +{"ibridge-mgmt", {NULL}, 2276, "tcp"}, +{"ibridge-mgmt", {NULL}, 2276, "udp"}, +{"bluectrlproxy", {NULL}, 2277, "tcp"}, +{"bluectrlproxy", {NULL}, 2277, "udp"}, +{"s3db", {NULL}, 2278, "tcp"}, +{"s3db", {NULL}, 2278, "udp"}, +{"xmquery", {NULL}, 2279, "tcp"}, +{"xmquery", {NULL}, 2279, "udp"}, +{"lnvpoller", {NULL}, 2280, "tcp"}, +{"lnvpoller", {NULL}, 2280, "udp"}, +{"lnvconsole", {NULL}, 2281, "tcp"}, +{"lnvconsole", {NULL}, 2281, "udp"}, +{"lnvalarm", {NULL}, 2282, "tcp"}, +{"lnvalarm", {NULL}, 2282, "udp"}, +{"lnvstatus", {NULL}, 2283, "tcp"}, +{"lnvstatus", {NULL}, 2283, "udp"}, +{"lnvmaps", {NULL}, 2284, "tcp"}, +{"lnvmaps", {NULL}, 2284, "udp"}, +{"lnvmailmon", {NULL}, 2285, "tcp"}, +{"lnvmailmon", {NULL}, 2285, "udp"}, +{"nas-metering", {NULL}, 2286, "tcp"}, +{"nas-metering", {NULL}, 2286, "udp"}, +{"dna", {NULL}, 2287, "tcp"}, +{"dna", {NULL}, 2287, "udp"}, +{"netml", {NULL}, 2288, "tcp"}, +{"netml", {NULL}, 2288, "udp"}, +{"dict-lookup", {NULL}, 2289, "tcp"}, +{"dict-lookup", {NULL}, 2289, "udp"}, +{"sonus-logging", {NULL}, 2290, "tcp"}, +{"sonus-logging", {NULL}, 2290, "udp"}, +{"eapsp", {NULL}, 2291, "tcp"}, +{"eapsp", {NULL}, 2291, "udp"}, +{"mib-streaming", {NULL}, 2292, "tcp"}, +{"mib-streaming", {NULL}, 2292, "udp"}, +{"npdbgmngr", {NULL}, 2293, "tcp"}, +{"npdbgmngr", {NULL}, 2293, "udp"}, +{"konshus-lm", {NULL}, 2294, "tcp"}, +{"konshus-lm", {NULL}, 2294, "udp"}, +{"advant-lm", {NULL}, 2295, "tcp"}, +{"advant-lm", {NULL}, 2295, "udp"}, +{"theta-lm", {NULL}, 2296, "tcp"}, +{"theta-lm", {NULL}, 2296, "udp"}, +{"d2k-datamover1", {NULL}, 2297, "tcp"}, +{"d2k-datamover1", {NULL}, 2297, "udp"}, +{"d2k-datamover2", {NULL}, 2298, "tcp"}, +{"d2k-datamover2", {NULL}, 2298, "udp"}, +{"pc-telecommute", {NULL}, 2299, "tcp"}, +{"pc-telecommute", {NULL}, 2299, "udp"}, +{"cvmmon", {NULL}, 2300, "tcp"}, +{"cvmmon", {NULL}, 2300, "udp"}, +{"cpq-wbem", {NULL}, 2301, "tcp"}, +{"cpq-wbem", {NULL}, 2301, "udp"}, +{"binderysupport", {NULL}, 2302, "tcp"}, +{"binderysupport", {NULL}, 2302, "udp"}, +{"proxy-gateway", {NULL}, 2303, "tcp"}, +{"proxy-gateway", {NULL}, 2303, "udp"}, +{"attachmate-uts", {NULL}, 2304, "tcp"}, +{"attachmate-uts", {NULL}, 2304, "udp"}, +{"mt-scaleserver", {NULL}, 2305, "tcp"}, +{"mt-scaleserver", {NULL}, 2305, "udp"}, +{"tappi-boxnet", {NULL}, 2306, "tcp"}, +{"tappi-boxnet", {NULL}, 2306, "udp"}, +{"pehelp", {NULL}, 2307, "tcp"}, +{"pehelp", {NULL}, 2307, "udp"}, +{"sdhelp", {NULL}, 2308, "tcp"}, +{"sdhelp", {NULL}, 2308, "udp"}, +{"sdserver", {NULL}, 2309, "tcp"}, +{"sdserver", {NULL}, 2309, "udp"}, +{"sdclient", {NULL}, 2310, "tcp"}, +{"sdclient", {NULL}, 2310, "udp"}, +{"messageservice", {NULL}, 2311, "tcp"}, +{"messageservice", {NULL}, 2311, "udp"}, +{"wanscaler", {NULL}, 2312, "tcp"}, +{"wanscaler", {NULL}, 2312, "udp"}, +{"iapp", {NULL}, 2313, "tcp"}, +{"iapp", {NULL}, 2313, "udp"}, +{"cr-websystems", {NULL}, 2314, "tcp"}, +{"cr-websystems", {NULL}, 2314, "udp"}, +{"precise-sft", {NULL}, 2315, "tcp"}, +{"precise-sft", {NULL}, 2315, "udp"}, +{"sent-lm", {NULL}, 2316, "tcp"}, +{"sent-lm", {NULL}, 2316, "udp"}, +{"attachmate-g32", {NULL}, 2317, "tcp"}, +{"attachmate-g32", {NULL}, 2317, "udp"}, +{"cadencecontrol", {NULL}, 2318, "tcp"}, +{"cadencecontrol", {NULL}, 2318, "udp"}, +{"infolibria", {NULL}, 2319, "tcp"}, +{"infolibria", {NULL}, 2319, "udp"}, +{"siebel-ns", {NULL}, 2320, "tcp"}, +{"siebel-ns", {NULL}, 2320, "udp"}, +{"rdlap", {NULL}, 2321, "tcp"}, +{"rdlap", {NULL}, 2321, "udp"}, +{"ofsd", {NULL}, 2322, "tcp"}, +{"ofsd", {NULL}, 2322, "udp"}, +{"3d-nfsd", {NULL}, 2323, "tcp"}, +{"3d-nfsd", {NULL}, 2323, "udp"}, +{"cosmocall", {NULL}, 2324, "tcp"}, +{"cosmocall", {NULL}, 2324, "udp"}, +{"ansysli", {NULL}, 2325, "tcp"}, +{"ansysli", {NULL}, 2325, "udp"}, +{"idcp", {NULL}, 2326, "tcp"}, +{"idcp", {NULL}, 2326, "udp"}, +{"xingcsm", {NULL}, 2327, "tcp"}, +{"xingcsm", {NULL}, 2327, "udp"}, +{"netrix-sftm", {NULL}, 2328, "tcp"}, +{"netrix-sftm", {NULL}, 2328, "udp"}, +{"nvd", {NULL}, 2329, "tcp"}, +{"nvd", {NULL}, 2329, "udp"}, +{"tscchat", {NULL}, 2330, "tcp"}, +{"tscchat", {NULL}, 2330, "udp"}, +{"agentview", {NULL}, 2331, "tcp"}, +{"agentview", {NULL}, 2331, "udp"}, +{"rcc-host", {NULL}, 2332, "tcp"}, +{"rcc-host", {NULL}, 2332, "udp"}, +{"snapp", {NULL}, 2333, "tcp"}, +{"snapp", {NULL}, 2333, "udp"}, +{"ace-client", {NULL}, 2334, "tcp"}, +{"ace-client", {NULL}, 2334, "udp"}, +{"ace-proxy", {NULL}, 2335, "tcp"}, +{"ace-proxy", {NULL}, 2335, "udp"}, +{"appleugcontrol", {NULL}, 2336, "tcp"}, +{"appleugcontrol", {NULL}, 2336, "udp"}, +{"ideesrv", {NULL}, 2337, "tcp"}, +{"ideesrv", {NULL}, 2337, "udp"}, +{"norton-lambert", {NULL}, 2338, "tcp"}, +{"norton-lambert", {NULL}, 2338, "udp"}, +{"3com-webview", {NULL}, 2339, "tcp"}, +{"3com-webview", {NULL}, 2339, "udp"}, +{"wrs_registry", {NULL}, 2340, "tcp"}, +{"wrs_registry", {NULL}, 2340, "udp"}, +{"xiostatus", {NULL}, 2341, "tcp"}, +{"xiostatus", {NULL}, 2341, "udp"}, +{"manage-exec", {NULL}, 2342, "tcp"}, +{"manage-exec", {NULL}, 2342, "udp"}, +{"nati-logos", {NULL}, 2343, "tcp"}, +{"nati-logos", {NULL}, 2343, "udp"}, +{"fcmsys", {NULL}, 2344, "tcp"}, +{"fcmsys", {NULL}, 2344, "udp"}, +{"dbm", {NULL}, 2345, "tcp"}, +{"dbm", {NULL}, 2345, "udp"}, +{"redstorm_join", {NULL}, 2346, "tcp"}, +{"redstorm_join", {NULL}, 2346, "udp"}, +{"redstorm_find", {NULL}, 2347, "tcp"}, +{"redstorm_find", {NULL}, 2347, "udp"}, +{"redstorm_info", {NULL}, 2348, "tcp"}, +{"redstorm_info", {NULL}, 2348, "udp"}, +{"redstorm_diag", {NULL}, 2349, "tcp"}, +{"redstorm_diag", {NULL}, 2349, "udp"}, +{"psbserver", {NULL}, 2350, "tcp"}, +{"psbserver", {NULL}, 2350, "udp"}, +{"psrserver", {NULL}, 2351, "tcp"}, +{"psrserver", {NULL}, 2351, "udp"}, +{"pslserver", {NULL}, 2352, "tcp"}, +{"pslserver", {NULL}, 2352, "udp"}, +{"pspserver", {NULL}, 2353, "tcp"}, +{"pspserver", {NULL}, 2353, "udp"}, +{"psprserver", {NULL}, 2354, "tcp"}, +{"psprserver", {NULL}, 2354, "udp"}, +{"psdbserver", {NULL}, 2355, "tcp"}, +{"psdbserver", {NULL}, 2355, "udp"}, +{"gxtelmd", {NULL}, 2356, "tcp"}, +{"gxtelmd", {NULL}, 2356, "udp"}, +{"unihub-server", {NULL}, 2357, "tcp"}, +{"unihub-server", {NULL}, 2357, "udp"}, +{"futrix", {NULL}, 2358, "tcp"}, +{"futrix", {NULL}, 2358, "udp"}, +{"flukeserver", {NULL}, 2359, "tcp"}, +{"flukeserver", {NULL}, 2359, "udp"}, +{"nexstorindltd", {NULL}, 2360, "tcp"}, +{"nexstorindltd", {NULL}, 2360, "udp"}, +{"tl1", {NULL}, 2361, "tcp"}, +{"tl1", {NULL}, 2361, "udp"}, +{"digiman", {NULL}, 2362, "tcp"}, +{"digiman", {NULL}, 2362, "udp"}, +{"mediacntrlnfsd", {NULL}, 2363, "tcp"}, +{"mediacntrlnfsd", {NULL}, 2363, "udp"}, +{"oi-2000", {NULL}, 2364, "tcp"}, +{"oi-2000", {NULL}, 2364, "udp"}, +{"dbref", {NULL}, 2365, "tcp"}, +{"dbref", {NULL}, 2365, "udp"}, +{"qip-login", {NULL}, 2366, "tcp"}, +{"qip-login", {NULL}, 2366, "udp"}, +{"service-ctrl", {NULL}, 2367, "tcp"}, +{"service-ctrl", {NULL}, 2367, "udp"}, +{"opentable", {NULL}, 2368, "tcp"}, +{"opentable", {NULL}, 2368, "udp"}, +{"l3-hbmon", {NULL}, 2370, "tcp"}, +{"l3-hbmon", {NULL}, 2370, "udp"}, +{"worldwire", {NULL}, 2371, "tcp"}, +{"worldwire", {NULL}, 2371, "udp"}, +{"lanmessenger", {NULL}, 2372, "tcp"}, +{"lanmessenger", {NULL}, 2372, "udp"}, +{"remographlm", {NULL}, 2373, "tcp"}, +{"hydra", {NULL}, 2374, "tcp"}, +{"compaq-https", {NULL}, 2381, "tcp"}, +{"compaq-https", {NULL}, 2381, "udp"}, +{"ms-olap3", {NULL}, 2382, "tcp"}, +{"ms-olap3", {NULL}, 2382, "udp"}, +{"ms-olap4", {NULL}, 2383, "tcp"}, +{"ms-olap4", {NULL}, 2383, "udp"}, +{"sd-request", {NULL}, 2384, "tcp"}, +{"sd-capacity", {NULL}, 2384, "udp"}, +{"sd-data", {NULL}, 2385, "tcp"}, +{"sd-data", {NULL}, 2385, "udp"}, +{"virtualtape", {NULL}, 2386, "tcp"}, +{"virtualtape", {NULL}, 2386, "udp"}, +{"vsamredirector", {NULL}, 2387, "tcp"}, +{"vsamredirector", {NULL}, 2387, "udp"}, +{"mynahautostart", {NULL}, 2388, "tcp"}, +{"mynahautostart", {NULL}, 2388, "udp"}, +{"ovsessionmgr", {NULL}, 2389, "tcp"}, +{"ovsessionmgr", {NULL}, 2389, "udp"}, +{"rsmtp", {NULL}, 2390, "tcp"}, +{"rsmtp", {NULL}, 2390, "udp"}, +{"3com-net-mgmt", {NULL}, 2391, "tcp"}, +{"3com-net-mgmt", {NULL}, 2391, "udp"}, +{"tacticalauth", {NULL}, 2392, "tcp"}, +{"tacticalauth", {NULL}, 2392, "udp"}, +{"ms-olap1", {NULL}, 2393, "tcp"}, +{"ms-olap1", {NULL}, 2393, "udp"}, +{"ms-olap2", {NULL}, 2394, "tcp"}, +{"ms-olap2", {NULL}, 2394, "udp"}, +{"lan900_remote", {NULL}, 2395, "tcp"}, +{"lan900_remote", {NULL}, 2395, "udp"}, +{"wusage", {NULL}, 2396, "tcp"}, +{"wusage", {NULL}, 2396, "udp"}, +{"ncl", {NULL}, 2397, "tcp"}, +{"ncl", {NULL}, 2397, "udp"}, +{"orbiter", {NULL}, 2398, "tcp"}, +{"orbiter", {NULL}, 2398, "udp"}, +{"fmpro-fdal", {NULL}, 2399, "tcp"}, +{"fmpro-fdal", {NULL}, 2399, "udp"}, +{"opequus-server", {NULL}, 2400, "tcp"}, +{"opequus-server", {NULL}, 2400, "udp"}, +{"cvspserver", {NULL}, 2401, "tcp"}, +{"cvspserver", {NULL}, 2401, "udp"}, +{"taskmaster2000", {NULL}, 2402, "tcp"}, +{"taskmaster2000", {NULL}, 2402, "udp"}, +{"taskmaster2000", {NULL}, 2403, "tcp"}, +{"taskmaster2000", {NULL}, 2403, "udp"}, +{"iec-104", {NULL}, 2404, "tcp"}, +{"iec-104", {NULL}, 2404, "udp"}, +{"trc-netpoll", {NULL}, 2405, "tcp"}, +{"trc-netpoll", {NULL}, 2405, "udp"}, +{"jediserver", {NULL}, 2406, "tcp"}, +{"jediserver", {NULL}, 2406, "udp"}, +{"orion", {NULL}, 2407, "tcp"}, +{"orion", {NULL}, 2407, "udp"}, +{"optimanet", {NULL}, 2408, "tcp"}, +{"optimanet", {NULL}, 2408, "udp"}, +{"sns-protocol", {NULL}, 2409, "tcp"}, +{"sns-protocol", {NULL}, 2409, "udp"}, +{"vrts-registry", {NULL}, 2410, "tcp"}, +{"vrts-registry", {NULL}, 2410, "udp"}, +{"netwave-ap-mgmt", {NULL}, 2411, "tcp"}, +{"netwave-ap-mgmt", {NULL}, 2411, "udp"}, +{"cdn", {NULL}, 2412, "tcp"}, +{"cdn", {NULL}, 2412, "udp"}, +{"orion-rmi-reg", {NULL}, 2413, "tcp"}, +{"orion-rmi-reg", {NULL}, 2413, "udp"}, +{"beeyond", {NULL}, 2414, "tcp"}, +{"beeyond", {NULL}, 2414, "udp"}, +{"codima-rtp", {NULL}, 2415, "tcp"}, +{"codima-rtp", {NULL}, 2415, "udp"}, +{"rmtserver", {NULL}, 2416, "tcp"}, +{"rmtserver", {NULL}, 2416, "udp"}, +{"composit-server", {NULL}, 2417, "tcp"}, +{"composit-server", {NULL}, 2417, "udp"}, +{"cas", {NULL}, 2418, "tcp"}, +{"cas", {NULL}, 2418, "udp"}, +{"attachmate-s2s", {NULL}, 2419, "tcp"}, +{"attachmate-s2s", {NULL}, 2419, "udp"}, +{"dslremote-mgmt", {NULL}, 2420, "tcp"}, +{"dslremote-mgmt", {NULL}, 2420, "udp"}, +{"g-talk", {NULL}, 2421, "tcp"}, +{"g-talk", {NULL}, 2421, "udp"}, +{"crmsbits", {NULL}, 2422, "tcp"}, +{"crmsbits", {NULL}, 2422, "udp"}, +{"rnrp", {NULL}, 2423, "tcp"}, +{"rnrp", {NULL}, 2423, "udp"}, +{"kofax-svr", {NULL}, 2424, "tcp"}, +{"kofax-svr", {NULL}, 2424, "udp"}, +{"fjitsuappmgr", {NULL}, 2425, "tcp"}, +{"fjitsuappmgr", {NULL}, 2425, "udp"}, +{"mgcp-gateway", {NULL}, 2427, "tcp"}, +{"mgcp-gateway", {NULL}, 2427, "udp"}, +{"ott", {NULL}, 2428, "tcp"}, +{"ott", {NULL}, 2428, "udp"}, +{"ft-role", {NULL}, 2429, "tcp"}, +{"ft-role", {NULL}, 2429, "udp"}, +{"venus", {NULL}, 2430, "tcp"}, +{"venus", {NULL}, 2430, "udp"}, +{"venus-se", {NULL}, 2431, "tcp"}, +{"venus-se", {NULL}, 2431, "udp"}, +{"codasrv", {NULL}, 2432, "tcp"}, +{"codasrv", {NULL}, 2432, "udp"}, +{"codasrv-se", {NULL}, 2433, "tcp"}, +{"codasrv-se", {NULL}, 2433, "udp"}, +{"pxc-epmap", {NULL}, 2434, "tcp"}, +{"pxc-epmap", {NULL}, 2434, "udp"}, +{"optilogic", {NULL}, 2435, "tcp"}, +{"optilogic", {NULL}, 2435, "udp"}, +{"topx", {NULL}, 2436, "tcp"}, +{"topx", {NULL}, 2436, "udp"}, +{"unicontrol", {NULL}, 2437, "tcp"}, +{"unicontrol", {NULL}, 2437, "udp"}, +{"msp", {NULL}, 2438, "tcp"}, +{"msp", {NULL}, 2438, "udp"}, +{"sybasedbsynch", {NULL}, 2439, "tcp"}, +{"sybasedbsynch", {NULL}, 2439, "udp"}, +{"spearway", {NULL}, 2440, "tcp"}, +{"spearway", {NULL}, 2440, "udp"}, +{"pvsw-inet", {NULL}, 2441, "tcp"}, +{"pvsw-inet", {NULL}, 2441, "udp"}, +{"netangel", {NULL}, 2442, "tcp"}, +{"netangel", {NULL}, 2442, "udp"}, +{"powerclientcsf", {NULL}, 2443, "tcp"}, +{"powerclientcsf", {NULL}, 2443, "udp"}, +{"btpp2sectrans", {NULL}, 2444, "tcp"}, +{"btpp2sectrans", {NULL}, 2444, "udp"}, +{"dtn1", {NULL}, 2445, "tcp"}, +{"dtn1", {NULL}, 2445, "udp"}, +{"bues_service", {NULL}, 2446, "tcp"}, +{"bues_service", {NULL}, 2446, "udp"}, +{"ovwdb", {NULL}, 2447, "tcp"}, +{"ovwdb", {NULL}, 2447, "udp"}, +{"hpppssvr", {NULL}, 2448, "tcp"}, +{"hpppssvr", {NULL}, 2448, "udp"}, +{"ratl", {NULL}, 2449, "tcp"}, +{"ratl", {NULL}, 2449, "udp"}, +{"netadmin", {NULL}, 2450, "tcp"}, +{"netadmin", {NULL}, 2450, "udp"}, +{"netchat", {NULL}, 2451, "tcp"}, +{"netchat", {NULL}, 2451, "udp"}, +{"snifferclient", {NULL}, 2452, "tcp"}, +{"snifferclient", {NULL}, 2452, "udp"}, +{"madge-ltd", {NULL}, 2453, "tcp"}, +{"madge-ltd", {NULL}, 2453, "udp"}, +{"indx-dds", {NULL}, 2454, "tcp"}, +{"indx-dds", {NULL}, 2454, "udp"}, +{"wago-io-system", {NULL}, 2455, "tcp"}, +{"wago-io-system", {NULL}, 2455, "udp"}, +{"altav-remmgt", {NULL}, 2456, "tcp"}, +{"altav-remmgt", {NULL}, 2456, "udp"}, +{"rapido-ip", {NULL}, 2457, "tcp"}, +{"rapido-ip", {NULL}, 2457, "udp"}, +{"griffin", {NULL}, 2458, "tcp"}, +{"griffin", {NULL}, 2458, "udp"}, +{"community", {NULL}, 2459, "tcp"}, +{"community", {NULL}, 2459, "udp"}, +{"ms-theater", {NULL}, 2460, "tcp"}, +{"ms-theater", {NULL}, 2460, "udp"}, +{"qadmifoper", {NULL}, 2461, "tcp"}, +{"qadmifoper", {NULL}, 2461, "udp"}, +{"qadmifevent", {NULL}, 2462, "tcp"}, +{"qadmifevent", {NULL}, 2462, "udp"}, +{"lsi-raid-mgmt", {NULL}, 2463, "tcp"}, +{"lsi-raid-mgmt", {NULL}, 2463, "udp"}, +{"direcpc-si", {NULL}, 2464, "tcp"}, +{"direcpc-si", {NULL}, 2464, "udp"}, +{"lbm", {NULL}, 2465, "tcp"}, +{"lbm", {NULL}, 2465, "udp"}, +{"lbf", {NULL}, 2466, "tcp"}, +{"lbf", {NULL}, 2466, "udp"}, +{"high-criteria", {NULL}, 2467, "tcp"}, +{"high-criteria", {NULL}, 2467, "udp"}, +{"qip-msgd", {NULL}, 2468, "tcp"}, +{"qip-msgd", {NULL}, 2468, "udp"}, +{"mti-tcs-comm", {NULL}, 2469, "tcp"}, +{"mti-tcs-comm", {NULL}, 2469, "udp"}, +{"taskman-port", {NULL}, 2470, "tcp"}, +{"taskman-port", {NULL}, 2470, "udp"}, +{"seaodbc", {NULL}, 2471, "tcp"}, +{"seaodbc", {NULL}, 2471, "udp"}, +{"c3", {NULL}, 2472, "tcp"}, +{"c3", {NULL}, 2472, "udp"}, +{"aker-cdp", {NULL}, 2473, "tcp"}, +{"aker-cdp", {NULL}, 2473, "udp"}, +{"vitalanalysis", {NULL}, 2474, "tcp"}, +{"vitalanalysis", {NULL}, 2474, "udp"}, +{"ace-server", {NULL}, 2475, "tcp"}, +{"ace-server", {NULL}, 2475, "udp"}, +{"ace-svr-prop", {NULL}, 2476, "tcp"}, +{"ace-svr-prop", {NULL}, 2476, "udp"}, +{"ssm-cvs", {NULL}, 2477, "tcp"}, +{"ssm-cvs", {NULL}, 2477, "udp"}, +{"ssm-cssps", {NULL}, 2478, "tcp"}, +{"ssm-cssps", {NULL}, 2478, "udp"}, +{"ssm-els", {NULL}, 2479, "tcp"}, +{"ssm-els", {NULL}, 2479, "udp"}, +{"powerexchange", {NULL}, 2480, "tcp"}, +{"powerexchange", {NULL}, 2480, "udp"}, +{"giop", {NULL}, 2481, "tcp"}, +{"giop", {NULL}, 2481, "udp"}, +{"giop-ssl", {NULL}, 2482, "tcp"}, +{"giop-ssl", {NULL}, 2482, "udp"}, +{"ttc", {NULL}, 2483, "tcp"}, +{"ttc", {NULL}, 2483, "udp"}, +{"ttc-ssl", {NULL}, 2484, "tcp"}, +{"ttc-ssl", {NULL}, 2484, "udp"}, +{"netobjects1", {NULL}, 2485, "tcp"}, +{"netobjects1", {NULL}, 2485, "udp"}, +{"netobjects2", {NULL}, 2486, "tcp"}, +{"netobjects2", {NULL}, 2486, "udp"}, +{"pns", {NULL}, 2487, "tcp"}, +{"pns", {NULL}, 2487, "udp"}, +{"moy-corp", {NULL}, 2488, "tcp"}, +{"moy-corp", {NULL}, 2488, "udp"}, +{"tsilb", {NULL}, 2489, "tcp"}, +{"tsilb", {NULL}, 2489, "udp"}, +{"qip-qdhcp", {NULL}, 2490, "tcp"}, +{"qip-qdhcp", {NULL}, 2490, "udp"}, +{"conclave-cpp", {NULL}, 2491, "tcp"}, +{"conclave-cpp", {NULL}, 2491, "udp"}, +{"groove", {NULL}, 2492, "tcp"}, +{"groove", {NULL}, 2492, "udp"}, +{"talarian-mqs", {NULL}, 2493, "tcp"}, +{"talarian-mqs", {NULL}, 2493, "udp"}, +{"bmc-ar", {NULL}, 2494, "tcp"}, +{"bmc-ar", {NULL}, 2494, "udp"}, +{"fast-rem-serv", {NULL}, 2495, "tcp"}, +{"fast-rem-serv", {NULL}, 2495, "udp"}, +{"dirgis", {NULL}, 2496, "tcp"}, +{"dirgis", {NULL}, 2496, "udp"}, +{"quaddb", {NULL}, 2497, "tcp"}, +{"quaddb", {NULL}, 2497, "udp"}, +{"odn-castraq", {NULL}, 2498, "tcp"}, +{"odn-castraq", {NULL}, 2498, "udp"}, +{"unicontrol", {NULL}, 2499, "tcp"}, +{"unicontrol", {NULL}, 2499, "udp"}, +{"rtsserv", {NULL}, 2500, "tcp"}, +{"rtsserv", {NULL}, 2500, "udp"}, +{"rtsclient", {NULL}, 2501, "tcp"}, +{"rtsclient", {NULL}, 2501, "udp"}, +{"kentrox-prot", {NULL}, 2502, "tcp"}, +{"kentrox-prot", {NULL}, 2502, "udp"}, +{"nms-dpnss", {NULL}, 2503, "tcp"}, +{"nms-dpnss", {NULL}, 2503, "udp"}, +{"wlbs", {NULL}, 2504, "tcp"}, +{"wlbs", {NULL}, 2504, "udp"}, +{"ppcontrol", {NULL}, 2505, "tcp"}, +{"ppcontrol", {NULL}, 2505, "udp"}, +{"jbroker", {NULL}, 2506, "tcp"}, +{"jbroker", {NULL}, 2506, "udp"}, +{"spock", {NULL}, 2507, "tcp"}, +{"spock", {NULL}, 2507, "udp"}, +{"jdatastore", {NULL}, 2508, "tcp"}, +{"jdatastore", {NULL}, 2508, "udp"}, +{"fjmpss", {NULL}, 2509, "tcp"}, +{"fjmpss", {NULL}, 2509, "udp"}, +{"fjappmgrbulk", {NULL}, 2510, "tcp"}, +{"fjappmgrbulk", {NULL}, 2510, "udp"}, +{"metastorm", {NULL}, 2511, "tcp"}, +{"metastorm", {NULL}, 2511, "udp"}, +{"citrixima", {NULL}, 2512, "tcp"}, +{"citrixima", {NULL}, 2512, "udp"}, +{"citrixadmin", {NULL}, 2513, "tcp"}, +{"citrixadmin", {NULL}, 2513, "udp"}, +{"facsys-ntp", {NULL}, 2514, "tcp"}, +{"facsys-ntp", {NULL}, 2514, "udp"}, +{"facsys-router", {NULL}, 2515, "tcp"}, +{"facsys-router", {NULL}, 2515, "udp"}, +{"maincontrol", {NULL}, 2516, "tcp"}, +{"maincontrol", {NULL}, 2516, "udp"}, +{"call-sig-trans", {NULL}, 2517, "tcp"}, +{"call-sig-trans", {NULL}, 2517, "udp"}, +{"willy", {NULL}, 2518, "tcp"}, +{"willy", {NULL}, 2518, "udp"}, +{"globmsgsvc", {NULL}, 2519, "tcp"}, +{"globmsgsvc", {NULL}, 2519, "udp"}, +{"pvsw", {NULL}, 2520, "tcp"}, +{"pvsw", {NULL}, 2520, "udp"}, +{"adaptecmgr", {NULL}, 2521, "tcp"}, +{"adaptecmgr", {NULL}, 2521, "udp"}, +{"windb", {NULL}, 2522, "tcp"}, +{"windb", {NULL}, 2522, "udp"}, +{"qke-llc-v3", {NULL}, 2523, "tcp"}, +{"qke-llc-v3", {NULL}, 2523, "udp"}, +{"optiwave-lm", {NULL}, 2524, "tcp"}, +{"optiwave-lm", {NULL}, 2524, "udp"}, +{"ms-v-worlds", {NULL}, 2525, "tcp"}, +{"ms-v-worlds", {NULL}, 2525, "udp"}, +{"ema-sent-lm", {NULL}, 2526, "tcp"}, +{"ema-sent-lm", {NULL}, 2526, "udp"}, +{"iqserver", {NULL}, 2527, "tcp"}, +{"iqserver", {NULL}, 2527, "udp"}, +{"ncr_ccl", {NULL}, 2528, "tcp"}, +{"ncr_ccl", {NULL}, 2528, "udp"}, +{"utsftp", {NULL}, 2529, "tcp"}, +{"utsftp", {NULL}, 2529, "udp"}, +{"vrcommerce", {NULL}, 2530, "tcp"}, +{"vrcommerce", {NULL}, 2530, "udp"}, +{"ito-e-gui", {NULL}, 2531, "tcp"}, +{"ito-e-gui", {NULL}, 2531, "udp"}, +{"ovtopmd", {NULL}, 2532, "tcp"}, +{"ovtopmd", {NULL}, 2532, "udp"}, +{"snifferserver", {NULL}, 2533, "tcp"}, +{"snifferserver", {NULL}, 2533, "udp"}, +{"combox-web-acc", {NULL}, 2534, "tcp"}, +{"combox-web-acc", {NULL}, 2534, "udp"}, +{"madcap", {NULL}, 2535, "tcp"}, +{"madcap", {NULL}, 2535, "udp"}, +{"btpp2audctr1", {NULL}, 2536, "tcp"}, +{"btpp2audctr1", {NULL}, 2536, "udp"}, +{"upgrade", {NULL}, 2537, "tcp"}, +{"upgrade", {NULL}, 2537, "udp"}, +{"vnwk-prapi", {NULL}, 2538, "tcp"}, +{"vnwk-prapi", {NULL}, 2538, "udp"}, +{"vsiadmin", {NULL}, 2539, "tcp"}, +{"vsiadmin", {NULL}, 2539, "udp"}, +{"lonworks", {NULL}, 2540, "tcp"}, +{"lonworks", {NULL}, 2540, "udp"}, +{"lonworks2", {NULL}, 2541, "tcp"}, +{"lonworks2", {NULL}, 2541, "udp"}, +{"udrawgraph", {NULL}, 2542, "tcp"}, +{"udrawgraph", {NULL}, 2542, "udp"}, +{"reftek", {NULL}, 2543, "tcp"}, +{"reftek", {NULL}, 2543, "udp"}, +{"novell-zen", {NULL}, 2544, "tcp"}, +{"novell-zen", {NULL}, 2544, "udp"}, +{"sis-emt", {NULL}, 2545, "tcp"}, +{"sis-emt", {NULL}, 2545, "udp"}, +{"vytalvaultbrtp", {NULL}, 2546, "tcp"}, +{"vytalvaultbrtp", {NULL}, 2546, "udp"}, +{"vytalvaultvsmp", {NULL}, 2547, "tcp"}, +{"vytalvaultvsmp", {NULL}, 2547, "udp"}, +{"vytalvaultpipe", {NULL}, 2548, "tcp"}, +{"vytalvaultpipe", {NULL}, 2548, "udp"}, +{"ipass", {NULL}, 2549, "tcp"}, +{"ipass", {NULL}, 2549, "udp"}, +{"ads", {NULL}, 2550, "tcp"}, +{"ads", {NULL}, 2550, "udp"}, +{"isg-uda-server", {NULL}, 2551, "tcp"}, +{"isg-uda-server", {NULL}, 2551, "udp"}, +{"call-logging", {NULL}, 2552, "tcp"}, +{"call-logging", {NULL}, 2552, "udp"}, +{"efidiningport", {NULL}, 2553, "tcp"}, +{"efidiningport", {NULL}, 2553, "udp"}, +{"vcnet-link-v10", {NULL}, 2554, "tcp"}, +{"vcnet-link-v10", {NULL}, 2554, "udp"}, +{"compaq-wcp", {NULL}, 2555, "tcp"}, +{"compaq-wcp", {NULL}, 2555, "udp"}, +{"nicetec-nmsvc", {NULL}, 2556, "tcp"}, +{"nicetec-nmsvc", {NULL}, 2556, "udp"}, +{"nicetec-mgmt", {NULL}, 2557, "tcp"}, +{"nicetec-mgmt", {NULL}, 2557, "udp"}, +{"pclemultimedia", {NULL}, 2558, "tcp"}, +{"pclemultimedia", {NULL}, 2558, "udp"}, +{"lstp", {NULL}, 2559, "tcp"}, +{"lstp", {NULL}, 2559, "udp"}, +{"labrat", {NULL}, 2560, "tcp"}, +{"labrat", {NULL}, 2560, "udp"}, +{"mosaixcc", {NULL}, 2561, "tcp"}, +{"mosaixcc", {NULL}, 2561, "udp"}, +{"delibo", {NULL}, 2562, "tcp"}, +{"delibo", {NULL}, 2562, "udp"}, +{"cti-redwood", {NULL}, 2563, "tcp"}, +{"cti-redwood", {NULL}, 2563, "udp"}, +{"hp-3000-telnet", {NULL}, 2564, "tcp"}, +{"coord-svr", {NULL}, 2565, "tcp"}, +{"coord-svr", {NULL}, 2565, "udp"}, +{"pcs-pcw", {NULL}, 2566, "tcp"}, +{"pcs-pcw", {NULL}, 2566, "udp"}, +{"clp", {NULL}, 2567, "tcp"}, +{"clp", {NULL}, 2567, "udp"}, +{"spamtrap", {NULL}, 2568, "tcp"}, +{"spamtrap", {NULL}, 2568, "udp"}, +{"sonuscallsig", {NULL}, 2569, "tcp"}, +{"sonuscallsig", {NULL}, 2569, "udp"}, +{"hs-port", {NULL}, 2570, "tcp"}, +{"hs-port", {NULL}, 2570, "udp"}, +{"cecsvc", {NULL}, 2571, "tcp"}, +{"cecsvc", {NULL}, 2571, "udp"}, +{"ibp", {NULL}, 2572, "tcp"}, +{"ibp", {NULL}, 2572, "udp"}, +{"trustestablish", {NULL}, 2573, "tcp"}, +{"trustestablish", {NULL}, 2573, "udp"}, +{"blockade-bpsp", {NULL}, 2574, "tcp"}, +{"blockade-bpsp", {NULL}, 2574, "udp"}, +{"hl7", {NULL}, 2575, "tcp"}, +{"hl7", {NULL}, 2575, "udp"}, +{"tclprodebugger", {NULL}, 2576, "tcp"}, +{"tclprodebugger", {NULL}, 2576, "udp"}, +{"scipticslsrvr", {NULL}, 2577, "tcp"}, +{"scipticslsrvr", {NULL}, 2577, "udp"}, +{"rvs-isdn-dcp", {NULL}, 2578, "tcp"}, +{"rvs-isdn-dcp", {NULL}, 2578, "udp"}, +{"mpfoncl", {NULL}, 2579, "tcp"}, +{"mpfoncl", {NULL}, 2579, "udp"}, +{"tributary", {NULL}, 2580, "tcp"}, +{"tributary", {NULL}, 2580, "udp"}, +{"argis-te", {NULL}, 2581, "tcp"}, +{"argis-te", {NULL}, 2581, "udp"}, +{"argis-ds", {NULL}, 2582, "tcp"}, +{"argis-ds", {NULL}, 2582, "udp"}, +{"mon", {NULL}, 2583, "tcp"}, +{"mon", {NULL}, 2583, "udp"}, +{"cyaserv", {NULL}, 2584, "tcp"}, +{"cyaserv", {NULL}, 2584, "udp"}, +{"netx-server", {NULL}, 2585, "tcp"}, +{"netx-server", {NULL}, 2585, "udp"}, +{"netx-agent", {NULL}, 2586, "tcp"}, +{"netx-agent", {NULL}, 2586, "udp"}, +{"masc", {NULL}, 2587, "tcp"}, +{"masc", {NULL}, 2587, "udp"}, +{"privilege", {NULL}, 2588, "tcp"}, +{"privilege", {NULL}, 2588, "udp"}, +{"quartus-tcl", {NULL}, 2589, "tcp"}, +{"quartus-tcl", {NULL}, 2589, "udp"}, +{"idotdist", {NULL}, 2590, "tcp"}, +{"idotdist", {NULL}, 2590, "udp"}, +{"maytagshuffle", {NULL}, 2591, "tcp"}, +{"maytagshuffle", {NULL}, 2591, "udp"}, +{"netrek", {NULL}, 2592, "tcp"}, +{"netrek", {NULL}, 2592, "udp"}, +{"mns-mail", {NULL}, 2593, "tcp"}, +{"mns-mail", {NULL}, 2593, "udp"}, +{"dts", {NULL}, 2594, "tcp"}, +{"dts", {NULL}, 2594, "udp"}, +{"worldfusion1", {NULL}, 2595, "tcp"}, +{"worldfusion1", {NULL}, 2595, "udp"}, +{"worldfusion2", {NULL}, 2596, "tcp"}, +{"worldfusion2", {NULL}, 2596, "udp"}, +{"homesteadglory", {NULL}, 2597, "tcp"}, +{"homesteadglory", {NULL}, 2597, "udp"}, +{"citriximaclient", {NULL}, 2598, "tcp"}, +{"citriximaclient", {NULL}, 2598, "udp"}, +{"snapd", {NULL}, 2599, "tcp"}, +{"snapd", {NULL}, 2599, "udp"}, +{"hpstgmgr", {NULL}, 2600, "tcp"}, +{"hpstgmgr", {NULL}, 2600, "udp"}, +{"discp-client", {NULL}, 2601, "tcp"}, +{"discp-client", {NULL}, 2601, "udp"}, +{"discp-server", {NULL}, 2602, "tcp"}, +{"discp-server", {NULL}, 2602, "udp"}, +{"servicemeter", {NULL}, 2603, "tcp"}, +{"servicemeter", {NULL}, 2603, "udp"}, +{"nsc-ccs", {NULL}, 2604, "tcp"}, +{"nsc-ccs", {NULL}, 2604, "udp"}, +{"nsc-posa", {NULL}, 2605, "tcp"}, +{"nsc-posa", {NULL}, 2605, "udp"}, +{"netmon", {NULL}, 2606, "tcp"}, +{"netmon", {NULL}, 2606, "udp"}, +{"connection", {NULL}, 2607, "tcp"}, +{"connection", {NULL}, 2607, "udp"}, +{"wag-service", {NULL}, 2608, "tcp"}, +{"wag-service", {NULL}, 2608, "udp"}, +{"system-monitor", {NULL}, 2609, "tcp"}, +{"system-monitor", {NULL}, 2609, "udp"}, +{"versa-tek", {NULL}, 2610, "tcp"}, +{"versa-tek", {NULL}, 2610, "udp"}, +{"lionhead", {NULL}, 2611, "tcp"}, +{"lionhead", {NULL}, 2611, "udp"}, +{"qpasa-agent", {NULL}, 2612, "tcp"}, +{"qpasa-agent", {NULL}, 2612, "udp"}, +{"smntubootstrap", {NULL}, 2613, "tcp"}, +{"smntubootstrap", {NULL}, 2613, "udp"}, +{"neveroffline", {NULL}, 2614, "tcp"}, +{"neveroffline", {NULL}, 2614, "udp"}, +{"firepower", {NULL}, 2615, "tcp"}, +{"firepower", {NULL}, 2615, "udp"}, +{"appswitch-emp", {NULL}, 2616, "tcp"}, +{"appswitch-emp", {NULL}, 2616, "udp"}, +{"cmadmin", {NULL}, 2617, "tcp"}, +{"cmadmin", {NULL}, 2617, "udp"}, +{"priority-e-com", {NULL}, 2618, "tcp"}, +{"priority-e-com", {NULL}, 2618, "udp"}, +{"bruce", {NULL}, 2619, "tcp"}, +{"bruce", {NULL}, 2619, "udp"}, +{"lpsrecommender", {NULL}, 2620, "tcp"}, +{"lpsrecommender", {NULL}, 2620, "udp"}, +{"miles-apart", {NULL}, 2621, "tcp"}, +{"miles-apart", {NULL}, 2621, "udp"}, +{"metricadbc", {NULL}, 2622, "tcp"}, +{"metricadbc", {NULL}, 2622, "udp"}, +{"lmdp", {NULL}, 2623, "tcp"}, +{"lmdp", {NULL}, 2623, "udp"}, +{"aria", {NULL}, 2624, "tcp"}, +{"aria", {NULL}, 2624, "udp"}, +{"blwnkl-port", {NULL}, 2625, "tcp"}, +{"blwnkl-port", {NULL}, 2625, "udp"}, +{"gbjd816", {NULL}, 2626, "tcp"}, +{"gbjd816", {NULL}, 2626, "udp"}, +{"moshebeeri", {NULL}, 2627, "tcp"}, +{"moshebeeri", {NULL}, 2627, "udp"}, +{"dict", {NULL}, 2628, "tcp"}, +{"dict", {NULL}, 2628, "udp"}, +{"sitaraserver", {NULL}, 2629, "tcp"}, +{"sitaraserver", {NULL}, 2629, "udp"}, +{"sitaramgmt", {NULL}, 2630, "tcp"}, +{"sitaramgmt", {NULL}, 2630, "udp"}, +{"sitaradir", {NULL}, 2631, "tcp"}, +{"sitaradir", {NULL}, 2631, "udp"}, +{"irdg-post", {NULL}, 2632, "tcp"}, +{"irdg-post", {NULL}, 2632, "udp"}, +{"interintelli", {NULL}, 2633, "tcp"}, +{"interintelli", {NULL}, 2633, "udp"}, +{"pk-electronics", {NULL}, 2634, "tcp"}, +{"pk-electronics", {NULL}, 2634, "udp"}, +{"backburner", {NULL}, 2635, "tcp"}, +{"backburner", {NULL}, 2635, "udp"}, +{"solve", {NULL}, 2636, "tcp"}, +{"solve", {NULL}, 2636, "udp"}, +{"imdocsvc", {NULL}, 2637, "tcp"}, +{"imdocsvc", {NULL}, 2637, "udp"}, +{"sybaseanywhere", {NULL}, 2638, "tcp"}, +{"sybaseanywhere", {NULL}, 2638, "udp"}, +{"aminet", {NULL}, 2639, "tcp"}, +{"aminet", {NULL}, 2639, "udp"}, +{"sai_sentlm", {NULL}, 2640, "tcp"}, +{"sai_sentlm", {NULL}, 2640, "udp"}, +{"hdl-srv", {NULL}, 2641, "tcp"}, +{"hdl-srv", {NULL}, 2641, "udp"}, +{"tragic", {NULL}, 2642, "tcp"}, +{"tragic", {NULL}, 2642, "udp"}, +{"gte-samp", {NULL}, 2643, "tcp"}, +{"gte-samp", {NULL}, 2643, "udp"}, +{"travsoft-ipx-t", {NULL}, 2644, "tcp"}, +{"travsoft-ipx-t", {NULL}, 2644, "udp"}, +{"novell-ipx-cmd", {NULL}, 2645, "tcp"}, +{"novell-ipx-cmd", {NULL}, 2645, "udp"}, +{"and-lm", {NULL}, 2646, "tcp"}, +{"and-lm", {NULL}, 2646, "udp"}, +{"syncserver", {NULL}, 2647, "tcp"}, +{"syncserver", {NULL}, 2647, "udp"}, +{"upsnotifyprot", {NULL}, 2648, "tcp"}, +{"upsnotifyprot", {NULL}, 2648, "udp"}, +{"vpsipport", {NULL}, 2649, "tcp"}, +{"vpsipport", {NULL}, 2649, "udp"}, +{"eristwoguns", {NULL}, 2650, "tcp"}, +{"eristwoguns", {NULL}, 2650, "udp"}, +{"ebinsite", {NULL}, 2651, "tcp"}, +{"ebinsite", {NULL}, 2651, "udp"}, +{"interpathpanel", {NULL}, 2652, "tcp"}, +{"interpathpanel", {NULL}, 2652, "udp"}, +{"sonus", {NULL}, 2653, "tcp"}, +{"sonus", {NULL}, 2653, "udp"}, +{"corel_vncadmin", {NULL}, 2654, "tcp"}, +{"corel_vncadmin", {NULL}, 2654, "udp"}, +{"unglue", {NULL}, 2655, "tcp"}, +{"unglue", {NULL}, 2655, "udp"}, +{"kana", {NULL}, 2656, "tcp"}, +{"kana", {NULL}, 2656, "udp"}, +{"sns-dispatcher", {NULL}, 2657, "tcp"}, +{"sns-dispatcher", {NULL}, 2657, "udp"}, +{"sns-admin", {NULL}, 2658, "tcp"}, +{"sns-admin", {NULL}, 2658, "udp"}, +{"sns-query", {NULL}, 2659, "tcp"}, +{"sns-query", {NULL}, 2659, "udp"}, +{"gcmonitor", {NULL}, 2660, "tcp"}, +{"gcmonitor", {NULL}, 2660, "udp"}, +{"olhost", {NULL}, 2661, "tcp"}, +{"olhost", {NULL}, 2661, "udp"}, +{"bintec-capi", {NULL}, 2662, "tcp"}, +{"bintec-capi", {NULL}, 2662, "udp"}, +{"bintec-tapi", {NULL}, 2663, "tcp"}, +{"bintec-tapi", {NULL}, 2663, "udp"}, +{"patrol-mq-gm", {NULL}, 2664, "tcp"}, +{"patrol-mq-gm", {NULL}, 2664, "udp"}, +{"patrol-mq-nm", {NULL}, 2665, "tcp"}, +{"patrol-mq-nm", {NULL}, 2665, "udp"}, +{"extensis", {NULL}, 2666, "tcp"}, +{"extensis", {NULL}, 2666, "udp"}, +{"alarm-clock-s", {NULL}, 2667, "tcp"}, +{"alarm-clock-s", {NULL}, 2667, "udp"}, +{"alarm-clock-c", {NULL}, 2668, "tcp"}, +{"alarm-clock-c", {NULL}, 2668, "udp"}, +{"toad", {NULL}, 2669, "tcp"}, +{"toad", {NULL}, 2669, "udp"}, +{"tve-announce", {NULL}, 2670, "tcp"}, +{"tve-announce", {NULL}, 2670, "udp"}, +{"newlixreg", {NULL}, 2671, "tcp"}, +{"newlixreg", {NULL}, 2671, "udp"}, +{"nhserver", {NULL}, 2672, "tcp"}, +{"nhserver", {NULL}, 2672, "udp"}, +{"firstcall42", {NULL}, 2673, "tcp"}, +{"firstcall42", {NULL}, 2673, "udp"}, +{"ewnn", {NULL}, 2674, "tcp"}, +{"ewnn", {NULL}, 2674, "udp"}, +{"ttc-etap", {NULL}, 2675, "tcp"}, +{"ttc-etap", {NULL}, 2675, "udp"}, +{"simslink", {NULL}, 2676, "tcp"}, +{"simslink", {NULL}, 2676, "udp"}, +{"gadgetgate1way", {NULL}, 2677, "tcp"}, +{"gadgetgate1way", {NULL}, 2677, "udp"}, +{"gadgetgate2way", {NULL}, 2678, "tcp"}, +{"gadgetgate2way", {NULL}, 2678, "udp"}, +{"syncserverssl", {NULL}, 2679, "tcp"}, +{"syncserverssl", {NULL}, 2679, "udp"}, +{"pxc-sapxom", {NULL}, 2680, "tcp"}, +{"pxc-sapxom", {NULL}, 2680, "udp"}, +{"mpnjsomb", {NULL}, 2681, "tcp"}, +{"mpnjsomb", {NULL}, 2681, "udp"}, +{"ncdloadbalance", {NULL}, 2683, "tcp"}, +{"ncdloadbalance", {NULL}, 2683, "udp"}, +{"mpnjsosv", {NULL}, 2684, "tcp"}, +{"mpnjsosv", {NULL}, 2684, "udp"}, +{"mpnjsocl", {NULL}, 2685, "tcp"}, +{"mpnjsocl", {NULL}, 2685, "udp"}, +{"mpnjsomg", {NULL}, 2686, "tcp"}, +{"mpnjsomg", {NULL}, 2686, "udp"}, +{"pq-lic-mgmt", {NULL}, 2687, "tcp"}, +{"pq-lic-mgmt", {NULL}, 2687, "udp"}, +{"md-cg-http", {NULL}, 2688, "tcp"}, +{"md-cg-http", {NULL}, 2688, "udp"}, +{"fastlynx", {NULL}, 2689, "tcp"}, +{"fastlynx", {NULL}, 2689, "udp"}, +{"hp-nnm-data", {NULL}, 2690, "tcp"}, +{"hp-nnm-data", {NULL}, 2690, "udp"}, +{"itinternet", {NULL}, 2691, "tcp"}, +{"itinternet", {NULL}, 2691, "udp"}, +{"admins-lms", {NULL}, 2692, "tcp"}, +{"admins-lms", {NULL}, 2692, "udp"}, +{"pwrsevent", {NULL}, 2694, "tcp"}, +{"pwrsevent", {NULL}, 2694, "udp"}, +{"vspread", {NULL}, 2695, "tcp"}, +{"vspread", {NULL}, 2695, "udp"}, +{"unifyadmin", {NULL}, 2696, "tcp"}, +{"unifyadmin", {NULL}, 2696, "udp"}, +{"oce-snmp-trap", {NULL}, 2697, "tcp"}, +{"oce-snmp-trap", {NULL}, 2697, "udp"}, +{"mck-ivpip", {NULL}, 2698, "tcp"}, +{"mck-ivpip", {NULL}, 2698, "udp"}, +{"csoft-plusclnt", {NULL}, 2699, "tcp"}, +{"csoft-plusclnt", {NULL}, 2699, "udp"}, +{"tqdata", {NULL}, 2700, "tcp"}, +{"tqdata", {NULL}, 2700, "udp"}, +{"sms-rcinfo", {NULL}, 2701, "tcp"}, +{"sms-rcinfo", {NULL}, 2701, "udp"}, +{"sms-xfer", {NULL}, 2702, "tcp"}, +{"sms-xfer", {NULL}, 2702, "udp"}, +{"sms-chat", {NULL}, 2703, "tcp"}, +{"sms-chat", {NULL}, 2703, "udp"}, +{"sms-remctrl", {NULL}, 2704, "tcp"}, +{"sms-remctrl", {NULL}, 2704, "udp"}, +{"sds-admin", {NULL}, 2705, "tcp"}, +{"sds-admin", {NULL}, 2705, "udp"}, +{"ncdmirroring", {NULL}, 2706, "tcp"}, +{"ncdmirroring", {NULL}, 2706, "udp"}, +{"emcsymapiport", {NULL}, 2707, "tcp"}, +{"emcsymapiport", {NULL}, 2707, "udp"}, +{"banyan-net", {NULL}, 2708, "tcp"}, +{"banyan-net", {NULL}, 2708, "udp"}, +{"supermon", {NULL}, 2709, "tcp"}, +{"supermon", {NULL}, 2709, "udp"}, +{"sso-service", {NULL}, 2710, "tcp"}, +{"sso-service", {NULL}, 2710, "udp"}, +{"sso-control", {NULL}, 2711, "tcp"}, +{"sso-control", {NULL}, 2711, "udp"}, +{"aocp", {NULL}, 2712, "tcp"}, +{"aocp", {NULL}, 2712, "udp"}, +{"raventbs", {NULL}, 2713, "tcp"}, +{"raventbs", {NULL}, 2713, "udp"}, +{"raventdm", {NULL}, 2714, "tcp"}, +{"raventdm", {NULL}, 2714, "udp"}, +{"hpstgmgr2", {NULL}, 2715, "tcp"}, +{"hpstgmgr2", {NULL}, 2715, "udp"}, +{"inova-ip-disco", {NULL}, 2716, "tcp"}, +{"inova-ip-disco", {NULL}, 2716, "udp"}, +{"pn-requester", {NULL}, 2717, "tcp"}, +{"pn-requester", {NULL}, 2717, "udp"}, +{"pn-requester2", {NULL}, 2718, "tcp"}, +{"pn-requester2", {NULL}, 2718, "udp"}, +{"scan-change", {NULL}, 2719, "tcp"}, +{"scan-change", {NULL}, 2719, "udp"}, +{"wkars", {NULL}, 2720, "tcp"}, +{"wkars", {NULL}, 2720, "udp"}, +{"smart-diagnose", {NULL}, 2721, "tcp"}, +{"smart-diagnose", {NULL}, 2721, "udp"}, +{"proactivesrvr", {NULL}, 2722, "tcp"}, +{"proactivesrvr", {NULL}, 2722, "udp"}, +{"watchdog-nt", {NULL}, 2723, "tcp"}, +{"watchdog-nt", {NULL}, 2723, "udp"}, +{"qotps", {NULL}, 2724, "tcp"}, +{"qotps", {NULL}, 2724, "udp"}, +{"msolap-ptp2", {NULL}, 2725, "tcp"}, +{"msolap-ptp2", {NULL}, 2725, "udp"}, +{"tams", {NULL}, 2726, "tcp"}, +{"tams", {NULL}, 2726, "udp"}, +{"mgcp-callagent", {NULL}, 2727, "tcp"}, +{"mgcp-callagent", {NULL}, 2727, "udp"}, +{"sqdr", {NULL}, 2728, "tcp"}, +{"sqdr", {NULL}, 2728, "udp"}, +{"tcim-control", {NULL}, 2729, "tcp"}, +{"tcim-control", {NULL}, 2729, "udp"}, +{"nec-raidplus", {NULL}, 2730, "tcp"}, +{"nec-raidplus", {NULL}, 2730, "udp"}, +{"fyre-messanger", {NULL}, 2731, "tcp"}, +{"fyre-messanger", {NULL}, 2731, "udp"}, +{"g5m", {NULL}, 2732, "tcp"}, +{"g5m", {NULL}, 2732, "udp"}, +{"signet-ctf", {NULL}, 2733, "tcp"}, +{"signet-ctf", {NULL}, 2733, "udp"}, +{"ccs-software", {NULL}, 2734, "tcp"}, +{"ccs-software", {NULL}, 2734, "udp"}, +{"netiq-mc", {NULL}, 2735, "tcp"}, +{"netiq-mc", {NULL}, 2735, "udp"}, +{"radwiz-nms-srv", {NULL}, 2736, "tcp"}, +{"radwiz-nms-srv", {NULL}, 2736, "udp"}, +{"srp-feedback", {NULL}, 2737, "tcp"}, +{"srp-feedback", {NULL}, 2737, "udp"}, +{"ndl-tcp-ois-gw", {NULL}, 2738, "tcp"}, +{"ndl-tcp-ois-gw", {NULL}, 2738, "udp"}, +{"tn-timing", {NULL}, 2739, "tcp"}, +{"tn-timing", {NULL}, 2739, "udp"}, +{"alarm", {NULL}, 2740, "tcp"}, +{"alarm", {NULL}, 2740, "udp"}, +{"tsb", {NULL}, 2741, "tcp"}, +{"tsb", {NULL}, 2741, "udp"}, +{"tsb2", {NULL}, 2742, "tcp"}, +{"tsb2", {NULL}, 2742, "udp"}, +{"murx", {NULL}, 2743, "tcp"}, +{"murx", {NULL}, 2743, "udp"}, +{"honyaku", {NULL}, 2744, "tcp"}, +{"honyaku", {NULL}, 2744, "udp"}, +{"urbisnet", {NULL}, 2745, "tcp"}, +{"urbisnet", {NULL}, 2745, "udp"}, +{"cpudpencap", {NULL}, 2746, "tcp"}, +{"cpudpencap", {NULL}, 2746, "udp"}, +{"fjippol-swrly", {NULL}, 2747, "tcp"}, +{"fjippol-swrly", {NULL}, 2747, "udp"}, +{"fjippol-polsvr", {NULL}, 2748, "tcp"}, +{"fjippol-polsvr", {NULL}, 2748, "udp"}, +{"fjippol-cnsl", {NULL}, 2749, "tcp"}, +{"fjippol-cnsl", {NULL}, 2749, "udp"}, +{"fjippol-port1", {NULL}, 2750, "tcp"}, +{"fjippol-port1", {NULL}, 2750, "udp"}, +{"fjippol-port2", {NULL}, 2751, "tcp"}, +{"fjippol-port2", {NULL}, 2751, "udp"}, +{"rsisysaccess", {NULL}, 2752, "tcp"}, +{"rsisysaccess", {NULL}, 2752, "udp"}, +{"de-spot", {NULL}, 2753, "tcp"}, +{"de-spot", {NULL}, 2753, "udp"}, +{"apollo-cc", {NULL}, 2754, "tcp"}, +{"apollo-cc", {NULL}, 2754, "udp"}, +{"expresspay", {NULL}, 2755, "tcp"}, +{"expresspay", {NULL}, 2755, "udp"}, +{"simplement-tie", {NULL}, 2756, "tcp"}, +{"simplement-tie", {NULL}, 2756, "udp"}, +{"cnrp", {NULL}, 2757, "tcp"}, +{"cnrp", {NULL}, 2757, "udp"}, +{"apollo-status", {NULL}, 2758, "tcp"}, +{"apollo-status", {NULL}, 2758, "udp"}, +{"apollo-gms", {NULL}, 2759, "tcp"}, +{"apollo-gms", {NULL}, 2759, "udp"}, +{"sabams", {NULL}, 2760, "tcp"}, +{"sabams", {NULL}, 2760, "udp"}, +{"dicom-iscl", {NULL}, 2761, "tcp"}, +{"dicom-iscl", {NULL}, 2761, "udp"}, +{"dicom-tls", {NULL}, 2762, "tcp"}, +{"dicom-tls", {NULL}, 2762, "udp"}, +{"desktop-dna", {NULL}, 2763, "tcp"}, +{"desktop-dna", {NULL}, 2763, "udp"}, +{"data-insurance", {NULL}, 2764, "tcp"}, +{"data-insurance", {NULL}, 2764, "udp"}, +{"qip-audup", {NULL}, 2765, "tcp"}, +{"qip-audup", {NULL}, 2765, "udp"}, +{"compaq-scp", {NULL}, 2766, "tcp"}, +{"compaq-scp", {NULL}, 2766, "udp"}, +{"uadtc", {NULL}, 2767, "tcp"}, +{"uadtc", {NULL}, 2767, "udp"}, +{"uacs", {NULL}, 2768, "tcp"}, +{"uacs", {NULL}, 2768, "udp"}, +{"exce", {NULL}, 2769, "tcp"}, +{"exce", {NULL}, 2769, "udp"}, +{"veronica", {NULL}, 2770, "tcp"}, +{"veronica", {NULL}, 2770, "udp"}, +{"vergencecm", {NULL}, 2771, "tcp"}, +{"vergencecm", {NULL}, 2771, "udp"}, +{"auris", {NULL}, 2772, "tcp"}, +{"auris", {NULL}, 2772, "udp"}, +{"rbakcup1", {NULL}, 2773, "tcp"}, +{"rbakcup1", {NULL}, 2773, "udp"}, +{"rbakcup2", {NULL}, 2774, "tcp"}, +{"rbakcup2", {NULL}, 2774, "udp"}, +{"smpp", {NULL}, 2775, "tcp"}, +{"smpp", {NULL}, 2775, "udp"}, +{"ridgeway1", {NULL}, 2776, "tcp"}, +{"ridgeway1", {NULL}, 2776, "udp"}, +{"ridgeway2", {NULL}, 2777, "tcp"}, +{"ridgeway2", {NULL}, 2777, "udp"}, +{"gwen-sonya", {NULL}, 2778, "tcp"}, +{"gwen-sonya", {NULL}, 2778, "udp"}, +{"lbc-sync", {NULL}, 2779, "tcp"}, +{"lbc-sync", {NULL}, 2779, "udp"}, +{"lbc-control", {NULL}, 2780, "tcp"}, +{"lbc-control", {NULL}, 2780, "udp"}, +{"whosells", {NULL}, 2781, "tcp"}, +{"whosells", {NULL}, 2781, "udp"}, +{"everydayrc", {NULL}, 2782, "tcp"}, +{"everydayrc", {NULL}, 2782, "udp"}, +{"aises", {NULL}, 2783, "tcp"}, +{"aises", {NULL}, 2783, "udp"}, +{"www-dev", {NULL}, 2784, "tcp"}, +{"www-dev", {NULL}, 2784, "udp"}, +{"aic-np", {NULL}, 2785, "tcp"}, +{"aic-np", {NULL}, 2785, "udp"}, +{"aic-oncrpc", {NULL}, 2786, "tcp"}, +{"aic-oncrpc", {NULL}, 2786, "udp"}, +{"piccolo", {NULL}, 2787, "tcp"}, +{"piccolo", {NULL}, 2787, "udp"}, +{"fryeserv", {NULL}, 2788, "tcp"}, +{"fryeserv", {NULL}, 2788, "udp"}, +{"media-agent", {NULL}, 2789, "tcp"}, +{"media-agent", {NULL}, 2789, "udp"}, +{"plgproxy", {NULL}, 2790, "tcp"}, +{"plgproxy", {NULL}, 2790, "udp"}, +{"mtport-regist", {NULL}, 2791, "tcp"}, +{"mtport-regist", {NULL}, 2791, "udp"}, +{"f5-globalsite", {NULL}, 2792, "tcp"}, +{"f5-globalsite", {NULL}, 2792, "udp"}, +{"initlsmsad", {NULL}, 2793, "tcp"}, +{"initlsmsad", {NULL}, 2793, "udp"}, +{"livestats", {NULL}, 2795, "tcp"}, +{"livestats", {NULL}, 2795, "udp"}, +{"ac-tech", {NULL}, 2796, "tcp"}, +{"ac-tech", {NULL}, 2796, "udp"}, +{"esp-encap", {NULL}, 2797, "tcp"}, +{"esp-encap", {NULL}, 2797, "udp"}, +{"tmesis-upshot", {NULL}, 2798, "tcp"}, +{"tmesis-upshot", {NULL}, 2798, "udp"}, +{"icon-discover", {NULL}, 2799, "tcp"}, +{"icon-discover", {NULL}, 2799, "udp"}, +{"acc-raid", {NULL}, 2800, "tcp"}, +{"acc-raid", {NULL}, 2800, "udp"}, +{"igcp", {NULL}, 2801, "tcp"}, +{"igcp", {NULL}, 2801, "udp"}, +{"veritas-tcp1", {NULL}, 2802, "tcp"}, +{"veritas-udp1", {NULL}, 2802, "udp"}, +{"btprjctrl", {NULL}, 2803, "tcp"}, +{"btprjctrl", {NULL}, 2803, "udp"}, +{"dvr-esm", {NULL}, 2804, "tcp"}, +{"dvr-esm", {NULL}, 2804, "udp"}, +{"wta-wsp-s", {NULL}, 2805, "tcp"}, +{"wta-wsp-s", {NULL}, 2805, "udp"}, +{"cspuni", {NULL}, 2806, "tcp"}, +{"cspuni", {NULL}, 2806, "udp"}, +{"cspmulti", {NULL}, 2807, "tcp"}, +{"cspmulti", {NULL}, 2807, "udp"}, +{"j-lan-p", {NULL}, 2808, "tcp"}, +{"j-lan-p", {NULL}, 2808, "udp"}, +{"corbaloc", {NULL}, 2809, "tcp"}, +{"corbaloc", {NULL}, 2809, "udp"}, +{"netsteward", {NULL}, 2810, "tcp"}, +{"netsteward", {NULL}, 2810, "udp"}, +{"gsiftp", {NULL}, 2811, "tcp"}, +{"gsiftp", {NULL}, 2811, "udp"}, +{"atmtcp", {NULL}, 2812, "tcp"}, +{"atmtcp", {NULL}, 2812, "udp"}, +{"llm-pass", {NULL}, 2813, "tcp"}, +{"llm-pass", {NULL}, 2813, "udp"}, +{"llm-csv", {NULL}, 2814, "tcp"}, +{"llm-csv", {NULL}, 2814, "udp"}, +{"lbc-measure", {NULL}, 2815, "tcp"}, +{"lbc-measure", {NULL}, 2815, "udp"}, +{"lbc-watchdog", {NULL}, 2816, "tcp"}, +{"lbc-watchdog", {NULL}, 2816, "udp"}, +{"nmsigport", {NULL}, 2817, "tcp"}, +{"nmsigport", {NULL}, 2817, "udp"}, +{"rmlnk", {NULL}, 2818, "tcp"}, +{"rmlnk", {NULL}, 2818, "udp"}, +{"fc-faultnotify", {NULL}, 2819, "tcp"}, +{"fc-faultnotify", {NULL}, 2819, "udp"}, +{"univision", {NULL}, 2820, "tcp"}, +{"univision", {NULL}, 2820, "udp"}, +{"vrts-at-port", {NULL}, 2821, "tcp"}, +{"vrts-at-port", {NULL}, 2821, "udp"}, +{"ka0wuc", {NULL}, 2822, "tcp"}, +{"ka0wuc", {NULL}, 2822, "udp"}, +{"cqg-netlan", {NULL}, 2823, "tcp"}, +{"cqg-netlan", {NULL}, 2823, "udp"}, +{"cqg-netlan-1", {NULL}, 2824, "tcp"}, +{"cqg-netlan-1", {NULL}, 2824, "udp"}, +{"slc-systemlog", {NULL}, 2826, "tcp"}, +{"slc-systemlog", {NULL}, 2826, "udp"}, +{"slc-ctrlrloops", {NULL}, 2827, "tcp"}, +{"slc-ctrlrloops", {NULL}, 2827, "udp"}, +{"itm-lm", {NULL}, 2828, "tcp"}, +{"itm-lm", {NULL}, 2828, "udp"}, +{"silkp1", {NULL}, 2829, "tcp"}, +{"silkp1", {NULL}, 2829, "udp"}, +{"silkp2", {NULL}, 2830, "tcp"}, +{"silkp2", {NULL}, 2830, "udp"}, +{"silkp3", {NULL}, 2831, "tcp"}, +{"silkp3", {NULL}, 2831, "udp"}, +{"silkp4", {NULL}, 2832, "tcp"}, +{"silkp4", {NULL}, 2832, "udp"}, +{"glishd", {NULL}, 2833, "tcp"}, +{"glishd", {NULL}, 2833, "udp"}, +{"evtp", {NULL}, 2834, "tcp"}, +{"evtp", {NULL}, 2834, "udp"}, +{"evtp-data", {NULL}, 2835, "tcp"}, +{"evtp-data", {NULL}, 2835, "udp"}, +{"catalyst", {NULL}, 2836, "tcp"}, +{"catalyst", {NULL}, 2836, "udp"}, +{"repliweb", {NULL}, 2837, "tcp"}, +{"repliweb", {NULL}, 2837, "udp"}, +{"starbot", {NULL}, 2838, "tcp"}, +{"starbot", {NULL}, 2838, "udp"}, +{"nmsigport", {NULL}, 2839, "tcp"}, +{"nmsigport", {NULL}, 2839, "udp"}, +{"l3-exprt", {NULL}, 2840, "tcp"}, +{"l3-exprt", {NULL}, 2840, "udp"}, +{"l3-ranger", {NULL}, 2841, "tcp"}, +{"l3-ranger", {NULL}, 2841, "udp"}, +{"l3-hawk", {NULL}, 2842, "tcp"}, +{"l3-hawk", {NULL}, 2842, "udp"}, +{"pdnet", {NULL}, 2843, "tcp"}, +{"pdnet", {NULL}, 2843, "udp"}, +{"bpcp-poll", {NULL}, 2844, "tcp"}, +{"bpcp-poll", {NULL}, 2844, "udp"}, +{"bpcp-trap", {NULL}, 2845, "tcp"}, +{"bpcp-trap", {NULL}, 2845, "udp"}, +{"aimpp-hello", {NULL}, 2846, "tcp"}, +{"aimpp-hello", {NULL}, 2846, "udp"}, +{"aimpp-port-req", {NULL}, 2847, "tcp"}, +{"aimpp-port-req", {NULL}, 2847, "udp"}, +{"amt-blc-port", {NULL}, 2848, "tcp"}, +{"amt-blc-port", {NULL}, 2848, "udp"}, +{"fxp", {NULL}, 2849, "tcp"}, +{"fxp", {NULL}, 2849, "udp"}, +{"metaconsole", {NULL}, 2850, "tcp"}, +{"metaconsole", {NULL}, 2850, "udp"}, +{"webemshttp", {NULL}, 2851, "tcp"}, +{"webemshttp", {NULL}, 2851, "udp"}, +{"bears-01", {NULL}, 2852, "tcp"}, +{"bears-01", {NULL}, 2852, "udp"}, +{"ispipes", {NULL}, 2853, "tcp"}, +{"ispipes", {NULL}, 2853, "udp"}, +{"infomover", {NULL}, 2854, "tcp"}, +{"infomover", {NULL}, 2854, "udp"}, +{"msrp", {NULL}, 2855, "tcp"}, +{"msrp", {NULL}, 2855, "udp"}, +{"cesdinv", {NULL}, 2856, "tcp"}, +{"cesdinv", {NULL}, 2856, "udp"}, +{"simctlp", {NULL}, 2857, "tcp"}, +{"simctlp", {NULL}, 2857, "udp"}, +{"ecnp", {NULL}, 2858, "tcp"}, +{"ecnp", {NULL}, 2858, "udp"}, +{"activememory", {NULL}, 2859, "tcp"}, +{"activememory", {NULL}, 2859, "udp"}, +{"dialpad-voice1", {NULL}, 2860, "tcp"}, +{"dialpad-voice1", {NULL}, 2860, "udp"}, +{"dialpad-voice2", {NULL}, 2861, "tcp"}, +{"dialpad-voice2", {NULL}, 2861, "udp"}, +{"ttg-protocol", {NULL}, 2862, "tcp"}, +{"ttg-protocol", {NULL}, 2862, "udp"}, +{"sonardata", {NULL}, 2863, "tcp"}, +{"sonardata", {NULL}, 2863, "udp"}, +{"astromed-main", {NULL}, 2864, "tcp"}, +{"astromed-main", {NULL}, 2864, "udp"}, +{"pit-vpn", {NULL}, 2865, "tcp"}, +{"pit-vpn", {NULL}, 2865, "udp"}, +{"iwlistener", {NULL}, 2866, "tcp"}, +{"iwlistener", {NULL}, 2866, "udp"}, +{"esps-portal", {NULL}, 2867, "tcp"}, +{"esps-portal", {NULL}, 2867, "udp"}, +{"npep-messaging", {NULL}, 2868, "tcp"}, +{"npep-messaging", {NULL}, 2868, "udp"}, +{"icslap", {NULL}, 2869, "tcp"}, +{"icslap", {NULL}, 2869, "udp"}, +{"daishi", {NULL}, 2870, "tcp"}, +{"daishi", {NULL}, 2870, "udp"}, +{"msi-selectplay", {NULL}, 2871, "tcp"}, +{"msi-selectplay", {NULL}, 2871, "udp"}, +{"radix", {NULL}, 2872, "tcp"}, +{"radix", {NULL}, 2872, "udp"}, +{"dxmessagebase1", {NULL}, 2874, "tcp"}, +{"dxmessagebase1", {NULL}, 2874, "udp"}, +{"dxmessagebase2", {NULL}, 2875, "tcp"}, +{"dxmessagebase2", {NULL}, 2875, "udp"}, +{"sps-tunnel", {NULL}, 2876, "tcp"}, +{"sps-tunnel", {NULL}, 2876, "udp"}, +{"bluelance", {NULL}, 2877, "tcp"}, +{"bluelance", {NULL}, 2877, "udp"}, +{"aap", {NULL}, 2878, "tcp"}, +{"aap", {NULL}, 2878, "udp"}, +{"ucentric-ds", {NULL}, 2879, "tcp"}, +{"ucentric-ds", {NULL}, 2879, "udp"}, +{"synapse", {NULL}, 2880, "tcp"}, +{"synapse", {NULL}, 2880, "udp"}, +{"ndsp", {NULL}, 2881, "tcp"}, +{"ndsp", {NULL}, 2881, "udp"}, +{"ndtp", {NULL}, 2882, "tcp"}, +{"ndtp", {NULL}, 2882, "udp"}, +{"ndnp", {NULL}, 2883, "tcp"}, +{"ndnp", {NULL}, 2883, "udp"}, +{"flashmsg", {NULL}, 2884, "tcp"}, +{"flashmsg", {NULL}, 2884, "udp"}, +{"topflow", {NULL}, 2885, "tcp"}, +{"topflow", {NULL}, 2885, "udp"}, +{"responselogic", {NULL}, 2886, "tcp"}, +{"responselogic", {NULL}, 2886, "udp"}, +{"aironetddp", {NULL}, 2887, "tcp"}, +{"aironetddp", {NULL}, 2887, "udp"}, +{"spcsdlobby", {NULL}, 2888, "tcp"}, +{"spcsdlobby", {NULL}, 2888, "udp"}, +{"rsom", {NULL}, 2889, "tcp"}, +{"rsom", {NULL}, 2889, "udp"}, +{"cspclmulti", {NULL}, 2890, "tcp"}, +{"cspclmulti", {NULL}, 2890, "udp"}, +{"cinegrfx-elmd", {NULL}, 2891, "tcp"}, +{"cinegrfx-elmd", {NULL}, 2891, "udp"}, +{"snifferdata", {NULL}, 2892, "tcp"}, +{"snifferdata", {NULL}, 2892, "udp"}, +{"vseconnector", {NULL}, 2893, "tcp"}, +{"vseconnector", {NULL}, 2893, "udp"}, +{"abacus-remote", {NULL}, 2894, "tcp"}, +{"abacus-remote", {NULL}, 2894, "udp"}, +{"natuslink", {NULL}, 2895, "tcp"}, +{"natuslink", {NULL}, 2895, "udp"}, +{"ecovisiong6-1", {NULL}, 2896, "tcp"}, +{"ecovisiong6-1", {NULL}, 2896, "udp"}, +{"citrix-rtmp", {NULL}, 2897, "tcp"}, +{"citrix-rtmp", {NULL}, 2897, "udp"}, +{"appliance-cfg", {NULL}, 2898, "tcp"}, +{"appliance-cfg", {NULL}, 2898, "udp"}, +{"powergemplus", {NULL}, 2899, "tcp"}, +{"powergemplus", {NULL}, 2899, "udp"}, +{"quicksuite", {NULL}, 2900, "tcp"}, +{"quicksuite", {NULL}, 2900, "udp"}, +{"allstorcns", {NULL}, 2901, "tcp"}, +{"allstorcns", {NULL}, 2901, "udp"}, +{"netaspi", {NULL}, 2902, "tcp"}, +{"netaspi", {NULL}, 2902, "udp"}, +{"suitcase", {NULL}, 2903, "tcp"}, +{"suitcase", {NULL}, 2903, "udp"}, +{"m2ua", {NULL}, 2904, "tcp"}, +{"m2ua", {NULL}, 2904, "udp"}, +{"m2ua", {NULL}, 2904, "sctp"}, +{"m3ua", {NULL}, 2905, "tcp"}, +{"m3ua", {NULL}, 2905, "sctp"}, +{"caller9", {NULL}, 2906, "tcp"}, +{"caller9", {NULL}, 2906, "udp"}, +{"webmethods-b2b", {NULL}, 2907, "tcp"}, +{"webmethods-b2b", {NULL}, 2907, "udp"}, +{"mao", {NULL}, 2908, "tcp"}, +{"mao", {NULL}, 2908, "udp"}, +{"funk-dialout", {NULL}, 2909, "tcp"}, +{"funk-dialout", {NULL}, 2909, "udp"}, +{"tdaccess", {NULL}, 2910, "tcp"}, +{"tdaccess", {NULL}, 2910, "udp"}, +{"blockade", {NULL}, 2911, "tcp"}, +{"blockade", {NULL}, 2911, "udp"}, +{"epicon", {NULL}, 2912, "tcp"}, +{"epicon", {NULL}, 2912, "udp"}, +{"boosterware", {NULL}, 2913, "tcp"}, +{"boosterware", {NULL}, 2913, "udp"}, +{"gamelobby", {NULL}, 2914, "tcp"}, +{"gamelobby", {NULL}, 2914, "udp"}, +{"tksocket", {NULL}, 2915, "tcp"}, +{"tksocket", {NULL}, 2915, "udp"}, +{"elvin_server", {NULL}, 2916, "tcp"}, +{"elvin_server", {NULL}, 2916, "udp"}, +{"elvin_client", {NULL}, 2917, "tcp"}, +{"elvin_client", {NULL}, 2917, "udp"}, +{"kastenchasepad", {NULL}, 2918, "tcp"}, +{"kastenchasepad", {NULL}, 2918, "udp"}, +{"roboer", {NULL}, 2919, "tcp"}, +{"roboer", {NULL}, 2919, "udp"}, +{"roboeda", {NULL}, 2920, "tcp"}, +{"roboeda", {NULL}, 2920, "udp"}, +{"cesdcdman", {NULL}, 2921, "tcp"}, +{"cesdcdman", {NULL}, 2921, "udp"}, +{"cesdcdtrn", {NULL}, 2922, "tcp"}, +{"cesdcdtrn", {NULL}, 2922, "udp"}, +{"wta-wsp-wtp-s", {NULL}, 2923, "tcp"}, +{"wta-wsp-wtp-s", {NULL}, 2923, "udp"}, +{"precise-vip", {NULL}, 2924, "tcp"}, +{"precise-vip", {NULL}, 2924, "udp"}, +{"mobile-file-dl", {NULL}, 2926, "tcp"}, +{"mobile-file-dl", {NULL}, 2926, "udp"}, +{"unimobilectrl", {NULL}, 2927, "tcp"}, +{"unimobilectrl", {NULL}, 2927, "udp"}, +{"redstone-cpss", {NULL}, 2928, "tcp"}, +{"redstone-cpss", {NULL}, 2928, "udp"}, +{"amx-webadmin", {NULL}, 2929, "tcp"}, +{"amx-webadmin", {NULL}, 2929, "udp"}, +{"amx-weblinx", {NULL}, 2930, "tcp"}, +{"amx-weblinx", {NULL}, 2930, "udp"}, +{"circle-x", {NULL}, 2931, "tcp"}, +{"circle-x", {NULL}, 2931, "udp"}, +{"incp", {NULL}, 2932, "tcp"}, +{"incp", {NULL}, 2932, "udp"}, +{"4-tieropmgw", {NULL}, 2933, "tcp"}, +{"4-tieropmgw", {NULL}, 2933, "udp"}, +{"4-tieropmcli", {NULL}, 2934, "tcp"}, +{"4-tieropmcli", {NULL}, 2934, "udp"}, +{"qtp", {NULL}, 2935, "tcp"}, +{"qtp", {NULL}, 2935, "udp"}, +{"otpatch", {NULL}, 2936, "tcp"}, +{"otpatch", {NULL}, 2936, "udp"}, +{"pnaconsult-lm", {NULL}, 2937, "tcp"}, +{"pnaconsult-lm", {NULL}, 2937, "udp"}, +{"sm-pas-1", {NULL}, 2938, "tcp"}, +{"sm-pas-1", {NULL}, 2938, "udp"}, +{"sm-pas-2", {NULL}, 2939, "tcp"}, +{"sm-pas-2", {NULL}, 2939, "udp"}, +{"sm-pas-3", {NULL}, 2940, "tcp"}, +{"sm-pas-3", {NULL}, 2940, "udp"}, +{"sm-pas-4", {NULL}, 2941, "tcp"}, +{"sm-pas-4", {NULL}, 2941, "udp"}, +{"sm-pas-5", {NULL}, 2942, "tcp"}, +{"sm-pas-5", {NULL}, 2942, "udp"}, +{"ttnrepository", {NULL}, 2943, "tcp"}, +{"ttnrepository", {NULL}, 2943, "udp"}, +{"megaco-h248", {NULL}, 2944, "tcp"}, +{"megaco-h248", {NULL}, 2944, "udp"}, +{"megaco-h248", {NULL}, 2944, "sctp"}, +{"h248-binary", {NULL}, 2945, "tcp"}, +{"h248-binary", {NULL}, 2945, "udp"}, +{"h248-binary", {NULL}, 2945, "sctp"}, +{"fjsvmpor", {NULL}, 2946, "tcp"}, +{"fjsvmpor", {NULL}, 2946, "udp"}, +{"gpsd", {NULL}, 2947, "tcp"}, +{"gpsd", {NULL}, 2947, "udp"}, +{"wap-push", {NULL}, 2948, "tcp"}, +{"wap-push", {NULL}, 2948, "udp"}, +{"wap-pushsecure", {NULL}, 2949, "tcp"}, +{"wap-pushsecure", {NULL}, 2949, "udp"}, +{"esip", {NULL}, 2950, "tcp"}, +{"esip", {NULL}, 2950, "udp"}, +{"ottp", {NULL}, 2951, "tcp"}, +{"ottp", {NULL}, 2951, "udp"}, +{"mpfwsas", {NULL}, 2952, "tcp"}, +{"mpfwsas", {NULL}, 2952, "udp"}, +{"ovalarmsrv", {NULL}, 2953, "tcp"}, +{"ovalarmsrv", {NULL}, 2953, "udp"}, +{"ovalarmsrv-cmd", {NULL}, 2954, "tcp"}, +{"ovalarmsrv-cmd", {NULL}, 2954, "udp"}, +{"csnotify", {NULL}, 2955, "tcp"}, +{"csnotify", {NULL}, 2955, "udp"}, +{"ovrimosdbman", {NULL}, 2956, "tcp"}, +{"ovrimosdbman", {NULL}, 2956, "udp"}, +{"jmact5", {NULL}, 2957, "tcp"}, +{"jmact5", {NULL}, 2957, "udp"}, +{"jmact6", {NULL}, 2958, "tcp"}, +{"jmact6", {NULL}, 2958, "udp"}, +{"rmopagt", {NULL}, 2959, "tcp"}, +{"rmopagt", {NULL}, 2959, "udp"}, +{"dfoxserver", {NULL}, 2960, "tcp"}, +{"dfoxserver", {NULL}, 2960, "udp"}, +{"boldsoft-lm", {NULL}, 2961, "tcp"}, +{"boldsoft-lm", {NULL}, 2961, "udp"}, +{"iph-policy-cli", {NULL}, 2962, "tcp"}, +{"iph-policy-cli", {NULL}, 2962, "udp"}, +{"iph-policy-adm", {NULL}, 2963, "tcp"}, +{"iph-policy-adm", {NULL}, 2963, "udp"}, +{"bullant-srap", {NULL}, 2964, "tcp"}, +{"bullant-srap", {NULL}, 2964, "udp"}, +{"bullant-rap", {NULL}, 2965, "tcp"}, +{"bullant-rap", {NULL}, 2965, "udp"}, +{"idp-infotrieve", {NULL}, 2966, "tcp"}, +{"idp-infotrieve", {NULL}, 2966, "udp"}, +{"ssc-agent", {NULL}, 2967, "tcp"}, +{"ssc-agent", {NULL}, 2967, "udp"}, +{"enpp", {NULL}, 2968, "tcp"}, +{"enpp", {NULL}, 2968, "udp"}, +{"essp", {NULL}, 2969, "tcp"}, +{"essp", {NULL}, 2969, "udp"}, +{"index-net", {NULL}, 2970, "tcp"}, +{"index-net", {NULL}, 2970, "udp"}, +{"netclip", {NULL}, 2971, "tcp"}, +{"netclip", {NULL}, 2971, "udp"}, +{"pmsm-webrctl", {NULL}, 2972, "tcp"}, +{"pmsm-webrctl", {NULL}, 2972, "udp"}, +{"svnetworks", {NULL}, 2973, "tcp"}, +{"svnetworks", {NULL}, 2973, "udp"}, +{"signal", {NULL}, 2974, "tcp"}, +{"signal", {NULL}, 2974, "udp"}, +{"fjmpcm", {NULL}, 2975, "tcp"}, +{"fjmpcm", {NULL}, 2975, "udp"}, +{"cns-srv-port", {NULL}, 2976, "tcp"}, +{"cns-srv-port", {NULL}, 2976, "udp"}, +{"ttc-etap-ns", {NULL}, 2977, "tcp"}, +{"ttc-etap-ns", {NULL}, 2977, "udp"}, +{"ttc-etap-ds", {NULL}, 2978, "tcp"}, +{"ttc-etap-ds", {NULL}, 2978, "udp"}, +{"h263-video", {NULL}, 2979, "tcp"}, +{"h263-video", {NULL}, 2979, "udp"}, +{"wimd", {NULL}, 2980, "tcp"}, +{"wimd", {NULL}, 2980, "udp"}, +{"mylxamport", {NULL}, 2981, "tcp"}, +{"mylxamport", {NULL}, 2981, "udp"}, +{"iwb-whiteboard", {NULL}, 2982, "tcp"}, +{"iwb-whiteboard", {NULL}, 2982, "udp"}, +{"netplan", {NULL}, 2983, "tcp"}, +{"netplan", {NULL}, 2983, "udp"}, +{"hpidsadmin", {NULL}, 2984, "tcp"}, +{"hpidsadmin", {NULL}, 2984, "udp"}, +{"hpidsagent", {NULL}, 2985, "tcp"}, +{"hpidsagent", {NULL}, 2985, "udp"}, +{"stonefalls", {NULL}, 2986, "tcp"}, +{"stonefalls", {NULL}, 2986, "udp"}, +{"identify", {NULL}, 2987, "tcp"}, +{"identify", {NULL}, 2987, "udp"}, +{"hippad", {NULL}, 2988, "tcp"}, +{"hippad", {NULL}, 2988, "udp"}, +{"zarkov", {NULL}, 2989, "tcp"}, +{"zarkov", {NULL}, 2989, "udp"}, +{"boscap", {NULL}, 2990, "tcp"}, +{"boscap", {NULL}, 2990, "udp"}, +{"wkstn-mon", {NULL}, 2991, "tcp"}, +{"wkstn-mon", {NULL}, 2991, "udp"}, +{"avenyo", {NULL}, 2992, "tcp"}, +{"avenyo", {NULL}, 2992, "udp"}, +{"veritas-vis1", {NULL}, 2993, "tcp"}, +{"veritas-vis1", {NULL}, 2993, "udp"}, +{"veritas-vis2", {NULL}, 2994, "tcp"}, +{"veritas-vis2", {NULL}, 2994, "udp"}, +{"idrs", {NULL}, 2995, "tcp"}, +{"idrs", {NULL}, 2995, "udp"}, +{"vsixml", {NULL}, 2996, "tcp"}, +{"vsixml", {NULL}, 2996, "udp"}, +{"rebol", {NULL}, 2997, "tcp"}, +{"rebol", {NULL}, 2997, "udp"}, +{"realsecure", {NULL}, 2998, "tcp"}, +{"realsecure", {NULL}, 2998, "udp"}, +{"remoteware-un", {NULL}, 2999, "tcp"}, +{"remoteware-un", {NULL}, 2999, "udp"}, +{"hbci", {NULL}, 3000, "tcp"}, +{"hbci", {NULL}, 3000, "udp"}, +{"remoteware-cl", {NULL}, 3000, "tcp"}, +{"remoteware-cl", {NULL}, 3000, "udp"}, +{"exlm-agent", {NULL}, 3002, "tcp"}, +{"exlm-agent", {NULL}, 3002, "udp"}, +{"remoteware-srv", {NULL}, 3002, "tcp"}, +{"remoteware-srv", {NULL}, 3002, "udp"}, +{"cgms", {NULL}, 3003, "tcp"}, +{"cgms", {NULL}, 3003, "udp"}, +{"csoftragent", {NULL}, 3004, "tcp"}, +{"csoftragent", {NULL}, 3004, "udp"}, +{"geniuslm", {NULL}, 3005, "tcp"}, +{"geniuslm", {NULL}, 3005, "udp"}, +{"ii-admin", {NULL}, 3006, "tcp"}, +{"ii-admin", {NULL}, 3006, "udp"}, +{"lotusmtap", {NULL}, 3007, "tcp"}, +{"lotusmtap", {NULL}, 3007, "udp"}, +{"midnight-tech", {NULL}, 3008, "tcp"}, +{"midnight-tech", {NULL}, 3008, "udp"}, +{"pxc-ntfy", {NULL}, 3009, "tcp"}, +{"pxc-ntfy", {NULL}, 3009, "udp"}, +{"gw", {NULL}, 3010, "tcp"}, +{"ping-pong", {NULL}, 3010, "udp"}, +{"trusted-web", {NULL}, 3011, "tcp"}, +{"trusted-web", {NULL}, 3011, "udp"}, +{"twsdss", {NULL}, 3012, "tcp"}, +{"twsdss", {NULL}, 3012, "udp"}, +{"gilatskysurfer", {NULL}, 3013, "tcp"}, +{"gilatskysurfer", {NULL}, 3013, "udp"}, +{"broker_service", {NULL}, 3014, "tcp"}, +{"broker_service", {NULL}, 3014, "udp"}, +{"nati-dstp", {NULL}, 3015, "tcp"}, +{"nati-dstp", {NULL}, 3015, "udp"}, +{"notify_srvr", {NULL}, 3016, "tcp"}, +{"notify_srvr", {NULL}, 3016, "udp"}, +{"event_listener", {NULL}, 3017, "tcp"}, +{"event_listener", {NULL}, 3017, "udp"}, +{"srvc_registry", {NULL}, 3018, "tcp"}, +{"srvc_registry", {NULL}, 3018, "udp"}, +{"resource_mgr", {NULL}, 3019, "tcp"}, +{"resource_mgr", {NULL}, 3019, "udp"}, +{"cifs", {NULL}, 3020, "tcp"}, +{"cifs", {NULL}, 3020, "udp"}, +{"agriserver", {NULL}, 3021, "tcp"}, +{"agriserver", {NULL}, 3021, "udp"}, +{"csregagent", {NULL}, 3022, "tcp"}, +{"csregagent", {NULL}, 3022, "udp"}, +{"magicnotes", {NULL}, 3023, "tcp"}, +{"magicnotes", {NULL}, 3023, "udp"}, +{"nds_sso", {NULL}, 3024, "tcp"}, +{"nds_sso", {NULL}, 3024, "udp"}, +{"arepa-raft", {NULL}, 3025, "tcp"}, +{"arepa-raft", {NULL}, 3025, "udp"}, +{"agri-gateway", {NULL}, 3026, "tcp"}, +{"agri-gateway", {NULL}, 3026, "udp"}, +{"LiebDevMgmt_C", {NULL}, 3027, "tcp"}, +{"LiebDevMgmt_C", {NULL}, 3027, "udp"}, +{"LiebDevMgmt_DM", {NULL}, 3028, "tcp"}, +{"LiebDevMgmt_DM", {NULL}, 3028, "udp"}, +{"LiebDevMgmt_A", {NULL}, 3029, "tcp"}, +{"LiebDevMgmt_A", {NULL}, 3029, "udp"}, +{"arepa-cas", {NULL}, 3030, "tcp"}, +{"arepa-cas", {NULL}, 3030, "udp"}, +{"eppc", {NULL}, 3031, "tcp"}, +{"eppc", {NULL}, 3031, "udp"}, +{"redwood-chat", {NULL}, 3032, "tcp"}, +{"redwood-chat", {NULL}, 3032, "udp"}, +{"pdb", {NULL}, 3033, "tcp"}, +{"pdb", {NULL}, 3033, "udp"}, +{"osmosis-aeea", {NULL}, 3034, "tcp"}, +{"osmosis-aeea", {NULL}, 3034, "udp"}, +{"fjsv-gssagt", {NULL}, 3035, "tcp"}, +{"fjsv-gssagt", {NULL}, 3035, "udp"}, +{"hagel-dump", {NULL}, 3036, "tcp"}, +{"hagel-dump", {NULL}, 3036, "udp"}, +{"hp-san-mgmt", {NULL}, 3037, "tcp"}, +{"hp-san-mgmt", {NULL}, 3037, "udp"}, +{"santak-ups", {NULL}, 3038, "tcp"}, +{"santak-ups", {NULL}, 3038, "udp"}, +{"cogitate", {NULL}, 3039, "tcp"}, +{"cogitate", {NULL}, 3039, "udp"}, +{"tomato-springs", {NULL}, 3040, "tcp"}, +{"tomato-springs", {NULL}, 3040, "udp"}, +{"di-traceware", {NULL}, 3041, "tcp"}, +{"di-traceware", {NULL}, 3041, "udp"}, +{"journee", {NULL}, 3042, "tcp"}, +{"journee", {NULL}, 3042, "udp"}, +{"brp", {NULL}, 3043, "tcp"}, +{"brp", {NULL}, 3043, "udp"}, +{"epp", {NULL}, 3044, "tcp"}, +{"epp", {NULL}, 3044, "udp"}, +{"responsenet", {NULL}, 3045, "tcp"}, +{"responsenet", {NULL}, 3045, "udp"}, +{"di-ase", {NULL}, 3046, "tcp"}, +{"di-ase", {NULL}, 3046, "udp"}, +{"hlserver", {NULL}, 3047, "tcp"}, +{"hlserver", {NULL}, 3047, "udp"}, +{"pctrader", {NULL}, 3048, "tcp"}, +{"pctrader", {NULL}, 3048, "udp"}, +{"nsws", {NULL}, 3049, "tcp"}, +{"nsws", {NULL}, 3049, "udp"}, +{"gds_db", {NULL}, 3050, "tcp"}, +{"gds_db", {NULL}, 3050, "udp"}, +{"galaxy-server", {NULL}, 3051, "tcp"}, +{"galaxy-server", {NULL}, 3051, "udp"}, +{"apc-3052", {NULL}, 3052, "tcp"}, +{"apc-3052", {NULL}, 3052, "udp"}, +{"dsom-server", {NULL}, 3053, "tcp"}, +{"dsom-server", {NULL}, 3053, "udp"}, +{"amt-cnf-prot", {NULL}, 3054, "tcp"}, +{"amt-cnf-prot", {NULL}, 3054, "udp"}, +{"policyserver", {NULL}, 3055, "tcp"}, +{"policyserver", {NULL}, 3055, "udp"}, +{"cdl-server", {NULL}, 3056, "tcp"}, +{"cdl-server", {NULL}, 3056, "udp"}, +{"goahead-fldup", {NULL}, 3057, "tcp"}, +{"goahead-fldup", {NULL}, 3057, "udp"}, +{"videobeans", {NULL}, 3058, "tcp"}, +{"videobeans", {NULL}, 3058, "udp"}, +{"qsoft", {NULL}, 3059, "tcp"}, +{"qsoft", {NULL}, 3059, "udp"}, +{"interserver", {NULL}, 3060, "tcp"}, +{"interserver", {NULL}, 3060, "udp"}, +{"cautcpd", {NULL}, 3061, "tcp"}, +{"cautcpd", {NULL}, 3061, "udp"}, +{"ncacn-ip-tcp", {NULL}, 3062, "tcp"}, +{"ncacn-ip-tcp", {NULL}, 3062, "udp"}, +{"ncadg-ip-udp", {NULL}, 3063, "tcp"}, +{"ncadg-ip-udp", {NULL}, 3063, "udp"}, +{"rprt", {NULL}, 3064, "tcp"}, +{"rprt", {NULL}, 3064, "udp"}, +{"slinterbase", {NULL}, 3065, "tcp"}, +{"slinterbase", {NULL}, 3065, "udp"}, +{"netattachsdmp", {NULL}, 3066, "tcp"}, +{"netattachsdmp", {NULL}, 3066, "udp"}, +{"fjhpjp", {NULL}, 3067, "tcp"}, +{"fjhpjp", {NULL}, 3067, "udp"}, +{"ls3bcast", {NULL}, 3068, "tcp"}, +{"ls3bcast", {NULL}, 3068, "udp"}, +{"ls3", {NULL}, 3069, "tcp"}, +{"ls3", {NULL}, 3069, "udp"}, +{"mgxswitch", {NULL}, 3070, "tcp"}, +{"mgxswitch", {NULL}, 3070, "udp"}, +{"csd-mgmt-port", {NULL}, 3071, "tcp"}, +{"csd-mgmt-port", {NULL}, 3071, "udp"}, +{"csd-monitor", {NULL}, 3072, "tcp"}, +{"csd-monitor", {NULL}, 3072, "udp"}, +{"vcrp", {NULL}, 3073, "tcp"}, +{"vcrp", {NULL}, 3073, "udp"}, +{"xbox", {NULL}, 3074, "tcp"}, +{"xbox", {NULL}, 3074, "udp"}, +{"orbix-locator", {NULL}, 3075, "tcp"}, +{"orbix-locator", {NULL}, 3075, "udp"}, +{"orbix-config", {NULL}, 3076, "tcp"}, +{"orbix-config", {NULL}, 3076, "udp"}, +{"orbix-loc-ssl", {NULL}, 3077, "tcp"}, +{"orbix-loc-ssl", {NULL}, 3077, "udp"}, +{"orbix-cfg-ssl", {NULL}, 3078, "tcp"}, +{"orbix-cfg-ssl", {NULL}, 3078, "udp"}, +{"lv-frontpanel", {NULL}, 3079, "tcp"}, +{"lv-frontpanel", {NULL}, 3079, "udp"}, +{"stm_pproc", {NULL}, 3080, "tcp"}, +{"stm_pproc", {NULL}, 3080, "udp"}, +{"tl1-lv", {NULL}, 3081, "tcp"}, +{"tl1-lv", {NULL}, 3081, "udp"}, +{"tl1-raw", {NULL}, 3082, "tcp"}, +{"tl1-raw", {NULL}, 3082, "udp"}, +{"tl1-telnet", {NULL}, 3083, "tcp"}, +{"tl1-telnet", {NULL}, 3083, "udp"}, +{"itm-mccs", {NULL}, 3084, "tcp"}, +{"itm-mccs", {NULL}, 3084, "udp"}, +{"pcihreq", {NULL}, 3085, "tcp"}, +{"pcihreq", {NULL}, 3085, "udp"}, +{"jdl-dbkitchen", {NULL}, 3086, "tcp"}, +{"jdl-dbkitchen", {NULL}, 3086, "udp"}, +{"asoki-sma", {NULL}, 3087, "tcp"}, +{"asoki-sma", {NULL}, 3087, "udp"}, +{"xdtp", {NULL}, 3088, "tcp"}, +{"xdtp", {NULL}, 3088, "udp"}, +{"ptk-alink", {NULL}, 3089, "tcp"}, +{"ptk-alink", {NULL}, 3089, "udp"}, +{"stss", {NULL}, 3090, "tcp"}, +{"stss", {NULL}, 3090, "udp"}, +{"1ci-smcs", {NULL}, 3091, "tcp"}, +{"1ci-smcs", {NULL}, 3091, "udp"}, +{"rapidmq-center", {NULL}, 3093, "tcp"}, +{"rapidmq-center", {NULL}, 3093, "udp"}, +{"rapidmq-reg", {NULL}, 3094, "tcp"}, +{"rapidmq-reg", {NULL}, 3094, "udp"}, +{"panasas", {NULL}, 3095, "tcp"}, +{"panasas", {NULL}, 3095, "udp"}, +{"ndl-aps", {NULL}, 3096, "tcp"}, +{"ndl-aps", {NULL}, 3096, "udp"}, +{"itu-bicc-stc", {NULL}, 3097, "sctp"}, +{"umm-port", {NULL}, 3098, "tcp"}, +{"umm-port", {NULL}, 3098, "udp"}, +{"chmd", {NULL}, 3099, "tcp"}, +{"chmd", {NULL}, 3099, "udp"}, +{"opcon-xps", {NULL}, 3100, "tcp"}, +{"opcon-xps", {NULL}, 3100, "udp"}, +{"hp-pxpib", {NULL}, 3101, "tcp"}, +{"hp-pxpib", {NULL}, 3101, "udp"}, +{"slslavemon", {NULL}, 3102, "tcp"}, +{"slslavemon", {NULL}, 3102, "udp"}, +{"autocuesmi", {NULL}, 3103, "tcp"}, +{"autocuesmi", {NULL}, 3103, "udp"}, +{"autocuelog", {NULL}, 3104, "tcp"}, +{"autocuetime", {NULL}, 3104, "udp"}, +{"cardbox", {NULL}, 3105, "tcp"}, +{"cardbox", {NULL}, 3105, "udp"}, +{"cardbox-http", {NULL}, 3106, "tcp"}, +{"cardbox-http", {NULL}, 3106, "udp"}, +{"business", {NULL}, 3107, "tcp"}, +{"business", {NULL}, 3107, "udp"}, +{"geolocate", {NULL}, 3108, "tcp"}, +{"geolocate", {NULL}, 3108, "udp"}, +{"personnel", {NULL}, 3109, "tcp"}, +{"personnel", {NULL}, 3109, "udp"}, +{"sim-control", {NULL}, 3110, "tcp"}, +{"sim-control", {NULL}, 3110, "udp"}, +{"wsynch", {NULL}, 3111, "tcp"}, +{"wsynch", {NULL}, 3111, "udp"}, +{"ksysguard", {NULL}, 3112, "tcp"}, +{"ksysguard", {NULL}, 3112, "udp"}, +{"cs-auth-svr", {NULL}, 3113, "tcp"}, +{"cs-auth-svr", {NULL}, 3113, "udp"}, +{"ccmad", {NULL}, 3114, "tcp"}, +{"ccmad", {NULL}, 3114, "udp"}, +{"mctet-master", {NULL}, 3115, "tcp"}, +{"mctet-master", {NULL}, 3115, "udp"}, +{"mctet-gateway", {NULL}, 3116, "tcp"}, +{"mctet-gateway", {NULL}, 3116, "udp"}, +{"mctet-jserv", {NULL}, 3117, "tcp"}, +{"mctet-jserv", {NULL}, 3117, "udp"}, +{"pkagent", {NULL}, 3118, "tcp"}, +{"pkagent", {NULL}, 3118, "udp"}, +{"d2000kernel", {NULL}, 3119, "tcp"}, +{"d2000kernel", {NULL}, 3119, "udp"}, +{"d2000webserver", {NULL}, 3120, "tcp"}, +{"d2000webserver", {NULL}, 3120, "udp"}, +{"vtr-emulator", {NULL}, 3122, "tcp"}, +{"vtr-emulator", {NULL}, 3122, "udp"}, +{"edix", {NULL}, 3123, "tcp"}, +{"edix", {NULL}, 3123, "udp"}, +{"beacon-port", {NULL}, 3124, "tcp"}, +{"beacon-port", {NULL}, 3124, "udp"}, +{"a13-an", {NULL}, 3125, "tcp"}, +{"a13-an", {NULL}, 3125, "udp"}, +{"ctx-bridge", {NULL}, 3127, "tcp"}, +{"ctx-bridge", {NULL}, 3127, "udp"}, +{"ndl-aas", {NULL}, 3128, "tcp"}, +{"ndl-aas", {NULL}, 3128, "udp"}, +{"netport-id", {NULL}, 3129, "tcp"}, +{"netport-id", {NULL}, 3129, "udp"}, +{"icpv2", {NULL}, 3130, "tcp"}, +{"icpv2", {NULL}, 3130, "udp"}, +{"netbookmark", {NULL}, 3131, "tcp"}, +{"netbookmark", {NULL}, 3131, "udp"}, +{"ms-rule-engine", {NULL}, 3132, "tcp"}, +{"ms-rule-engine", {NULL}, 3132, "udp"}, +{"prism-deploy", {NULL}, 3133, "tcp"}, +{"prism-deploy", {NULL}, 3133, "udp"}, +{"ecp", {NULL}, 3134, "tcp"}, +{"ecp", {NULL}, 3134, "udp"}, +{"peerbook-port", {NULL}, 3135, "tcp"}, +{"peerbook-port", {NULL}, 3135, "udp"}, +{"grubd", {NULL}, 3136, "tcp"}, +{"grubd", {NULL}, 3136, "udp"}, +{"rtnt-1", {NULL}, 3137, "tcp"}, +{"rtnt-1", {NULL}, 3137, "udp"}, +{"rtnt-2", {NULL}, 3138, "tcp"}, +{"rtnt-2", {NULL}, 3138, "udp"}, +{"incognitorv", {NULL}, 3139, "tcp"}, +{"incognitorv", {NULL}, 3139, "udp"}, +{"ariliamulti", {NULL}, 3140, "tcp"}, +{"ariliamulti", {NULL}, 3140, "udp"}, +{"vmodem", {NULL}, 3141, "tcp"}, +{"vmodem", {NULL}, 3141, "udp"}, +{"rdc-wh-eos", {NULL}, 3142, "tcp"}, +{"rdc-wh-eos", {NULL}, 3142, "udp"}, +{"seaview", {NULL}, 3143, "tcp"}, +{"seaview", {NULL}, 3143, "udp"}, +{"tarantella", {NULL}, 3144, "tcp"}, +{"tarantella", {NULL}, 3144, "udp"}, +{"csi-lfap", {NULL}, 3145, "tcp"}, +{"csi-lfap", {NULL}, 3145, "udp"}, +{"bears-02", {NULL}, 3146, "tcp"}, +{"bears-02", {NULL}, 3146, "udp"}, +{"rfio", {NULL}, 3147, "tcp"}, +{"rfio", {NULL}, 3147, "udp"}, +{"nm-game-admin", {NULL}, 3148, "tcp"}, +{"nm-game-admin", {NULL}, 3148, "udp"}, +{"nm-game-server", {NULL}, 3149, "tcp"}, +{"nm-game-server", {NULL}, 3149, "udp"}, +{"nm-asses-admin", {NULL}, 3150, "tcp"}, +{"nm-asses-admin", {NULL}, 3150, "udp"}, +{"nm-assessor", {NULL}, 3151, "tcp"}, +{"nm-assessor", {NULL}, 3151, "udp"}, +{"feitianrockey", {NULL}, 3152, "tcp"}, +{"feitianrockey", {NULL}, 3152, "udp"}, +{"s8-client-port", {NULL}, 3153, "tcp"}, +{"s8-client-port", {NULL}, 3153, "udp"}, +{"ccmrmi", {NULL}, 3154, "tcp"}, +{"ccmrmi", {NULL}, 3154, "udp"}, +{"jpegmpeg", {NULL}, 3155, "tcp"}, +{"jpegmpeg", {NULL}, 3155, "udp"}, +{"indura", {NULL}, 3156, "tcp"}, +{"indura", {NULL}, 3156, "udp"}, +{"e3consultants", {NULL}, 3157, "tcp"}, +{"e3consultants", {NULL}, 3157, "udp"}, +{"stvp", {NULL}, 3158, "tcp"}, +{"stvp", {NULL}, 3158, "udp"}, +{"navegaweb-port", {NULL}, 3159, "tcp"}, +{"navegaweb-port", {NULL}, 3159, "udp"}, +{"tip-app-server", {NULL}, 3160, "tcp"}, +{"tip-app-server", {NULL}, 3160, "udp"}, +{"doc1lm", {NULL}, 3161, "tcp"}, +{"doc1lm", {NULL}, 3161, "udp"}, +{"sflm", {NULL}, 3162, "tcp"}, +{"sflm", {NULL}, 3162, "udp"}, +{"res-sap", {NULL}, 3163, "tcp"}, +{"res-sap", {NULL}, 3163, "udp"}, +{"imprs", {NULL}, 3164, "tcp"}, +{"imprs", {NULL}, 3164, "udp"}, +{"newgenpay", {NULL}, 3165, "tcp"}, +{"newgenpay", {NULL}, 3165, "udp"}, +{"sossecollector", {NULL}, 3166, "tcp"}, +{"sossecollector", {NULL}, 3166, "udp"}, +{"nowcontact", {NULL}, 3167, "tcp"}, +{"nowcontact", {NULL}, 3167, "udp"}, +{"poweronnud", {NULL}, 3168, "tcp"}, +{"poweronnud", {NULL}, 3168, "udp"}, +{"serverview-as", {NULL}, 3169, "tcp"}, +{"serverview-as", {NULL}, 3169, "udp"}, +{"serverview-asn", {NULL}, 3170, "tcp"}, +{"serverview-asn", {NULL}, 3170, "udp"}, +{"serverview-gf", {NULL}, 3171, "tcp"}, +{"serverview-gf", {NULL}, 3171, "udp"}, +{"serverview-rm", {NULL}, 3172, "tcp"}, +{"serverview-rm", {NULL}, 3172, "udp"}, +{"serverview-icc", {NULL}, 3173, "tcp"}, +{"serverview-icc", {NULL}, 3173, "udp"}, +{"armi-server", {NULL}, 3174, "tcp"}, +{"armi-server", {NULL}, 3174, "udp"}, +{"t1-e1-over-ip", {NULL}, 3175, "tcp"}, +{"t1-e1-over-ip", {NULL}, 3175, "udp"}, +{"ars-master", {NULL}, 3176, "tcp"}, +{"ars-master", {NULL}, 3176, "udp"}, +{"phonex-port", {NULL}, 3177, "tcp"}, +{"phonex-port", {NULL}, 3177, "udp"}, +{"radclientport", {NULL}, 3178, "tcp"}, +{"radclientport", {NULL}, 3178, "udp"}, +{"h2gf-w-2m", {NULL}, 3179, "tcp"}, +{"h2gf-w-2m", {NULL}, 3179, "udp"}, +{"mc-brk-srv", {NULL}, 3180, "tcp"}, +{"mc-brk-srv", {NULL}, 3180, "udp"}, +{"bmcpatrolagent", {NULL}, 3181, "tcp"}, +{"bmcpatrolagent", {NULL}, 3181, "udp"}, +{"bmcpatrolrnvu", {NULL}, 3182, "tcp"}, +{"bmcpatrolrnvu", {NULL}, 3182, "udp"}, +{"cops-tls", {NULL}, 3183, "tcp"}, +{"cops-tls", {NULL}, 3183, "udp"}, +{"apogeex-port", {NULL}, 3184, "tcp"}, +{"apogeex-port", {NULL}, 3184, "udp"}, +{"smpppd", {NULL}, 3185, "tcp"}, +{"smpppd", {NULL}, 3185, "udp"}, +{"iiw-port", {NULL}, 3186, "tcp"}, +{"iiw-port", {NULL}, 3186, "udp"}, +{"odi-port", {NULL}, 3187, "tcp"}, +{"odi-port", {NULL}, 3187, "udp"}, +{"brcm-comm-port", {NULL}, 3188, "tcp"}, +{"brcm-comm-port", {NULL}, 3188, "udp"}, +{"pcle-infex", {NULL}, 3189, "tcp"}, +{"pcle-infex", {NULL}, 3189, "udp"}, +{"csvr-proxy", {NULL}, 3190, "tcp"}, +{"csvr-proxy", {NULL}, 3190, "udp"}, +{"csvr-sslproxy", {NULL}, 3191, "tcp"}, +{"csvr-sslproxy", {NULL}, 3191, "udp"}, +{"firemonrcc", {NULL}, 3192, "tcp"}, +{"firemonrcc", {NULL}, 3192, "udp"}, +{"spandataport", {NULL}, 3193, "tcp"}, +{"spandataport", {NULL}, 3193, "udp"}, +{"magbind", {NULL}, 3194, "tcp"}, +{"magbind", {NULL}, 3194, "udp"}, +{"ncu-1", {NULL}, 3195, "tcp"}, +{"ncu-1", {NULL}, 3195, "udp"}, +{"ncu-2", {NULL}, 3196, "tcp"}, +{"ncu-2", {NULL}, 3196, "udp"}, +{"embrace-dp-s", {NULL}, 3197, "tcp"}, +{"embrace-dp-s", {NULL}, 3197, "udp"}, +{"embrace-dp-c", {NULL}, 3198, "tcp"}, +{"embrace-dp-c", {NULL}, 3198, "udp"}, +{"dmod-workspace", {NULL}, 3199, "tcp"}, +{"dmod-workspace", {NULL}, 3199, "udp"}, +{"tick-port", {NULL}, 3200, "tcp"}, +{"tick-port", {NULL}, 3200, "udp"}, +{"cpq-tasksmart", {NULL}, 3201, "tcp"}, +{"cpq-tasksmart", {NULL}, 3201, "udp"}, +{"intraintra", {NULL}, 3202, "tcp"}, +{"intraintra", {NULL}, 3202, "udp"}, +{"netwatcher-mon", {NULL}, 3203, "tcp"}, +{"netwatcher-mon", {NULL}, 3203, "udp"}, +{"netwatcher-db", {NULL}, 3204, "tcp"}, +{"netwatcher-db", {NULL}, 3204, "udp"}, +{"isns", {NULL}, 3205, "tcp"}, +{"isns", {NULL}, 3205, "udp"}, +{"ironmail", {NULL}, 3206, "tcp"}, +{"ironmail", {NULL}, 3206, "udp"}, +{"vx-auth-port", {NULL}, 3207, "tcp"}, +{"vx-auth-port", {NULL}, 3207, "udp"}, +{"pfu-prcallback", {NULL}, 3208, "tcp"}, +{"pfu-prcallback", {NULL}, 3208, "udp"}, +{"netwkpathengine", {NULL}, 3209, "tcp"}, +{"netwkpathengine", {NULL}, 3209, "udp"}, +{"flamenco-proxy", {NULL}, 3210, "tcp"}, +{"flamenco-proxy", {NULL}, 3210, "udp"}, +{"avsecuremgmt", {NULL}, 3211, "tcp"}, +{"avsecuremgmt", {NULL}, 3211, "udp"}, +{"surveyinst", {NULL}, 3212, "tcp"}, +{"surveyinst", {NULL}, 3212, "udp"}, +{"neon24x7", {NULL}, 3213, "tcp"}, +{"neon24x7", {NULL}, 3213, "udp"}, +{"jmq-daemon-1", {NULL}, 3214, "tcp"}, +{"jmq-daemon-1", {NULL}, 3214, "udp"}, +{"jmq-daemon-2", {NULL}, 3215, "tcp"}, +{"jmq-daemon-2", {NULL}, 3215, "udp"}, +{"ferrari-foam", {NULL}, 3216, "tcp"}, +{"ferrari-foam", {NULL}, 3216, "udp"}, +{"unite", {NULL}, 3217, "tcp"}, +{"unite", {NULL}, 3217, "udp"}, +{"smartpackets", {NULL}, 3218, "tcp"}, +{"smartpackets", {NULL}, 3218, "udp"}, +{"wms-messenger", {NULL}, 3219, "tcp"}, +{"wms-messenger", {NULL}, 3219, "udp"}, +{"xnm-ssl", {NULL}, 3220, "tcp"}, +{"xnm-ssl", {NULL}, 3220, "udp"}, +{"xnm-clear-text", {NULL}, 3221, "tcp"}, +{"xnm-clear-text", {NULL}, 3221, "udp"}, +{"glbp", {NULL}, 3222, "tcp"}, +{"glbp", {NULL}, 3222, "udp"}, +{"digivote", {NULL}, 3223, "tcp"}, +{"digivote", {NULL}, 3223, "udp"}, +{"aes-discovery", {NULL}, 3224, "tcp"}, +{"aes-discovery", {NULL}, 3224, "udp"}, +{"fcip-port", {NULL}, 3225, "tcp"}, +{"fcip-port", {NULL}, 3225, "udp"}, +{"isi-irp", {NULL}, 3226, "tcp"}, +{"isi-irp", {NULL}, 3226, "udp"}, +{"dwnmshttp", {NULL}, 3227, "tcp"}, +{"dwnmshttp", {NULL}, 3227, "udp"}, +{"dwmsgserver", {NULL}, 3228, "tcp"}, +{"dwmsgserver", {NULL}, 3228, "udp"}, +{"global-cd-port", {NULL}, 3229, "tcp"}, +{"global-cd-port", {NULL}, 3229, "udp"}, +{"sftdst-port", {NULL}, 3230, "tcp"}, +{"sftdst-port", {NULL}, 3230, "udp"}, +{"vidigo", {NULL}, 3231, "tcp"}, +{"vidigo", {NULL}, 3231, "udp"}, +{"mdtp", {NULL}, 3232, "tcp"}, +{"mdtp", {NULL}, 3232, "udp"}, +{"whisker", {NULL}, 3233, "tcp"}, +{"whisker", {NULL}, 3233, "udp"}, +{"alchemy", {NULL}, 3234, "tcp"}, +{"alchemy", {NULL}, 3234, "udp"}, +{"mdap-port", {NULL}, 3235, "tcp"}, +{"mdap-port", {NULL}, 3235, "udp"}, +{"apparenet-ts", {NULL}, 3236, "tcp"}, +{"apparenet-ts", {NULL}, 3236, "udp"}, +{"apparenet-tps", {NULL}, 3237, "tcp"}, +{"apparenet-tps", {NULL}, 3237, "udp"}, +{"apparenet-as", {NULL}, 3238, "tcp"}, +{"apparenet-as", {NULL}, 3238, "udp"}, +{"apparenet-ui", {NULL}, 3239, "tcp"}, +{"apparenet-ui", {NULL}, 3239, "udp"}, +{"triomotion", {NULL}, 3240, "tcp"}, +{"triomotion", {NULL}, 3240, "udp"}, +{"sysorb", {NULL}, 3241, "tcp"}, +{"sysorb", {NULL}, 3241, "udp"}, +{"sdp-id-port", {NULL}, 3242, "tcp"}, +{"sdp-id-port", {NULL}, 3242, "udp"}, +{"timelot", {NULL}, 3243, "tcp"}, +{"timelot", {NULL}, 3243, "udp"}, +{"onesaf", {NULL}, 3244, "tcp"}, +{"onesaf", {NULL}, 3244, "udp"}, +{"vieo-fe", {NULL}, 3245, "tcp"}, +{"vieo-fe", {NULL}, 3245, "udp"}, +{"dvt-system", {NULL}, 3246, "tcp"}, +{"dvt-system", {NULL}, 3246, "udp"}, +{"dvt-data", {NULL}, 3247, "tcp"}, +{"dvt-data", {NULL}, 3247, "udp"}, +{"procos-lm", {NULL}, 3248, "tcp"}, +{"procos-lm", {NULL}, 3248, "udp"}, +{"ssp", {NULL}, 3249, "tcp"}, +{"ssp", {NULL}, 3249, "udp"}, +{"hicp", {NULL}, 3250, "tcp"}, +{"hicp", {NULL}, 3250, "udp"}, +{"sysscanner", {NULL}, 3251, "tcp"}, +{"sysscanner", {NULL}, 3251, "udp"}, +{"dhe", {NULL}, 3252, "tcp"}, +{"dhe", {NULL}, 3252, "udp"}, +{"pda-data", {NULL}, 3253, "tcp"}, +{"pda-data", {NULL}, 3253, "udp"}, +{"pda-sys", {NULL}, 3254, "tcp"}, +{"pda-sys", {NULL}, 3254, "udp"}, +{"semaphore", {NULL}, 3255, "tcp"}, +{"semaphore", {NULL}, 3255, "udp"}, +{"cpqrpm-agent", {NULL}, 3256, "tcp"}, +{"cpqrpm-agent", {NULL}, 3256, "udp"}, +{"cpqrpm-server", {NULL}, 3257, "tcp"}, +{"cpqrpm-server", {NULL}, 3257, "udp"}, +{"ivecon-port", {NULL}, 3258, "tcp"}, +{"ivecon-port", {NULL}, 3258, "udp"}, +{"epncdp2", {NULL}, 3259, "tcp"}, +{"epncdp2", {NULL}, 3259, "udp"}, +{"iscsi-target", {NULL}, 3260, "tcp"}, +{"iscsi-target", {NULL}, 3260, "udp"}, +{"winshadow", {NULL}, 3261, "tcp"}, +{"winshadow", {NULL}, 3261, "udp"}, +{"necp", {NULL}, 3262, "tcp"}, +{"necp", {NULL}, 3262, "udp"}, +{"ecolor-imager", {NULL}, 3263, "tcp"}, +{"ecolor-imager", {NULL}, 3263, "udp"}, +{"ccmail", {NULL}, 3264, "tcp"}, +{"ccmail", {NULL}, 3264, "udp"}, +{"altav-tunnel", {NULL}, 3265, "tcp"}, +{"altav-tunnel", {NULL}, 3265, "udp"}, +{"ns-cfg-server", {NULL}, 3266, "tcp"}, +{"ns-cfg-server", {NULL}, 3266, "udp"}, +{"ibm-dial-out", {NULL}, 3267, "tcp"}, +{"ibm-dial-out", {NULL}, 3267, "udp"}, +{"msft-gc", {NULL}, 3268, "tcp"}, +{"msft-gc", {NULL}, 3268, "udp"}, +{"msft-gc-ssl", {NULL}, 3269, "tcp"}, +{"msft-gc-ssl", {NULL}, 3269, "udp"}, +{"verismart", {NULL}, 3270, "tcp"}, +{"verismart", {NULL}, 3270, "udp"}, +{"csoft-prev", {NULL}, 3271, "tcp"}, +{"csoft-prev", {NULL}, 3271, "udp"}, +{"user-manager", {NULL}, 3272, "tcp"}, +{"user-manager", {NULL}, 3272, "udp"}, +{"sxmp", {NULL}, 3273, "tcp"}, +{"sxmp", {NULL}, 3273, "udp"}, +{"ordinox-server", {NULL}, 3274, "tcp"}, +{"ordinox-server", {NULL}, 3274, "udp"}, +{"samd", {NULL}, 3275, "tcp"}, +{"samd", {NULL}, 3275, "udp"}, +{"maxim-asics", {NULL}, 3276, "tcp"}, +{"maxim-asics", {NULL}, 3276, "udp"}, +{"awg-proxy", {NULL}, 3277, "tcp"}, +{"awg-proxy", {NULL}, 3277, "udp"}, +{"lkcmserver", {NULL}, 3278, "tcp"}, +{"lkcmserver", {NULL}, 3278, "udp"}, +{"admind", {NULL}, 3279, "tcp"}, +{"admind", {NULL}, 3279, "udp"}, +{"vs-server", {NULL}, 3280, "tcp"}, +{"vs-server", {NULL}, 3280, "udp"}, +{"sysopt", {NULL}, 3281, "tcp"}, +{"sysopt", {NULL}, 3281, "udp"}, +{"datusorb", {NULL}, 3282, "tcp"}, +{"datusorb", {NULL}, 3282, "udp"}, +{"net-assistant", {NULL}, 3283, "tcp"}, +{"net-assistant", {NULL}, 3283, "udp"}, +{"4talk", {NULL}, 3284, "tcp"}, +{"4talk", {NULL}, 3284, "udp"}, +{"plato", {NULL}, 3285, "tcp"}, +{"plato", {NULL}, 3285, "udp"}, +{"e-net", {NULL}, 3286, "tcp"}, +{"e-net", {NULL}, 3286, "udp"}, +{"directvdata", {NULL}, 3287, "tcp"}, +{"directvdata", {NULL}, 3287, "udp"}, +{"cops", {NULL}, 3288, "tcp"}, +{"cops", {NULL}, 3288, "udp"}, +{"enpc", {NULL}, 3289, "tcp"}, +{"enpc", {NULL}, 3289, "udp"}, +{"caps-lm", {NULL}, 3290, "tcp"}, +{"caps-lm", {NULL}, 3290, "udp"}, +{"sah-lm", {NULL}, 3291, "tcp"}, +{"sah-lm", {NULL}, 3291, "udp"}, +{"cart-o-rama", {NULL}, 3292, "tcp"}, +{"cart-o-rama", {NULL}, 3292, "udp"}, +{"fg-fps", {NULL}, 3293, "tcp"}, +{"fg-fps", {NULL}, 3293, "udp"}, +{"fg-gip", {NULL}, 3294, "tcp"}, +{"fg-gip", {NULL}, 3294, "udp"}, +{"dyniplookup", {NULL}, 3295, "tcp"}, +{"dyniplookup", {NULL}, 3295, "udp"}, +{"rib-slm", {NULL}, 3296, "tcp"}, +{"rib-slm", {NULL}, 3296, "udp"}, +{"cytel-lm", {NULL}, 3297, "tcp"}, +{"cytel-lm", {NULL}, 3297, "udp"}, +{"deskview", {NULL}, 3298, "tcp"}, +{"deskview", {NULL}, 3298, "udp"}, +{"pdrncs", {NULL}, 3299, "tcp"}, +{"pdrncs", {NULL}, 3299, "udp"}, +{"mcs-fastmail", {NULL}, 3302, "tcp"}, +{"mcs-fastmail", {NULL}, 3302, "udp"}, +{"opsession-clnt", {NULL}, 3303, "tcp"}, +{"opsession-clnt", {NULL}, 3303, "udp"}, +{"opsession-srvr", {NULL}, 3304, "tcp"}, +{"opsession-srvr", {NULL}, 3304, "udp"}, +{"odette-ftp", {NULL}, 3305, "tcp"}, +{"odette-ftp", {NULL}, 3305, "udp"}, +{"mysql", {NULL}, 3306, "tcp"}, +{"mysql", {NULL}, 3306, "udp"}, +{"opsession-prxy", {NULL}, 3307, "tcp"}, +{"opsession-prxy", {NULL}, 3307, "udp"}, +{"tns-server", {NULL}, 3308, "tcp"}, +{"tns-server", {NULL}, 3308, "udp"}, +{"tns-adv", {NULL}, 3309, "tcp"}, +{"tns-adv", {NULL}, 3309, "udp"}, +{"dyna-access", {NULL}, 3310, "tcp"}, +{"dyna-access", {NULL}, 3310, "udp"}, +{"mcns-tel-ret", {NULL}, 3311, "tcp"}, +{"mcns-tel-ret", {NULL}, 3311, "udp"}, +{"appman-server", {NULL}, 3312, "tcp"}, +{"appman-server", {NULL}, 3312, "udp"}, +{"uorb", {NULL}, 3313, "tcp"}, +{"uorb", {NULL}, 3313, "udp"}, +{"uohost", {NULL}, 3314, "tcp"}, +{"uohost", {NULL}, 3314, "udp"}, +{"cdid", {NULL}, 3315, "tcp"}, +{"cdid", {NULL}, 3315, "udp"}, +{"aicc-cmi", {NULL}, 3316, "tcp"}, +{"aicc-cmi", {NULL}, 3316, "udp"}, +{"vsaiport", {NULL}, 3317, "tcp"}, +{"vsaiport", {NULL}, 3317, "udp"}, +{"ssrip", {NULL}, 3318, "tcp"}, +{"ssrip", {NULL}, 3318, "udp"}, +{"sdt-lmd", {NULL}, 3319, "tcp"}, +{"sdt-lmd", {NULL}, 3319, "udp"}, +{"officelink2000", {NULL}, 3320, "tcp"}, +{"officelink2000", {NULL}, 3320, "udp"}, +{"vnsstr", {NULL}, 3321, "tcp"}, +{"vnsstr", {NULL}, 3321, "udp"}, +{"sftu", {NULL}, 3326, "tcp"}, +{"sftu", {NULL}, 3326, "udp"}, +{"bbars", {NULL}, 3327, "tcp"}, +{"bbars", {NULL}, 3327, "udp"}, +{"egptlm", {NULL}, 3328, "tcp"}, +{"egptlm", {NULL}, 3328, "udp"}, +{"hp-device-disc", {NULL}, 3329, "tcp"}, +{"hp-device-disc", {NULL}, 3329, "udp"}, +{"mcs-calypsoicf", {NULL}, 3330, "tcp"}, +{"mcs-calypsoicf", {NULL}, 3330, "udp"}, +{"mcs-messaging", {NULL}, 3331, "tcp"}, +{"mcs-messaging", {NULL}, 3331, "udp"}, +{"mcs-mailsvr", {NULL}, 3332, "tcp"}, +{"mcs-mailsvr", {NULL}, 3332, "udp"}, +{"dec-notes", {NULL}, 3333, "tcp"}, +{"dec-notes", {NULL}, 3333, "udp"}, +{"directv-web", {NULL}, 3334, "tcp"}, +{"directv-web", {NULL}, 3334, "udp"}, +{"directv-soft", {NULL}, 3335, "tcp"}, +{"directv-soft", {NULL}, 3335, "udp"}, +{"directv-tick", {NULL}, 3336, "tcp"}, +{"directv-tick", {NULL}, 3336, "udp"}, +{"directv-catlg", {NULL}, 3337, "tcp"}, +{"directv-catlg", {NULL}, 3337, "udp"}, +{"anet-b", {NULL}, 3338, "tcp"}, +{"anet-b", {NULL}, 3338, "udp"}, +{"anet-l", {NULL}, 3339, "tcp"}, +{"anet-l", {NULL}, 3339, "udp"}, +{"anet-m", {NULL}, 3340, "tcp"}, +{"anet-m", {NULL}, 3340, "udp"}, +{"anet-h", {NULL}, 3341, "tcp"}, +{"anet-h", {NULL}, 3341, "udp"}, +{"webtie", {NULL}, 3342, "tcp"}, +{"webtie", {NULL}, 3342, "udp"}, +{"ms-cluster-net", {NULL}, 3343, "tcp"}, +{"ms-cluster-net", {NULL}, 3343, "udp"}, +{"bnt-manager", {NULL}, 3344, "tcp"}, +{"bnt-manager", {NULL}, 3344, "udp"}, +{"influence", {NULL}, 3345, "tcp"}, +{"influence", {NULL}, 3345, "udp"}, +{"trnsprntproxy", {NULL}, 3346, "tcp"}, +{"trnsprntproxy", {NULL}, 3346, "udp"}, +{"phoenix-rpc", {NULL}, 3347, "tcp"}, +{"phoenix-rpc", {NULL}, 3347, "udp"}, +{"pangolin-laser", {NULL}, 3348, "tcp"}, +{"pangolin-laser", {NULL}, 3348, "udp"}, +{"chevinservices", {NULL}, 3349, "tcp"}, +{"chevinservices", {NULL}, 3349, "udp"}, +{"findviatv", {NULL}, 3350, "tcp"}, +{"findviatv", {NULL}, 3350, "udp"}, +{"btrieve", {NULL}, 3351, "tcp"}, +{"btrieve", {NULL}, 3351, "udp"}, +{"ssql", {NULL}, 3352, "tcp"}, +{"ssql", {NULL}, 3352, "udp"}, +{"fatpipe", {NULL}, 3353, "tcp"}, +{"fatpipe", {NULL}, 3353, "udp"}, +{"suitjd", {NULL}, 3354, "tcp"}, +{"suitjd", {NULL}, 3354, "udp"}, +{"ordinox-dbase", {NULL}, 3355, "tcp"}, +{"ordinox-dbase", {NULL}, 3355, "udp"}, +{"upnotifyps", {NULL}, 3356, "tcp"}, +{"upnotifyps", {NULL}, 3356, "udp"}, +{"adtech-test", {NULL}, 3357, "tcp"}, +{"adtech-test", {NULL}, 3357, "udp"}, +{"mpsysrmsvr", {NULL}, 3358, "tcp"}, +{"mpsysrmsvr", {NULL}, 3358, "udp"}, +{"wg-netforce", {NULL}, 3359, "tcp"}, +{"wg-netforce", {NULL}, 3359, "udp"}, +{"kv-server", {NULL}, 3360, "tcp"}, +{"kv-server", {NULL}, 3360, "udp"}, +{"kv-agent", {NULL}, 3361, "tcp"}, +{"kv-agent", {NULL}, 3361, "udp"}, +{"dj-ilm", {NULL}, 3362, "tcp"}, +{"dj-ilm", {NULL}, 3362, "udp"}, +{"nati-vi-server", {NULL}, 3363, "tcp"}, +{"nati-vi-server", {NULL}, 3363, "udp"}, +{"creativeserver", {NULL}, 3364, "tcp"}, +{"creativeserver", {NULL}, 3364, "udp"}, +{"contentserver", {NULL}, 3365, "tcp"}, +{"contentserver", {NULL}, 3365, "udp"}, +{"creativepartnr", {NULL}, 3366, "tcp"}, +{"creativepartnr", {NULL}, 3366, "udp"}, +{"tip2", {NULL}, 3372, "tcp"}, +{"tip2", {NULL}, 3372, "udp"}, +{"lavenir-lm", {NULL}, 3373, "tcp"}, +{"lavenir-lm", {NULL}, 3373, "udp"}, +{"cluster-disc", {NULL}, 3374, "tcp"}, +{"cluster-disc", {NULL}, 3374, "udp"}, +{"vsnm-agent", {NULL}, 3375, "tcp"}, +{"vsnm-agent", {NULL}, 3375, "udp"}, +{"cdbroker", {NULL}, 3376, "tcp"}, +{"cdbroker", {NULL}, 3376, "udp"}, +{"cogsys-lm", {NULL}, 3377, "tcp"}, +{"cogsys-lm", {NULL}, 3377, "udp"}, +{"wsicopy", {NULL}, 3378, "tcp"}, +{"wsicopy", {NULL}, 3378, "udp"}, +{"socorfs", {NULL}, 3379, "tcp"}, +{"socorfs", {NULL}, 3379, "udp"}, +{"sns-channels", {NULL}, 3380, "tcp"}, +{"sns-channels", {NULL}, 3380, "udp"}, +{"geneous", {NULL}, 3381, "tcp"}, +{"geneous", {NULL}, 3381, "udp"}, +{"fujitsu-neat", {NULL}, 3382, "tcp"}, +{"fujitsu-neat", {NULL}, 3382, "udp"}, +{"esp-lm", {NULL}, 3383, "tcp"}, +{"esp-lm", {NULL}, 3383, "udp"}, +{"hp-clic", {NULL}, 3384, "tcp"}, +{"hp-clic", {NULL}, 3384, "udp"}, +{"qnxnetman", {NULL}, 3385, "tcp"}, +{"qnxnetman", {NULL}, 3385, "udp"}, +{"gprs-data", {NULL}, 3386, "tcp"}, +{"gprs-sig", {NULL}, 3386, "udp"}, +{"backroomnet", {NULL}, 3387, "tcp"}, +{"backroomnet", {NULL}, 3387, "udp"}, +{"cbserver", {NULL}, 3388, "tcp"}, +{"cbserver", {NULL}, 3388, "udp"}, +{"ms-wbt-server", {NULL}, 3389, "tcp"}, +{"ms-wbt-server", {NULL}, 3389, "udp"}, +{"dsc", {NULL}, 3390, "tcp"}, +{"dsc", {NULL}, 3390, "udp"}, +{"savant", {NULL}, 3391, "tcp"}, +{"savant", {NULL}, 3391, "udp"}, +{"efi-lm", {NULL}, 3392, "tcp"}, +{"efi-lm", {NULL}, 3392, "udp"}, +{"d2k-tapestry1", {NULL}, 3393, "tcp"}, +{"d2k-tapestry1", {NULL}, 3393, "udp"}, +{"d2k-tapestry2", {NULL}, 3394, "tcp"}, +{"d2k-tapestry2", {NULL}, 3394, "udp"}, +{"dyna-lm", {NULL}, 3395, "tcp"}, +{"dyna-lm", {NULL}, 3395, "udp"}, +{"printer_agent", {NULL}, 3396, "tcp"}, +{"printer_agent", {NULL}, 3396, "udp"}, +{"cloanto-lm", {NULL}, 3397, "tcp"}, +{"cloanto-lm", {NULL}, 3397, "udp"}, +{"mercantile", {NULL}, 3398, "tcp"}, +{"mercantile", {NULL}, 3398, "udp"}, +{"csms", {NULL}, 3399, "tcp"}, +{"csms", {NULL}, 3399, "udp"}, +{"csms2", {NULL}, 3400, "tcp"}, +{"csms2", {NULL}, 3400, "udp"}, +{"filecast", {NULL}, 3401, "tcp"}, +{"filecast", {NULL}, 3401, "udp"}, +{"fxaengine-net", {NULL}, 3402, "tcp"}, +{"fxaengine-net", {NULL}, 3402, "udp"}, +{"nokia-ann-ch1", {NULL}, 3405, "tcp"}, +{"nokia-ann-ch1", {NULL}, 3405, "udp"}, +{"nokia-ann-ch2", {NULL}, 3406, "tcp"}, +{"nokia-ann-ch2", {NULL}, 3406, "udp"}, +{"ldap-admin", {NULL}, 3407, "tcp"}, +{"ldap-admin", {NULL}, 3407, "udp"}, +{"BESApi", {NULL}, 3408, "tcp"}, +{"BESApi", {NULL}, 3408, "udp"}, +{"networklens", {NULL}, 3409, "tcp"}, +{"networklens", {NULL}, 3409, "udp"}, +{"networklenss", {NULL}, 3410, "tcp"}, +{"networklenss", {NULL}, 3410, "udp"}, +{"biolink-auth", {NULL}, 3411, "tcp"}, +{"biolink-auth", {NULL}, 3411, "udp"}, +{"xmlblaster", {NULL}, 3412, "tcp"}, +{"xmlblaster", {NULL}, 3412, "udp"}, +{"svnet", {NULL}, 3413, "tcp"}, +{"svnet", {NULL}, 3413, "udp"}, +{"wip-port", {NULL}, 3414, "tcp"}, +{"wip-port", {NULL}, 3414, "udp"}, +{"bcinameservice", {NULL}, 3415, "tcp"}, +{"bcinameservice", {NULL}, 3415, "udp"}, +{"commandport", {NULL}, 3416, "tcp"}, +{"commandport", {NULL}, 3416, "udp"}, +{"csvr", {NULL}, 3417, "tcp"}, +{"csvr", {NULL}, 3417, "udp"}, +{"rnmap", {NULL}, 3418, "tcp"}, +{"rnmap", {NULL}, 3418, "udp"}, +{"softaudit", {NULL}, 3419, "tcp"}, +{"softaudit", {NULL}, 3419, "udp"}, +{"ifcp-port", {NULL}, 3420, "tcp"}, +{"ifcp-port", {NULL}, 3420, "udp"}, +{"bmap", {NULL}, 3421, "tcp"}, +{"bmap", {NULL}, 3421, "udp"}, +{"rusb-sys-port", {NULL}, 3422, "tcp"}, +{"rusb-sys-port", {NULL}, 3422, "udp"}, +{"xtrm", {NULL}, 3423, "tcp"}, +{"xtrm", {NULL}, 3423, "udp"}, +{"xtrms", {NULL}, 3424, "tcp"}, +{"xtrms", {NULL}, 3424, "udp"}, +{"agps-port", {NULL}, 3425, "tcp"}, +{"agps-port", {NULL}, 3425, "udp"}, +{"arkivio", {NULL}, 3426, "tcp"}, +{"arkivio", {NULL}, 3426, "udp"}, +{"websphere-snmp", {NULL}, 3427, "tcp"}, +{"websphere-snmp", {NULL}, 3427, "udp"}, +{"twcss", {NULL}, 3428, "tcp"}, +{"twcss", {NULL}, 3428, "udp"}, +{"gcsp", {NULL}, 3429, "tcp"}, +{"gcsp", {NULL}, 3429, "udp"}, +{"ssdispatch", {NULL}, 3430, "tcp"}, +{"ssdispatch", {NULL}, 3430, "udp"}, +{"ndl-als", {NULL}, 3431, "tcp"}, +{"ndl-als", {NULL}, 3431, "udp"}, +{"osdcp", {NULL}, 3432, "tcp"}, +{"osdcp", {NULL}, 3432, "udp"}, +{"alta-smp", {NULL}, 3433, "tcp"}, +{"alta-smp", {NULL}, 3433, "udp"}, +{"opencm", {NULL}, 3434, "tcp"}, +{"opencm", {NULL}, 3434, "udp"}, +{"pacom", {NULL}, 3435, "tcp"}, +{"pacom", {NULL}, 3435, "udp"}, +{"gc-config", {NULL}, 3436, "tcp"}, +{"gc-config", {NULL}, 3436, "udp"}, +{"autocueds", {NULL}, 3437, "tcp"}, +{"autocueds", {NULL}, 3437, "udp"}, +{"spiral-admin", {NULL}, 3438, "tcp"}, +{"spiral-admin", {NULL}, 3438, "udp"}, +{"hri-port", {NULL}, 3439, "tcp"}, +{"hri-port", {NULL}, 3439, "udp"}, +{"ans-console", {NULL}, 3440, "tcp"}, +{"ans-console", {NULL}, 3440, "udp"}, +{"connect-client", {NULL}, 3441, "tcp"}, +{"connect-client", {NULL}, 3441, "udp"}, +{"connect-server", {NULL}, 3442, "tcp"}, +{"connect-server", {NULL}, 3442, "udp"}, +{"ov-nnm-websrv", {NULL}, 3443, "tcp"}, +{"ov-nnm-websrv", {NULL}, 3443, "udp"}, +{"denali-server", {NULL}, 3444, "tcp"}, +{"denali-server", {NULL}, 3444, "udp"}, +{"monp", {NULL}, 3445, "tcp"}, +{"monp", {NULL}, 3445, "udp"}, +{"3comfaxrpc", {NULL}, 3446, "tcp"}, +{"3comfaxrpc", {NULL}, 3446, "udp"}, +{"directnet", {NULL}, 3447, "tcp"}, +{"directnet", {NULL}, 3447, "udp"}, +{"dnc-port", {NULL}, 3448, "tcp"}, +{"dnc-port", {NULL}, 3448, "udp"}, +{"hotu-chat", {NULL}, 3449, "tcp"}, +{"hotu-chat", {NULL}, 3449, "udp"}, +{"castorproxy", {NULL}, 3450, "tcp"}, +{"castorproxy", {NULL}, 3450, "udp"}, +{"asam", {NULL}, 3451, "tcp"}, +{"asam", {NULL}, 3451, "udp"}, +{"sabp-signal", {NULL}, 3452, "tcp"}, +{"sabp-signal", {NULL}, 3452, "udp"}, +{"pscupd", {NULL}, 3453, "tcp"}, +{"pscupd", {NULL}, 3453, "udp"}, +{"mira", {NULL}, 3454, "tcp"}, +{"prsvp", {NULL}, 3455, "tcp"}, +{"prsvp", {NULL}, 3455, "udp"}, +{"vat", {NULL}, 3456, "tcp"}, +{"vat", {NULL}, 3456, "udp"}, +{"vat-control", {NULL}, 3457, "tcp"}, +{"vat-control", {NULL}, 3457, "udp"}, +{"d3winosfi", {NULL}, 3458, "tcp"}, +{"d3winosfi", {NULL}, 3458, "udp"}, +{"integral", {NULL}, 3459, "tcp"}, +{"integral", {NULL}, 3459, "udp"}, +{"edm-manager", {NULL}, 3460, "tcp"}, +{"edm-manager", {NULL}, 3460, "udp"}, +{"edm-stager", {NULL}, 3461, "tcp"}, +{"edm-stager", {NULL}, 3461, "udp"}, +{"edm-std-notify", {NULL}, 3462, "tcp"}, +{"edm-std-notify", {NULL}, 3462, "udp"}, +{"edm-adm-notify", {NULL}, 3463, "tcp"}, +{"edm-adm-notify", {NULL}, 3463, "udp"}, +{"edm-mgr-sync", {NULL}, 3464, "tcp"}, +{"edm-mgr-sync", {NULL}, 3464, "udp"}, +{"edm-mgr-cntrl", {NULL}, 3465, "tcp"}, +{"edm-mgr-cntrl", {NULL}, 3465, "udp"}, +{"workflow", {NULL}, 3466, "tcp"}, +{"workflow", {NULL}, 3466, "udp"}, +{"rcst", {NULL}, 3467, "tcp"}, +{"rcst", {NULL}, 3467, "udp"}, +{"ttcmremotectrl", {NULL}, 3468, "tcp"}, +{"ttcmremotectrl", {NULL}, 3468, "udp"}, +{"pluribus", {NULL}, 3469, "tcp"}, +{"pluribus", {NULL}, 3469, "udp"}, +{"jt400", {NULL}, 3470, "tcp"}, +{"jt400", {NULL}, 3470, "udp"}, +{"jt400-ssl", {NULL}, 3471, "tcp"}, +{"jt400-ssl", {NULL}, 3471, "udp"}, +{"jaugsremotec-1", {NULL}, 3472, "tcp"}, +{"jaugsremotec-1", {NULL}, 3472, "udp"}, +{"jaugsremotec-2", {NULL}, 3473, "tcp"}, +{"jaugsremotec-2", {NULL}, 3473, "udp"}, +{"ttntspauto", {NULL}, 3474, "tcp"}, +{"ttntspauto", {NULL}, 3474, "udp"}, +{"genisar-port", {NULL}, 3475, "tcp"}, +{"genisar-port", {NULL}, 3475, "udp"}, +{"nppmp", {NULL}, 3476, "tcp"}, +{"nppmp", {NULL}, 3476, "udp"}, +{"ecomm", {NULL}, 3477, "tcp"}, +{"ecomm", {NULL}, 3477, "udp"}, +{"stun", {NULL}, 3478, "tcp"}, +{"stun", {NULL}, 3478, "udp"}, +{"turn", {NULL}, 3478, "tcp"}, +{"turn", {NULL}, 3478, "udp"}, +{"stun-behavior", {NULL}, 3478, "tcp"}, +{"stun-behavior", {NULL}, 3478, "udp"}, +{"twrpc", {NULL}, 3479, "tcp"}, +{"twrpc", {NULL}, 3479, "udp"}, +{"plethora", {NULL}, 3480, "tcp"}, +{"plethora", {NULL}, 3480, "udp"}, +{"cleanerliverc", {NULL}, 3481, "tcp"}, +{"cleanerliverc", {NULL}, 3481, "udp"}, +{"vulture", {NULL}, 3482, "tcp"}, +{"vulture", {NULL}, 3482, "udp"}, +{"slim-devices", {NULL}, 3483, "tcp"}, +{"slim-devices", {NULL}, 3483, "udp"}, +{"gbs-stp", {NULL}, 3484, "tcp"}, +{"gbs-stp", {NULL}, 3484, "udp"}, +{"celatalk", {NULL}, 3485, "tcp"}, +{"celatalk", {NULL}, 3485, "udp"}, +{"ifsf-hb-port", {NULL}, 3486, "tcp"}, +{"ifsf-hb-port", {NULL}, 3486, "udp"}, +{"ltctcp", {NULL}, 3487, "tcp"}, +{"ltcudp", {NULL}, 3487, "udp"}, +{"fs-rh-srv", {NULL}, 3488, "tcp"}, +{"fs-rh-srv", {NULL}, 3488, "udp"}, +{"dtp-dia", {NULL}, 3489, "tcp"}, +{"dtp-dia", {NULL}, 3489, "udp"}, +{"colubris", {NULL}, 3490, "tcp"}, +{"colubris", {NULL}, 3490, "udp"}, +{"swr-port", {NULL}, 3491, "tcp"}, +{"swr-port", {NULL}, 3491, "udp"}, +{"tvdumtray-port", {NULL}, 3492, "tcp"}, +{"tvdumtray-port", {NULL}, 3492, "udp"}, +{"nut", {NULL}, 3493, "tcp"}, +{"nut", {NULL}, 3493, "udp"}, +{"ibm3494", {NULL}, 3494, "tcp"}, +{"ibm3494", {NULL}, 3494, "udp"}, +{"seclayer-tcp", {NULL}, 3495, "tcp"}, +{"seclayer-tcp", {NULL}, 3495, "udp"}, +{"seclayer-tls", {NULL}, 3496, "tcp"}, +{"seclayer-tls", {NULL}, 3496, "udp"}, +{"ipether232port", {NULL}, 3497, "tcp"}, +{"ipether232port", {NULL}, 3497, "udp"}, +{"dashpas-port", {NULL}, 3498, "tcp"}, +{"dashpas-port", {NULL}, 3498, "udp"}, +{"sccip-media", {NULL}, 3499, "tcp"}, +{"sccip-media", {NULL}, 3499, "udp"}, +{"rtmp-port", {NULL}, 3500, "tcp"}, +{"rtmp-port", {NULL}, 3500, "udp"}, +{"isoft-p2p", {NULL}, 3501, "tcp"}, +{"isoft-p2p", {NULL}, 3501, "udp"}, +{"avinstalldisc", {NULL}, 3502, "tcp"}, +{"avinstalldisc", {NULL}, 3502, "udp"}, +{"lsp-ping", {NULL}, 3503, "tcp"}, +{"lsp-ping", {NULL}, 3503, "udp"}, +{"ironstorm", {NULL}, 3504, "tcp"}, +{"ironstorm", {NULL}, 3504, "udp"}, +{"ccmcomm", {NULL}, 3505, "tcp"}, +{"ccmcomm", {NULL}, 3505, "udp"}, +{"apc-3506", {NULL}, 3506, "tcp"}, +{"apc-3506", {NULL}, 3506, "udp"}, +{"nesh-broker", {NULL}, 3507, "tcp"}, +{"nesh-broker", {NULL}, 3507, "udp"}, +{"interactionweb", {NULL}, 3508, "tcp"}, +{"interactionweb", {NULL}, 3508, "udp"}, +{"vt-ssl", {NULL}, 3509, "tcp"}, +{"vt-ssl", {NULL}, 3509, "udp"}, +{"xss-port", {NULL}, 3510, "tcp"}, +{"xss-port", {NULL}, 3510, "udp"}, +{"webmail-2", {NULL}, 3511, "tcp"}, +{"webmail-2", {NULL}, 3511, "udp"}, +{"aztec", {NULL}, 3512, "tcp"}, +{"aztec", {NULL}, 3512, "udp"}, +{"arcpd", {NULL}, 3513, "tcp"}, +{"arcpd", {NULL}, 3513, "udp"}, +{"must-p2p", {NULL}, 3514, "tcp"}, +{"must-p2p", {NULL}, 3514, "udp"}, +{"must-backplane", {NULL}, 3515, "tcp"}, +{"must-backplane", {NULL}, 3515, "udp"}, +{"smartcard-port", {NULL}, 3516, "tcp"}, +{"smartcard-port", {NULL}, 3516, "udp"}, +{"802-11-iapp", {NULL}, 3517, "tcp"}, +{"802-11-iapp", {NULL}, 3517, "udp"}, +{"artifact-msg", {NULL}, 3518, "tcp"}, +{"artifact-msg", {NULL}, 3518, "udp"}, +{"nvmsgd", {NULL}, 3519, "tcp"}, +{"galileo", {NULL}, 3519, "udp"}, +{"galileolog", {NULL}, 3520, "tcp"}, +{"galileolog", {NULL}, 3520, "udp"}, +{"mc3ss", {NULL}, 3521, "tcp"}, +{"mc3ss", {NULL}, 3521, "udp"}, +{"nssocketport", {NULL}, 3522, "tcp"}, +{"nssocketport", {NULL}, 3522, "udp"}, +{"odeumservlink", {NULL}, 3523, "tcp"}, +{"odeumservlink", {NULL}, 3523, "udp"}, +{"ecmport", {NULL}, 3524, "tcp"}, +{"ecmport", {NULL}, 3524, "udp"}, +{"eisport", {NULL}, 3525, "tcp"}, +{"eisport", {NULL}, 3525, "udp"}, +{"starquiz-port", {NULL}, 3526, "tcp"}, +{"starquiz-port", {NULL}, 3526, "udp"}, +{"beserver-msg-q", {NULL}, 3527, "tcp"}, +{"beserver-msg-q", {NULL}, 3527, "udp"}, +{"jboss-iiop", {NULL}, 3528, "tcp"}, +{"jboss-iiop", {NULL}, 3528, "udp"}, +{"jboss-iiop-ssl", {NULL}, 3529, "tcp"}, +{"jboss-iiop-ssl", {NULL}, 3529, "udp"}, +{"gf", {NULL}, 3530, "tcp"}, +{"gf", {NULL}, 3530, "udp"}, +{"joltid", {NULL}, 3531, "tcp"}, +{"joltid", {NULL}, 3531, "udp"}, +{"raven-rmp", {NULL}, 3532, "tcp"}, +{"raven-rmp", {NULL}, 3532, "udp"}, +{"raven-rdp", {NULL}, 3533, "tcp"}, +{"raven-rdp", {NULL}, 3533, "udp"}, +{"urld-port", {NULL}, 3534, "tcp"}, +{"urld-port", {NULL}, 3534, "udp"}, +{"ms-la", {NULL}, 3535, "tcp"}, +{"ms-la", {NULL}, 3535, "udp"}, +{"snac", {NULL}, 3536, "tcp"}, +{"snac", {NULL}, 3536, "udp"}, +{"ni-visa-remote", {NULL}, 3537, "tcp"}, +{"ni-visa-remote", {NULL}, 3537, "udp"}, +{"ibm-diradm", {NULL}, 3538, "tcp"}, +{"ibm-diradm", {NULL}, 3538, "udp"}, +{"ibm-diradm-ssl", {NULL}, 3539, "tcp"}, +{"ibm-diradm-ssl", {NULL}, 3539, "udp"}, +{"pnrp-port", {NULL}, 3540, "tcp"}, +{"pnrp-port", {NULL}, 3540, "udp"}, +{"voispeed-port", {NULL}, 3541, "tcp"}, +{"voispeed-port", {NULL}, 3541, "udp"}, +{"hacl-monitor", {NULL}, 3542, "tcp"}, +{"hacl-monitor", {NULL}, 3542, "udp"}, +{"qftest-lookup", {NULL}, 3543, "tcp"}, +{"qftest-lookup", {NULL}, 3543, "udp"}, +{"teredo", {NULL}, 3544, "tcp"}, +{"teredo", {NULL}, 3544, "udp"}, +{"camac", {NULL}, 3545, "tcp"}, +{"camac", {NULL}, 3545, "udp"}, +{"symantec-sim", {NULL}, 3547, "tcp"}, +{"symantec-sim", {NULL}, 3547, "udp"}, +{"interworld", {NULL}, 3548, "tcp"}, +{"interworld", {NULL}, 3548, "udp"}, +{"tellumat-nms", {NULL}, 3549, "tcp"}, +{"tellumat-nms", {NULL}, 3549, "udp"}, +{"ssmpp", {NULL}, 3550, "tcp"}, +{"ssmpp", {NULL}, 3550, "udp"}, +{"apcupsd", {NULL}, 3551, "tcp"}, +{"apcupsd", {NULL}, 3551, "udp"}, +{"taserver", {NULL}, 3552, "tcp"}, +{"taserver", {NULL}, 3552, "udp"}, +{"rbr-discovery", {NULL}, 3553, "tcp"}, +{"rbr-discovery", {NULL}, 3553, "udp"}, +{"questnotify", {NULL}, 3554, "tcp"}, +{"questnotify", {NULL}, 3554, "udp"}, +{"razor", {NULL}, 3555, "tcp"}, +{"razor", {NULL}, 3555, "udp"}, +{"sky-transport", {NULL}, 3556, "tcp"}, +{"sky-transport", {NULL}, 3556, "udp"}, +{"personalos-001", {NULL}, 3557, "tcp"}, +{"personalos-001", {NULL}, 3557, "udp"}, +{"mcp-port", {NULL}, 3558, "tcp"}, +{"mcp-port", {NULL}, 3558, "udp"}, +{"cctv-port", {NULL}, 3559, "tcp"}, +{"cctv-port", {NULL}, 3559, "udp"}, +{"iniserve-port", {NULL}, 3560, "tcp"}, +{"iniserve-port", {NULL}, 3560, "udp"}, +{"bmc-onekey", {NULL}, 3561, "tcp"}, +{"bmc-onekey", {NULL}, 3561, "udp"}, +{"sdbproxy", {NULL}, 3562, "tcp"}, +{"sdbproxy", {NULL}, 3562, "udp"}, +{"watcomdebug", {NULL}, 3563, "tcp"}, +{"watcomdebug", {NULL}, 3563, "udp"}, +{"esimport", {NULL}, 3564, "tcp"}, +{"esimport", {NULL}, 3564, "udp"}, +{"m2pa", {NULL}, 3565, "tcp"}, +{"m2pa", {NULL}, 3565, "sctp"}, +{"quest-data-hub", {NULL}, 3566, "tcp"}, +{"oap", {NULL}, 3567, "tcp"}, +{"oap", {NULL}, 3567, "udp"}, +{"oap-s", {NULL}, 3568, "tcp"}, +{"oap-s", {NULL}, 3568, "udp"}, +{"mbg-ctrl", {NULL}, 3569, "tcp"}, +{"mbg-ctrl", {NULL}, 3569, "udp"}, +{"mccwebsvr-port", {NULL}, 3570, "tcp"}, +{"mccwebsvr-port", {NULL}, 3570, "udp"}, +{"megardsvr-port", {NULL}, 3571, "tcp"}, +{"megardsvr-port", {NULL}, 3571, "udp"}, +{"megaregsvrport", {NULL}, 3572, "tcp"}, +{"megaregsvrport", {NULL}, 3572, "udp"}, +{"tag-ups-1", {NULL}, 3573, "tcp"}, +{"tag-ups-1", {NULL}, 3573, "udp"}, +{"dmaf-server", {NULL}, 3574, "tcp"}, +{"dmaf-caster", {NULL}, 3574, "udp"}, +{"ccm-port", {NULL}, 3575, "tcp"}, +{"ccm-port", {NULL}, 3575, "udp"}, +{"cmc-port", {NULL}, 3576, "tcp"}, +{"cmc-port", {NULL}, 3576, "udp"}, +{"config-port", {NULL}, 3577, "tcp"}, +{"config-port", {NULL}, 3577, "udp"}, +{"data-port", {NULL}, 3578, "tcp"}, +{"data-port", {NULL}, 3578, "udp"}, +{"ttat3lb", {NULL}, 3579, "tcp"}, +{"ttat3lb", {NULL}, 3579, "udp"}, +{"nati-svrloc", {NULL}, 3580, "tcp"}, +{"nati-svrloc", {NULL}, 3580, "udp"}, +{"kfxaclicensing", {NULL}, 3581, "tcp"}, +{"kfxaclicensing", {NULL}, 3581, "udp"}, +{"press", {NULL}, 3582, "tcp"}, +{"press", {NULL}, 3582, "udp"}, +{"canex-watch", {NULL}, 3583, "tcp"}, +{"canex-watch", {NULL}, 3583, "udp"}, +{"u-dbap", {NULL}, 3584, "tcp"}, +{"u-dbap", {NULL}, 3584, "udp"}, +{"emprise-lls", {NULL}, 3585, "tcp"}, +{"emprise-lls", {NULL}, 3585, "udp"}, +{"emprise-lsc", {NULL}, 3586, "tcp"}, +{"emprise-lsc", {NULL}, 3586, "udp"}, +{"p2pgroup", {NULL}, 3587, "tcp"}, +{"p2pgroup", {NULL}, 3587, "udp"}, +{"sentinel", {NULL}, 3588, "tcp"}, +{"sentinel", {NULL}, 3588, "udp"}, +{"isomair", {NULL}, 3589, "tcp"}, +{"isomair", {NULL}, 3589, "udp"}, +{"wv-csp-sms", {NULL}, 3590, "tcp"}, +{"wv-csp-sms", {NULL}, 3590, "udp"}, +{"gtrack-server", {NULL}, 3591, "tcp"}, +{"gtrack-server", {NULL}, 3591, "udp"}, +{"gtrack-ne", {NULL}, 3592, "tcp"}, +{"gtrack-ne", {NULL}, 3592, "udp"}, +{"bpmd", {NULL}, 3593, "tcp"}, +{"bpmd", {NULL}, 3593, "udp"}, +{"mediaspace", {NULL}, 3594, "tcp"}, +{"mediaspace", {NULL}, 3594, "udp"}, +{"shareapp", {NULL}, 3595, "tcp"}, +{"shareapp", {NULL}, 3595, "udp"}, +{"iw-mmogame", {NULL}, 3596, "tcp"}, +{"iw-mmogame", {NULL}, 3596, "udp"}, +{"a14", {NULL}, 3597, "tcp"}, +{"a14", {NULL}, 3597, "udp"}, +{"a15", {NULL}, 3598, "tcp"}, +{"a15", {NULL}, 3598, "udp"}, +{"quasar-server", {NULL}, 3599, "tcp"}, +{"quasar-server", {NULL}, 3599, "udp"}, +{"trap-daemon", {NULL}, 3600, "tcp"}, +{"trap-daemon", {NULL}, 3600, "udp"}, +{"visinet-gui", {NULL}, 3601, "tcp"}, +{"visinet-gui", {NULL}, 3601, "udp"}, +{"infiniswitchcl", {NULL}, 3602, "tcp"}, +{"infiniswitchcl", {NULL}, 3602, "udp"}, +{"int-rcv-cntrl", {NULL}, 3603, "tcp"}, +{"int-rcv-cntrl", {NULL}, 3603, "udp"}, +{"bmc-jmx-port", {NULL}, 3604, "tcp"}, +{"bmc-jmx-port", {NULL}, 3604, "udp"}, +{"comcam-io", {NULL}, 3605, "tcp"}, +{"comcam-io", {NULL}, 3605, "udp"}, +{"splitlock", {NULL}, 3606, "tcp"}, +{"splitlock", {NULL}, 3606, "udp"}, +{"precise-i3", {NULL}, 3607, "tcp"}, +{"precise-i3", {NULL}, 3607, "udp"}, +{"trendchip-dcp", {NULL}, 3608, "tcp"}, +{"trendchip-dcp", {NULL}, 3608, "udp"}, +{"cpdi-pidas-cm", {NULL}, 3609, "tcp"}, +{"cpdi-pidas-cm", {NULL}, 3609, "udp"}, +{"echonet", {NULL}, 3610, "tcp"}, +{"echonet", {NULL}, 3610, "udp"}, +{"six-degrees", {NULL}, 3611, "tcp"}, +{"six-degrees", {NULL}, 3611, "udp"}, +{"hp-dataprotect", {NULL}, 3612, "tcp"}, +{"hp-dataprotect", {NULL}, 3612, "udp"}, +{"alaris-disc", {NULL}, 3613, "tcp"}, +{"alaris-disc", {NULL}, 3613, "udp"}, +{"sigma-port", {NULL}, 3614, "tcp"}, +{"sigma-port", {NULL}, 3614, "udp"}, +{"start-network", {NULL}, 3615, "tcp"}, +{"start-network", {NULL}, 3615, "udp"}, +{"cd3o-protocol", {NULL}, 3616, "tcp"}, +{"cd3o-protocol", {NULL}, 3616, "udp"}, +{"sharp-server", {NULL}, 3617, "tcp"}, +{"sharp-server", {NULL}, 3617, "udp"}, +{"aairnet-1", {NULL}, 3618, "tcp"}, +{"aairnet-1", {NULL}, 3618, "udp"}, +{"aairnet-2", {NULL}, 3619, "tcp"}, +{"aairnet-2", {NULL}, 3619, "udp"}, +{"ep-pcp", {NULL}, 3620, "tcp"}, +{"ep-pcp", {NULL}, 3620, "udp"}, +{"ep-nsp", {NULL}, 3621, "tcp"}, +{"ep-nsp", {NULL}, 3621, "udp"}, +{"ff-lr-port", {NULL}, 3622, "tcp"}, +{"ff-lr-port", {NULL}, 3622, "udp"}, +{"haipe-discover", {NULL}, 3623, "tcp"}, +{"haipe-discover", {NULL}, 3623, "udp"}, +{"dist-upgrade", {NULL}, 3624, "tcp"}, +{"dist-upgrade", {NULL}, 3624, "udp"}, +{"volley", {NULL}, 3625, "tcp"}, +{"volley", {NULL}, 3625, "udp"}, +{"bvcdaemon-port", {NULL}, 3626, "tcp"}, +{"bvcdaemon-port", {NULL}, 3626, "udp"}, +{"jamserverport", {NULL}, 3627, "tcp"}, +{"jamserverport", {NULL}, 3627, "udp"}, +{"ept-machine", {NULL}, 3628, "tcp"}, +{"ept-machine", {NULL}, 3628, "udp"}, +{"escvpnet", {NULL}, 3629, "tcp"}, +{"escvpnet", {NULL}, 3629, "udp"}, +{"cs-remote-db", {NULL}, 3630, "tcp"}, +{"cs-remote-db", {NULL}, 3630, "udp"}, +{"cs-services", {NULL}, 3631, "tcp"}, +{"cs-services", {NULL}, 3631, "udp"}, +{"distcc", {NULL}, 3632, "tcp"}, +{"distcc", {NULL}, 3632, "udp"}, +{"wacp", {NULL}, 3633, "tcp"}, +{"wacp", {NULL}, 3633, "udp"}, +{"hlibmgr", {NULL}, 3634, "tcp"}, +{"hlibmgr", {NULL}, 3634, "udp"}, +{"sdo", {NULL}, 3635, "tcp"}, +{"sdo", {NULL}, 3635, "udp"}, +{"servistaitsm", {NULL}, 3636, "tcp"}, +{"servistaitsm", {NULL}, 3636, "udp"}, +{"scservp", {NULL}, 3637, "tcp"}, +{"scservp", {NULL}, 3637, "udp"}, +{"ehp-backup", {NULL}, 3638, "tcp"}, +{"ehp-backup", {NULL}, 3638, "udp"}, +{"xap-ha", {NULL}, 3639, "tcp"}, +{"xap-ha", {NULL}, 3639, "udp"}, +{"netplay-port1", {NULL}, 3640, "tcp"}, +{"netplay-port1", {NULL}, 3640, "udp"}, +{"netplay-port2", {NULL}, 3641, "tcp"}, +{"netplay-port2", {NULL}, 3641, "udp"}, +{"juxml-port", {NULL}, 3642, "tcp"}, +{"juxml-port", {NULL}, 3642, "udp"}, +{"audiojuggler", {NULL}, 3643, "tcp"}, +{"audiojuggler", {NULL}, 3643, "udp"}, +{"ssowatch", {NULL}, 3644, "tcp"}, +{"ssowatch", {NULL}, 3644, "udp"}, +{"cyc", {NULL}, 3645, "tcp"}, +{"cyc", {NULL}, 3645, "udp"}, +{"xss-srv-port", {NULL}, 3646, "tcp"}, +{"xss-srv-port", {NULL}, 3646, "udp"}, +{"splitlock-gw", {NULL}, 3647, "tcp"}, +{"splitlock-gw", {NULL}, 3647, "udp"}, +{"fjcp", {NULL}, 3648, "tcp"}, +{"fjcp", {NULL}, 3648, "udp"}, +{"nmmp", {NULL}, 3649, "tcp"}, +{"nmmp", {NULL}, 3649, "udp"}, +{"prismiq-plugin", {NULL}, 3650, "tcp"}, +{"prismiq-plugin", {NULL}, 3650, "udp"}, +{"xrpc-registry", {NULL}, 3651, "tcp"}, +{"xrpc-registry", {NULL}, 3651, "udp"}, +{"vxcrnbuport", {NULL}, 3652, "tcp"}, +{"vxcrnbuport", {NULL}, 3652, "udp"}, +{"tsp", {NULL}, 3653, "tcp"}, +{"tsp", {NULL}, 3653, "udp"}, +{"vaprtm", {NULL}, 3654, "tcp"}, +{"vaprtm", {NULL}, 3654, "udp"}, +{"abatemgr", {NULL}, 3655, "tcp"}, +{"abatemgr", {NULL}, 3655, "udp"}, +{"abatjss", {NULL}, 3656, "tcp"}, +{"abatjss", {NULL}, 3656, "udp"}, +{"immedianet-bcn", {NULL}, 3657, "tcp"}, +{"immedianet-bcn", {NULL}, 3657, "udp"}, +{"ps-ams", {NULL}, 3658, "tcp"}, +{"ps-ams", {NULL}, 3658, "udp"}, +{"apple-sasl", {NULL}, 3659, "tcp"}, +{"apple-sasl", {NULL}, 3659, "udp"}, +{"can-nds-ssl", {NULL}, 3660, "tcp"}, +{"can-nds-ssl", {NULL}, 3660, "udp"}, +{"can-ferret-ssl", {NULL}, 3661, "tcp"}, +{"can-ferret-ssl", {NULL}, 3661, "udp"}, +{"pserver", {NULL}, 3662, "tcp"}, +{"pserver", {NULL}, 3662, "udp"}, +{"dtp", {NULL}, 3663, "tcp"}, +{"dtp", {NULL}, 3663, "udp"}, +{"ups-engine", {NULL}, 3664, "tcp"}, +{"ups-engine", {NULL}, 3664, "udp"}, +{"ent-engine", {NULL}, 3665, "tcp"}, +{"ent-engine", {NULL}, 3665, "udp"}, +{"eserver-pap", {NULL}, 3666, "tcp"}, +{"eserver-pap", {NULL}, 3666, "udp"}, +{"infoexch", {NULL}, 3667, "tcp"}, +{"infoexch", {NULL}, 3667, "udp"}, +{"dell-rm-port", {NULL}, 3668, "tcp"}, +{"dell-rm-port", {NULL}, 3668, "udp"}, +{"casanswmgmt", {NULL}, 3669, "tcp"}, +{"casanswmgmt", {NULL}, 3669, "udp"}, +{"smile", {NULL}, 3670, "tcp"}, +{"smile", {NULL}, 3670, "udp"}, +{"efcp", {NULL}, 3671, "tcp"}, +{"efcp", {NULL}, 3671, "udp"}, +{"lispworks-orb", {NULL}, 3672, "tcp"}, +{"lispworks-orb", {NULL}, 3672, "udp"}, +{"mediavault-gui", {NULL}, 3673, "tcp"}, +{"mediavault-gui", {NULL}, 3673, "udp"}, +{"wininstall-ipc", {NULL}, 3674, "tcp"}, +{"wininstall-ipc", {NULL}, 3674, "udp"}, +{"calltrax", {NULL}, 3675, "tcp"}, +{"calltrax", {NULL}, 3675, "udp"}, +{"va-pacbase", {NULL}, 3676, "tcp"}, +{"va-pacbase", {NULL}, 3676, "udp"}, +{"roverlog", {NULL}, 3677, "tcp"}, +{"roverlog", {NULL}, 3677, "udp"}, +{"ipr-dglt", {NULL}, 3678, "tcp"}, +{"ipr-dglt", {NULL}, 3678, "udp"}, +{"newton-dock", {NULL}, 3679, "tcp"}, +{"newton-dock", {NULL}, 3679, "udp"}, +{"npds-tracker", {NULL}, 3680, "tcp"}, +{"npds-tracker", {NULL}, 3680, "udp"}, +{"bts-x73", {NULL}, 3681, "tcp"}, +{"bts-x73", {NULL}, 3681, "udp"}, +{"cas-mapi", {NULL}, 3682, "tcp"}, +{"cas-mapi", {NULL}, 3682, "udp"}, +{"bmc-ea", {NULL}, 3683, "tcp"}, +{"bmc-ea", {NULL}, 3683, "udp"}, +{"faxstfx-port", {NULL}, 3684, "tcp"}, +{"faxstfx-port", {NULL}, 3684, "udp"}, +{"dsx-agent", {NULL}, 3685, "tcp"}, +{"dsx-agent", {NULL}, 3685, "udp"}, +{"tnmpv2", {NULL}, 3686, "tcp"}, +{"tnmpv2", {NULL}, 3686, "udp"}, +{"simple-push", {NULL}, 3687, "tcp"}, +{"simple-push", {NULL}, 3687, "udp"}, +{"simple-push-s", {NULL}, 3688, "tcp"}, +{"simple-push-s", {NULL}, 3688, "udp"}, +{"daap", {NULL}, 3689, "tcp"}, +{"daap", {NULL}, 3689, "udp"}, +{"svn", {NULL}, 3690, "tcp"}, +{"svn", {NULL}, 3690, "udp"}, +{"magaya-network", {NULL}, 3691, "tcp"}, +{"magaya-network", {NULL}, 3691, "udp"}, +{"intelsync", {NULL}, 3692, "tcp"}, +{"intelsync", {NULL}, 3692, "udp"}, +{"bmc-data-coll", {NULL}, 3695, "tcp"}, +{"bmc-data-coll", {NULL}, 3695, "udp"}, +{"telnetcpcd", {NULL}, 3696, "tcp"}, +{"telnetcpcd", {NULL}, 3696, "udp"}, +{"nw-license", {NULL}, 3697, "tcp"}, +{"nw-license", {NULL}, 3697, "udp"}, +{"sagectlpanel", {NULL}, 3698, "tcp"}, +{"sagectlpanel", {NULL}, 3698, "udp"}, +{"kpn-icw", {NULL}, 3699, "tcp"}, +{"kpn-icw", {NULL}, 3699, "udp"}, +{"lrs-paging", {NULL}, 3700, "tcp"}, +{"lrs-paging", {NULL}, 3700, "udp"}, +{"netcelera", {NULL}, 3701, "tcp"}, +{"netcelera", {NULL}, 3701, "udp"}, +{"ws-discovery", {NULL}, 3702, "tcp"}, +{"ws-discovery", {NULL}, 3702, "udp"}, +{"adobeserver-3", {NULL}, 3703, "tcp"}, +{"adobeserver-3", {NULL}, 3703, "udp"}, +{"adobeserver-4", {NULL}, 3704, "tcp"}, +{"adobeserver-4", {NULL}, 3704, "udp"}, +{"adobeserver-5", {NULL}, 3705, "tcp"}, +{"adobeserver-5", {NULL}, 3705, "udp"}, +{"rt-event", {NULL}, 3706, "tcp"}, +{"rt-event", {NULL}, 3706, "udp"}, +{"rt-event-s", {NULL}, 3707, "tcp"}, +{"rt-event-s", {NULL}, 3707, "udp"}, +{"sun-as-iiops", {NULL}, 3708, "tcp"}, +{"sun-as-iiops", {NULL}, 3708, "udp"}, +{"ca-idms", {NULL}, 3709, "tcp"}, +{"ca-idms", {NULL}, 3709, "udp"}, +{"portgate-auth", {NULL}, 3710, "tcp"}, +{"portgate-auth", {NULL}, 3710, "udp"}, +{"edb-server2", {NULL}, 3711, "tcp"}, +{"edb-server2", {NULL}, 3711, "udp"}, +{"sentinel-ent", {NULL}, 3712, "tcp"}, +{"sentinel-ent", {NULL}, 3712, "udp"}, +{"tftps", {NULL}, 3713, "tcp"}, +{"tftps", {NULL}, 3713, "udp"}, +{"delos-dms", {NULL}, 3714, "tcp"}, +{"delos-dms", {NULL}, 3714, "udp"}, +{"anoto-rendezv", {NULL}, 3715, "tcp"}, +{"anoto-rendezv", {NULL}, 3715, "udp"}, +{"wv-csp-sms-cir", {NULL}, 3716, "tcp"}, +{"wv-csp-sms-cir", {NULL}, 3716, "udp"}, +{"wv-csp-udp-cir", {NULL}, 3717, "tcp"}, +{"wv-csp-udp-cir", {NULL}, 3717, "udp"}, +{"opus-services", {NULL}, 3718, "tcp"}, +{"opus-services", {NULL}, 3718, "udp"}, +{"itelserverport", {NULL}, 3719, "tcp"}, +{"itelserverport", {NULL}, 3719, "udp"}, +{"ufastro-instr", {NULL}, 3720, "tcp"}, +{"ufastro-instr", {NULL}, 3720, "udp"}, +{"xsync", {NULL}, 3721, "tcp"}, +{"xsync", {NULL}, 3721, "udp"}, +{"xserveraid", {NULL}, 3722, "tcp"}, +{"xserveraid", {NULL}, 3722, "udp"}, +{"sychrond", {NULL}, 3723, "tcp"}, +{"sychrond", {NULL}, 3723, "udp"}, +{"blizwow", {NULL}, 3724, "tcp"}, +{"blizwow", {NULL}, 3724, "udp"}, +{"na-er-tip", {NULL}, 3725, "tcp"}, +{"na-er-tip", {NULL}, 3725, "udp"}, +{"array-manager", {NULL}, 3726, "tcp"}, +{"array-manager", {NULL}, 3726, "udp"}, +{"e-mdu", {NULL}, 3727, "tcp"}, +{"e-mdu", {NULL}, 3727, "udp"}, +{"e-woa", {NULL}, 3728, "tcp"}, +{"e-woa", {NULL}, 3728, "udp"}, +{"fksp-audit", {NULL}, 3729, "tcp"}, +{"fksp-audit", {NULL}, 3729, "udp"}, +{"client-ctrl", {NULL}, 3730, "tcp"}, +{"client-ctrl", {NULL}, 3730, "udp"}, +{"smap", {NULL}, 3731, "tcp"}, +{"smap", {NULL}, 3731, "udp"}, +{"m-wnn", {NULL}, 3732, "tcp"}, +{"m-wnn", {NULL}, 3732, "udp"}, +{"multip-msg", {NULL}, 3733, "tcp"}, +{"multip-msg", {NULL}, 3733, "udp"}, +{"synel-data", {NULL}, 3734, "tcp"}, +{"synel-data", {NULL}, 3734, "udp"}, +{"pwdis", {NULL}, 3735, "tcp"}, +{"pwdis", {NULL}, 3735, "udp"}, +{"rs-rmi", {NULL}, 3736, "tcp"}, +{"rs-rmi", {NULL}, 3736, "udp"}, +{"xpanel", {NULL}, 3737, "tcp"}, +{"versatalk", {NULL}, 3738, "tcp"}, +{"versatalk", {NULL}, 3738, "udp"}, +{"launchbird-lm", {NULL}, 3739, "tcp"}, +{"launchbird-lm", {NULL}, 3739, "udp"}, +{"heartbeat", {NULL}, 3740, "tcp"}, +{"heartbeat", {NULL}, 3740, "udp"}, +{"wysdma", {NULL}, 3741, "tcp"}, +{"wysdma", {NULL}, 3741, "udp"}, +{"cst-port", {NULL}, 3742, "tcp"}, +{"cst-port", {NULL}, 3742, "udp"}, +{"ipcs-command", {NULL}, 3743, "tcp"}, +{"ipcs-command", {NULL}, 3743, "udp"}, +{"sasg", {NULL}, 3744, "tcp"}, +{"sasg", {NULL}, 3744, "udp"}, +{"gw-call-port", {NULL}, 3745, "tcp"}, +{"gw-call-port", {NULL}, 3745, "udp"}, +{"linktest", {NULL}, 3746, "tcp"}, +{"linktest", {NULL}, 3746, "udp"}, +{"linktest-s", {NULL}, 3747, "tcp"}, +{"linktest-s", {NULL}, 3747, "udp"}, +{"webdata", {NULL}, 3748, "tcp"}, +{"webdata", {NULL}, 3748, "udp"}, +{"cimtrak", {NULL}, 3749, "tcp"}, +{"cimtrak", {NULL}, 3749, "udp"}, +{"cbos-ip-port", {NULL}, 3750, "tcp"}, +{"cbos-ip-port", {NULL}, 3750, "udp"}, +{"gprs-cube", {NULL}, 3751, "tcp"}, +{"gprs-cube", {NULL}, 3751, "udp"}, +{"vipremoteagent", {NULL}, 3752, "tcp"}, +{"vipremoteagent", {NULL}, 3752, "udp"}, +{"nattyserver", {NULL}, 3753, "tcp"}, +{"nattyserver", {NULL}, 3753, "udp"}, +{"timestenbroker", {NULL}, 3754, "tcp"}, +{"timestenbroker", {NULL}, 3754, "udp"}, +{"sas-remote-hlp", {NULL}, 3755, "tcp"}, +{"sas-remote-hlp", {NULL}, 3755, "udp"}, +{"canon-capt", {NULL}, 3756, "tcp"}, +{"canon-capt", {NULL}, 3756, "udp"}, +{"grf-port", {NULL}, 3757, "tcp"}, +{"grf-port", {NULL}, 3757, "udp"}, +{"apw-registry", {NULL}, 3758, "tcp"}, +{"apw-registry", {NULL}, 3758, "udp"}, +{"exapt-lmgr", {NULL}, 3759, "tcp"}, +{"exapt-lmgr", {NULL}, 3759, "udp"}, +{"adtempusclient", {NULL}, 3760, "tcp"}, +{"adtempusclient", {NULL}, 3760, "udp"}, +{"gsakmp", {NULL}, 3761, "tcp"}, +{"gsakmp", {NULL}, 3761, "udp"}, +{"gbs-smp", {NULL}, 3762, "tcp"}, +{"gbs-smp", {NULL}, 3762, "udp"}, +{"xo-wave", {NULL}, 3763, "tcp"}, +{"xo-wave", {NULL}, 3763, "udp"}, +{"mni-prot-rout", {NULL}, 3764, "tcp"}, +{"mni-prot-rout", {NULL}, 3764, "udp"}, +{"rtraceroute", {NULL}, 3765, "tcp"}, +{"rtraceroute", {NULL}, 3765, "udp"}, +{"listmgr-port", {NULL}, 3767, "tcp"}, +{"listmgr-port", {NULL}, 3767, "udp"}, +{"rblcheckd", {NULL}, 3768, "tcp"}, +{"rblcheckd", {NULL}, 3768, "udp"}, +{"haipe-otnk", {NULL}, 3769, "tcp"}, +{"haipe-otnk", {NULL}, 3769, "udp"}, +{"cindycollab", {NULL}, 3770, "tcp"}, +{"cindycollab", {NULL}, 3770, "udp"}, +{"paging-port", {NULL}, 3771, "tcp"}, +{"paging-port", {NULL}, 3771, "udp"}, +{"ctp", {NULL}, 3772, "tcp"}, +{"ctp", {NULL}, 3772, "udp"}, +{"ctdhercules", {NULL}, 3773, "tcp"}, +{"ctdhercules", {NULL}, 3773, "udp"}, +{"zicom", {NULL}, 3774, "tcp"}, +{"zicom", {NULL}, 3774, "udp"}, +{"ispmmgr", {NULL}, 3775, "tcp"}, +{"ispmmgr", {NULL}, 3775, "udp"}, +{"dvcprov-port", {NULL}, 3776, "tcp"}, +{"dvcprov-port", {NULL}, 3776, "udp"}, +{"jibe-eb", {NULL}, 3777, "tcp"}, +{"jibe-eb", {NULL}, 3777, "udp"}, +{"c-h-it-port", {NULL}, 3778, "tcp"}, +{"c-h-it-port", {NULL}, 3778, "udp"}, +{"cognima", {NULL}, 3779, "tcp"}, +{"cognima", {NULL}, 3779, "udp"}, +{"nnp", {NULL}, 3780, "tcp"}, +{"nnp", {NULL}, 3780, "udp"}, +{"abcvoice-port", {NULL}, 3781, "tcp"}, +{"abcvoice-port", {NULL}, 3781, "udp"}, +{"iso-tp0s", {NULL}, 3782, "tcp"}, +{"iso-tp0s", {NULL}, 3782, "udp"}, +{"bim-pem", {NULL}, 3783, "tcp"}, +{"bim-pem", {NULL}, 3783, "udp"}, +{"bfd-control", {NULL}, 3784, "tcp"}, +{"bfd-control", {NULL}, 3784, "udp"}, +{"bfd-echo", {NULL}, 3785, "tcp"}, +{"bfd-echo", {NULL}, 3785, "udp"}, +{"upstriggervsw", {NULL}, 3786, "tcp"}, +{"upstriggervsw", {NULL}, 3786, "udp"}, +{"fintrx", {NULL}, 3787, "tcp"}, +{"fintrx", {NULL}, 3787, "udp"}, +{"isrp-port", {NULL}, 3788, "tcp"}, +{"isrp-port", {NULL}, 3788, "udp"}, +{"remotedeploy", {NULL}, 3789, "tcp"}, +{"remotedeploy", {NULL}, 3789, "udp"}, +{"quickbooksrds", {NULL}, 3790, "tcp"}, +{"quickbooksrds", {NULL}, 3790, "udp"}, +{"tvnetworkvideo", {NULL}, 3791, "tcp"}, +{"tvnetworkvideo", {NULL}, 3791, "udp"}, +{"sitewatch", {NULL}, 3792, "tcp"}, +{"sitewatch", {NULL}, 3792, "udp"}, +{"dcsoftware", {NULL}, 3793, "tcp"}, +{"dcsoftware", {NULL}, 3793, "udp"}, +{"jaus", {NULL}, 3794, "tcp"}, +{"jaus", {NULL}, 3794, "udp"}, +{"myblast", {NULL}, 3795, "tcp"}, +{"myblast", {NULL}, 3795, "udp"}, +{"spw-dialer", {NULL}, 3796, "tcp"}, +{"spw-dialer", {NULL}, 3796, "udp"}, +{"idps", {NULL}, 3797, "tcp"}, +{"idps", {NULL}, 3797, "udp"}, +{"minilock", {NULL}, 3798, "tcp"}, +{"minilock", {NULL}, 3798, "udp"}, +{"radius-dynauth", {NULL}, 3799, "tcp"}, +{"radius-dynauth", {NULL}, 3799, "udp"}, +{"pwgpsi", {NULL}, 3800, "tcp"}, +{"pwgpsi", {NULL}, 3800, "udp"}, +{"ibm-mgr", {NULL}, 3801, "tcp"}, +{"ibm-mgr", {NULL}, 3801, "udp"}, +{"vhd", {NULL}, 3802, "tcp"}, +{"vhd", {NULL}, 3802, "udp"}, +{"soniqsync", {NULL}, 3803, "tcp"}, +{"soniqsync", {NULL}, 3803, "udp"}, +{"iqnet-port", {NULL}, 3804, "tcp"}, +{"iqnet-port", {NULL}, 3804, "udp"}, +{"tcpdataserver", {NULL}, 3805, "tcp"}, +{"tcpdataserver", {NULL}, 3805, "udp"}, +{"wsmlb", {NULL}, 3806, "tcp"}, +{"wsmlb", {NULL}, 3806, "udp"}, +{"spugna", {NULL}, 3807, "tcp"}, +{"spugna", {NULL}, 3807, "udp"}, +{"sun-as-iiops-ca", {NULL}, 3808, "tcp"}, +{"sun-as-iiops-ca", {NULL}, 3808, "udp"}, +{"apocd", {NULL}, 3809, "tcp"}, +{"apocd", {NULL}, 3809, "udp"}, +{"wlanauth", {NULL}, 3810, "tcp"}, +{"wlanauth", {NULL}, 3810, "udp"}, +{"amp", {NULL}, 3811, "tcp"}, +{"amp", {NULL}, 3811, "udp"}, +{"neto-wol-server", {NULL}, 3812, "tcp"}, +{"neto-wol-server", {NULL}, 3812, "udp"}, +{"rap-ip", {NULL}, 3813, "tcp"}, +{"rap-ip", {NULL}, 3813, "udp"}, +{"neto-dcs", {NULL}, 3814, "tcp"}, +{"neto-dcs", {NULL}, 3814, "udp"}, +{"lansurveyorxml", {NULL}, 3815, "tcp"}, +{"lansurveyorxml", {NULL}, 3815, "udp"}, +{"sunlps-http", {NULL}, 3816, "tcp"}, +{"sunlps-http", {NULL}, 3816, "udp"}, +{"tapeware", {NULL}, 3817, "tcp"}, +{"tapeware", {NULL}, 3817, "udp"}, +{"crinis-hb", {NULL}, 3818, "tcp"}, +{"crinis-hb", {NULL}, 3818, "udp"}, +{"epl-slp", {NULL}, 3819, "tcp"}, +{"epl-slp", {NULL}, 3819, "udp"}, +{"scp", {NULL}, 3820, "tcp"}, +{"scp", {NULL}, 3820, "udp"}, +{"pmcp", {NULL}, 3821, "tcp"}, +{"pmcp", {NULL}, 3821, "udp"}, +{"acp-discovery", {NULL}, 3822, "tcp"}, +{"acp-discovery", {NULL}, 3822, "udp"}, +{"acp-conduit", {NULL}, 3823, "tcp"}, +{"acp-conduit", {NULL}, 3823, "udp"}, +{"acp-policy", {NULL}, 3824, "tcp"}, +{"acp-policy", {NULL}, 3824, "udp"}, +{"ffserver", {NULL}, 3825, "tcp"}, +{"ffserver", {NULL}, 3825, "udp"}, +{"wormux", {NULL}, 3826, "tcp"}, +{"wormux", {NULL}, 3826, "udp"}, +{"netmpi", {NULL}, 3827, "tcp"}, +{"netmpi", {NULL}, 3827, "udp"}, +{"neteh", {NULL}, 3828, "tcp"}, +{"neteh", {NULL}, 3828, "udp"}, +{"neteh-ext", {NULL}, 3829, "tcp"}, +{"neteh-ext", {NULL}, 3829, "udp"}, +{"cernsysmgmtagt", {NULL}, 3830, "tcp"}, +{"cernsysmgmtagt", {NULL}, 3830, "udp"}, +{"dvapps", {NULL}, 3831, "tcp"}, +{"dvapps", {NULL}, 3831, "udp"}, +{"xxnetserver", {NULL}, 3832, "tcp"}, +{"xxnetserver", {NULL}, 3832, "udp"}, +{"aipn-auth", {NULL}, 3833, "tcp"}, +{"aipn-auth", {NULL}, 3833, "udp"}, +{"spectardata", {NULL}, 3834, "tcp"}, +{"spectardata", {NULL}, 3834, "udp"}, +{"spectardb", {NULL}, 3835, "tcp"}, +{"spectardb", {NULL}, 3835, "udp"}, +{"markem-dcp", {NULL}, 3836, "tcp"}, +{"markem-dcp", {NULL}, 3836, "udp"}, +{"mkm-discovery", {NULL}, 3837, "tcp"}, +{"mkm-discovery", {NULL}, 3837, "udp"}, +{"sos", {NULL}, 3838, "tcp"}, +{"sos", {NULL}, 3838, "udp"}, +{"amx-rms", {NULL}, 3839, "tcp"}, +{"amx-rms", {NULL}, 3839, "udp"}, +{"flirtmitmir", {NULL}, 3840, "tcp"}, +{"flirtmitmir", {NULL}, 3840, "udp"}, +{"zfirm-shiprush3", {NULL}, 3841, "tcp"}, +{"zfirm-shiprush3", {NULL}, 3841, "udp"}, +{"nhci", {NULL}, 3842, "tcp"}, +{"nhci", {NULL}, 3842, "udp"}, +{"quest-agent", {NULL}, 3843, "tcp"}, +{"quest-agent", {NULL}, 3843, "udp"}, +{"rnm", {NULL}, 3844, "tcp"}, +{"rnm", {NULL}, 3844, "udp"}, +{"v-one-spp", {NULL}, 3845, "tcp"}, +{"v-one-spp", {NULL}, 3845, "udp"}, +{"an-pcp", {NULL}, 3846, "tcp"}, +{"an-pcp", {NULL}, 3846, "udp"}, +{"msfw-control", {NULL}, 3847, "tcp"}, +{"msfw-control", {NULL}, 3847, "udp"}, +{"item", {NULL}, 3848, "tcp"}, +{"item", {NULL}, 3848, "udp"}, +{"spw-dnspreload", {NULL}, 3849, "tcp"}, +{"spw-dnspreload", {NULL}, 3849, "udp"}, +{"qtms-bootstrap", {NULL}, 3850, "tcp"}, +{"qtms-bootstrap", {NULL}, 3850, "udp"}, +{"spectraport", {NULL}, 3851, "tcp"}, +{"spectraport", {NULL}, 3851, "udp"}, +{"sse-app-config", {NULL}, 3852, "tcp"}, +{"sse-app-config", {NULL}, 3852, "udp"}, +{"sscan", {NULL}, 3853, "tcp"}, +{"sscan", {NULL}, 3853, "udp"}, +{"stryker-com", {NULL}, 3854, "tcp"}, +{"stryker-com", {NULL}, 3854, "udp"}, +{"opentrac", {NULL}, 3855, "tcp"}, +{"opentrac", {NULL}, 3855, "udp"}, +{"informer", {NULL}, 3856, "tcp"}, +{"informer", {NULL}, 3856, "udp"}, +{"trap-port", {NULL}, 3857, "tcp"}, +{"trap-port", {NULL}, 3857, "udp"}, +{"trap-port-mom", {NULL}, 3858, "tcp"}, +{"trap-port-mom", {NULL}, 3858, "udp"}, +{"nav-port", {NULL}, 3859, "tcp"}, +{"nav-port", {NULL}, 3859, "udp"}, +{"sasp", {NULL}, 3860, "tcp"}, +{"sasp", {NULL}, 3860, "udp"}, +{"winshadow-hd", {NULL}, 3861, "tcp"}, +{"winshadow-hd", {NULL}, 3861, "udp"}, +{"giga-pocket", {NULL}, 3862, "tcp"}, +{"giga-pocket", {NULL}, 3862, "udp"}, +{"asap-tcp", {NULL}, 3863, "tcp"}, +{"asap-udp", {NULL}, 3863, "udp"}, +{"asap-sctp", {NULL}, 3863, "sctp"}, +{"asap-tcp-tls", {NULL}, 3864, "tcp"}, +{"asap-sctp-tls", {NULL}, 3864, "sctp"}, +{"xpl", {NULL}, 3865, "tcp"}, +{"xpl", {NULL}, 3865, "udp"}, +{"dzdaemon", {NULL}, 3866, "tcp"}, +{"dzdaemon", {NULL}, 3866, "udp"}, +{"dzoglserver", {NULL}, 3867, "tcp"}, +{"dzoglserver", {NULL}, 3867, "udp"}, +{"diameter", {NULL}, 3868, "tcp"}, +{"diameter", {NULL}, 3868, "sctp"}, +{"ovsam-mgmt", {NULL}, 3869, "tcp"}, +{"ovsam-mgmt", {NULL}, 3869, "udp"}, +{"ovsam-d-agent", {NULL}, 3870, "tcp"}, +{"ovsam-d-agent", {NULL}, 3870, "udp"}, +{"avocent-adsap", {NULL}, 3871, "tcp"}, +{"avocent-adsap", {NULL}, 3871, "udp"}, +{"oem-agent", {NULL}, 3872, "tcp"}, +{"oem-agent", {NULL}, 3872, "udp"}, +{"fagordnc", {NULL}, 3873, "tcp"}, +{"fagordnc", {NULL}, 3873, "udp"}, +{"sixxsconfig", {NULL}, 3874, "tcp"}, +{"sixxsconfig", {NULL}, 3874, "udp"}, +{"pnbscada", {NULL}, 3875, "tcp"}, +{"pnbscada", {NULL}, 3875, "udp"}, +{"dl_agent", {NULL}, 3876, "tcp"}, +{"dl_agent", {NULL}, 3876, "udp"}, +{"xmpcr-interface", {NULL}, 3877, "tcp"}, +{"xmpcr-interface", {NULL}, 3877, "udp"}, +{"fotogcad", {NULL}, 3878, "tcp"}, +{"fotogcad", {NULL}, 3878, "udp"}, +{"appss-lm", {NULL}, 3879, "tcp"}, +{"appss-lm", {NULL}, 3879, "udp"}, +{"igrs", {NULL}, 3880, "tcp"}, +{"igrs", {NULL}, 3880, "udp"}, +{"idac", {NULL}, 3881, "tcp"}, +{"idac", {NULL}, 3881, "udp"}, +{"msdts1", {NULL}, 3882, "tcp"}, +{"msdts1", {NULL}, 3882, "udp"}, +{"vrpn", {NULL}, 3883, "tcp"}, +{"vrpn", {NULL}, 3883, "udp"}, +{"softrack-meter", {NULL}, 3884, "tcp"}, +{"softrack-meter", {NULL}, 3884, "udp"}, +{"topflow-ssl", {NULL}, 3885, "tcp"}, +{"topflow-ssl", {NULL}, 3885, "udp"}, +{"nei-management", {NULL}, 3886, "tcp"}, +{"nei-management", {NULL}, 3886, "udp"}, +{"ciphire-data", {NULL}, 3887, "tcp"}, +{"ciphire-data", {NULL}, 3887, "udp"}, +{"ciphire-serv", {NULL}, 3888, "tcp"}, +{"ciphire-serv", {NULL}, 3888, "udp"}, +{"dandv-tester", {NULL}, 3889, "tcp"}, +{"dandv-tester", {NULL}, 3889, "udp"}, +{"ndsconnect", {NULL}, 3890, "tcp"}, +{"ndsconnect", {NULL}, 3890, "udp"}, +{"rtc-pm-port", {NULL}, 3891, "tcp"}, +{"rtc-pm-port", {NULL}, 3891, "udp"}, +{"pcc-image-port", {NULL}, 3892, "tcp"}, +{"pcc-image-port", {NULL}, 3892, "udp"}, +{"cgi-starapi", {NULL}, 3893, "tcp"}, +{"cgi-starapi", {NULL}, 3893, "udp"}, +{"syam-agent", {NULL}, 3894, "tcp"}, +{"syam-agent", {NULL}, 3894, "udp"}, +{"syam-smc", {NULL}, 3895, "tcp"}, +{"syam-smc", {NULL}, 3895, "udp"}, +{"sdo-tls", {NULL}, 3896, "tcp"}, +{"sdo-tls", {NULL}, 3896, "udp"}, +{"sdo-ssh", {NULL}, 3897, "tcp"}, +{"sdo-ssh", {NULL}, 3897, "udp"}, +{"senip", {NULL}, 3898, "tcp"}, +{"senip", {NULL}, 3898, "udp"}, +{"itv-control", {NULL}, 3899, "tcp"}, +{"itv-control", {NULL}, 3899, "udp"}, +{"udt_os", {NULL}, 3900, "tcp"}, +{"udt_os", {NULL}, 3900, "udp"}, +{"nimsh", {NULL}, 3901, "tcp"}, +{"nimsh", {NULL}, 3901, "udp"}, +{"nimaux", {NULL}, 3902, "tcp"}, +{"nimaux", {NULL}, 3902, "udp"}, +{"charsetmgr", {NULL}, 3903, "tcp"}, +{"charsetmgr", {NULL}, 3903, "udp"}, +{"omnilink-port", {NULL}, 3904, "tcp"}, +{"omnilink-port", {NULL}, 3904, "udp"}, +{"mupdate", {NULL}, 3905, "tcp"}, +{"mupdate", {NULL}, 3905, "udp"}, +{"topovista-data", {NULL}, 3906, "tcp"}, +{"topovista-data", {NULL}, 3906, "udp"}, +{"imoguia-port", {NULL}, 3907, "tcp"}, +{"imoguia-port", {NULL}, 3907, "udp"}, +{"hppronetman", {NULL}, 3908, "tcp"}, +{"hppronetman", {NULL}, 3908, "udp"}, +{"surfcontrolcpa", {NULL}, 3909, "tcp"}, +{"surfcontrolcpa", {NULL}, 3909, "udp"}, +{"prnrequest", {NULL}, 3910, "tcp"}, +{"prnrequest", {NULL}, 3910, "udp"}, +{"prnstatus", {NULL}, 3911, "tcp"}, +{"prnstatus", {NULL}, 3911, "udp"}, +{"gbmt-stars", {NULL}, 3912, "tcp"}, +{"gbmt-stars", {NULL}, 3912, "udp"}, +{"listcrt-port", {NULL}, 3913, "tcp"}, +{"listcrt-port", {NULL}, 3913, "udp"}, +{"listcrt-port-2", {NULL}, 3914, "tcp"}, +{"listcrt-port-2", {NULL}, 3914, "udp"}, +{"agcat", {NULL}, 3915, "tcp"}, +{"agcat", {NULL}, 3915, "udp"}, +{"wysdmc", {NULL}, 3916, "tcp"}, +{"wysdmc", {NULL}, 3916, "udp"}, +{"aftmux", {NULL}, 3917, "tcp"}, +{"aftmux", {NULL}, 3917, "udp"}, +{"pktcablemmcops", {NULL}, 3918, "tcp"}, +{"pktcablemmcops", {NULL}, 3918, "udp"}, +{"hyperip", {NULL}, 3919, "tcp"}, +{"hyperip", {NULL}, 3919, "udp"}, +{"exasoftport1", {NULL}, 3920, "tcp"}, +{"exasoftport1", {NULL}, 3920, "udp"}, +{"herodotus-net", {NULL}, 3921, "tcp"}, +{"herodotus-net", {NULL}, 3921, "udp"}, +{"sor-update", {NULL}, 3922, "tcp"}, +{"sor-update", {NULL}, 3922, "udp"}, +{"symb-sb-port", {NULL}, 3923, "tcp"}, +{"symb-sb-port", {NULL}, 3923, "udp"}, +{"mpl-gprs-port", {NULL}, 3924, "tcp"}, +{"mpl-gprs-port", {NULL}, 3924, "udp"}, +{"zmp", {NULL}, 3925, "tcp"}, +{"zmp", {NULL}, 3925, "udp"}, +{"winport", {NULL}, 3926, "tcp"}, +{"winport", {NULL}, 3926, "udp"}, +{"natdataservice", {NULL}, 3927, "tcp"}, +{"natdataservice", {NULL}, 3927, "udp"}, +{"netboot-pxe", {NULL}, 3928, "tcp"}, +{"netboot-pxe", {NULL}, 3928, "udp"}, +{"smauth-port", {NULL}, 3929, "tcp"}, +{"smauth-port", {NULL}, 3929, "udp"}, +{"syam-webserver", {NULL}, 3930, "tcp"}, +{"syam-webserver", {NULL}, 3930, "udp"}, +{"msr-plugin-port", {NULL}, 3931, "tcp"}, +{"msr-plugin-port", {NULL}, 3931, "udp"}, +{"dyn-site", {NULL}, 3932, "tcp"}, +{"dyn-site", {NULL}, 3932, "udp"}, +{"plbserve-port", {NULL}, 3933, "tcp"}, +{"plbserve-port", {NULL}, 3933, "udp"}, +{"sunfm-port", {NULL}, 3934, "tcp"}, +{"sunfm-port", {NULL}, 3934, "udp"}, +{"sdp-portmapper", {NULL}, 3935, "tcp"}, +{"sdp-portmapper", {NULL}, 3935, "udp"}, +{"mailprox", {NULL}, 3936, "tcp"}, +{"mailprox", {NULL}, 3936, "udp"}, +{"dvbservdsc", {NULL}, 3937, "tcp"}, +{"dvbservdsc", {NULL}, 3937, "udp"}, +{"dbcontrol_agent", {NULL}, 3938, "tcp"}, +{"dbcontrol_agent", {NULL}, 3938, "udp"}, +{"aamp", {NULL}, 3939, "tcp"}, +{"aamp", {NULL}, 3939, "udp"}, +{"xecp-node", {NULL}, 3940, "tcp"}, +{"xecp-node", {NULL}, 3940, "udp"}, +{"homeportal-web", {NULL}, 3941, "tcp"}, +{"homeportal-web", {NULL}, 3941, "udp"}, +{"srdp", {NULL}, 3942, "tcp"}, +{"srdp", {NULL}, 3942, "udp"}, +{"tig", {NULL}, 3943, "tcp"}, +{"tig", {NULL}, 3943, "udp"}, +{"sops", {NULL}, 3944, "tcp"}, +{"sops", {NULL}, 3944, "udp"}, +{"emcads", {NULL}, 3945, "tcp"}, +{"emcads", {NULL}, 3945, "udp"}, +{"backupedge", {NULL}, 3946, "tcp"}, +{"backupedge", {NULL}, 3946, "udp"}, +{"ccp", {NULL}, 3947, "tcp"}, +{"ccp", {NULL}, 3947, "udp"}, +{"apdap", {NULL}, 3948, "tcp"}, +{"apdap", {NULL}, 3948, "udp"}, +{"drip", {NULL}, 3949, "tcp"}, +{"drip", {NULL}, 3949, "udp"}, +{"namemunge", {NULL}, 3950, "tcp"}, +{"namemunge", {NULL}, 3950, "udp"}, +{"pwgippfax", {NULL}, 3951, "tcp"}, +{"pwgippfax", {NULL}, 3951, "udp"}, +{"i3-sessionmgr", {NULL}, 3952, "tcp"}, +{"i3-sessionmgr", {NULL}, 3952, "udp"}, +{"xmlink-connect", {NULL}, 3953, "tcp"}, +{"xmlink-connect", {NULL}, 3953, "udp"}, +{"adrep", {NULL}, 3954, "tcp"}, +{"adrep", {NULL}, 3954, "udp"}, +{"p2pcommunity", {NULL}, 3955, "tcp"}, +{"p2pcommunity", {NULL}, 3955, "udp"}, +{"gvcp", {NULL}, 3956, "tcp"}, +{"gvcp", {NULL}, 3956, "udp"}, +{"mqe-broker", {NULL}, 3957, "tcp"}, +{"mqe-broker", {NULL}, 3957, "udp"}, +{"mqe-agent", {NULL}, 3958, "tcp"}, +{"mqe-agent", {NULL}, 3958, "udp"}, +{"treehopper", {NULL}, 3959, "tcp"}, +{"treehopper", {NULL}, 3959, "udp"}, +{"bess", {NULL}, 3960, "tcp"}, +{"bess", {NULL}, 3960, "udp"}, +{"proaxess", {NULL}, 3961, "tcp"}, +{"proaxess", {NULL}, 3961, "udp"}, +{"sbi-agent", {NULL}, 3962, "tcp"}, +{"sbi-agent", {NULL}, 3962, "udp"}, +{"thrp", {NULL}, 3963, "tcp"}, +{"thrp", {NULL}, 3963, "udp"}, +{"sasggprs", {NULL}, 3964, "tcp"}, +{"sasggprs", {NULL}, 3964, "udp"}, +{"ati-ip-to-ncpe", {NULL}, 3965, "tcp"}, +{"ati-ip-to-ncpe", {NULL}, 3965, "udp"}, +{"bflckmgr", {NULL}, 3966, "tcp"}, +{"bflckmgr", {NULL}, 3966, "udp"}, +{"ppsms", {NULL}, 3967, "tcp"}, +{"ppsms", {NULL}, 3967, "udp"}, +{"ianywhere-dbns", {NULL}, 3968, "tcp"}, +{"ianywhere-dbns", {NULL}, 3968, "udp"}, +{"landmarks", {NULL}, 3969, "tcp"}, +{"landmarks", {NULL}, 3969, "udp"}, +{"lanrevagent", {NULL}, 3970, "tcp"}, +{"lanrevagent", {NULL}, 3970, "udp"}, +{"lanrevserver", {NULL}, 3971, "tcp"}, +{"lanrevserver", {NULL}, 3971, "udp"}, +{"iconp", {NULL}, 3972, "tcp"}, +{"iconp", {NULL}, 3972, "udp"}, +{"progistics", {NULL}, 3973, "tcp"}, +{"progistics", {NULL}, 3973, "udp"}, +{"citysearch", {NULL}, 3974, "tcp"}, +{"citysearch", {NULL}, 3974, "udp"}, +{"airshot", {NULL}, 3975, "tcp"}, +{"airshot", {NULL}, 3975, "udp"}, +{"opswagent", {NULL}, 3976, "tcp"}, +{"opswagent", {NULL}, 3976, "udp"}, +{"opswmanager", {NULL}, 3977, "tcp"}, +{"opswmanager", {NULL}, 3977, "udp"}, +{"secure-cfg-svr", {NULL}, 3978, "tcp"}, +{"secure-cfg-svr", {NULL}, 3978, "udp"}, +{"smwan", {NULL}, 3979, "tcp"}, +{"smwan", {NULL}, 3979, "udp"}, +{"acms", {NULL}, 3980, "tcp"}, +{"acms", {NULL}, 3980, "udp"}, +{"starfish", {NULL}, 3981, "tcp"}, +{"starfish", {NULL}, 3981, "udp"}, +{"eis", {NULL}, 3982, "tcp"}, +{"eis", {NULL}, 3982, "udp"}, +{"eisp", {NULL}, 3983, "tcp"}, +{"eisp", {NULL}, 3983, "udp"}, +{"mapper-nodemgr", {NULL}, 3984, "tcp"}, +{"mapper-nodemgr", {NULL}, 3984, "udp"}, +{"mapper-mapethd", {NULL}, 3985, "tcp"}, +{"mapper-mapethd", {NULL}, 3985, "udp"}, +{"mapper-ws_ethd", {NULL}, 3986, "tcp"}, +{"mapper-ws_ethd", {NULL}, 3986, "udp"}, +{"centerline", {NULL}, 3987, "tcp"}, +{"centerline", {NULL}, 3987, "udp"}, +{"dcs-config", {NULL}, 3988, "tcp"}, +{"dcs-config", {NULL}, 3988, "udp"}, +{"bv-queryengine", {NULL}, 3989, "tcp"}, +{"bv-queryengine", {NULL}, 3989, "udp"}, +{"bv-is", {NULL}, 3990, "tcp"}, +{"bv-is", {NULL}, 3990, "udp"}, +{"bv-smcsrv", {NULL}, 3991, "tcp"}, +{"bv-smcsrv", {NULL}, 3991, "udp"}, +{"bv-ds", {NULL}, 3992, "tcp"}, +{"bv-ds", {NULL}, 3992, "udp"}, +{"bv-agent", {NULL}, 3993, "tcp"}, +{"bv-agent", {NULL}, 3993, "udp"}, +{"iss-mgmt-ssl", {NULL}, 3995, "tcp"}, +{"iss-mgmt-ssl", {NULL}, 3995, "udp"}, +{"abcsoftware", {NULL}, 3996, "tcp"}, +{"abcsoftware", {NULL}, 3996, "udp"}, +{"agentsease-db", {NULL}, 3997, "tcp"}, +{"agentsease-db", {NULL}, 3997, "udp"}, +{"dnx", {NULL}, 3998, "tcp"}, +{"dnx", {NULL}, 3998, "udp"}, +{"nvcnet", {NULL}, 3999, "tcp"}, +{"nvcnet", {NULL}, 3999, "udp"}, +{"terabase", {NULL}, 4000, "tcp"}, +{"terabase", {NULL}, 4000, "udp"}, +{"newoak", {NULL}, 4001, "tcp"}, +{"newoak", {NULL}, 4001, "udp"}, +{"pxc-spvr-ft", {NULL}, 4002, "tcp"}, +{"pxc-spvr-ft", {NULL}, 4002, "udp"}, +{"pxc-splr-ft", {NULL}, 4003, "tcp"}, +{"pxc-splr-ft", {NULL}, 4003, "udp"}, +{"pxc-roid", {NULL}, 4004, "tcp"}, +{"pxc-roid", {NULL}, 4004, "udp"}, +{"pxc-pin", {NULL}, 4005, "tcp"}, +{"pxc-pin", {NULL}, 4005, "udp"}, +{"pxc-spvr", {NULL}, 4006, "tcp"}, +{"pxc-spvr", {NULL}, 4006, "udp"}, +{"pxc-splr", {NULL}, 4007, "tcp"}, +{"pxc-splr", {NULL}, 4007, "udp"}, +{"netcheque", {NULL}, 4008, "tcp"}, +{"netcheque", {NULL}, 4008, "udp"}, +{"chimera-hwm", {NULL}, 4009, "tcp"}, +{"chimera-hwm", {NULL}, 4009, "udp"}, +{"samsung-unidex", {NULL}, 4010, "tcp"}, +{"samsung-unidex", {NULL}, 4010, "udp"}, +{"altserviceboot", {NULL}, 4011, "tcp"}, +{"altserviceboot", {NULL}, 4011, "udp"}, +{"pda-gate", {NULL}, 4012, "tcp"}, +{"pda-gate", {NULL}, 4012, "udp"}, +{"acl-manager", {NULL}, 4013, "tcp"}, +{"acl-manager", {NULL}, 4013, "udp"}, +{"taiclock", {NULL}, 4014, "tcp"}, +{"taiclock", {NULL}, 4014, "udp"}, +{"talarian-mcast1", {NULL}, 4015, "tcp"}, +{"talarian-mcast1", {NULL}, 4015, "udp"}, +{"talarian-mcast2", {NULL}, 4016, "tcp"}, +{"talarian-mcast2", {NULL}, 4016, "udp"}, +{"talarian-mcast3", {NULL}, 4017, "tcp"}, +{"talarian-mcast3", {NULL}, 4017, "udp"}, +{"talarian-mcast4", {NULL}, 4018, "tcp"}, +{"talarian-mcast4", {NULL}, 4018, "udp"}, +{"talarian-mcast5", {NULL}, 4019, "tcp"}, +{"talarian-mcast5", {NULL}, 4019, "udp"}, +{"trap", {NULL}, 4020, "tcp"}, +{"trap", {NULL}, 4020, "udp"}, +{"nexus-portal", {NULL}, 4021, "tcp"}, +{"nexus-portal", {NULL}, 4021, "udp"}, +{"dnox", {NULL}, 4022, "tcp"}, +{"dnox", {NULL}, 4022, "udp"}, +{"esnm-zoning", {NULL}, 4023, "tcp"}, +{"esnm-zoning", {NULL}, 4023, "udp"}, +{"tnp1-port", {NULL}, 4024, "tcp"}, +{"tnp1-port", {NULL}, 4024, "udp"}, +{"partimage", {NULL}, 4025, "tcp"}, +{"partimage", {NULL}, 4025, "udp"}, +{"as-debug", {NULL}, 4026, "tcp"}, +{"as-debug", {NULL}, 4026, "udp"}, +{"bxp", {NULL}, 4027, "tcp"}, +{"bxp", {NULL}, 4027, "udp"}, +{"dtserver-port", {NULL}, 4028, "tcp"}, +{"dtserver-port", {NULL}, 4028, "udp"}, +{"ip-qsig", {NULL}, 4029, "tcp"}, +{"ip-qsig", {NULL}, 4029, "udp"}, +{"jdmn-port", {NULL}, 4030, "tcp"}, +{"jdmn-port", {NULL}, 4030, "udp"}, +{"suucp", {NULL}, 4031, "tcp"}, +{"suucp", {NULL}, 4031, "udp"}, +{"vrts-auth-port", {NULL}, 4032, "tcp"}, +{"vrts-auth-port", {NULL}, 4032, "udp"}, +{"sanavigator", {NULL}, 4033, "tcp"}, +{"sanavigator", {NULL}, 4033, "udp"}, +{"ubxd", {NULL}, 4034, "tcp"}, +{"ubxd", {NULL}, 4034, "udp"}, +{"wap-push-http", {NULL}, 4035, "tcp"}, +{"wap-push-http", {NULL}, 4035, "udp"}, +{"wap-push-https", {NULL}, 4036, "tcp"}, +{"wap-push-https", {NULL}, 4036, "udp"}, +{"ravehd", {NULL}, 4037, "tcp"}, +{"ravehd", {NULL}, 4037, "udp"}, +{"fazzt-ptp", {NULL}, 4038, "tcp"}, +{"fazzt-ptp", {NULL}, 4038, "udp"}, +{"fazzt-admin", {NULL}, 4039, "tcp"}, +{"fazzt-admin", {NULL}, 4039, "udp"}, +{"yo-main", {NULL}, 4040, "tcp"}, +{"yo-main", {NULL}, 4040, "udp"}, +{"houston", {NULL}, 4041, "tcp"}, +{"houston", {NULL}, 4041, "udp"}, +{"ldxp", {NULL}, 4042, "tcp"}, +{"ldxp", {NULL}, 4042, "udp"}, +{"nirp", {NULL}, 4043, "tcp"}, +{"nirp", {NULL}, 4043, "udp"}, +{"ltp", {NULL}, 4044, "tcp"}, +{"ltp", {NULL}, 4044, "udp"}, +{"npp", {NULL}, 4045, "tcp"}, +{"npp", {NULL}, 4045, "udp"}, +{"acp-proto", {NULL}, 4046, "tcp"}, +{"acp-proto", {NULL}, 4046, "udp"}, +{"ctp-state", {NULL}, 4047, "tcp"}, +{"ctp-state", {NULL}, 4047, "udp"}, +{"wafs", {NULL}, 4049, "tcp"}, +{"wafs", {NULL}, 4049, "udp"}, +{"cisco-wafs", {NULL}, 4050, "tcp"}, +{"cisco-wafs", {NULL}, 4050, "udp"}, +{"cppdp", {NULL}, 4051, "tcp"}, +{"cppdp", {NULL}, 4051, "udp"}, +{"interact", {NULL}, 4052, "tcp"}, +{"interact", {NULL}, 4052, "udp"}, +{"ccu-comm-1", {NULL}, 4053, "tcp"}, +{"ccu-comm-1", {NULL}, 4053, "udp"}, +{"ccu-comm-2", {NULL}, 4054, "tcp"}, +{"ccu-comm-2", {NULL}, 4054, "udp"}, +{"ccu-comm-3", {NULL}, 4055, "tcp"}, +{"ccu-comm-3", {NULL}, 4055, "udp"}, +{"lms", {NULL}, 4056, "tcp"}, +{"lms", {NULL}, 4056, "udp"}, +{"wfm", {NULL}, 4057, "tcp"}, +{"wfm", {NULL}, 4057, "udp"}, +{"kingfisher", {NULL}, 4058, "tcp"}, +{"kingfisher", {NULL}, 4058, "udp"}, +{"dlms-cosem", {NULL}, 4059, "tcp"}, +{"dlms-cosem", {NULL}, 4059, "udp"}, +{"dsmeter_iatc", {NULL}, 4060, "tcp"}, +{"dsmeter_iatc", {NULL}, 4060, "udp"}, +{"ice-location", {NULL}, 4061, "tcp"}, +{"ice-location", {NULL}, 4061, "udp"}, +{"ice-slocation", {NULL}, 4062, "tcp"}, +{"ice-slocation", {NULL}, 4062, "udp"}, +{"ice-router", {NULL}, 4063, "tcp"}, +{"ice-router", {NULL}, 4063, "udp"}, +{"ice-srouter", {NULL}, 4064, "tcp"}, +{"ice-srouter", {NULL}, 4064, "udp"}, +{"avanti_cdp", {NULL}, 4065, "tcp"}, +{"avanti_cdp", {NULL}, 4065, "udp"}, +{"pmas", {NULL}, 4066, "tcp"}, +{"pmas", {NULL}, 4066, "udp"}, +{"idp", {NULL}, 4067, "tcp"}, +{"idp", {NULL}, 4067, "udp"}, +{"ipfltbcst", {NULL}, 4068, "tcp"}, +{"ipfltbcst", {NULL}, 4068, "udp"}, +{"minger", {NULL}, 4069, "tcp"}, +{"minger", {NULL}, 4069, "udp"}, +{"tripe", {NULL}, 4070, "tcp"}, +{"tripe", {NULL}, 4070, "udp"}, +{"aibkup", {NULL}, 4071, "tcp"}, +{"aibkup", {NULL}, 4071, "udp"}, +{"zieto-sock", {NULL}, 4072, "tcp"}, +{"zieto-sock", {NULL}, 4072, "udp"}, +{"iRAPP", {NULL}, 4073, "tcp"}, +{"iRAPP", {NULL}, 4073, "udp"}, +{"cequint-cityid", {NULL}, 4074, "tcp"}, +{"cequint-cityid", {NULL}, 4074, "udp"}, +{"perimlan", {NULL}, 4075, "tcp"}, +{"perimlan", {NULL}, 4075, "udp"}, +{"seraph", {NULL}, 4076, "tcp"}, +{"seraph", {NULL}, 4076, "udp"}, +{"ascomalarm", {NULL}, 4077, "udp"}, +{"cssp", {NULL}, 4078, "tcp"}, +{"santools", {NULL}, 4079, "tcp"}, +{"santools", {NULL}, 4079, "udp"}, +{"lorica-in", {NULL}, 4080, "tcp"}, +{"lorica-in", {NULL}, 4080, "udp"}, +{"lorica-in-sec", {NULL}, 4081, "tcp"}, +{"lorica-in-sec", {NULL}, 4081, "udp"}, +{"lorica-out", {NULL}, 4082, "tcp"}, +{"lorica-out", {NULL}, 4082, "udp"}, +{"lorica-out-sec", {NULL}, 4083, "tcp"}, +{"lorica-out-sec", {NULL}, 4083, "udp"}, +{"fortisphere-vm", {NULL}, 4084, "udp"}, +{"ezmessagesrv", {NULL}, 4085, "tcp"}, +{"ftsync", {NULL}, 4086, "udp"}, +{"applusservice", {NULL}, 4087, "tcp"}, +{"npsp", {NULL}, 4088, "tcp"}, +{"opencore", {NULL}, 4089, "tcp"}, +{"opencore", {NULL}, 4089, "udp"}, +{"omasgport", {NULL}, 4090, "tcp"}, +{"omasgport", {NULL}, 4090, "udp"}, +{"ewinstaller", {NULL}, 4091, "tcp"}, +{"ewinstaller", {NULL}, 4091, "udp"}, +{"ewdgs", {NULL}, 4092, "tcp"}, +{"ewdgs", {NULL}, 4092, "udp"}, +{"pvxpluscs", {NULL}, 4093, "tcp"}, +{"pvxpluscs", {NULL}, 4093, "udp"}, +{"sysrqd", {NULL}, 4094, "tcp"}, +{"sysrqd", {NULL}, 4094, "udp"}, +{"xtgui", {NULL}, 4095, "tcp"}, +{"xtgui", {NULL}, 4095, "udp"}, +{"bre", {NULL}, 4096, "tcp"}, +{"bre", {NULL}, 4096, "udp"}, +{"patrolview", {NULL}, 4097, "tcp"}, +{"patrolview", {NULL}, 4097, "udp"}, +{"drmsfsd", {NULL}, 4098, "tcp"}, +{"drmsfsd", {NULL}, 4098, "udp"}, +{"dpcp", {NULL}, 4099, "tcp"}, +{"dpcp", {NULL}, 4099, "udp"}, +{"igo-incognito", {NULL}, 4100, "tcp"}, +{"igo-incognito", {NULL}, 4100, "udp"}, +{"brlp-0", {NULL}, 4101, "tcp"}, +{"brlp-0", {NULL}, 4101, "udp"}, +{"brlp-1", {NULL}, 4102, "tcp"}, +{"brlp-1", {NULL}, 4102, "udp"}, +{"brlp-2", {NULL}, 4103, "tcp"}, +{"brlp-2", {NULL}, 4103, "udp"}, +{"brlp-3", {NULL}, 4104, "tcp"}, +{"brlp-3", {NULL}, 4104, "udp"}, +{"shofarplayer", {NULL}, 4105, "tcp"}, +{"shofarplayer", {NULL}, 4105, "udp"}, +{"synchronite", {NULL}, 4106, "tcp"}, +{"synchronite", {NULL}, 4106, "udp"}, +{"j-ac", {NULL}, 4107, "tcp"}, +{"j-ac", {NULL}, 4107, "udp"}, +{"accel", {NULL}, 4108, "tcp"}, +{"accel", {NULL}, 4108, "udp"}, +{"izm", {NULL}, 4109, "tcp"}, +{"izm", {NULL}, 4109, "udp"}, +{"g2tag", {NULL}, 4110, "tcp"}, +{"g2tag", {NULL}, 4110, "udp"}, +{"xgrid", {NULL}, 4111, "tcp"}, +{"xgrid", {NULL}, 4111, "udp"}, +{"apple-vpns-rp", {NULL}, 4112, "tcp"}, +{"apple-vpns-rp", {NULL}, 4112, "udp"}, +{"aipn-reg", {NULL}, 4113, "tcp"}, +{"aipn-reg", {NULL}, 4113, "udp"}, +{"jomamqmonitor", {NULL}, 4114, "tcp"}, +{"jomamqmonitor", {NULL}, 4114, "udp"}, +{"cds", {NULL}, 4115, "tcp"}, +{"cds", {NULL}, 4115, "udp"}, +{"smartcard-tls", {NULL}, 4116, "tcp"}, +{"smartcard-tls", {NULL}, 4116, "udp"}, +{"hillrserv", {NULL}, 4117, "tcp"}, +{"hillrserv", {NULL}, 4117, "udp"}, +{"netscript", {NULL}, 4118, "tcp"}, +{"netscript", {NULL}, 4118, "udp"}, +{"assuria-slm", {NULL}, 4119, "tcp"}, +{"assuria-slm", {NULL}, 4119, "udp"}, +{"e-builder", {NULL}, 4121, "tcp"}, +{"e-builder", {NULL}, 4121, "udp"}, +{"fprams", {NULL}, 4122, "tcp"}, +{"fprams", {NULL}, 4122, "udp"}, +{"z-wave", {NULL}, 4123, "tcp"}, +{"z-wave", {NULL}, 4123, "udp"}, +{"tigv2", {NULL}, 4124, "tcp"}, +{"tigv2", {NULL}, 4124, "udp"}, +{"opsview-envoy", {NULL}, 4125, "tcp"}, +{"opsview-envoy", {NULL}, 4125, "udp"}, +{"ddrepl", {NULL}, 4126, "tcp"}, +{"ddrepl", {NULL}, 4126, "udp"}, +{"unikeypro", {NULL}, 4127, "tcp"}, +{"unikeypro", {NULL}, 4127, "udp"}, +{"nufw", {NULL}, 4128, "tcp"}, +{"nufw", {NULL}, 4128, "udp"}, +{"nuauth", {NULL}, 4129, "tcp"}, +{"nuauth", {NULL}, 4129, "udp"}, +{"fronet", {NULL}, 4130, "tcp"}, +{"fronet", {NULL}, 4130, "udp"}, +{"stars", {NULL}, 4131, "tcp"}, +{"stars", {NULL}, 4131, "udp"}, +{"nuts_dem", {NULL}, 4132, "tcp"}, +{"nuts_dem", {NULL}, 4132, "udp"}, +{"nuts_bootp", {NULL}, 4133, "tcp"}, +{"nuts_bootp", {NULL}, 4133, "udp"}, +{"nifty-hmi", {NULL}, 4134, "tcp"}, +{"nifty-hmi", {NULL}, 4134, "udp"}, +{"cl-db-attach", {NULL}, 4135, "tcp"}, +{"cl-db-attach", {NULL}, 4135, "udp"}, +{"cl-db-request", {NULL}, 4136, "tcp"}, +{"cl-db-request", {NULL}, 4136, "udp"}, +{"cl-db-remote", {NULL}, 4137, "tcp"}, +{"cl-db-remote", {NULL}, 4137, "udp"}, +{"nettest", {NULL}, 4138, "tcp"}, +{"nettest", {NULL}, 4138, "udp"}, +{"thrtx", {NULL}, 4139, "tcp"}, +{"thrtx", {NULL}, 4139, "udp"}, +{"cedros_fds", {NULL}, 4140, "tcp"}, +{"cedros_fds", {NULL}, 4140, "udp"}, +{"oirtgsvc", {NULL}, 4141, "tcp"}, +{"oirtgsvc", {NULL}, 4141, "udp"}, +{"oidocsvc", {NULL}, 4142, "tcp"}, +{"oidocsvc", {NULL}, 4142, "udp"}, +{"oidsr", {NULL}, 4143, "tcp"}, +{"oidsr", {NULL}, 4143, "udp"}, +{"vvr-control", {NULL}, 4145, "tcp"}, +{"vvr-control", {NULL}, 4145, "udp"}, +{"tgcconnect", {NULL}, 4146, "tcp"}, +{"tgcconnect", {NULL}, 4146, "udp"}, +{"vrxpservman", {NULL}, 4147, "tcp"}, +{"vrxpservman", {NULL}, 4147, "udp"}, +{"hhb-handheld", {NULL}, 4148, "tcp"}, +{"hhb-handheld", {NULL}, 4148, "udp"}, +{"agslb", {NULL}, 4149, "tcp"}, +{"agslb", {NULL}, 4149, "udp"}, +{"PowerAlert-nsa", {NULL}, 4150, "tcp"}, +{"PowerAlert-nsa", {NULL}, 4150, "udp"}, +{"menandmice_noh", {NULL}, 4151, "tcp"}, +{"menandmice_noh", {NULL}, 4151, "udp"}, +{"idig_mux", {NULL}, 4152, "tcp"}, +{"idig_mux", {NULL}, 4152, "udp"}, +{"mbl-battd", {NULL}, 4153, "tcp"}, +{"mbl-battd", {NULL}, 4153, "udp"}, +{"atlinks", {NULL}, 4154, "tcp"}, +{"atlinks", {NULL}, 4154, "udp"}, +{"bzr", {NULL}, 4155, "tcp"}, +{"bzr", {NULL}, 4155, "udp"}, +{"stat-results", {NULL}, 4156, "tcp"}, +{"stat-results", {NULL}, 4156, "udp"}, +{"stat-scanner", {NULL}, 4157, "tcp"}, +{"stat-scanner", {NULL}, 4157, "udp"}, +{"stat-cc", {NULL}, 4158, "tcp"}, +{"stat-cc", {NULL}, 4158, "udp"}, +{"nss", {NULL}, 4159, "tcp"}, +{"nss", {NULL}, 4159, "udp"}, +{"jini-discovery", {NULL}, 4160, "tcp"}, +{"jini-discovery", {NULL}, 4160, "udp"}, +{"omscontact", {NULL}, 4161, "tcp"}, +{"omscontact", {NULL}, 4161, "udp"}, +{"omstopology", {NULL}, 4162, "tcp"}, +{"omstopology", {NULL}, 4162, "udp"}, +{"silverpeakpeer", {NULL}, 4163, "tcp"}, +{"silverpeakpeer", {NULL}, 4163, "udp"}, +{"silverpeakcomm", {NULL}, 4164, "tcp"}, +{"silverpeakcomm", {NULL}, 4164, "udp"}, +{"altcp", {NULL}, 4165, "tcp"}, +{"altcp", {NULL}, 4165, "udp"}, +{"joost", {NULL}, 4166, "tcp"}, +{"joost", {NULL}, 4166, "udp"}, +{"ddgn", {NULL}, 4167, "tcp"}, +{"ddgn", {NULL}, 4167, "udp"}, +{"pslicser", {NULL}, 4168, "tcp"}, +{"pslicser", {NULL}, 4168, "udp"}, +{"iadt", {NULL}, 4169, "tcp"}, +{"iadt-disc", {NULL}, 4169, "udp"}, +{"d-cinema-csp", {NULL}, 4170, "tcp"}, +{"ml-svnet", {NULL}, 4171, "tcp"}, +{"pcoip", {NULL}, 4172, "tcp"}, +{"pcoip", {NULL}, 4172, "udp"}, +{"smcluster", {NULL}, 4174, "tcp"}, +{"bccp", {NULL}, 4175, "tcp"}, +{"tl-ipcproxy", {NULL}, 4176, "tcp"}, +{"wello", {NULL}, 4177, "tcp"}, +{"wello", {NULL}, 4177, "udp"}, +{"storman", {NULL}, 4178, "tcp"}, +{"storman", {NULL}, 4178, "udp"}, +{"MaxumSP", {NULL}, 4179, "tcp"}, +{"MaxumSP", {NULL}, 4179, "udp"}, +{"httpx", {NULL}, 4180, "tcp"}, +{"httpx", {NULL}, 4180, "udp"}, +{"macbak", {NULL}, 4181, "tcp"}, +{"macbak", {NULL}, 4181, "udp"}, +{"pcptcpservice", {NULL}, 4182, "tcp"}, +{"pcptcpservice", {NULL}, 4182, "udp"}, +{"gmmp", {NULL}, 4183, "tcp"}, +{"gmmp", {NULL}, 4183, "udp"}, +{"universe_suite", {NULL}, 4184, "tcp"}, +{"universe_suite", {NULL}, 4184, "udp"}, +{"wcpp", {NULL}, 4185, "tcp"}, +{"wcpp", {NULL}, 4185, "udp"}, +{"boxbackupstore", {NULL}, 4186, "tcp"}, +{"csc_proxy", {NULL}, 4187, "tcp"}, +{"vatata", {NULL}, 4188, "tcp"}, +{"vatata", {NULL}, 4188, "udp"}, +{"pcep", {NULL}, 4189, "tcp"}, +{"sieve", {NULL}, 4190, "tcp"}, +{"dsmipv6", {NULL}, 4191, "udp"}, +{"azeti", {NULL}, 4192, "tcp"}, +{"azeti-bd", {NULL}, 4192, "udp"}, +{"pvxplusio", {NULL}, 4193, "tcp"}, +{"eims-admin", {NULL}, 4199, "tcp"}, +{"eims-admin", {NULL}, 4199, "udp"}, +{"corelccam", {NULL}, 4300, "tcp"}, +{"corelccam", {NULL}, 4300, "udp"}, +{"d-data", {NULL}, 4301, "tcp"}, +{"d-data", {NULL}, 4301, "udp"}, +{"d-data-control", {NULL}, 4302, "tcp"}, +{"d-data-control", {NULL}, 4302, "udp"}, +{"srcp", {NULL}, 4303, "tcp"}, +{"srcp", {NULL}, 4303, "udp"}, +{"owserver", {NULL}, 4304, "tcp"}, +{"owserver", {NULL}, 4304, "udp"}, +{"batman", {NULL}, 4305, "tcp"}, +{"batman", {NULL}, 4305, "udp"}, +{"pinghgl", {NULL}, 4306, "tcp"}, +{"pinghgl", {NULL}, 4306, "udp"}, +{"visicron-vs", {NULL}, 4307, "tcp"}, +{"visicron-vs", {NULL}, 4307, "udp"}, +{"compx-lockview", {NULL}, 4308, "tcp"}, +{"compx-lockview", {NULL}, 4308, "udp"}, +{"dserver", {NULL}, 4309, "tcp"}, +{"dserver", {NULL}, 4309, "udp"}, +{"mirrtex", {NULL}, 4310, "tcp"}, +{"mirrtex", {NULL}, 4310, "udp"}, +{"p6ssmc", {NULL}, 4311, "tcp"}, +{"pscl-mgt", {NULL}, 4312, "tcp"}, +{"perrla", {NULL}, 4313, "tcp"}, +{"fdt-rcatp", {NULL}, 4320, "tcp"}, +{"fdt-rcatp", {NULL}, 4320, "udp"}, +{"rwhois", {NULL}, 4321, "tcp"}, +{"rwhois", {NULL}, 4321, "udp"}, +{"trim-event", {NULL}, 4322, "tcp"}, +{"trim-event", {NULL}, 4322, "udp"}, +{"trim-ice", {NULL}, 4323, "tcp"}, +{"trim-ice", {NULL}, 4323, "udp"}, +{"balour", {NULL}, 4324, "tcp"}, +{"balour", {NULL}, 4324, "udp"}, +{"geognosisman", {NULL}, 4325, "tcp"}, +{"geognosisman", {NULL}, 4325, "udp"}, +{"geognosis", {NULL}, 4326, "tcp"}, +{"geognosis", {NULL}, 4326, "udp"}, +{"jaxer-web", {NULL}, 4327, "tcp"}, +{"jaxer-web", {NULL}, 4327, "udp"}, +{"jaxer-manager", {NULL}, 4328, "tcp"}, +{"jaxer-manager", {NULL}, 4328, "udp"}, +{"publiqare-sync", {NULL}, 4329, "tcp"}, +{"gaia", {NULL}, 4340, "tcp"}, +{"gaia", {NULL}, 4340, "udp"}, +{"lisp-data", {NULL}, 4341, "tcp"}, +{"lisp-data", {NULL}, 4341, "udp"}, +{"lisp-cons", {NULL}, 4342, "tcp"}, +{"lisp-control", {NULL}, 4342, "udp"}, +{"unicall", {NULL}, 4343, "tcp"}, +{"unicall", {NULL}, 4343, "udp"}, +{"vinainstall", {NULL}, 4344, "tcp"}, +{"vinainstall", {NULL}, 4344, "udp"}, +{"m4-network-as", {NULL}, 4345, "tcp"}, +{"m4-network-as", {NULL}, 4345, "udp"}, +{"elanlm", {NULL}, 4346, "tcp"}, +{"elanlm", {NULL}, 4346, "udp"}, +{"lansurveyor", {NULL}, 4347, "tcp"}, +{"lansurveyor", {NULL}, 4347, "udp"}, +{"itose", {NULL}, 4348, "tcp"}, +{"itose", {NULL}, 4348, "udp"}, +{"fsportmap", {NULL}, 4349, "tcp"}, +{"fsportmap", {NULL}, 4349, "udp"}, +{"net-device", {NULL}, 4350, "tcp"}, +{"net-device", {NULL}, 4350, "udp"}, +{"plcy-net-svcs", {NULL}, 4351, "tcp"}, +{"plcy-net-svcs", {NULL}, 4351, "udp"}, +{"pjlink", {NULL}, 4352, "tcp"}, +{"pjlink", {NULL}, 4352, "udp"}, +{"f5-iquery", {NULL}, 4353, "tcp"}, +{"f5-iquery", {NULL}, 4353, "udp"}, +{"qsnet-trans", {NULL}, 4354, "tcp"}, +{"qsnet-trans", {NULL}, 4354, "udp"}, +{"qsnet-workst", {NULL}, 4355, "tcp"}, +{"qsnet-workst", {NULL}, 4355, "udp"}, +{"qsnet-assist", {NULL}, 4356, "tcp"}, +{"qsnet-assist", {NULL}, 4356, "udp"}, +{"qsnet-cond", {NULL}, 4357, "tcp"}, +{"qsnet-cond", {NULL}, 4357, "udp"}, +{"qsnet-nucl", {NULL}, 4358, "tcp"}, +{"qsnet-nucl", {NULL}, 4358, "udp"}, +{"omabcastltkm", {NULL}, 4359, "tcp"}, +{"omabcastltkm", {NULL}, 4359, "udp"}, +{"matrix_vnet", {NULL}, 4360, "tcp"}, +{"nacnl", {NULL}, 4361, "udp"}, +{"afore-vdp-disc", {NULL}, 4362, "udp"}, +{"wxbrief", {NULL}, 4368, "tcp"}, +{"wxbrief", {NULL}, 4368, "udp"}, +{"epmd", {NULL}, 4369, "tcp"}, +{"epmd", {NULL}, 4369, "udp"}, +{"elpro_tunnel", {NULL}, 4370, "tcp"}, +{"elpro_tunnel", {NULL}, 4370, "udp"}, +{"l2c-control", {NULL}, 4371, "tcp"}, +{"l2c-disc", {NULL}, 4371, "udp"}, +{"l2c-data", {NULL}, 4372, "tcp"}, +{"l2c-data", {NULL}, 4372, "udp"}, +{"remctl", {NULL}, 4373, "tcp"}, +{"remctl", {NULL}, 4373, "udp"}, +{"psi-ptt", {NULL}, 4374, "tcp"}, +{"tolteces", {NULL}, 4375, "tcp"}, +{"tolteces", {NULL}, 4375, "udp"}, +{"bip", {NULL}, 4376, "tcp"}, +{"bip", {NULL}, 4376, "udp"}, +{"cp-spxsvr", {NULL}, 4377, "tcp"}, +{"cp-spxsvr", {NULL}, 4377, "udp"}, +{"cp-spxdpy", {NULL}, 4378, "tcp"}, +{"cp-spxdpy", {NULL}, 4378, "udp"}, +{"ctdb", {NULL}, 4379, "tcp"}, +{"ctdb", {NULL}, 4379, "udp"}, +{"xandros-cms", {NULL}, 4389, "tcp"}, +{"xandros-cms", {NULL}, 4389, "udp"}, +{"wiegand", {NULL}, 4390, "tcp"}, +{"wiegand", {NULL}, 4390, "udp"}, +{"apwi-imserver", {NULL}, 4391, "tcp"}, +{"apwi-rxserver", {NULL}, 4392, "tcp"}, +{"apwi-rxspooler", {NULL}, 4393, "tcp"}, +{"apwi-disc", {NULL}, 4394, "udp"}, +{"omnivisionesx", {NULL}, 4395, "tcp"}, +{"omnivisionesx", {NULL}, 4395, "udp"}, +{"fly", {NULL}, 4396, "tcp"}, +{"ds-srv", {NULL}, 4400, "tcp"}, +{"ds-srv", {NULL}, 4400, "udp"}, +{"ds-srvr", {NULL}, 4401, "tcp"}, +{"ds-srvr", {NULL}, 4401, "udp"}, +{"ds-clnt", {NULL}, 4402, "tcp"}, +{"ds-clnt", {NULL}, 4402, "udp"}, +{"ds-user", {NULL}, 4403, "tcp"}, +{"ds-user", {NULL}, 4403, "udp"}, +{"ds-admin", {NULL}, 4404, "tcp"}, +{"ds-admin", {NULL}, 4404, "udp"}, +{"ds-mail", {NULL}, 4405, "tcp"}, +{"ds-mail", {NULL}, 4405, "udp"}, +{"ds-slp", {NULL}, 4406, "tcp"}, +{"ds-slp", {NULL}, 4406, "udp"}, +{"nacagent", {NULL}, 4407, "tcp"}, +{"slscc", {NULL}, 4408, "tcp"}, +{"netcabinet-com", {NULL}, 4409, "tcp"}, +{"itwo-server", {NULL}, 4410, "tcp"}, +{"netrockey6", {NULL}, 4425, "tcp"}, +{"netrockey6", {NULL}, 4425, "udp"}, +{"beacon-port-2", {NULL}, 4426, "tcp"}, +{"beacon-port-2", {NULL}, 4426, "udp"}, +{"drizzle", {NULL}, 4427, "tcp"}, +{"omviserver", {NULL}, 4428, "tcp"}, +{"omviagent", {NULL}, 4429, "tcp"}, +{"rsqlserver", {NULL}, 4430, "tcp"}, +{"rsqlserver", {NULL}, 4430, "udp"}, +{"wspipe", {NULL}, 4431, "tcp"}, +{"netblox", {NULL}, 4441, "udp"}, +{"saris", {NULL}, 4442, "tcp"}, +{"saris", {NULL}, 4442, "udp"}, +{"pharos", {NULL}, 4443, "tcp"}, +{"pharos", {NULL}, 4443, "udp"}, +{"krb524", {NULL}, 4444, "tcp"}, +{"krb524", {NULL}, 4444, "udp"}, +{"nv-video", {NULL}, 4444, "tcp"}, +{"nv-video", {NULL}, 4444, "udp"}, +{"upnotifyp", {NULL}, 4445, "tcp"}, +{"upnotifyp", {NULL}, 4445, "udp"}, +{"n1-fwp", {NULL}, 4446, "tcp"}, +{"n1-fwp", {NULL}, 4446, "udp"}, +{"n1-rmgmt", {NULL}, 4447, "tcp"}, +{"n1-rmgmt", {NULL}, 4447, "udp"}, +{"asc-slmd", {NULL}, 4448, "tcp"}, +{"asc-slmd", {NULL}, 4448, "udp"}, +{"privatewire", {NULL}, 4449, "tcp"}, +{"privatewire", {NULL}, 4449, "udp"}, +{"camp", {NULL}, 4450, "tcp"}, +{"camp", {NULL}, 4450, "udp"}, +{"ctisystemmsg", {NULL}, 4451, "tcp"}, +{"ctisystemmsg", {NULL}, 4451, "udp"}, +{"ctiprogramload", {NULL}, 4452, "tcp"}, +{"ctiprogramload", {NULL}, 4452, "udp"}, +{"nssalertmgr", {NULL}, 4453, "tcp"}, +{"nssalertmgr", {NULL}, 4453, "udp"}, +{"nssagentmgr", {NULL}, 4454, "tcp"}, +{"nssagentmgr", {NULL}, 4454, "udp"}, +{"prchat-user", {NULL}, 4455, "tcp"}, +{"prchat-user", {NULL}, 4455, "udp"}, +{"prchat-server", {NULL}, 4456, "tcp"}, +{"prchat-server", {NULL}, 4456, "udp"}, +{"prRegister", {NULL}, 4457, "tcp"}, +{"prRegister", {NULL}, 4457, "udp"}, +{"mcp", {NULL}, 4458, "tcp"}, +{"mcp", {NULL}, 4458, "udp"}, +{"hpssmgmt", {NULL}, 4484, "tcp"}, +{"hpssmgmt", {NULL}, 4484, "udp"}, +{"assyst-dr", {NULL}, 4485, "tcp"}, +{"icms", {NULL}, 4486, "tcp"}, +{"icms", {NULL}, 4486, "udp"}, +{"prex-tcp", {NULL}, 4487, "tcp"}, +{"awacs-ice", {NULL}, 4488, "tcp"}, +{"awacs-ice", {NULL}, 4488, "udp"}, +{"ipsec-nat-t", {NULL}, 4500, "tcp"}, +{"ipsec-nat-t", {NULL}, 4500, "udp"}, +{"ehs", {NULL}, 4535, "tcp"}, +{"ehs", {NULL}, 4535, "udp"}, +{"ehs-ssl", {NULL}, 4536, "tcp"}, +{"ehs-ssl", {NULL}, 4536, "udp"}, +{"wssauthsvc", {NULL}, 4537, "tcp"}, +{"wssauthsvc", {NULL}, 4537, "udp"}, +{"swx-gate", {NULL}, 4538, "tcp"}, +{"swx-gate", {NULL}, 4538, "udp"}, +{"worldscores", {NULL}, 4545, "tcp"}, +{"worldscores", {NULL}, 4545, "udp"}, +{"sf-lm", {NULL}, 4546, "tcp"}, +{"sf-lm", {NULL}, 4546, "udp"}, +{"lanner-lm", {NULL}, 4547, "tcp"}, +{"lanner-lm", {NULL}, 4547, "udp"}, +{"synchromesh", {NULL}, 4548, "tcp"}, +{"synchromesh", {NULL}, 4548, "udp"}, +{"aegate", {NULL}, 4549, "tcp"}, +{"aegate", {NULL}, 4549, "udp"}, +{"gds-adppiw-db", {NULL}, 4550, "tcp"}, +{"gds-adppiw-db", {NULL}, 4550, "udp"}, +{"ieee-mih", {NULL}, 4551, "tcp"}, +{"ieee-mih", {NULL}, 4551, "udp"}, +{"menandmice-mon", {NULL}, 4552, "tcp"}, +{"menandmice-mon", {NULL}, 4552, "udp"}, +{"icshostsvc", {NULL}, 4553, "tcp"}, +{"msfrs", {NULL}, 4554, "tcp"}, +{"msfrs", {NULL}, 4554, "udp"}, +{"rsip", {NULL}, 4555, "tcp"}, +{"rsip", {NULL}, 4555, "udp"}, +{"dtn-bundle-tcp", {NULL}, 4556, "tcp"}, +{"dtn-bundle-udp", {NULL}, 4556, "udp"}, +{"mtcevrunqss", {NULL}, 4557, "udp"}, +{"mtcevrunqman", {NULL}, 4558, "udp"}, +{"hylafax", {NULL}, 4559, "tcp"}, +{"hylafax", {NULL}, 4559, "udp"}, +{"kwtc", {NULL}, 4566, "tcp"}, +{"kwtc", {NULL}, 4566, "udp"}, +{"tram", {NULL}, 4567, "tcp"}, +{"tram", {NULL}, 4567, "udp"}, +{"bmc-reporting", {NULL}, 4568, "tcp"}, +{"bmc-reporting", {NULL}, 4568, "udp"}, +{"iax", {NULL}, 4569, "tcp"}, +{"iax", {NULL}, 4569, "udp"}, +{"rid", {NULL}, 4590, "tcp"}, +{"l3t-at-an", {NULL}, 4591, "tcp"}, +{"l3t-at-an", {NULL}, 4591, "udp"}, +{"hrpd-ith-at-an", {NULL}, 4592, "udp"}, +{"ipt-anri-anri", {NULL}, 4593, "tcp"}, +{"ipt-anri-anri", {NULL}, 4593, "udp"}, +{"ias-session", {NULL}, 4594, "tcp"}, +{"ias-session", {NULL}, 4594, "udp"}, +{"ias-paging", {NULL}, 4595, "tcp"}, +{"ias-paging", {NULL}, 4595, "udp"}, +{"ias-neighbor", {NULL}, 4596, "tcp"}, +{"ias-neighbor", {NULL}, 4596, "udp"}, +{"a21-an-1xbs", {NULL}, 4597, "tcp"}, +{"a21-an-1xbs", {NULL}, 4597, "udp"}, +{"a16-an-an", {NULL}, 4598, "tcp"}, +{"a16-an-an", {NULL}, 4598, "udp"}, +{"a17-an-an", {NULL}, 4599, "tcp"}, +{"a17-an-an", {NULL}, 4599, "udp"}, +{"piranha1", {NULL}, 4600, "tcp"}, +{"piranha1", {NULL}, 4600, "udp"}, +{"piranha2", {NULL}, 4601, "tcp"}, +{"piranha2", {NULL}, 4601, "udp"}, +{"mtsserver", {NULL}, 4602, "tcp"}, +{"menandmice-upg", {NULL}, 4603, "tcp"}, +{"playsta2-app", {NULL}, 4658, "tcp"}, +{"playsta2-app", {NULL}, 4658, "udp"}, +{"playsta2-lob", {NULL}, 4659, "tcp"}, +{"playsta2-lob", {NULL}, 4659, "udp"}, +{"smaclmgr", {NULL}, 4660, "tcp"}, +{"smaclmgr", {NULL}, 4660, "udp"}, +{"kar2ouche", {NULL}, 4661, "tcp"}, +{"kar2ouche", {NULL}, 4661, "udp"}, +{"oms", {NULL}, 4662, "tcp"}, +{"oms", {NULL}, 4662, "udp"}, +{"noteit", {NULL}, 4663, "tcp"}, +{"noteit", {NULL}, 4663, "udp"}, +{"ems", {NULL}, 4664, "tcp"}, +{"ems", {NULL}, 4664, "udp"}, +{"contclientms", {NULL}, 4665, "tcp"}, +{"contclientms", {NULL}, 4665, "udp"}, +{"eportcomm", {NULL}, 4666, "tcp"}, +{"eportcomm", {NULL}, 4666, "udp"}, +{"mmacomm", {NULL}, 4667, "tcp"}, +{"mmacomm", {NULL}, 4667, "udp"}, +{"mmaeds", {NULL}, 4668, "tcp"}, +{"mmaeds", {NULL}, 4668, "udp"}, +{"eportcommdata", {NULL}, 4669, "tcp"}, +{"eportcommdata", {NULL}, 4669, "udp"}, +{"light", {NULL}, 4670, "tcp"}, +{"light", {NULL}, 4670, "udp"}, +{"acter", {NULL}, 4671, "tcp"}, +{"acter", {NULL}, 4671, "udp"}, +{"rfa", {NULL}, 4672, "tcp"}, +{"rfa", {NULL}, 4672, "udp"}, +{"cxws", {NULL}, 4673, "tcp"}, +{"cxws", {NULL}, 4673, "udp"}, +{"appiq-mgmt", {NULL}, 4674, "tcp"}, +{"appiq-mgmt", {NULL}, 4674, "udp"}, +{"dhct-status", {NULL}, 4675, "tcp"}, +{"dhct-status", {NULL}, 4675, "udp"}, +{"dhct-alerts", {NULL}, 4676, "tcp"}, +{"dhct-alerts", {NULL}, 4676, "udp"}, +{"bcs", {NULL}, 4677, "tcp"}, +{"bcs", {NULL}, 4677, "udp"}, +{"traversal", {NULL}, 4678, "tcp"}, +{"traversal", {NULL}, 4678, "udp"}, +{"mgesupervision", {NULL}, 4679, "tcp"}, +{"mgesupervision", {NULL}, 4679, "udp"}, +{"mgemanagement", {NULL}, 4680, "tcp"}, +{"mgemanagement", {NULL}, 4680, "udp"}, +{"parliant", {NULL}, 4681, "tcp"}, +{"parliant", {NULL}, 4681, "udp"}, +{"finisar", {NULL}, 4682, "tcp"}, +{"finisar", {NULL}, 4682, "udp"}, +{"spike", {NULL}, 4683, "tcp"}, +{"spike", {NULL}, 4683, "udp"}, +{"rfid-rp1", {NULL}, 4684, "tcp"}, +{"rfid-rp1", {NULL}, 4684, "udp"}, +{"autopac", {NULL}, 4685, "tcp"}, +{"autopac", {NULL}, 4685, "udp"}, +{"msp-os", {NULL}, 4686, "tcp"}, +{"msp-os", {NULL}, 4686, "udp"}, +{"nst", {NULL}, 4687, "tcp"}, +{"nst", {NULL}, 4687, "udp"}, +{"mobile-p2p", {NULL}, 4688, "tcp"}, +{"mobile-p2p", {NULL}, 4688, "udp"}, +{"altovacentral", {NULL}, 4689, "tcp"}, +{"altovacentral", {NULL}, 4689, "udp"}, +{"prelude", {NULL}, 4690, "tcp"}, +{"prelude", {NULL}, 4690, "udp"}, +{"mtn", {NULL}, 4691, "tcp"}, +{"mtn", {NULL}, 4691, "udp"}, +{"conspiracy", {NULL}, 4692, "tcp"}, +{"conspiracy", {NULL}, 4692, "udp"}, +{"netxms-agent", {NULL}, 4700, "tcp"}, +{"netxms-agent", {NULL}, 4700, "udp"}, +{"netxms-mgmt", {NULL}, 4701, "tcp"}, +{"netxms-mgmt", {NULL}, 4701, "udp"}, +{"netxms-sync", {NULL}, 4702, "tcp"}, +{"netxms-sync", {NULL}, 4702, "udp"}, +{"npqes-test", {NULL}, 4703, "tcp"}, +{"assuria-ins", {NULL}, 4704, "tcp"}, +{"truckstar", {NULL}, 4725, "tcp"}, +{"truckstar", {NULL}, 4725, "udp"}, +{"a26-fap-fgw", {NULL}, 4726, "udp"}, +{"fcis", {NULL}, 4727, "tcp"}, +{"fcis-disc", {NULL}, 4727, "udp"}, +{"capmux", {NULL}, 4728, "tcp"}, +{"capmux", {NULL}, 4728, "udp"}, +{"gsmtap", {NULL}, 4729, "udp"}, +{"gearman", {NULL}, 4730, "tcp"}, +{"gearman", {NULL}, 4730, "udp"}, +{"remcap", {NULL}, 4731, "tcp"}, +{"ohmtrigger", {NULL}, 4732, "udp"}, +{"resorcs", {NULL}, 4733, "tcp"}, +{"ipdr-sp", {NULL}, 4737, "tcp"}, +{"ipdr-sp", {NULL}, 4737, "udp"}, +{"solera-lpn", {NULL}, 4738, "tcp"}, +{"solera-lpn", {NULL}, 4738, "udp"}, +{"ipfix", {NULL}, 4739, "tcp"}, +{"ipfix", {NULL}, 4739, "udp"}, +{"ipfix", {NULL}, 4739, "sctp"}, +{"ipfixs", {NULL}, 4740, "tcp"}, +{"ipfixs", {NULL}, 4740, "sctp"}, +{"ipfixs", {NULL}, 4740, "udp"}, +{"lumimgrd", {NULL}, 4741, "tcp"}, +{"lumimgrd", {NULL}, 4741, "udp"}, +{"sicct", {NULL}, 4742, "tcp"}, +{"sicct-sdp", {NULL}, 4742, "udp"}, +{"openhpid", {NULL}, 4743, "tcp"}, +{"openhpid", {NULL}, 4743, "udp"}, +{"ifsp", {NULL}, 4744, "tcp"}, +{"ifsp", {NULL}, 4744, "udp"}, +{"fmp", {NULL}, 4745, "tcp"}, +{"fmp", {NULL}, 4745, "udp"}, +{"profilemac", {NULL}, 4749, "tcp"}, +{"profilemac", {NULL}, 4749, "udp"}, +{"ssad", {NULL}, 4750, "tcp"}, +{"ssad", {NULL}, 4750, "udp"}, +{"spocp", {NULL}, 4751, "tcp"}, +{"spocp", {NULL}, 4751, "udp"}, +{"snap", {NULL}, 4752, "tcp"}, +{"snap", {NULL}, 4752, "udp"}, +{"bfd-multi-ctl", {NULL}, 4784, "tcp"}, +{"bfd-multi-ctl", {NULL}, 4784, "udp"}, +{"cncp", {NULL}, 4785, "udp"}, +{"smart-install", {NULL}, 4786, "tcp"}, +{"sia-ctrl-plane", {NULL}, 4787, "tcp"}, +{"iims", {NULL}, 4800, "tcp"}, +{"iims", {NULL}, 4800, "udp"}, +{"iwec", {NULL}, 4801, "tcp"}, +{"iwec", {NULL}, 4801, "udp"}, +{"ilss", {NULL}, 4802, "tcp"}, +{"ilss", {NULL}, 4802, "udp"}, +{"notateit", {NULL}, 4803, "tcp"}, +{"notateit-disc", {NULL}, 4803, "udp"}, +{"aja-ntv4-disc", {NULL}, 4804, "udp"}, +{"htcp", {NULL}, 4827, "tcp"}, +{"htcp", {NULL}, 4827, "udp"}, +{"varadero-0", {NULL}, 4837, "tcp"}, +{"varadero-0", {NULL}, 4837, "udp"}, +{"varadero-1", {NULL}, 4838, "tcp"}, +{"varadero-1", {NULL}, 4838, "udp"}, +{"varadero-2", {NULL}, 4839, "tcp"}, +{"varadero-2", {NULL}, 4839, "udp"}, +{"opcua-tcp", {NULL}, 4840, "tcp"}, +{"opcua-udp", {NULL}, 4840, "udp"}, +{"quosa", {NULL}, 4841, "tcp"}, +{"quosa", {NULL}, 4841, "udp"}, +{"gw-asv", {NULL}, 4842, "tcp"}, +{"gw-asv", {NULL}, 4842, "udp"}, +{"opcua-tls", {NULL}, 4843, "tcp"}, +{"opcua-tls", {NULL}, 4843, "udp"}, +{"gw-log", {NULL}, 4844, "tcp"}, +{"gw-log", {NULL}, 4844, "udp"}, +{"wcr-remlib", {NULL}, 4845, "tcp"}, +{"wcr-remlib", {NULL}, 4845, "udp"}, +{"contamac_icm", {NULL}, 4846, "tcp"}, +{"contamac_icm", {NULL}, 4846, "udp"}, +{"wfc", {NULL}, 4847, "tcp"}, +{"wfc", {NULL}, 4847, "udp"}, +{"appserv-http", {NULL}, 4848, "tcp"}, +{"appserv-http", {NULL}, 4848, "udp"}, +{"appserv-https", {NULL}, 4849, "tcp"}, +{"appserv-https", {NULL}, 4849, "udp"}, +{"sun-as-nodeagt", {NULL}, 4850, "tcp"}, +{"sun-as-nodeagt", {NULL}, 4850, "udp"}, +{"derby-repli", {NULL}, 4851, "tcp"}, +{"derby-repli", {NULL}, 4851, "udp"}, +{"unify-debug", {NULL}, 4867, "tcp"}, +{"unify-debug", {NULL}, 4867, "udp"}, +{"phrelay", {NULL}, 4868, "tcp"}, +{"phrelay", {NULL}, 4868, "udp"}, +{"phrelaydbg", {NULL}, 4869, "tcp"}, +{"phrelaydbg", {NULL}, 4869, "udp"}, +{"cc-tracking", {NULL}, 4870, "tcp"}, +{"cc-tracking", {NULL}, 4870, "udp"}, +{"wired", {NULL}, 4871, "tcp"}, +{"wired", {NULL}, 4871, "udp"}, +{"tritium-can", {NULL}, 4876, "tcp"}, +{"tritium-can", {NULL}, 4876, "udp"}, +{"lmcs", {NULL}, 4877, "tcp"}, +{"lmcs", {NULL}, 4877, "udp"}, +{"inst-discovery", {NULL}, 4878, "udp"}, +{"wsdl-event", {NULL}, 4879, "tcp"}, +{"hislip", {NULL}, 4880, "tcp"}, +{"socp-t", {NULL}, 4881, "udp"}, +{"socp-c", {NULL}, 4882, "udp"}, +{"wmlserver", {NULL}, 4883, "tcp"}, +{"hivestor", {NULL}, 4884, "tcp"}, +{"hivestor", {NULL}, 4884, "udp"}, +{"abbs", {NULL}, 4885, "tcp"}, +{"abbs", {NULL}, 4885, "udp"}, +{"lyskom", {NULL}, 4894, "tcp"}, +{"lyskom", {NULL}, 4894, "udp"}, +{"radmin-port", {NULL}, 4899, "tcp"}, +{"radmin-port", {NULL}, 4899, "udp"}, +{"hfcs", {NULL}, 4900, "tcp"}, +{"hfcs", {NULL}, 4900, "udp"}, +{"flr_agent", {NULL}, 4901, "tcp"}, +{"magiccontrol", {NULL}, 4902, "tcp"}, +{"lutap", {NULL}, 4912, "tcp"}, +{"lutcp", {NULL}, 4913, "tcp"}, +{"bones", {NULL}, 4914, "tcp"}, +{"bones", {NULL}, 4914, "udp"}, +{"frcs", {NULL}, 4915, "tcp"}, +{"atsc-mh-ssc", {NULL}, 4937, "udp"}, +{"eq-office-4940", {NULL}, 4940, "tcp"}, +{"eq-office-4940", {NULL}, 4940, "udp"}, +{"eq-office-4941", {NULL}, 4941, "tcp"}, +{"eq-office-4941", {NULL}, 4941, "udp"}, +{"eq-office-4942", {NULL}, 4942, "tcp"}, +{"eq-office-4942", {NULL}, 4942, "udp"}, +{"munin", {NULL}, 4949, "tcp"}, +{"munin", {NULL}, 4949, "udp"}, +{"sybasesrvmon", {NULL}, 4950, "tcp"}, +{"sybasesrvmon", {NULL}, 4950, "udp"}, +{"pwgwims", {NULL}, 4951, "tcp"}, +{"pwgwims", {NULL}, 4951, "udp"}, +{"sagxtsds", {NULL}, 4952, "tcp"}, +{"sagxtsds", {NULL}, 4952, "udp"}, +{"dbsyncarbiter", {NULL}, 4953, "tcp"}, +{"ccss-qmm", {NULL}, 4969, "tcp"}, +{"ccss-qmm", {NULL}, 4969, "udp"}, +{"ccss-qsm", {NULL}, 4970, "tcp"}, +{"ccss-qsm", {NULL}, 4970, "udp"}, +{"webyast", {NULL}, 4984, "tcp"}, +{"gerhcs", {NULL}, 4985, "tcp"}, +{"mrip", {NULL}, 4986, "tcp"}, +{"mrip", {NULL}, 4986, "udp"}, +{"smar-se-port1", {NULL}, 4987, "tcp"}, +{"smar-se-port1", {NULL}, 4987, "udp"}, +{"smar-se-port2", {NULL}, 4988, "tcp"}, +{"smar-se-port2", {NULL}, 4988, "udp"}, +{"parallel", {NULL}, 4989, "tcp"}, +{"parallel", {NULL}, 4989, "udp"}, +{"busycal", {NULL}, 4990, "tcp"}, +{"busycal", {NULL}, 4990, "udp"}, +{"vrt", {NULL}, 4991, "tcp"}, +{"vrt", {NULL}, 4991, "udp"}, +{"hfcs-manager", {NULL}, 4999, "tcp"}, +{"hfcs-manager", {NULL}, 4999, "udp"}, +{"commplex-main", {NULL}, 5000, "tcp"}, +{"commplex-main", {NULL}, 5000, "udp"}, +{"commplex-link", {NULL}, 5001, "tcp"}, +{"commplex-link", {NULL}, 5001, "udp"}, +{"rfe", {NULL}, 5002, "tcp"}, +{"rfe", {NULL}, 5002, "udp"}, +{"fmpro-internal", {NULL}, 5003, "tcp"}, +{"fmpro-internal", {NULL}, 5003, "udp"}, +{"avt-profile-1", {NULL}, 5004, "tcp"}, +{"avt-profile-1", {NULL}, 5004, "udp"}, +{"avt-profile-1", {NULL}, 5004, "dccp"}, +{"avt-profile-2", {NULL}, 5005, "tcp"}, +{"avt-profile-2", {NULL}, 5005, "udp"}, +{"avt-profile-2", {NULL}, 5005, "dccp"}, +{"wsm-server", {NULL}, 5006, "tcp"}, +{"wsm-server", {NULL}, 5006, "udp"}, +{"wsm-server-ssl", {NULL}, 5007, "tcp"}, +{"wsm-server-ssl", {NULL}, 5007, "udp"}, +{"synapsis-edge", {NULL}, 5008, "tcp"}, +{"synapsis-edge", {NULL}, 5008, "udp"}, +{"winfs", {NULL}, 5009, "tcp"}, +{"winfs", {NULL}, 5009, "udp"}, +{"telelpathstart", {NULL}, 5010, "tcp"}, +{"telelpathstart", {NULL}, 5010, "udp"}, +{"telelpathattack", {NULL}, 5011, "tcp"}, +{"telelpathattack", {NULL}, 5011, "udp"}, +{"nsp", {NULL}, 5012, "tcp"}, +{"nsp", {NULL}, 5012, "udp"}, +{"fmpro-v6", {NULL}, 5013, "tcp"}, +{"fmpro-v6", {NULL}, 5013, "udp"}, +{"onpsocket", {NULL}, 5014, "udp"}, +{"fmwp", {NULL}, 5015, "tcp"}, +{"zenginkyo-1", {NULL}, 5020, "tcp"}, +{"zenginkyo-1", {NULL}, 5020, "udp"}, +{"zenginkyo-2", {NULL}, 5021, "tcp"}, +{"zenginkyo-2", {NULL}, 5021, "udp"}, +{"mice", {NULL}, 5022, "tcp"}, +{"mice", {NULL}, 5022, "udp"}, +{"htuilsrv", {NULL}, 5023, "tcp"}, +{"htuilsrv", {NULL}, 5023, "udp"}, +{"scpi-telnet", {NULL}, 5024, "tcp"}, +{"scpi-telnet", {NULL}, 5024, "udp"}, +{"scpi-raw", {NULL}, 5025, "tcp"}, +{"scpi-raw", {NULL}, 5025, "udp"}, +{"strexec-d", {NULL}, 5026, "tcp"}, +{"strexec-d", {NULL}, 5026, "udp"}, +{"strexec-s", {NULL}, 5027, "tcp"}, +{"strexec-s", {NULL}, 5027, "udp"}, +{"qvr", {NULL}, 5028, "tcp"}, +{"infobright", {NULL}, 5029, "tcp"}, +{"infobright", {NULL}, 5029, "udp"}, +{"surfpass", {NULL}, 5030, "tcp"}, +{"surfpass", {NULL}, 5030, "udp"}, +{"dmp", {NULL}, 5031, "udp"}, +{"asnaacceler8db", {NULL}, 5042, "tcp"}, +{"asnaacceler8db", {NULL}, 5042, "udp"}, +{"swxadmin", {NULL}, 5043, "tcp"}, +{"swxadmin", {NULL}, 5043, "udp"}, +{"lxi-evntsvc", {NULL}, 5044, "tcp"}, +{"lxi-evntsvc", {NULL}, 5044, "udp"}, +{"osp", {NULL}, 5045, "tcp"}, +{"vpm-udp", {NULL}, 5046, "udp"}, +{"iscape", {NULL}, 5047, "udp"}, +{"texai", {NULL}, 5048, "tcp"}, +{"ivocalize", {NULL}, 5049, "tcp"}, +{"ivocalize", {NULL}, 5049, "udp"}, +{"mmcc", {NULL}, 5050, "tcp"}, +{"mmcc", {NULL}, 5050, "udp"}, +{"ita-agent", {NULL}, 5051, "tcp"}, +{"ita-agent", {NULL}, 5051, "udp"}, +{"ita-manager", {NULL}, 5052, "tcp"}, +{"ita-manager", {NULL}, 5052, "udp"}, +{"rlm", {NULL}, 5053, "tcp"}, +{"rlm-admin", {NULL}, 5054, "tcp"}, +{"unot", {NULL}, 5055, "tcp"}, +{"unot", {NULL}, 5055, "udp"}, +{"intecom-ps1", {NULL}, 5056, "tcp"}, +{"intecom-ps1", {NULL}, 5056, "udp"}, +{"intecom-ps2", {NULL}, 5057, "tcp"}, +{"intecom-ps2", {NULL}, 5057, "udp"}, +{"locus-disc", {NULL}, 5058, "udp"}, +{"sds", {NULL}, 5059, "tcp"}, +{"sds", {NULL}, 5059, "udp"}, +{"sip", {NULL}, 5060, "tcp"}, +{"sip", {NULL}, 5060, "udp"}, +{"sip-tls", {NULL}, 5061, "tcp"}, +{"sip-tls", {NULL}, 5061, "udp"}, +{"na-localise", {NULL}, 5062, "tcp"}, +{"na-localise", {NULL}, 5062, "udp"}, +{"csrpc", {NULL}, 5063, "tcp"}, +{"ca-1", {NULL}, 5064, "tcp"}, +{"ca-1", {NULL}, 5064, "udp"}, +{"ca-2", {NULL}, 5065, "tcp"}, +{"ca-2", {NULL}, 5065, "udp"}, +{"stanag-5066", {NULL}, 5066, "tcp"}, +{"stanag-5066", {NULL}, 5066, "udp"}, +{"authentx", {NULL}, 5067, "tcp"}, +{"authentx", {NULL}, 5067, "udp"}, +{"bitforestsrv", {NULL}, 5068, "tcp"}, +{"i-net-2000-npr", {NULL}, 5069, "tcp"}, +{"i-net-2000-npr", {NULL}, 5069, "udp"}, +{"vtsas", {NULL}, 5070, "tcp"}, +{"vtsas", {NULL}, 5070, "udp"}, +{"powerschool", {NULL}, 5071, "tcp"}, +{"powerschool", {NULL}, 5071, "udp"}, +{"ayiya", {NULL}, 5072, "tcp"}, +{"ayiya", {NULL}, 5072, "udp"}, +{"tag-pm", {NULL}, 5073, "tcp"}, +{"tag-pm", {NULL}, 5073, "udp"}, +{"alesquery", {NULL}, 5074, "tcp"}, +{"alesquery", {NULL}, 5074, "udp"}, +{"cp-spxrpts", {NULL}, 5079, "udp"}, +{"onscreen", {NULL}, 5080, "tcp"}, +{"onscreen", {NULL}, 5080, "udp"}, +{"sdl-ets", {NULL}, 5081, "tcp"}, +{"sdl-ets", {NULL}, 5081, "udp"}, +{"qcp", {NULL}, 5082, "tcp"}, +{"qcp", {NULL}, 5082, "udp"}, +{"qfp", {NULL}, 5083, "tcp"}, +{"qfp", {NULL}, 5083, "udp"}, +{"llrp", {NULL}, 5084, "tcp"}, +{"llrp", {NULL}, 5084, "udp"}, +{"encrypted-llrp", {NULL}, 5085, "tcp"}, +{"encrypted-llrp", {NULL}, 5085, "udp"}, +{"aprigo-cs", {NULL}, 5086, "tcp"}, +{"car", {NULL}, 5090, "sctp"}, +{"cxtp", {NULL}, 5091, "sctp"}, +{"magpie", {NULL}, 5092, "udp"}, +{"sentinel-lm", {NULL}, 5093, "tcp"}, +{"sentinel-lm", {NULL}, 5093, "udp"}, +{"hart-ip", {NULL}, 5094, "tcp"}, +{"hart-ip", {NULL}, 5094, "udp"}, +{"sentlm-srv2srv", {NULL}, 5099, "tcp"}, +{"sentlm-srv2srv", {NULL}, 5099, "udp"}, +{"socalia", {NULL}, 5100, "tcp"}, +{"socalia", {NULL}, 5100, "udp"}, +{"talarian-tcp", {NULL}, 5101, "tcp"}, +{"talarian-udp", {NULL}, 5101, "udp"}, +{"oms-nonsecure", {NULL}, 5102, "tcp"}, +{"oms-nonsecure", {NULL}, 5102, "udp"}, +{"actifio-c2c", {NULL}, 5103, "tcp"}, +{"tinymessage", {NULL}, 5104, "udp"}, +{"hughes-ap", {NULL}, 5105, "udp"}, +{"taep-as-svc", {NULL}, 5111, "tcp"}, +{"taep-as-svc", {NULL}, 5111, "udp"}, +{"pm-cmdsvr", {NULL}, 5112, "tcp"}, +{"pm-cmdsvr", {NULL}, 5112, "udp"}, +{"ev-services", {NULL}, 5114, "tcp"}, +{"autobuild", {NULL}, 5115, "tcp"}, +{"emb-proj-cmd", {NULL}, 5116, "udp"}, +{"gradecam", {NULL}, 5117, "tcp"}, +{"nbt-pc", {NULL}, 5133, "tcp"}, +{"nbt-pc", {NULL}, 5133, "udp"}, +{"ppactivation", {NULL}, 5134, "tcp"}, +{"erp-scale", {NULL}, 5135, "tcp"}, +{"minotaur-sa", {NULL}, 5136, "udp"}, +{"ctsd", {NULL}, 5137, "tcp"}, +{"ctsd", {NULL}, 5137, "udp"}, +{"rmonitor_secure", {NULL}, 5145, "tcp"}, +{"rmonitor_secure", {NULL}, 5145, "udp"}, +{"social-alarm", {NULL}, 5146, "tcp"}, +{"atmp", {NULL}, 5150, "tcp"}, +{"atmp", {NULL}, 5150, "udp"}, +{"esri_sde", {NULL}, 5151, "tcp"}, +{"esri_sde", {NULL}, 5151, "udp"}, +{"sde-discovery", {NULL}, 5152, "tcp"}, +{"sde-discovery", {NULL}, 5152, "udp"}, +{"toruxserver", {NULL}, 5153, "tcp"}, +{"bzflag", {NULL}, 5154, "tcp"}, +{"bzflag", {NULL}, 5154, "udp"}, +{"asctrl-agent", {NULL}, 5155, "tcp"}, +{"asctrl-agent", {NULL}, 5155, "udp"}, +{"rugameonline", {NULL}, 5156, "tcp"}, +{"mediat", {NULL}, 5157, "tcp"}, +{"snmpssh", {NULL}, 5161, "tcp"}, +{"snmpssh-trap", {NULL}, 5162, "tcp"}, +{"sbackup", {NULL}, 5163, "tcp"}, +{"vpa", {NULL}, 5164, "tcp"}, +{"vpa-disc", {NULL}, 5164, "udp"}, +{"ife_icorp", {NULL}, 5165, "tcp"}, +{"ife_icorp", {NULL}, 5165, "udp"}, +{"winpcs", {NULL}, 5166, "tcp"}, +{"winpcs", {NULL}, 5166, "udp"}, +{"scte104", {NULL}, 5167, "tcp"}, +{"scte104", {NULL}, 5167, "udp"}, +{"scte30", {NULL}, 5168, "tcp"}, +{"scte30", {NULL}, 5168, "udp"}, +{"aol", {NULL}, 5190, "tcp"}, +{"aol", {NULL}, 5190, "udp"}, +{"aol-1", {NULL}, 5191, "tcp"}, +{"aol-1", {NULL}, 5191, "udp"}, +{"aol-2", {NULL}, 5192, "tcp"}, +{"aol-2", {NULL}, 5192, "udp"}, +{"aol-3", {NULL}, 5193, "tcp"}, +{"aol-3", {NULL}, 5193, "udp"}, +{"cpscomm", {NULL}, 5194, "tcp"}, +{"targus-getdata", {NULL}, 5200, "tcp"}, +{"targus-getdata", {NULL}, 5200, "udp"}, +{"targus-getdata1", {NULL}, 5201, "tcp"}, +{"targus-getdata1", {NULL}, 5201, "udp"}, +{"targus-getdata2", {NULL}, 5202, "tcp"}, +{"targus-getdata2", {NULL}, 5202, "udp"}, +{"targus-getdata3", {NULL}, 5203, "tcp"}, +{"targus-getdata3", {NULL}, 5203, "udp"}, +{"3exmp", {NULL}, 5221, "tcp"}, +{"xmpp-client", {NULL}, 5222, "tcp"}, +{"hpvirtgrp", {NULL}, 5223, "tcp"}, +{"hpvirtgrp", {NULL}, 5223, "udp"}, +{"hpvirtctrl", {NULL}, 5224, "tcp"}, +{"hpvirtctrl", {NULL}, 5224, "udp"}, +{"hp-server", {NULL}, 5225, "tcp"}, +{"hp-server", {NULL}, 5225, "udp"}, +{"hp-status", {NULL}, 5226, "tcp"}, +{"hp-status", {NULL}, 5226, "udp"}, +{"perfd", {NULL}, 5227, "tcp"}, +{"perfd", {NULL}, 5227, "udp"}, +{"hpvroom", {NULL}, 5228, "tcp"}, +{"csedaemon", {NULL}, 5232, "tcp"}, +{"enfs", {NULL}, 5233, "tcp"}, +{"eenet", {NULL}, 5234, "tcp"}, +{"eenet", {NULL}, 5234, "udp"}, +{"galaxy-network", {NULL}, 5235, "tcp"}, +{"galaxy-network", {NULL}, 5235, "udp"}, +{"padl2sim", {NULL}, 5236, "tcp"}, +{"padl2sim", {NULL}, 5236, "udp"}, +{"mnet-discovery", {NULL}, 5237, "tcp"}, +{"mnet-discovery", {NULL}, 5237, "udp"}, +{"downtools", {NULL}, 5245, "tcp"}, +{"downtools-disc", {NULL}, 5245, "udp"}, +{"capwap-control", {NULL}, 5246, "udp"}, +{"capwap-data", {NULL}, 5247, "udp"}, +{"caacws", {NULL}, 5248, "tcp"}, +{"caacws", {NULL}, 5248, "udp"}, +{"caaclang2", {NULL}, 5249, "tcp"}, +{"caaclang2", {NULL}, 5249, "udp"}, +{"soagateway", {NULL}, 5250, "tcp"}, +{"soagateway", {NULL}, 5250, "udp"}, +{"caevms", {NULL}, 5251, "tcp"}, +{"caevms", {NULL}, 5251, "udp"}, +{"movaz-ssc", {NULL}, 5252, "tcp"}, +{"movaz-ssc", {NULL}, 5252, "udp"}, +{"kpdp", {NULL}, 5253, "tcp"}, +{"3com-njack-1", {NULL}, 5264, "tcp"}, +{"3com-njack-1", {NULL}, 5264, "udp"}, +{"3com-njack-2", {NULL}, 5265, "tcp"}, +{"3com-njack-2", {NULL}, 5265, "udp"}, +{"xmpp-server", {NULL}, 5269, "tcp"}, +{"xmp", {NULL}, 5270, "tcp"}, +{"xmp", {NULL}, 5270, "udp"}, +{"cuelink", {NULL}, 5271, "tcp"}, +{"cuelink-disc", {NULL}, 5271, "udp"}, +{"pk", {NULL}, 5272, "tcp"}, +{"pk", {NULL}, 5272, "udp"}, +{"xmpp-bosh", {NULL}, 5280, "tcp"}, +{"undo-lm", {NULL}, 5281, "tcp"}, +{"transmit-port", {NULL}, 5282, "tcp"}, +{"transmit-port", {NULL}, 5282, "udp"}, +{"presence", {NULL}, 5298, "tcp"}, +{"presence", {NULL}, 5298, "udp"}, +{"nlg-data", {NULL}, 5299, "tcp"}, +{"nlg-data", {NULL}, 5299, "udp"}, +{"hacl-hb", {NULL}, 5300, "tcp"}, +{"hacl-hb", {NULL}, 5300, "udp"}, +{"hacl-gs", {NULL}, 5301, "tcp"}, +{"hacl-gs", {NULL}, 5301, "udp"}, +{"hacl-cfg", {NULL}, 5302, "tcp"}, +{"hacl-cfg", {NULL}, 5302, "udp"}, +{"hacl-probe", {NULL}, 5303, "tcp"}, +{"hacl-probe", {NULL}, 5303, "udp"}, +{"hacl-local", {NULL}, 5304, "tcp"}, +{"hacl-local", {NULL}, 5304, "udp"}, +{"hacl-test", {NULL}, 5305, "tcp"}, +{"hacl-test", {NULL}, 5305, "udp"}, +{"sun-mc-grp", {NULL}, 5306, "tcp"}, +{"sun-mc-grp", {NULL}, 5306, "udp"}, +{"sco-aip", {NULL}, 5307, "tcp"}, +{"sco-aip", {NULL}, 5307, "udp"}, +{"cfengine", {NULL}, 5308, "tcp"}, +{"cfengine", {NULL}, 5308, "udp"}, +{"jprinter", {NULL}, 5309, "tcp"}, +{"jprinter", {NULL}, 5309, "udp"}, +{"outlaws", {NULL}, 5310, "tcp"}, +{"outlaws", {NULL}, 5310, "udp"}, +{"permabit-cs", {NULL}, 5312, "tcp"}, +{"permabit-cs", {NULL}, 5312, "udp"}, +{"rrdp", {NULL}, 5313, "tcp"}, +{"rrdp", {NULL}, 5313, "udp"}, +{"opalis-rbt-ipc", {NULL}, 5314, "tcp"}, +{"opalis-rbt-ipc", {NULL}, 5314, "udp"}, +{"hacl-poll", {NULL}, 5315, "tcp"}, +{"hacl-poll", {NULL}, 5315, "udp"}, +{"hpdevms", {NULL}, 5316, "tcp"}, +{"hpdevms", {NULL}, 5316, "udp"}, +{"bsfserver-zn", {NULL}, 5320, "tcp"}, +{"bsfsvr-zn-ssl", {NULL}, 5321, "tcp"}, +{"kfserver", {NULL}, 5343, "tcp"}, +{"kfserver", {NULL}, 5343, "udp"}, +{"xkotodrcp", {NULL}, 5344, "tcp"}, +{"xkotodrcp", {NULL}, 5344, "udp"}, +{"stuns", {NULL}, 5349, "tcp"}, +{"stuns", {NULL}, 5349, "udp"}, +{"turns", {NULL}, 5349, "tcp"}, +{"turns", {NULL}, 5349, "udp"}, +{"stun-behaviors", {NULL}, 5349, "tcp"}, +{"stun-behaviors", {NULL}, 5349, "udp"}, +{"nat-pmp-status", {NULL}, 5350, "tcp"}, +{"nat-pmp-status", {NULL}, 5350, "udp"}, +{"nat-pmp", {NULL}, 5351, "tcp"}, +{"nat-pmp", {NULL}, 5351, "udp"}, +{"dns-llq", {NULL}, 5352, "tcp"}, +{"dns-llq", {NULL}, 5352, "udp"}, +{"mdns", {NULL}, 5353, "tcp"}, +{"mdns", {NULL}, 5353, "udp"}, +{"mdnsresponder", {NULL}, 5354, "tcp"}, +{"mdnsresponder", {NULL}, 5354, "udp"}, +{"llmnr", {NULL}, 5355, "tcp"}, +{"llmnr", {NULL}, 5355, "udp"}, +{"ms-smlbiz", {NULL}, 5356, "tcp"}, +{"ms-smlbiz", {NULL}, 5356, "udp"}, +{"wsdapi", {NULL}, 5357, "tcp"}, +{"wsdapi", {NULL}, 5357, "udp"}, +{"wsdapi-s", {NULL}, 5358, "tcp"}, +{"wsdapi-s", {NULL}, 5358, "udp"}, +{"ms-alerter", {NULL}, 5359, "tcp"}, +{"ms-alerter", {NULL}, 5359, "udp"}, +{"ms-sideshow", {NULL}, 5360, "tcp"}, +{"ms-sideshow", {NULL}, 5360, "udp"}, +{"ms-s-sideshow", {NULL}, 5361, "tcp"}, +{"ms-s-sideshow", {NULL}, 5361, "udp"}, +{"serverwsd2", {NULL}, 5362, "tcp"}, +{"serverwsd2", {NULL}, 5362, "udp"}, +{"net-projection", {NULL}, 5363, "tcp"}, +{"net-projection", {NULL}, 5363, "udp"}, +{"stresstester", {NULL}, 5397, "tcp"}, +{"stresstester", {NULL}, 5397, "udp"}, +{"elektron-admin", {NULL}, 5398, "tcp"}, +{"elektron-admin", {NULL}, 5398, "udp"}, +{"securitychase", {NULL}, 5399, "tcp"}, +{"securitychase", {NULL}, 5399, "udp"}, +{"excerpt", {NULL}, 5400, "tcp"}, +{"excerpt", {NULL}, 5400, "udp"}, +{"excerpts", {NULL}, 5401, "tcp"}, +{"excerpts", {NULL}, 5401, "udp"}, +{"mftp", {NULL}, 5402, "tcp"}, +{"mftp", {NULL}, 5402, "udp"}, +{"hpoms-ci-lstn", {NULL}, 5403, "tcp"}, +{"hpoms-ci-lstn", {NULL}, 5403, "udp"}, +{"hpoms-dps-lstn", {NULL}, 5404, "tcp"}, +{"hpoms-dps-lstn", {NULL}, 5404, "udp"}, +{"netsupport", {NULL}, 5405, "tcp"}, +{"netsupport", {NULL}, 5405, "udp"}, +{"systemics-sox", {NULL}, 5406, "tcp"}, +{"systemics-sox", {NULL}, 5406, "udp"}, +{"foresyte-clear", {NULL}, 5407, "tcp"}, +{"foresyte-clear", {NULL}, 5407, "udp"}, +{"foresyte-sec", {NULL}, 5408, "tcp"}, +{"foresyte-sec", {NULL}, 5408, "udp"}, +{"salient-dtasrv", {NULL}, 5409, "tcp"}, +{"salient-dtasrv", {NULL}, 5409, "udp"}, +{"salient-usrmgr", {NULL}, 5410, "tcp"}, +{"salient-usrmgr", {NULL}, 5410, "udp"}, +{"actnet", {NULL}, 5411, "tcp"}, +{"actnet", {NULL}, 5411, "udp"}, +{"continuus", {NULL}, 5412, "tcp"}, +{"continuus", {NULL}, 5412, "udp"}, +{"wwiotalk", {NULL}, 5413, "tcp"}, +{"wwiotalk", {NULL}, 5413, "udp"}, +{"statusd", {NULL}, 5414, "tcp"}, +{"statusd", {NULL}, 5414, "udp"}, +{"ns-server", {NULL}, 5415, "tcp"}, +{"ns-server", {NULL}, 5415, "udp"}, +{"sns-gateway", {NULL}, 5416, "tcp"}, +{"sns-gateway", {NULL}, 5416, "udp"}, +{"sns-agent", {NULL}, 5417, "tcp"}, +{"sns-agent", {NULL}, 5417, "udp"}, +{"mcntp", {NULL}, 5418, "tcp"}, +{"mcntp", {NULL}, 5418, "udp"}, +{"dj-ice", {NULL}, 5419, "tcp"}, +{"dj-ice", {NULL}, 5419, "udp"}, +{"cylink-c", {NULL}, 5420, "tcp"}, +{"cylink-c", {NULL}, 5420, "udp"}, +{"netsupport2", {NULL}, 5421, "tcp"}, +{"netsupport2", {NULL}, 5421, "udp"}, +{"salient-mux", {NULL}, 5422, "tcp"}, +{"salient-mux", {NULL}, 5422, "udp"}, +{"virtualuser", {NULL}, 5423, "tcp"}, +{"virtualuser", {NULL}, 5423, "udp"}, +{"beyond-remote", {NULL}, 5424, "tcp"}, +{"beyond-remote", {NULL}, 5424, "udp"}, +{"br-channel", {NULL}, 5425, "tcp"}, +{"br-channel", {NULL}, 5425, "udp"}, +{"devbasic", {NULL}, 5426, "tcp"}, +{"devbasic", {NULL}, 5426, "udp"}, +{"sco-peer-tta", {NULL}, 5427, "tcp"}, +{"sco-peer-tta", {NULL}, 5427, "udp"}, +{"telaconsole", {NULL}, 5428, "tcp"}, +{"telaconsole", {NULL}, 5428, "udp"}, +{"base", {NULL}, 5429, "tcp"}, +{"base", {NULL}, 5429, "udp"}, +{"radec-corp", {NULL}, 5430, "tcp"}, +{"radec-corp", {NULL}, 5430, "udp"}, +{"park-agent", {NULL}, 5431, "tcp"}, +{"park-agent", {NULL}, 5431, "udp"}, +{"postgresql", {NULL}, 5432, "tcp"}, +{"postgresql", {NULL}, 5432, "udp"}, +{"pyrrho", {NULL}, 5433, "tcp"}, +{"pyrrho", {NULL}, 5433, "udp"}, +{"sgi-arrayd", {NULL}, 5434, "tcp"}, +{"sgi-arrayd", {NULL}, 5434, "udp"}, +{"sceanics", {NULL}, 5435, "tcp"}, +{"sceanics", {NULL}, 5435, "udp"}, +{"pmip6-cntl", {NULL}, 5436, "udp"}, +{"pmip6-data", {NULL}, 5437, "udp"}, +{"spss", {NULL}, 5443, "tcp"}, +{"spss", {NULL}, 5443, "udp"}, +{"surebox", {NULL}, 5453, "tcp"}, +{"surebox", {NULL}, 5453, "udp"}, +{"apc-5454", {NULL}, 5454, "tcp"}, +{"apc-5454", {NULL}, 5454, "udp"}, +{"apc-5455", {NULL}, 5455, "tcp"}, +{"apc-5455", {NULL}, 5455, "udp"}, +{"apc-5456", {NULL}, 5456, "tcp"}, +{"apc-5456", {NULL}, 5456, "udp"}, +{"silkmeter", {NULL}, 5461, "tcp"}, +{"silkmeter", {NULL}, 5461, "udp"}, +{"ttl-publisher", {NULL}, 5462, "tcp"}, +{"ttl-publisher", {NULL}, 5462, "udp"}, +{"ttlpriceproxy", {NULL}, 5463, "tcp"}, +{"ttlpriceproxy", {NULL}, 5463, "udp"}, +{"quailnet", {NULL}, 5464, "tcp"}, +{"quailnet", {NULL}, 5464, "udp"}, +{"netops-broker", {NULL}, 5465, "tcp"}, +{"netops-broker", {NULL}, 5465, "udp"}, +{"fcp-addr-srvr1", {NULL}, 5500, "tcp"}, +{"fcp-addr-srvr1", {NULL}, 5500, "udp"}, +{"fcp-addr-srvr2", {NULL}, 5501, "tcp"}, +{"fcp-addr-srvr2", {NULL}, 5501, "udp"}, +{"fcp-srvr-inst1", {NULL}, 5502, "tcp"}, +{"fcp-srvr-inst1", {NULL}, 5502, "udp"}, +{"fcp-srvr-inst2", {NULL}, 5503, "tcp"}, +{"fcp-srvr-inst2", {NULL}, 5503, "udp"}, +{"fcp-cics-gw1", {NULL}, 5504, "tcp"}, +{"fcp-cics-gw1", {NULL}, 5504, "udp"}, +{"checkoutdb", {NULL}, 5505, "tcp"}, +{"checkoutdb", {NULL}, 5505, "udp"}, +{"amc", {NULL}, 5506, "tcp"}, +{"amc", {NULL}, 5506, "udp"}, +{"sgi-eventmond", {NULL}, 5553, "tcp"}, +{"sgi-eventmond", {NULL}, 5553, "udp"}, +{"sgi-esphttp", {NULL}, 5554, "tcp"}, +{"sgi-esphttp", {NULL}, 5554, "udp"}, +{"personal-agent", {NULL}, 5555, "tcp"}, +{"personal-agent", {NULL}, 5555, "udp"}, +{"freeciv", {NULL}, 5556, "tcp"}, +{"freeciv", {NULL}, 5556, "udp"}, +{"farenet", {NULL}, 5557, "tcp"}, +{"westec-connect", {NULL}, 5566, "tcp"}, +{"m-oap", {NULL}, 5567, "tcp"}, +{"m-oap", {NULL}, 5567, "udp"}, +{"sdt", {NULL}, 5568, "tcp"}, +{"sdt", {NULL}, 5568, "udp"}, +{"sdmmp", {NULL}, 5573, "tcp"}, +{"sdmmp", {NULL}, 5573, "udp"}, +{"lsi-bobcat", {NULL}, 5574, "tcp"}, +{"ora-oap", {NULL}, 5575, "tcp"}, +{"fdtracks", {NULL}, 5579, "tcp"}, +{"tmosms0", {NULL}, 5580, "tcp"}, +{"tmosms0", {NULL}, 5580, "udp"}, +{"tmosms1", {NULL}, 5581, "tcp"}, +{"tmosms1", {NULL}, 5581, "udp"}, +{"fac-restore", {NULL}, 5582, "tcp"}, +{"fac-restore", {NULL}, 5582, "udp"}, +{"tmo-icon-sync", {NULL}, 5583, "tcp"}, +{"tmo-icon-sync", {NULL}, 5583, "udp"}, +{"bis-web", {NULL}, 5584, "tcp"}, +{"bis-web", {NULL}, 5584, "udp"}, +{"bis-sync", {NULL}, 5585, "tcp"}, +{"bis-sync", {NULL}, 5585, "udp"}, +{"ininmessaging", {NULL}, 5597, "tcp"}, +{"ininmessaging", {NULL}, 5597, "udp"}, +{"mctfeed", {NULL}, 5598, "tcp"}, +{"mctfeed", {NULL}, 5598, "udp"}, +{"esinstall", {NULL}, 5599, "tcp"}, +{"esinstall", {NULL}, 5599, "udp"}, +{"esmmanager", {NULL}, 5600, "tcp"}, +{"esmmanager", {NULL}, 5600, "udp"}, +{"esmagent", {NULL}, 5601, "tcp"}, +{"esmagent", {NULL}, 5601, "udp"}, +{"a1-msc", {NULL}, 5602, "tcp"}, +{"a1-msc", {NULL}, 5602, "udp"}, +{"a1-bs", {NULL}, 5603, "tcp"}, +{"a1-bs", {NULL}, 5603, "udp"}, +{"a3-sdunode", {NULL}, 5604, "tcp"}, +{"a3-sdunode", {NULL}, 5604, "udp"}, +{"a4-sdunode", {NULL}, 5605, "tcp"}, +{"a4-sdunode", {NULL}, 5605, "udp"}, +{"ninaf", {NULL}, 5627, "tcp"}, +{"ninaf", {NULL}, 5627, "udp"}, +{"htrust", {NULL}, 5628, "tcp"}, +{"htrust", {NULL}, 5628, "udp"}, +{"symantec-sfdb", {NULL}, 5629, "tcp"}, +{"symantec-sfdb", {NULL}, 5629, "udp"}, +{"precise-comm", {NULL}, 5630, "tcp"}, +{"precise-comm", {NULL}, 5630, "udp"}, +{"pcanywheredata", {NULL}, 5631, "tcp"}, +{"pcanywheredata", {NULL}, 5631, "udp"}, +{"pcanywherestat", {NULL}, 5632, "tcp"}, +{"pcanywherestat", {NULL}, 5632, "udp"}, +{"beorl", {NULL}, 5633, "tcp"}, +{"beorl", {NULL}, 5633, "udp"}, +{"xprtld", {NULL}, 5634, "tcp"}, +{"xprtld", {NULL}, 5634, "udp"}, +{"sfmsso", {NULL}, 5635, "tcp"}, +{"sfm-db-server", {NULL}, 5636, "tcp"}, +{"cssc", {NULL}, 5637, "tcp"}, +{"amqps", {NULL}, 5671, "tcp"}, +{"amqps", {NULL}, 5671, "udp"}, +{"amqp", {NULL}, 5672, "tcp"}, +{"amqp", {NULL}, 5672, "udp"}, +{"amqp", {NULL}, 5672, "sctp"}, +{"jms", {NULL}, 5673, "tcp"}, +{"jms", {NULL}, 5673, "udp"}, +{"hyperscsi-port", {NULL}, 5674, "tcp"}, +{"hyperscsi-port", {NULL}, 5674, "udp"}, +{"v5ua", {NULL}, 5675, "tcp"}, +{"v5ua", {NULL}, 5675, "udp"}, +{"v5ua", {NULL}, 5675, "sctp"}, +{"raadmin", {NULL}, 5676, "tcp"}, +{"raadmin", {NULL}, 5676, "udp"}, +{"questdb2-lnchr", {NULL}, 5677, "tcp"}, +{"questdb2-lnchr", {NULL}, 5677, "udp"}, +{"rrac", {NULL}, 5678, "tcp"}, +{"rrac", {NULL}, 5678, "udp"}, +{"dccm", {NULL}, 5679, "tcp"}, +{"dccm", {NULL}, 5679, "udp"}, +{"auriga-router", {NULL}, 5680, "tcp"}, +{"auriga-router", {NULL}, 5680, "udp"}, +{"ncxcp", {NULL}, 5681, "tcp"}, +{"ncxcp", {NULL}, 5681, "udp"}, +{"brightcore", {NULL}, 5682, "udp"}, +{"ggz", {NULL}, 5688, "tcp"}, +{"ggz", {NULL}, 5688, "udp"}, +{"qmvideo", {NULL}, 5689, "tcp"}, +{"qmvideo", {NULL}, 5689, "udp"}, +{"proshareaudio", {NULL}, 5713, "tcp"}, +{"proshareaudio", {NULL}, 5713, "udp"}, +{"prosharevideo", {NULL}, 5714, "tcp"}, +{"prosharevideo", {NULL}, 5714, "udp"}, +{"prosharedata", {NULL}, 5715, "tcp"}, +{"prosharedata", {NULL}, 5715, "udp"}, +{"prosharerequest", {NULL}, 5716, "tcp"}, +{"prosharerequest", {NULL}, 5716, "udp"}, +{"prosharenotify", {NULL}, 5717, "tcp"}, +{"prosharenotify", {NULL}, 5717, "udp"}, +{"dpm", {NULL}, 5718, "tcp"}, +{"dpm", {NULL}, 5718, "udp"}, +{"dpm-agent", {NULL}, 5719, "tcp"}, +{"dpm-agent", {NULL}, 5719, "udp"}, +{"ms-licensing", {NULL}, 5720, "tcp"}, +{"ms-licensing", {NULL}, 5720, "udp"}, +{"dtpt", {NULL}, 5721, "tcp"}, +{"dtpt", {NULL}, 5721, "udp"}, +{"msdfsr", {NULL}, 5722, "tcp"}, +{"msdfsr", {NULL}, 5722, "udp"}, +{"omhs", {NULL}, 5723, "tcp"}, +{"omhs", {NULL}, 5723, "udp"}, +{"omsdk", {NULL}, 5724, "tcp"}, +{"omsdk", {NULL}, 5724, "udp"}, +{"ms-ilm", {NULL}, 5725, "tcp"}, +{"ms-ilm-sts", {NULL}, 5726, "tcp"}, +{"asgenf", {NULL}, 5727, "tcp"}, +{"io-dist-data", {NULL}, 5728, "tcp"}, +{"io-dist-group", {NULL}, 5728, "udp"}, +{"openmail", {NULL}, 5729, "tcp"}, +{"openmail", {NULL}, 5729, "udp"}, +{"unieng", {NULL}, 5730, "tcp"}, +{"unieng", {NULL}, 5730, "udp"}, +{"ida-discover1", {NULL}, 5741, "tcp"}, +{"ida-discover1", {NULL}, 5741, "udp"}, +{"ida-discover2", {NULL}, 5742, "tcp"}, +{"ida-discover2", {NULL}, 5742, "udp"}, +{"watchdoc-pod", {NULL}, 5743, "tcp"}, +{"watchdoc-pod", {NULL}, 5743, "udp"}, +{"watchdoc", {NULL}, 5744, "tcp"}, +{"watchdoc", {NULL}, 5744, "udp"}, +{"fcopy-server", {NULL}, 5745, "tcp"}, +{"fcopy-server", {NULL}, 5745, "udp"}, +{"fcopys-server", {NULL}, 5746, "tcp"}, +{"fcopys-server", {NULL}, 5746, "udp"}, +{"tunatic", {NULL}, 5747, "tcp"}, +{"tunatic", {NULL}, 5747, "udp"}, +{"tunalyzer", {NULL}, 5748, "tcp"}, +{"tunalyzer", {NULL}, 5748, "udp"}, +{"rscd", {NULL}, 5750, "tcp"}, +{"rscd", {NULL}, 5750, "udp"}, +{"openmailg", {NULL}, 5755, "tcp"}, +{"openmailg", {NULL}, 5755, "udp"}, +{"x500ms", {NULL}, 5757, "tcp"}, +{"x500ms", {NULL}, 5757, "udp"}, +{"openmailns", {NULL}, 5766, "tcp"}, +{"openmailns", {NULL}, 5766, "udp"}, +{"s-openmail", {NULL}, 5767, "tcp"}, +{"s-openmail", {NULL}, 5767, "udp"}, +{"openmailpxy", {NULL}, 5768, "tcp"}, +{"openmailpxy", {NULL}, 5768, "udp"}, +{"spramsca", {NULL}, 5769, "tcp"}, +{"spramsca", {NULL}, 5769, "udp"}, +{"spramsd", {NULL}, 5770, "tcp"}, +{"spramsd", {NULL}, 5770, "udp"}, +{"netagent", {NULL}, 5771, "tcp"}, +{"netagent", {NULL}, 5771, "udp"}, +{"dali-port", {NULL}, 5777, "tcp"}, +{"dali-port", {NULL}, 5777, "udp"}, +{"vts-rpc", {NULL}, 5780, "tcp"}, +{"3par-evts", {NULL}, 5781, "tcp"}, +{"3par-evts", {NULL}, 5781, "udp"}, +{"3par-mgmt", {NULL}, 5782, "tcp"}, +{"3par-mgmt", {NULL}, 5782, "udp"}, +{"3par-mgmt-ssl", {NULL}, 5783, "tcp"}, +{"3par-mgmt-ssl", {NULL}, 5783, "udp"}, +{"ibar", {NULL}, 5784, "udp"}, +{"3par-rcopy", {NULL}, 5785, "tcp"}, +{"3par-rcopy", {NULL}, 5785, "udp"}, +{"cisco-redu", {NULL}, 5786, "udp"}, +{"waascluster", {NULL}, 5787, "udp"}, +{"xtreamx", {NULL}, 5793, "tcp"}, +{"xtreamx", {NULL}, 5793, "udp"}, +{"spdp", {NULL}, 5794, "udp"}, +{"icmpd", {NULL}, 5813, "tcp"}, +{"icmpd", {NULL}, 5813, "udp"}, +{"spt-automation", {NULL}, 5814, "tcp"}, +{"spt-automation", {NULL}, 5814, "udp"}, +{"wherehoo", {NULL}, 5859, "tcp"}, +{"wherehoo", {NULL}, 5859, "udp"}, +{"ppsuitemsg", {NULL}, 5863, "tcp"}, +{"ppsuitemsg", {NULL}, 5863, "udp"}, +{"rfb", {NULL}, 5900, "tcp"}, +{"rfb", {NULL}, 5900, "udp"}, +{"cm", {NULL}, 5910, "tcp"}, +{"cm", {NULL}, 5910, "udp"}, +{"cpdlc", {NULL}, 5911, "tcp"}, +{"cpdlc", {NULL}, 5911, "udp"}, +{"fis", {NULL}, 5912, "tcp"}, +{"fis", {NULL}, 5912, "udp"}, +{"ads-c", {NULL}, 5913, "tcp"}, +{"ads-c", {NULL}, 5913, "udp"}, +{"indy", {NULL}, 5963, "tcp"}, +{"indy", {NULL}, 5963, "udp"}, +{"mppolicy-v5", {NULL}, 5968, "tcp"}, +{"mppolicy-v5", {NULL}, 5968, "udp"}, +{"mppolicy-mgr", {NULL}, 5969, "tcp"}, +{"mppolicy-mgr", {NULL}, 5969, "udp"}, +{"couchdb", {NULL}, 5984, "tcp"}, +{"couchdb", {NULL}, 5984, "udp"}, +{"wsman", {NULL}, 5985, "tcp"}, +{"wsman", {NULL}, 5985, "udp"}, +{"wsmans", {NULL}, 5986, "tcp"}, +{"wsmans", {NULL}, 5986, "udp"}, +{"wbem-rmi", {NULL}, 5987, "tcp"}, +{"wbem-rmi", {NULL}, 5987, "udp"}, +{"wbem-http", {NULL}, 5988, "tcp"}, +{"wbem-http", {NULL}, 5988, "udp"}, +{"wbem-https", {NULL}, 5989, "tcp"}, +{"wbem-https", {NULL}, 5989, "udp"}, +{"wbem-exp-https", {NULL}, 5990, "tcp"}, +{"wbem-exp-https", {NULL}, 5990, "udp"}, +{"nuxsl", {NULL}, 5991, "tcp"}, +{"nuxsl", {NULL}, 5991, "udp"}, +{"consul-insight", {NULL}, 5992, "tcp"}, +{"consul-insight", {NULL}, 5992, "udp"}, +{"cvsup", {NULL}, 5999, "tcp"}, +{"cvsup", {NULL}, 5999, "udp"}, +{"ndl-ahp-svc", {NULL}, 6064, "tcp"}, +{"ndl-ahp-svc", {NULL}, 6064, "udp"}, +{"winpharaoh", {NULL}, 6065, "tcp"}, +{"winpharaoh", {NULL}, 6065, "udp"}, +{"ewctsp", {NULL}, 6066, "tcp"}, +{"ewctsp", {NULL}, 6066, "udp"}, +{"gsmp", {NULL}, 6068, "tcp"}, +{"gsmp", {NULL}, 6068, "udp"}, +{"trip", {NULL}, 6069, "tcp"}, +{"trip", {NULL}, 6069, "udp"}, +{"messageasap", {NULL}, 6070, "tcp"}, +{"messageasap", {NULL}, 6070, "udp"}, +{"ssdtp", {NULL}, 6071, "tcp"}, +{"ssdtp", {NULL}, 6071, "udp"}, +{"diagnose-proc", {NULL}, 6072, "tcp"}, +{"diagnose-proc", {NULL}, 6072, "udp"}, +{"directplay8", {NULL}, 6073, "tcp"}, +{"directplay8", {NULL}, 6073, "udp"}, +{"max", {NULL}, 6074, "tcp"}, +{"max", {NULL}, 6074, "udp"}, +{"dpm-acm", {NULL}, 6075, "tcp"}, +{"miami-bcast", {NULL}, 6083, "udp"}, +{"p2p-sip", {NULL}, 6084, "tcp"}, +{"konspire2b", {NULL}, 6085, "tcp"}, +{"konspire2b", {NULL}, 6085, "udp"}, +{"pdtp", {NULL}, 6086, "tcp"}, +{"pdtp", {NULL}, 6086, "udp"}, +{"ldss", {NULL}, 6087, "tcp"}, +{"ldss", {NULL}, 6087, "udp"}, +{"raxa-mgmt", {NULL}, 6099, "tcp"}, +{"synchronet-db", {NULL}, 6100, "tcp"}, +{"synchronet-db", {NULL}, 6100, "udp"}, +{"synchronet-rtc", {NULL}, 6101, "tcp"}, +{"synchronet-rtc", {NULL}, 6101, "udp"}, +{"synchronet-upd", {NULL}, 6102, "tcp"}, +{"synchronet-upd", {NULL}, 6102, "udp"}, +{"rets", {NULL}, 6103, "tcp"}, +{"rets", {NULL}, 6103, "udp"}, +{"dbdb", {NULL}, 6104, "tcp"}, +{"dbdb", {NULL}, 6104, "udp"}, +{"primaserver", {NULL}, 6105, "tcp"}, +{"primaserver", {NULL}, 6105, "udp"}, +{"mpsserver", {NULL}, 6106, "tcp"}, +{"mpsserver", {NULL}, 6106, "udp"}, +{"etc-control", {NULL}, 6107, "tcp"}, +{"etc-control", {NULL}, 6107, "udp"}, +{"sercomm-scadmin", {NULL}, 6108, "tcp"}, +{"sercomm-scadmin", {NULL}, 6108, "udp"}, +{"globecast-id", {NULL}, 6109, "tcp"}, +{"globecast-id", {NULL}, 6109, "udp"}, +{"softcm", {NULL}, 6110, "tcp"}, +{"softcm", {NULL}, 6110, "udp"}, +{"spc", {NULL}, 6111, "tcp"}, +{"spc", {NULL}, 6111, "udp"}, +{"dtspcd", {NULL}, 6112, "tcp"}, +{"dtspcd", {NULL}, 6112, "udp"}, +{"dayliteserver", {NULL}, 6113, "tcp"}, +{"wrspice", {NULL}, 6114, "tcp"}, +{"xic", {NULL}, 6115, "tcp"}, +{"xtlserv", {NULL}, 6116, "tcp"}, +{"daylitetouch", {NULL}, 6117, "tcp"}, +{"spdy", {NULL}, 6121, "tcp"}, +{"bex-webadmin", {NULL}, 6122, "tcp"}, +{"bex-webadmin", {NULL}, 6122, "udp"}, +{"backup-express", {NULL}, 6123, "tcp"}, +{"backup-express", {NULL}, 6123, "udp"}, +{"pnbs", {NULL}, 6124, "tcp"}, +{"pnbs", {NULL}, 6124, "udp"}, +{"nbt-wol", {NULL}, 6133, "tcp"}, +{"nbt-wol", {NULL}, 6133, "udp"}, +{"pulsonixnls", {NULL}, 6140, "tcp"}, +{"pulsonixnls", {NULL}, 6140, "udp"}, +{"meta-corp", {NULL}, 6141, "tcp"}, +{"meta-corp", {NULL}, 6141, "udp"}, +{"aspentec-lm", {NULL}, 6142, "tcp"}, +{"aspentec-lm", {NULL}, 6142, "udp"}, +{"watershed-lm", {NULL}, 6143, "tcp"}, +{"watershed-lm", {NULL}, 6143, "udp"}, +{"statsci1-lm", {NULL}, 6144, "tcp"}, +{"statsci1-lm", {NULL}, 6144, "udp"}, +{"statsci2-lm", {NULL}, 6145, "tcp"}, +{"statsci2-lm", {NULL}, 6145, "udp"}, +{"lonewolf-lm", {NULL}, 6146, "tcp"}, +{"lonewolf-lm", {NULL}, 6146, "udp"}, +{"montage-lm", {NULL}, 6147, "tcp"}, +{"montage-lm", {NULL}, 6147, "udp"}, +{"ricardo-lm", {NULL}, 6148, "tcp"}, +{"ricardo-lm", {NULL}, 6148, "udp"}, +{"tal-pod", {NULL}, 6149, "tcp"}, +{"tal-pod", {NULL}, 6149, "udp"}, +{"efb-aci", {NULL}, 6159, "tcp"}, +{"patrol-ism", {NULL}, 6161, "tcp"}, +{"patrol-ism", {NULL}, 6161, "udp"}, +{"patrol-coll", {NULL}, 6162, "tcp"}, +{"patrol-coll", {NULL}, 6162, "udp"}, +{"pscribe", {NULL}, 6163, "tcp"}, +{"pscribe", {NULL}, 6163, "udp"}, +{"lm-x", {NULL}, 6200, "tcp"}, +{"lm-x", {NULL}, 6200, "udp"}, +{"radmind", {NULL}, 6222, "tcp"}, +{"radmind", {NULL}, 6222, "udp"}, +{"jeol-nsdtp-1", {NULL}, 6241, "tcp"}, +{"jeol-nsddp-1", {NULL}, 6241, "udp"}, +{"jeol-nsdtp-2", {NULL}, 6242, "tcp"}, +{"jeol-nsddp-2", {NULL}, 6242, "udp"}, +{"jeol-nsdtp-3", {NULL}, 6243, "tcp"}, +{"jeol-nsddp-3", {NULL}, 6243, "udp"}, +{"jeol-nsdtp-4", {NULL}, 6244, "tcp"}, +{"jeol-nsddp-4", {NULL}, 6244, "udp"}, +{"tl1-raw-ssl", {NULL}, 6251, "tcp"}, +{"tl1-raw-ssl", {NULL}, 6251, "udp"}, +{"tl1-ssh", {NULL}, 6252, "tcp"}, +{"tl1-ssh", {NULL}, 6252, "udp"}, +{"crip", {NULL}, 6253, "tcp"}, +{"crip", {NULL}, 6253, "udp"}, +{"gld", {NULL}, 6267, "tcp"}, +{"grid", {NULL}, 6268, "tcp"}, +{"grid", {NULL}, 6268, "udp"}, +{"grid-alt", {NULL}, 6269, "tcp"}, +{"grid-alt", {NULL}, 6269, "udp"}, +{"bmc-grx", {NULL}, 6300, "tcp"}, +{"bmc-grx", {NULL}, 6300, "udp"}, +{"bmc_ctd_ldap", {NULL}, 6301, "tcp"}, +{"bmc_ctd_ldap", {NULL}, 6301, "udp"}, +{"ufmp", {NULL}, 6306, "tcp"}, +{"ufmp", {NULL}, 6306, "udp"}, +{"scup", {NULL}, 6315, "tcp"}, +{"scup-disc", {NULL}, 6315, "udp"}, +{"abb-escp", {NULL}, 6316, "tcp"}, +{"abb-escp", {NULL}, 6316, "udp"}, +{"repsvc", {NULL}, 6320, "tcp"}, +{"repsvc", {NULL}, 6320, "udp"}, +{"emp-server1", {NULL}, 6321, "tcp"}, +{"emp-server1", {NULL}, 6321, "udp"}, +{"emp-server2", {NULL}, 6322, "tcp"}, +{"emp-server2", {NULL}, 6322, "udp"}, +{"sflow", {NULL}, 6343, "tcp"}, +{"sflow", {NULL}, 6343, "udp"}, +{"gnutella-svc", {NULL}, 6346, "tcp"}, +{"gnutella-svc", {NULL}, 6346, "udp"}, +{"gnutella-rtr", {NULL}, 6347, "tcp"}, +{"gnutella-rtr", {NULL}, 6347, "udp"}, +{"adap", {NULL}, 6350, "tcp"}, +{"adap", {NULL}, 6350, "udp"}, +{"pmcs", {NULL}, 6355, "tcp"}, +{"pmcs", {NULL}, 6355, "udp"}, +{"metaedit-mu", {NULL}, 6360, "tcp"}, +{"metaedit-mu", {NULL}, 6360, "udp"}, +{"metaedit-se", {NULL}, 6370, "tcp"}, +{"metaedit-se", {NULL}, 6370, "udp"}, +{"metatude-mds", {NULL}, 6382, "tcp"}, +{"metatude-mds", {NULL}, 6382, "udp"}, +{"clariion-evr01", {NULL}, 6389, "tcp"}, +{"clariion-evr01", {NULL}, 6389, "udp"}, +{"metaedit-ws", {NULL}, 6390, "tcp"}, +{"metaedit-ws", {NULL}, 6390, "udp"}, +{"faxcomservice", {NULL}, 6417, "tcp"}, +{"faxcomservice", {NULL}, 6417, "udp"}, +{"syserverremote", {NULL}, 6418, "tcp"}, +{"svdrp", {NULL}, 6419, "tcp"}, +{"nim-vdrshell", {NULL}, 6420, "tcp"}, +{"nim-vdrshell", {NULL}, 6420, "udp"}, +{"nim-wan", {NULL}, 6421, "tcp"}, +{"nim-wan", {NULL}, 6421, "udp"}, +{"pgbouncer", {NULL}, 6432, "tcp"}, +{"sun-sr-https", {NULL}, 6443, "tcp"}, +{"sun-sr-https", {NULL}, 6443, "udp"}, +{"sge_qmaster", {NULL}, 6444, "tcp"}, +{"sge_qmaster", {NULL}, 6444, "udp"}, +{"sge_execd", {NULL}, 6445, "tcp"}, +{"sge_execd", {NULL}, 6445, "udp"}, +{"mysql-proxy", {NULL}, 6446, "tcp"}, +{"mysql-proxy", {NULL}, 6446, "udp"}, +{"skip-cert-recv", {NULL}, 6455, "tcp"}, +{"skip-cert-send", {NULL}, 6456, "udp"}, +{"lvision-lm", {NULL}, 6471, "tcp"}, +{"lvision-lm", {NULL}, 6471, "udp"}, +{"sun-sr-http", {NULL}, 6480, "tcp"}, +{"sun-sr-http", {NULL}, 6480, "udp"}, +{"servicetags", {NULL}, 6481, "tcp"}, +{"servicetags", {NULL}, 6481, "udp"}, +{"ldoms-mgmt", {NULL}, 6482, "tcp"}, +{"ldoms-mgmt", {NULL}, 6482, "udp"}, +{"SunVTS-RMI", {NULL}, 6483, "tcp"}, +{"SunVTS-RMI", {NULL}, 6483, "udp"}, +{"sun-sr-jms", {NULL}, 6484, "tcp"}, +{"sun-sr-jms", {NULL}, 6484, "udp"}, +{"sun-sr-iiop", {NULL}, 6485, "tcp"}, +{"sun-sr-iiop", {NULL}, 6485, "udp"}, +{"sun-sr-iiops", {NULL}, 6486, "tcp"}, +{"sun-sr-iiops", {NULL}, 6486, "udp"}, +{"sun-sr-iiop-aut", {NULL}, 6487, "tcp"}, +{"sun-sr-iiop-aut", {NULL}, 6487, "udp"}, +{"sun-sr-jmx", {NULL}, 6488, "tcp"}, +{"sun-sr-jmx", {NULL}, 6488, "udp"}, +{"sun-sr-admin", {NULL}, 6489, "tcp"}, +{"sun-sr-admin", {NULL}, 6489, "udp"}, +{"boks", {NULL}, 6500, "tcp"}, +{"boks", {NULL}, 6500, "udp"}, +{"boks_servc", {NULL}, 6501, "tcp"}, +{"boks_servc", {NULL}, 6501, "udp"}, +{"boks_servm", {NULL}, 6502, "tcp"}, +{"boks_servm", {NULL}, 6502, "udp"}, +{"boks_clntd", {NULL}, 6503, "tcp"}, +{"boks_clntd", {NULL}, 6503, "udp"}, +{"badm_priv", {NULL}, 6505, "tcp"}, +{"badm_priv", {NULL}, 6505, "udp"}, +{"badm_pub", {NULL}, 6506, "tcp"}, +{"badm_pub", {NULL}, 6506, "udp"}, +{"bdir_priv", {NULL}, 6507, "tcp"}, +{"bdir_priv", {NULL}, 6507, "udp"}, +{"bdir_pub", {NULL}, 6508, "tcp"}, +{"bdir_pub", {NULL}, 6508, "udp"}, +{"mgcs-mfp-port", {NULL}, 6509, "tcp"}, +{"mgcs-mfp-port", {NULL}, 6509, "udp"}, +{"mcer-port", {NULL}, 6510, "tcp"}, +{"mcer-port", {NULL}, 6510, "udp"}, +{"netconf-tls", {NULL}, 6513, "tcp"}, +{"syslog-tls", {NULL}, 6514, "tcp"}, +{"syslog-tls", {NULL}, 6514, "udp"}, +{"syslog-tls", {NULL}, 6514, "dccp"}, +{"elipse-rec", {NULL}, 6515, "tcp"}, +{"elipse-rec", {NULL}, 6515, "udp"}, +{"lds-distrib", {NULL}, 6543, "tcp"}, +{"lds-distrib", {NULL}, 6543, "udp"}, +{"lds-dump", {NULL}, 6544, "tcp"}, +{"lds-dump", {NULL}, 6544, "udp"}, +{"apc-6547", {NULL}, 6547, "tcp"}, +{"apc-6547", {NULL}, 6547, "udp"}, +{"apc-6548", {NULL}, 6548, "tcp"}, +{"apc-6548", {NULL}, 6548, "udp"}, +{"apc-6549", {NULL}, 6549, "tcp"}, +{"apc-6549", {NULL}, 6549, "udp"}, +{"fg-sysupdate", {NULL}, 6550, "tcp"}, +{"fg-sysupdate", {NULL}, 6550, "udp"}, +{"sum", {NULL}, 6551, "tcp"}, +{"sum", {NULL}, 6551, "udp"}, +{"xdsxdm", {NULL}, 6558, "tcp"}, +{"xdsxdm", {NULL}, 6558, "udp"}, +{"sane-port", {NULL}, 6566, "tcp"}, +{"sane-port", {NULL}, 6566, "udp"}, +{"esp", {NULL}, 6567, "tcp"}, +{"esp", {NULL}, 6567, "udp"}, +{"canit_store", {NULL}, 6568, "tcp"}, +{"rp-reputation", {NULL}, 6568, "udp"}, +{"affiliate", {NULL}, 6579, "tcp"}, +{"affiliate", {NULL}, 6579, "udp"}, +{"parsec-master", {NULL}, 6580, "tcp"}, +{"parsec-master", {NULL}, 6580, "udp"}, +{"parsec-peer", {NULL}, 6581, "tcp"}, +{"parsec-peer", {NULL}, 6581, "udp"}, +{"parsec-game", {NULL}, 6582, "tcp"}, +{"parsec-game", {NULL}, 6582, "udp"}, +{"joaJewelSuite", {NULL}, 6583, "tcp"}, +{"joaJewelSuite", {NULL}, 6583, "udp"}, +{"mshvlm", {NULL}, 6600, "tcp"}, +{"mstmg-sstp", {NULL}, 6601, "tcp"}, +{"wsscomfrmwk", {NULL}, 6602, "tcp"}, +{"odette-ftps", {NULL}, 6619, "tcp"}, +{"odette-ftps", {NULL}, 6619, "udp"}, +{"kftp-data", {NULL}, 6620, "tcp"}, +{"kftp-data", {NULL}, 6620, "udp"}, +{"kftp", {NULL}, 6621, "tcp"}, +{"kftp", {NULL}, 6621, "udp"}, +{"mcftp", {NULL}, 6622, "tcp"}, +{"mcftp", {NULL}, 6622, "udp"}, +{"ktelnet", {NULL}, 6623, "tcp"}, +{"ktelnet", {NULL}, 6623, "udp"}, +{"datascaler-db", {NULL}, 6624, "tcp"}, +{"datascaler-ctl", {NULL}, 6625, "tcp"}, +{"wago-service", {NULL}, 6626, "tcp"}, +{"wago-service", {NULL}, 6626, "udp"}, +{"nexgen", {NULL}, 6627, "tcp"}, +{"nexgen", {NULL}, 6627, "udp"}, +{"afesc-mc", {NULL}, 6628, "tcp"}, +{"afesc-mc", {NULL}, 6628, "udp"}, +{"mxodbc-connect", {NULL}, 6632, "tcp"}, +{"pcs-sf-ui-man", {NULL}, 6655, "tcp"}, +{"emgmsg", {NULL}, 6656, "tcp"}, +{"palcom-disc", {NULL}, 6657, "udp"}, +{"vocaltec-gold", {NULL}, 6670, "tcp"}, +{"vocaltec-gold", {NULL}, 6670, "udp"}, +{"p4p-portal", {NULL}, 6671, "tcp"}, +{"p4p-portal", {NULL}, 6671, "udp"}, +{"vision_server", {NULL}, 6672, "tcp"}, +{"vision_server", {NULL}, 6672, "udp"}, +{"vision_elmd", {NULL}, 6673, "tcp"}, +{"vision_elmd", {NULL}, 6673, "udp"}, +{"vfbp", {NULL}, 6678, "tcp"}, +{"vfbp-disc", {NULL}, 6678, "udp"}, +{"osaut", {NULL}, 6679, "tcp"}, +{"osaut", {NULL}, 6679, "udp"}, +{"clever-ctrace", {NULL}, 6687, "tcp"}, +{"clever-tcpip", {NULL}, 6688, "tcp"}, +{"tsa", {NULL}, 6689, "tcp"}, +{"tsa", {NULL}, 6689, "udp"}, +{"babel", {NULL}, 6697, "udp"}, +{"kti-icad-srvr", {NULL}, 6701, "tcp"}, +{"kti-icad-srvr", {NULL}, 6701, "udp"}, +{"e-design-net", {NULL}, 6702, "tcp"}, +{"e-design-net", {NULL}, 6702, "udp"}, +{"e-design-web", {NULL}, 6703, "tcp"}, +{"e-design-web", {NULL}, 6703, "udp"}, +{"frc-hp", {NULL}, 6704, "sctp"}, +{"frc-mp", {NULL}, 6705, "sctp"}, +{"frc-lp", {NULL}, 6706, "sctp"}, +{"ibprotocol", {NULL}, 6714, "tcp"}, +{"ibprotocol", {NULL}, 6714, "udp"}, +{"fibotrader-com", {NULL}, 6715, "tcp"}, +{"fibotrader-com", {NULL}, 6715, "udp"}, +{"bmc-perf-agent", {NULL}, 6767, "tcp"}, +{"bmc-perf-agent", {NULL}, 6767, "udp"}, +{"bmc-perf-mgrd", {NULL}, 6768, "tcp"}, +{"bmc-perf-mgrd", {NULL}, 6768, "udp"}, +{"adi-gxp-srvprt", {NULL}, 6769, "tcp"}, +{"adi-gxp-srvprt", {NULL}, 6769, "udp"}, +{"plysrv-http", {NULL}, 6770, "tcp"}, +{"plysrv-http", {NULL}, 6770, "udp"}, +{"plysrv-https", {NULL}, 6771, "tcp"}, +{"plysrv-https", {NULL}, 6771, "udp"}, +{"dgpf-exchg", {NULL}, 6785, "tcp"}, +{"dgpf-exchg", {NULL}, 6785, "udp"}, +{"smc-jmx", {NULL}, 6786, "tcp"}, +{"smc-jmx", {NULL}, 6786, "udp"}, +{"smc-admin", {NULL}, 6787, "tcp"}, +{"smc-admin", {NULL}, 6787, "udp"}, +{"smc-http", {NULL}, 6788, "tcp"}, +{"smc-http", {NULL}, 6788, "udp"}, +{"smc-https", {NULL}, 6789, "tcp"}, +{"smc-https", {NULL}, 6789, "udp"}, +{"hnmp", {NULL}, 6790, "tcp"}, +{"hnmp", {NULL}, 6790, "udp"}, +{"hnm", {NULL}, 6791, "tcp"}, +{"hnm", {NULL}, 6791, "udp"}, +{"acnet", {NULL}, 6801, "tcp"}, +{"acnet", {NULL}, 6801, "udp"}, +{"pentbox-sim", {NULL}, 6817, "tcp"}, +{"ambit-lm", {NULL}, 6831, "tcp"}, +{"ambit-lm", {NULL}, 6831, "udp"}, +{"netmo-default", {NULL}, 6841, "tcp"}, +{"netmo-default", {NULL}, 6841, "udp"}, +{"netmo-http", {NULL}, 6842, "tcp"}, +{"netmo-http", {NULL}, 6842, "udp"}, +{"iccrushmore", {NULL}, 6850, "tcp"}, +{"iccrushmore", {NULL}, 6850, "udp"}, +{"acctopus-cc", {NULL}, 6868, "tcp"}, +{"acctopus-st", {NULL}, 6868, "udp"}, +{"muse", {NULL}, 6888, "tcp"}, +{"muse", {NULL}, 6888, "udp"}, +{"jetstream", {NULL}, 6901, "tcp"}, +{"xsmsvc", {NULL}, 6936, "tcp"}, +{"xsmsvc", {NULL}, 6936, "udp"}, +{"bioserver", {NULL}, 6946, "tcp"}, +{"bioserver", {NULL}, 6946, "udp"}, +{"otlp", {NULL}, 6951, "tcp"}, +{"otlp", {NULL}, 6951, "udp"}, +{"jmact3", {NULL}, 6961, "tcp"}, +{"jmact3", {NULL}, 6961, "udp"}, +{"jmevt2", {NULL}, 6962, "tcp"}, +{"jmevt2", {NULL}, 6962, "udp"}, +{"swismgr1", {NULL}, 6963, "tcp"}, +{"swismgr1", {NULL}, 6963, "udp"}, +{"swismgr2", {NULL}, 6964, "tcp"}, +{"swismgr2", {NULL}, 6964, "udp"}, +{"swistrap", {NULL}, 6965, "tcp"}, +{"swistrap", {NULL}, 6965, "udp"}, +{"swispol", {NULL}, 6966, "tcp"}, +{"swispol", {NULL}, 6966, "udp"}, +{"acmsoda", {NULL}, 6969, "tcp"}, +{"acmsoda", {NULL}, 6969, "udp"}, +{"MobilitySrv", {NULL}, 6997, "tcp"}, +{"MobilitySrv", {NULL}, 6997, "udp"}, +{"iatp-highpri", {NULL}, 6998, "tcp"}, +{"iatp-highpri", {NULL}, 6998, "udp"}, +{"iatp-normalpri", {NULL}, 6999, "tcp"}, +{"iatp-normalpri", {NULL}, 6999, "udp"}, +{"afs3-fileserver", {NULL}, 7000, "tcp"}, +{"afs3-fileserver", {NULL}, 7000, "udp"}, +{"afs3-callback", {NULL}, 7001, "tcp"}, +{"afs3-callback", {NULL}, 7001, "udp"}, +{"afs3-prserver", {NULL}, 7002, "tcp"}, +{"afs3-prserver", {NULL}, 7002, "udp"}, +{"afs3-vlserver", {NULL}, 7003, "tcp"}, +{"afs3-vlserver", {NULL}, 7003, "udp"}, +{"afs3-kaserver", {NULL}, 7004, "tcp"}, +{"afs3-kaserver", {NULL}, 7004, "udp"}, +{"afs3-volser", {NULL}, 7005, "tcp"}, +{"afs3-volser", {NULL}, 7005, "udp"}, +{"afs3-errors", {NULL}, 7006, "tcp"}, +{"afs3-errors", {NULL}, 7006, "udp"}, +{"afs3-bos", {NULL}, 7007, "tcp"}, +{"afs3-bos", {NULL}, 7007, "udp"}, +{"afs3-update", {NULL}, 7008, "tcp"}, +{"afs3-update", {NULL}, 7008, "udp"}, +{"afs3-rmtsys", {NULL}, 7009, "tcp"}, +{"afs3-rmtsys", {NULL}, 7009, "udp"}, +{"ups-onlinet", {NULL}, 7010, "tcp"}, +{"ups-onlinet", {NULL}, 7010, "udp"}, +{"talon-disc", {NULL}, 7011, "tcp"}, +{"talon-disc", {NULL}, 7011, "udp"}, +{"talon-engine", {NULL}, 7012, "tcp"}, +{"talon-engine", {NULL}, 7012, "udp"}, +{"microtalon-dis", {NULL}, 7013, "tcp"}, +{"microtalon-dis", {NULL}, 7013, "udp"}, +{"microtalon-com", {NULL}, 7014, "tcp"}, +{"microtalon-com", {NULL}, 7014, "udp"}, +{"talon-webserver", {NULL}, 7015, "tcp"}, +{"talon-webserver", {NULL}, 7015, "udp"}, +{"dpserve", {NULL}, 7020, "tcp"}, +{"dpserve", {NULL}, 7020, "udp"}, +{"dpserveadmin", {NULL}, 7021, "tcp"}, +{"dpserveadmin", {NULL}, 7021, "udp"}, +{"ctdp", {NULL}, 7022, "tcp"}, +{"ctdp", {NULL}, 7022, "udp"}, +{"ct2nmcs", {NULL}, 7023, "tcp"}, +{"ct2nmcs", {NULL}, 7023, "udp"}, +{"vmsvc", {NULL}, 7024, "tcp"}, +{"vmsvc", {NULL}, 7024, "udp"}, +{"vmsvc-2", {NULL}, 7025, "tcp"}, +{"vmsvc-2", {NULL}, 7025, "udp"}, +{"op-probe", {NULL}, 7030, "tcp"}, +{"op-probe", {NULL}, 7030, "udp"}, +{"arcp", {NULL}, 7070, "tcp"}, +{"arcp", {NULL}, 7070, "udp"}, +{"iwg1", {NULL}, 7071, "tcp"}, +{"iwg1", {NULL}, 7071, "udp"}, +{"empowerid", {NULL}, 7080, "tcp"}, +{"empowerid", {NULL}, 7080, "udp"}, +{"lazy-ptop", {NULL}, 7099, "tcp"}, +{"lazy-ptop", {NULL}, 7099, "udp"}, +{"font-service", {NULL}, 7100, "tcp"}, +{"font-service", {NULL}, 7100, "udp"}, +{"elcn", {NULL}, 7101, "tcp"}, +{"elcn", {NULL}, 7101, "udp"}, +{"aes-x170", {NULL}, 7107, "udp"}, +{"virprot-lm", {NULL}, 7121, "tcp"}, +{"virprot-lm", {NULL}, 7121, "udp"}, +{"scenidm", {NULL}, 7128, "tcp"}, +{"scenidm", {NULL}, 7128, "udp"}, +{"scenccs", {NULL}, 7129, "tcp"}, +{"scenccs", {NULL}, 7129, "udp"}, +{"cabsm-comm", {NULL}, 7161, "tcp"}, +{"cabsm-comm", {NULL}, 7161, "udp"}, +{"caistoragemgr", {NULL}, 7162, "tcp"}, +{"caistoragemgr", {NULL}, 7162, "udp"}, +{"cacsambroker", {NULL}, 7163, "tcp"}, +{"cacsambroker", {NULL}, 7163, "udp"}, +{"fsr", {NULL}, 7164, "tcp"}, +{"fsr", {NULL}, 7164, "udp"}, +{"doc-server", {NULL}, 7165, "tcp"}, +{"doc-server", {NULL}, 7165, "udp"}, +{"aruba-server", {NULL}, 7166, "tcp"}, +{"aruba-server", {NULL}, 7166, "udp"}, +{"casrmagent", {NULL}, 7167, "tcp"}, +{"cnckadserver", {NULL}, 7168, "tcp"}, +{"ccag-pib", {NULL}, 7169, "tcp"}, +{"ccag-pib", {NULL}, 7169, "udp"}, +{"nsrp", {NULL}, 7170, "tcp"}, +{"nsrp", {NULL}, 7170, "udp"}, +{"drm-production", {NULL}, 7171, "tcp"}, +{"drm-production", {NULL}, 7171, "udp"}, +{"zsecure", {NULL}, 7173, "tcp"}, +{"clutild", {NULL}, 7174, "tcp"}, +{"clutild", {NULL}, 7174, "udp"}, +{"fodms", {NULL}, 7200, "tcp"}, +{"fodms", {NULL}, 7200, "udp"}, +{"dlip", {NULL}, 7201, "tcp"}, +{"dlip", {NULL}, 7201, "udp"}, +{"ramp", {NULL}, 7227, "tcp"}, +{"ramp", {NULL}, 7227, "udp"}, +{"citrixupp", {NULL}, 7228, "tcp"}, +{"citrixuppg", {NULL}, 7229, "tcp"}, +{"pads", {NULL}, 7237, "tcp"}, +{"cnap", {NULL}, 7262, "tcp"}, +{"cnap", {NULL}, 7262, "udp"}, +{"watchme-7272", {NULL}, 7272, "tcp"}, +{"watchme-7272", {NULL}, 7272, "udp"}, +{"oma-rlp", {NULL}, 7273, "tcp"}, +{"oma-rlp", {NULL}, 7273, "udp"}, +{"oma-rlp-s", {NULL}, 7274, "tcp"}, +{"oma-rlp-s", {NULL}, 7274, "udp"}, +{"oma-ulp", {NULL}, 7275, "tcp"}, +{"oma-ulp", {NULL}, 7275, "udp"}, +{"oma-ilp", {NULL}, 7276, "tcp"}, +{"oma-ilp", {NULL}, 7276, "udp"}, +{"oma-ilp-s", {NULL}, 7277, "tcp"}, +{"oma-ilp-s", {NULL}, 7277, "udp"}, +{"oma-dcdocbs", {NULL}, 7278, "tcp"}, +{"oma-dcdocbs", {NULL}, 7278, "udp"}, +{"ctxlic", {NULL}, 7279, "tcp"}, +{"ctxlic", {NULL}, 7279, "udp"}, +{"itactionserver1", {NULL}, 7280, "tcp"}, +{"itactionserver1", {NULL}, 7280, "udp"}, +{"itactionserver2", {NULL}, 7281, "tcp"}, +{"itactionserver2", {NULL}, 7281, "udp"}, +{"mzca-action", {NULL}, 7282, "tcp"}, +{"mzca-alert", {NULL}, 7282, "udp"}, +{"lcm-server", {NULL}, 7365, "tcp"}, +{"lcm-server", {NULL}, 7365, "udp"}, +{"mindfilesys", {NULL}, 7391, "tcp"}, +{"mindfilesys", {NULL}, 7391, "udp"}, +{"mrssrendezvous", {NULL}, 7392, "tcp"}, +{"mrssrendezvous", {NULL}, 7392, "udp"}, +{"nfoldman", {NULL}, 7393, "tcp"}, +{"nfoldman", {NULL}, 7393, "udp"}, +{"fse", {NULL}, 7394, "tcp"}, +{"fse", {NULL}, 7394, "udp"}, +{"winqedit", {NULL}, 7395, "tcp"}, +{"winqedit", {NULL}, 7395, "udp"}, +{"hexarc", {NULL}, 7397, "tcp"}, +{"hexarc", {NULL}, 7397, "udp"}, +{"rtps-discovery", {NULL}, 7400, "tcp"}, +{"rtps-discovery", {NULL}, 7400, "udp"}, +{"rtps-dd-ut", {NULL}, 7401, "tcp"}, +{"rtps-dd-ut", {NULL}, 7401, "udp"}, +{"rtps-dd-mt", {NULL}, 7402, "tcp"}, +{"rtps-dd-mt", {NULL}, 7402, "udp"}, +{"ionixnetmon", {NULL}, 7410, "tcp"}, +{"ionixnetmon", {NULL}, 7410, "udp"}, +{"mtportmon", {NULL}, 7421, "tcp"}, +{"mtportmon", {NULL}, 7421, "udp"}, +{"pmdmgr", {NULL}, 7426, "tcp"}, +{"pmdmgr", {NULL}, 7426, "udp"}, +{"oveadmgr", {NULL}, 7427, "tcp"}, +{"oveadmgr", {NULL}, 7427, "udp"}, +{"ovladmgr", {NULL}, 7428, "tcp"}, +{"ovladmgr", {NULL}, 7428, "udp"}, +{"opi-sock", {NULL}, 7429, "tcp"}, +{"opi-sock", {NULL}, 7429, "udp"}, +{"xmpv7", {NULL}, 7430, "tcp"}, +{"xmpv7", {NULL}, 7430, "udp"}, +{"pmd", {NULL}, 7431, "tcp"}, +{"pmd", {NULL}, 7431, "udp"}, +{"faximum", {NULL}, 7437, "tcp"}, +{"faximum", {NULL}, 7437, "udp"}, +{"oracleas-https", {NULL}, 7443, "tcp"}, +{"oracleas-https", {NULL}, 7443, "udp"}, +{"rise", {NULL}, 7473, "tcp"}, +{"rise", {NULL}, 7473, "udp"}, +{"telops-lmd", {NULL}, 7491, "tcp"}, +{"telops-lmd", {NULL}, 7491, "udp"}, +{"silhouette", {NULL}, 7500, "tcp"}, +{"silhouette", {NULL}, 7500, "udp"}, +{"ovbus", {NULL}, 7501, "tcp"}, +{"ovbus", {NULL}, 7501, "udp"}, +{"acplt", {NULL}, 7509, "tcp"}, +{"ovhpas", {NULL}, 7510, "tcp"}, +{"ovhpas", {NULL}, 7510, "udp"}, +{"pafec-lm", {NULL}, 7511, "tcp"}, +{"pafec-lm", {NULL}, 7511, "udp"}, +{"saratoga", {NULL}, 7542, "tcp"}, +{"saratoga", {NULL}, 7542, "udp"}, +{"atul", {NULL}, 7543, "tcp"}, +{"atul", {NULL}, 7543, "udp"}, +{"nta-ds", {NULL}, 7544, "tcp"}, +{"nta-ds", {NULL}, 7544, "udp"}, +{"nta-us", {NULL}, 7545, "tcp"}, +{"nta-us", {NULL}, 7545, "udp"}, +{"cfs", {NULL}, 7546, "tcp"}, +{"cfs", {NULL}, 7546, "udp"}, +{"cwmp", {NULL}, 7547, "tcp"}, +{"cwmp", {NULL}, 7547, "udp"}, +{"tidp", {NULL}, 7548, "tcp"}, +{"tidp", {NULL}, 7548, "udp"}, +{"nls-tl", {NULL}, 7549, "tcp"}, +{"nls-tl", {NULL}, 7549, "udp"}, +{"sncp", {NULL}, 7560, "tcp"}, +{"sncp", {NULL}, 7560, "udp"}, +{"cfw", {NULL}, 7563, "tcp"}, +{"vsi-omega", {NULL}, 7566, "tcp"}, +{"vsi-omega", {NULL}, 7566, "udp"}, +{"dell-eql-asm", {NULL}, 7569, "tcp"}, +{"aries-kfinder", {NULL}, 7570, "tcp"}, +{"aries-kfinder", {NULL}, 7570, "udp"}, +{"sun-lm", {NULL}, 7588, "tcp"}, +{"sun-lm", {NULL}, 7588, "udp"}, +{"indi", {NULL}, 7624, "tcp"}, +{"indi", {NULL}, 7624, "udp"}, +{"simco", {NULL}, 7626, "tcp"}, +{"simco", {NULL}, 7626, "sctp"}, +{"soap-http", {NULL}, 7627, "tcp"}, +{"soap-http", {NULL}, 7627, "udp"}, +{"zen-pawn", {NULL}, 7628, "tcp"}, +{"zen-pawn", {NULL}, 7628, "udp"}, +{"xdas", {NULL}, 7629, "tcp"}, +{"xdas", {NULL}, 7629, "udp"}, +{"hawk", {NULL}, 7630, "tcp"}, +{"tesla-sys-msg", {NULL}, 7631, "tcp"}, +{"pmdfmgt", {NULL}, 7633, "tcp"}, +{"pmdfmgt", {NULL}, 7633, "udp"}, +{"cuseeme", {NULL}, 7648, "tcp"}, +{"cuseeme", {NULL}, 7648, "udp"}, +{"imqstomp", {NULL}, 7672, "tcp"}, +{"imqstomps", {NULL}, 7673, "tcp"}, +{"imqtunnels", {NULL}, 7674, "tcp"}, +{"imqtunnels", {NULL}, 7674, "udp"}, +{"imqtunnel", {NULL}, 7675, "tcp"}, +{"imqtunnel", {NULL}, 7675, "udp"}, +{"imqbrokerd", {NULL}, 7676, "tcp"}, +{"imqbrokerd", {NULL}, 7676, "udp"}, +{"sun-user-https", {NULL}, 7677, "tcp"}, +{"sun-user-https", {NULL}, 7677, "udp"}, +{"pando-pub", {NULL}, 7680, "tcp"}, +{"pando-pub", {NULL}, 7680, "udp"}, +{"collaber", {NULL}, 7689, "tcp"}, +{"collaber", {NULL}, 7689, "udp"}, +{"klio", {NULL}, 7697, "tcp"}, +{"klio", {NULL}, 7697, "udp"}, +{"em7-secom", {NULL}, 7700, "tcp"}, +{"sync-em7", {NULL}, 7707, "tcp"}, +{"sync-em7", {NULL}, 7707, "udp"}, +{"scinet", {NULL}, 7708, "tcp"}, +{"scinet", {NULL}, 7708, "udp"}, +{"medimageportal", {NULL}, 7720, "tcp"}, +{"medimageportal", {NULL}, 7720, "udp"}, +{"nsdeepfreezectl", {NULL}, 7724, "tcp"}, +{"nsdeepfreezectl", {NULL}, 7724, "udp"}, +{"nitrogen", {NULL}, 7725, "tcp"}, +{"nitrogen", {NULL}, 7725, "udp"}, +{"freezexservice", {NULL}, 7726, "tcp"}, +{"freezexservice", {NULL}, 7726, "udp"}, +{"trident-data", {NULL}, 7727, "tcp"}, +{"trident-data", {NULL}, 7727, "udp"}, +{"smip", {NULL}, 7734, "tcp"}, +{"smip", {NULL}, 7734, "udp"}, +{"aiagent", {NULL}, 7738, "tcp"}, +{"aiagent", {NULL}, 7738, "udp"}, +{"scriptview", {NULL}, 7741, "tcp"}, +{"scriptview", {NULL}, 7741, "udp"}, +{"msss", {NULL}, 7742, "tcp"}, +{"sstp-1", {NULL}, 7743, "tcp"}, +{"sstp-1", {NULL}, 7743, "udp"}, +{"raqmon-pdu", {NULL}, 7744, "tcp"}, +{"raqmon-pdu", {NULL}, 7744, "udp"}, +{"prgp", {NULL}, 7747, "tcp"}, +{"prgp", {NULL}, 7747, "udp"}, +{"cbt", {NULL}, 7777, "tcp"}, +{"cbt", {NULL}, 7777, "udp"}, +{"interwise", {NULL}, 7778, "tcp"}, +{"interwise", {NULL}, 7778, "udp"}, +{"vstat", {NULL}, 7779, "tcp"}, +{"vstat", {NULL}, 7779, "udp"}, +{"accu-lmgr", {NULL}, 7781, "tcp"}, +{"accu-lmgr", {NULL}, 7781, "udp"}, +{"minivend", {NULL}, 7786, "tcp"}, +{"minivend", {NULL}, 7786, "udp"}, +{"popup-reminders", {NULL}, 7787, "tcp"}, +{"popup-reminders", {NULL}, 7787, "udp"}, +{"office-tools", {NULL}, 7789, "tcp"}, +{"office-tools", {NULL}, 7789, "udp"}, +{"q3ade", {NULL}, 7794, "tcp"}, +{"q3ade", {NULL}, 7794, "udp"}, +{"pnet-conn", {NULL}, 7797, "tcp"}, +{"pnet-conn", {NULL}, 7797, "udp"}, +{"pnet-enc", {NULL}, 7798, "tcp"}, +{"pnet-enc", {NULL}, 7798, "udp"}, +{"altbsdp", {NULL}, 7799, "tcp"}, +{"altbsdp", {NULL}, 7799, "udp"}, +{"asr", {NULL}, 7800, "tcp"}, +{"asr", {NULL}, 7800, "udp"}, +{"ssp-client", {NULL}, 7801, "tcp"}, +{"ssp-client", {NULL}, 7801, "udp"}, +{"rbt-wanopt", {NULL}, 7810, "tcp"}, +{"rbt-wanopt", {NULL}, 7810, "udp"}, +{"apc-7845", {NULL}, 7845, "tcp"}, +{"apc-7845", {NULL}, 7845, "udp"}, +{"apc-7846", {NULL}, 7846, "tcp"}, +{"apc-7846", {NULL}, 7846, "udp"}, +{"mobileanalyzer", {NULL}, 7869, "tcp"}, +{"rbt-smc", {NULL}, 7870, "tcp"}, +{"pss", {NULL}, 7880, "tcp"}, +{"pss", {NULL}, 7880, "udp"}, +{"ubroker", {NULL}, 7887, "tcp"}, +{"ubroker", {NULL}, 7887, "udp"}, +{"mevent", {NULL}, 7900, "tcp"}, +{"mevent", {NULL}, 7900, "udp"}, +{"tnos-sp", {NULL}, 7901, "tcp"}, +{"tnos-sp", {NULL}, 7901, "udp"}, +{"tnos-dp", {NULL}, 7902, "tcp"}, +{"tnos-dp", {NULL}, 7902, "udp"}, +{"tnos-dps", {NULL}, 7903, "tcp"}, +{"tnos-dps", {NULL}, 7903, "udp"}, +{"qo-secure", {NULL}, 7913, "tcp"}, +{"qo-secure", {NULL}, 7913, "udp"}, +{"t2-drm", {NULL}, 7932, "tcp"}, +{"t2-drm", {NULL}, 7932, "udp"}, +{"t2-brm", {NULL}, 7933, "tcp"}, +{"t2-brm", {NULL}, 7933, "udp"}, +{"supercell", {NULL}, 7967, "tcp"}, +{"supercell", {NULL}, 7967, "udp"}, +{"micromuse-ncps", {NULL}, 7979, "tcp"}, +{"micromuse-ncps", {NULL}, 7979, "udp"}, +{"quest-vista", {NULL}, 7980, "tcp"}, +{"quest-vista", {NULL}, 7980, "udp"}, +{"sossd-collect", {NULL}, 7981, "tcp"}, +{"sossd-agent", {NULL}, 7982, "tcp"}, +{"sossd-disc", {NULL}, 7982, "udp"}, +{"pushns", {NULL}, 7997, "tcp"}, +{"usicontentpush", {NULL}, 7998, "udp"}, +{"irdmi2", {NULL}, 7999, "tcp"}, +{"irdmi2", {NULL}, 7999, "udp"}, +{"irdmi", {NULL}, 8000, "tcp"}, +{"irdmi", {NULL}, 8000, "udp"}, +{"vcom-tunnel", {NULL}, 8001, "tcp"}, +{"vcom-tunnel", {NULL}, 8001, "udp"}, +{"teradataordbms", {NULL}, 8002, "tcp"}, +{"teradataordbms", {NULL}, 8002, "udp"}, +{"mcreport", {NULL}, 8003, "tcp"}, +{"mcreport", {NULL}, 8003, "udp"}, +{"mxi", {NULL}, 8005, "tcp"}, +{"mxi", {NULL}, 8005, "udp"}, +{"http-alt", {NULL}, 8008, "tcp"}, +{"http-alt", {NULL}, 8008, "udp"}, +{"qbdb", {NULL}, 8019, "tcp"}, +{"qbdb", {NULL}, 8019, "udp"}, +{"intu-ec-svcdisc", {NULL}, 8020, "tcp"}, +{"intu-ec-svcdisc", {NULL}, 8020, "udp"}, +{"intu-ec-client", {NULL}, 8021, "tcp"}, +{"intu-ec-client", {NULL}, 8021, "udp"}, +{"oa-system", {NULL}, 8022, "tcp"}, +{"oa-system", {NULL}, 8022, "udp"}, +{"ca-audit-da", {NULL}, 8025, "tcp"}, +{"ca-audit-da", {NULL}, 8025, "udp"}, +{"ca-audit-ds", {NULL}, 8026, "tcp"}, +{"ca-audit-ds", {NULL}, 8026, "udp"}, +{"pro-ed", {NULL}, 8032, "tcp"}, +{"pro-ed", {NULL}, 8032, "udp"}, +{"mindprint", {NULL}, 8033, "tcp"}, +{"mindprint", {NULL}, 8033, "udp"}, +{"vantronix-mgmt", {NULL}, 8034, "tcp"}, +{"vantronix-mgmt", {NULL}, 8034, "udp"}, +{"ampify", {NULL}, 8040, "tcp"}, +{"ampify", {NULL}, 8040, "udp"}, +{"fs-agent", {NULL}, 8042, "tcp"}, +{"fs-server", {NULL}, 8043, "tcp"}, +{"fs-mgmt", {NULL}, 8044, "tcp"}, +{"senomix01", {NULL}, 8052, "tcp"}, +{"senomix01", {NULL}, 8052, "udp"}, +{"senomix02", {NULL}, 8053, "tcp"}, +{"senomix02", {NULL}, 8053, "udp"}, +{"senomix03", {NULL}, 8054, "tcp"}, +{"senomix03", {NULL}, 8054, "udp"}, +{"senomix04", {NULL}, 8055, "tcp"}, +{"senomix04", {NULL}, 8055, "udp"}, +{"senomix05", {NULL}, 8056, "tcp"}, +{"senomix05", {NULL}, 8056, "udp"}, +{"senomix06", {NULL}, 8057, "tcp"}, +{"senomix06", {NULL}, 8057, "udp"}, +{"senomix07", {NULL}, 8058, "tcp"}, +{"senomix07", {NULL}, 8058, "udp"}, +{"senomix08", {NULL}, 8059, "tcp"}, +{"senomix08", {NULL}, 8059, "udp"}, +{"gadugadu", {NULL}, 8074, "tcp"}, +{"gadugadu", {NULL}, 8074, "udp"}, +{"http-alt", {NULL}, 8080, "tcp"}, +{"http-alt", {NULL}, 8080, "udp"}, +{"sunproxyadmin", {NULL}, 8081, "tcp"}, +{"sunproxyadmin", {NULL}, 8081, "udp"}, +{"us-cli", {NULL}, 8082, "tcp"}, +{"us-cli", {NULL}, 8082, "udp"}, +{"us-srv", {NULL}, 8083, "tcp"}, +{"us-srv", {NULL}, 8083, "udp"}, +{"d-s-n", {NULL}, 8086, "tcp"}, +{"d-s-n", {NULL}, 8086, "udp"}, +{"simplifymedia", {NULL}, 8087, "tcp"}, +{"simplifymedia", {NULL}, 8087, "udp"}, +{"radan-http", {NULL}, 8088, "tcp"}, +{"radan-http", {NULL}, 8088, "udp"}, +{"jamlink", {NULL}, 8091, "tcp"}, +{"sac", {NULL}, 8097, "tcp"}, +{"sac", {NULL}, 8097, "udp"}, +{"xprint-server", {NULL}, 8100, "tcp"}, +{"xprint-server", {NULL}, 8100, "udp"}, +{"ldoms-migr", {NULL}, 8101, "tcp"}, +{"mtl8000-matrix", {NULL}, 8115, "tcp"}, +{"mtl8000-matrix", {NULL}, 8115, "udp"}, +{"cp-cluster", {NULL}, 8116, "tcp"}, +{"cp-cluster", {NULL}, 8116, "udp"}, +{"privoxy", {NULL}, 8118, "tcp"}, +{"privoxy", {NULL}, 8118, "udp"}, +{"apollo-data", {NULL}, 8121, "tcp"}, +{"apollo-data", {NULL}, 8121, "udp"}, +{"apollo-admin", {NULL}, 8122, "tcp"}, +{"apollo-admin", {NULL}, 8122, "udp"}, +{"paycash-online", {NULL}, 8128, "tcp"}, +{"paycash-online", {NULL}, 8128, "udp"}, +{"paycash-wbp", {NULL}, 8129, "tcp"}, +{"paycash-wbp", {NULL}, 8129, "udp"}, +{"indigo-vrmi", {NULL}, 8130, "tcp"}, +{"indigo-vrmi", {NULL}, 8130, "udp"}, +{"indigo-vbcp", {NULL}, 8131, "tcp"}, +{"indigo-vbcp", {NULL}, 8131, "udp"}, +{"dbabble", {NULL}, 8132, "tcp"}, +{"dbabble", {NULL}, 8132, "udp"}, +{"isdd", {NULL}, 8148, "tcp"}, +{"isdd", {NULL}, 8148, "udp"}, +{"patrol", {NULL}, 8160, "tcp"}, +{"patrol", {NULL}, 8160, "udp"}, +{"patrol-snmp", {NULL}, 8161, "tcp"}, +{"patrol-snmp", {NULL}, 8161, "udp"}, +{"vmware-fdm", {NULL}, 8182, "tcp"}, +{"vmware-fdm", {NULL}, 8182, "udp"}, +{"proremote", {NULL}, 8183, "tcp"}, +{"itach", {NULL}, 8184, "tcp"}, +{"itach", {NULL}, 8184, "udp"}, +{"spytechphone", {NULL}, 8192, "tcp"}, +{"spytechphone", {NULL}, 8192, "udp"}, +{"blp1", {NULL}, 8194, "tcp"}, +{"blp1", {NULL}, 8194, "udp"}, +{"blp2", {NULL}, 8195, "tcp"}, +{"blp2", {NULL}, 8195, "udp"}, +{"vvr-data", {NULL}, 8199, "tcp"}, +{"vvr-data", {NULL}, 8199, "udp"}, +{"trivnet1", {NULL}, 8200, "tcp"}, +{"trivnet1", {NULL}, 8200, "udp"}, +{"trivnet2", {NULL}, 8201, "tcp"}, +{"trivnet2", {NULL}, 8201, "udp"}, +{"lm-perfworks", {NULL}, 8204, "tcp"}, +{"lm-perfworks", {NULL}, 8204, "udp"}, +{"lm-instmgr", {NULL}, 8205, "tcp"}, +{"lm-instmgr", {NULL}, 8205, "udp"}, +{"lm-dta", {NULL}, 8206, "tcp"}, +{"lm-dta", {NULL}, 8206, "udp"}, +{"lm-sserver", {NULL}, 8207, "tcp"}, +{"lm-sserver", {NULL}, 8207, "udp"}, +{"lm-webwatcher", {NULL}, 8208, "tcp"}, +{"lm-webwatcher", {NULL}, 8208, "udp"}, +{"rexecj", {NULL}, 8230, "tcp"}, +{"rexecj", {NULL}, 8230, "udp"}, +{"synapse-nhttps", {NULL}, 8243, "tcp"}, +{"synapse-nhttps", {NULL}, 8243, "udp"}, +{"pando-sec", {NULL}, 8276, "tcp"}, +{"pando-sec", {NULL}, 8276, "udp"}, +{"synapse-nhttp", {NULL}, 8280, "tcp"}, +{"synapse-nhttp", {NULL}, 8280, "udp"}, +{"blp3", {NULL}, 8292, "tcp"}, +{"blp3", {NULL}, 8292, "udp"}, +{"hiperscan-id", {NULL}, 8293, "tcp"}, +{"blp4", {NULL}, 8294, "tcp"}, +{"blp4", {NULL}, 8294, "udp"}, +{"tmi", {NULL}, 8300, "tcp"}, +{"tmi", {NULL}, 8300, "udp"}, +{"amberon", {NULL}, 8301, "tcp"}, +{"amberon", {NULL}, 8301, "udp"}, +{"tnp-discover", {NULL}, 8320, "tcp"}, +{"tnp-discover", {NULL}, 8320, "udp"}, +{"tnp", {NULL}, 8321, "tcp"}, +{"tnp", {NULL}, 8321, "udp"}, +{"server-find", {NULL}, 8351, "tcp"}, +{"server-find", {NULL}, 8351, "udp"}, +{"cruise-enum", {NULL}, 8376, "tcp"}, +{"cruise-enum", {NULL}, 8376, "udp"}, +{"cruise-swroute", {NULL}, 8377, "tcp"}, +{"cruise-swroute", {NULL}, 8377, "udp"}, +{"cruise-config", {NULL}, 8378, "tcp"}, +{"cruise-config", {NULL}, 8378, "udp"}, +{"cruise-diags", {NULL}, 8379, "tcp"}, +{"cruise-diags", {NULL}, 8379, "udp"}, +{"cruise-update", {NULL}, 8380, "tcp"}, +{"cruise-update", {NULL}, 8380, "udp"}, +{"m2mservices", {NULL}, 8383, "tcp"}, +{"m2mservices", {NULL}, 8383, "udp"}, +{"cvd", {NULL}, 8400, "tcp"}, +{"cvd", {NULL}, 8400, "udp"}, +{"sabarsd", {NULL}, 8401, "tcp"}, +{"sabarsd", {NULL}, 8401, "udp"}, +{"abarsd", {NULL}, 8402, "tcp"}, +{"abarsd", {NULL}, 8402, "udp"}, +{"admind", {NULL}, 8403, "tcp"}, +{"admind", {NULL}, 8403, "udp"}, +{"svcloud", {NULL}, 8404, "tcp"}, +{"svbackup", {NULL}, 8405, "tcp"}, +{"espeech", {NULL}, 8416, "tcp"}, +{"espeech", {NULL}, 8416, "udp"}, +{"espeech-rtp", {NULL}, 8417, "tcp"}, +{"espeech-rtp", {NULL}, 8417, "udp"}, +{"cybro-a-bus", {NULL}, 8442, "tcp"}, +{"cybro-a-bus", {NULL}, 8442, "udp"}, +{"pcsync-https", {NULL}, 8443, "tcp"}, +{"pcsync-https", {NULL}, 8443, "udp"}, +{"pcsync-http", {NULL}, 8444, "tcp"}, +{"pcsync-http", {NULL}, 8444, "udp"}, +{"npmp", {NULL}, 8450, "tcp"}, +{"npmp", {NULL}, 8450, "udp"}, +{"cisco-avp", {NULL}, 8470, "tcp"}, +{"pim-port", {NULL}, 8471, "tcp"}, +{"pim-port", {NULL}, 8471, "sctp"}, +{"otv", {NULL}, 8472, "tcp"}, +{"otv", {NULL}, 8472, "udp"}, +{"vp2p", {NULL}, 8473, "tcp"}, +{"vp2p", {NULL}, 8473, "udp"}, +{"noteshare", {NULL}, 8474, "tcp"}, +{"noteshare", {NULL}, 8474, "udp"}, +{"fmtp", {NULL}, 8500, "tcp"}, +{"fmtp", {NULL}, 8500, "udp"}, +{"rtsp-alt", {NULL}, 8554, "tcp"}, +{"rtsp-alt", {NULL}, 8554, "udp"}, +{"d-fence", {NULL}, 8555, "tcp"}, +{"d-fence", {NULL}, 8555, "udp"}, +{"oap-admin", {NULL}, 8567, "tcp"}, +{"oap-admin", {NULL}, 8567, "udp"}, +{"asterix", {NULL}, 8600, "tcp"}, +{"asterix", {NULL}, 8600, "udp"}, +{"canon-mfnp", {NULL}, 8610, "tcp"}, +{"canon-mfnp", {NULL}, 8610, "udp"}, +{"canon-bjnp1", {NULL}, 8611, "tcp"}, +{"canon-bjnp1", {NULL}, 8611, "udp"}, +{"canon-bjnp2", {NULL}, 8612, "tcp"}, +{"canon-bjnp2", {NULL}, 8612, "udp"}, +{"canon-bjnp3", {NULL}, 8613, "tcp"}, +{"canon-bjnp3", {NULL}, 8613, "udp"}, +{"canon-bjnp4", {NULL}, 8614, "tcp"}, +{"canon-bjnp4", {NULL}, 8614, "udp"}, +{"sun-as-jmxrmi", {NULL}, 8686, "tcp"}, +{"sun-as-jmxrmi", {NULL}, 8686, "udp"}, +{"vnyx", {NULL}, 8699, "tcp"}, +{"vnyx", {NULL}, 8699, "udp"}, +{"dtp-net", {NULL}, 8732, "udp"}, +{"ibus", {NULL}, 8733, "tcp"}, +{"ibus", {NULL}, 8733, "udp"}, +{"mc-appserver", {NULL}, 8763, "tcp"}, +{"mc-appserver", {NULL}, 8763, "udp"}, +{"openqueue", {NULL}, 8764, "tcp"}, +{"openqueue", {NULL}, 8764, "udp"}, +{"ultraseek-http", {NULL}, 8765, "tcp"}, +{"ultraseek-http", {NULL}, 8765, "udp"}, +{"dpap", {NULL}, 8770, "tcp"}, +{"dpap", {NULL}, 8770, "udp"}, +{"msgclnt", {NULL}, 8786, "tcp"}, +{"msgclnt", {NULL}, 8786, "udp"}, +{"msgsrvr", {NULL}, 8787, "tcp"}, +{"msgsrvr", {NULL}, 8787, "udp"}, +{"sunwebadmin", {NULL}, 8800, "tcp"}, +{"sunwebadmin", {NULL}, 8800, "udp"}, +{"truecm", {NULL}, 8804, "tcp"}, +{"truecm", {NULL}, 8804, "udp"}, +{"dxspider", {NULL}, 8873, "tcp"}, +{"dxspider", {NULL}, 8873, "udp"}, +{"cddbp-alt", {NULL}, 8880, "tcp"}, +{"cddbp-alt", {NULL}, 8880, "udp"}, +{"secure-mqtt", {NULL}, 8883, "tcp"}, +{"secure-mqtt", {NULL}, 8883, "udp"}, +{"ddi-tcp-1", {NULL}, 8888, "tcp"}, +{"ddi-udp-1", {NULL}, 8888, "udp"}, +{"ddi-tcp-2", {NULL}, 8889, "tcp"}, +{"ddi-udp-2", {NULL}, 8889, "udp"}, +{"ddi-tcp-3", {NULL}, 8890, "tcp"}, +{"ddi-udp-3", {NULL}, 8890, "udp"}, +{"ddi-tcp-4", {NULL}, 8891, "tcp"}, +{"ddi-udp-4", {NULL}, 8891, "udp"}, +{"ddi-tcp-5", {NULL}, 8892, "tcp"}, +{"ddi-udp-5", {NULL}, 8892, "udp"}, +{"ddi-tcp-6", {NULL}, 8893, "tcp"}, +{"ddi-udp-6", {NULL}, 8893, "udp"}, +{"ddi-tcp-7", {NULL}, 8894, "tcp"}, +{"ddi-udp-7", {NULL}, 8894, "udp"}, +{"ospf-lite", {NULL}, 8899, "tcp"}, +{"ospf-lite", {NULL}, 8899, "udp"}, +{"jmb-cds1", {NULL}, 8900, "tcp"}, +{"jmb-cds1", {NULL}, 8900, "udp"}, +{"jmb-cds2", {NULL}, 8901, "tcp"}, +{"jmb-cds2", {NULL}, 8901, "udp"}, +{"manyone-http", {NULL}, 8910, "tcp"}, +{"manyone-http", {NULL}, 8910, "udp"}, +{"manyone-xml", {NULL}, 8911, "tcp"}, +{"manyone-xml", {NULL}, 8911, "udp"}, +{"wcbackup", {NULL}, 8912, "tcp"}, +{"wcbackup", {NULL}, 8912, "udp"}, +{"dragonfly", {NULL}, 8913, "tcp"}, +{"dragonfly", {NULL}, 8913, "udp"}, +{"twds", {NULL}, 8937, "tcp"}, +{"cumulus-admin", {NULL}, 8954, "tcp"}, +{"cumulus-admin", {NULL}, 8954, "udp"}, +{"sunwebadmins", {NULL}, 8989, "tcp"}, +{"sunwebadmins", {NULL}, 8989, "udp"}, +{"http-wmap", {NULL}, 8990, "tcp"}, +{"http-wmap", {NULL}, 8990, "udp"}, +{"https-wmap", {NULL}, 8991, "tcp"}, +{"https-wmap", {NULL}, 8991, "udp"}, +{"bctp", {NULL}, 8999, "tcp"}, +{"bctp", {NULL}, 8999, "udp"}, +{"cslistener", {NULL}, 9000, "tcp"}, +{"cslistener", {NULL}, 9000, "udp"}, +{"etlservicemgr", {NULL}, 9001, "tcp"}, +{"etlservicemgr", {NULL}, 9001, "udp"}, +{"dynamid", {NULL}, 9002, "tcp"}, +{"dynamid", {NULL}, 9002, "udp"}, +{"ogs-client", {NULL}, 9007, "udp"}, +{"ogs-server", {NULL}, 9008, "tcp"}, +{"pichat", {NULL}, 9009, "tcp"}, +{"pichat", {NULL}, 9009, "udp"}, +{"sdr", {NULL}, 9010, "tcp"}, +{"tambora", {NULL}, 9020, "tcp"}, +{"tambora", {NULL}, 9020, "udp"}, +{"panagolin-ident", {NULL}, 9021, "tcp"}, +{"panagolin-ident", {NULL}, 9021, "udp"}, +{"paragent", {NULL}, 9022, "tcp"}, +{"paragent", {NULL}, 9022, "udp"}, +{"swa-1", {NULL}, 9023, "tcp"}, +{"swa-1", {NULL}, 9023, "udp"}, +{"swa-2", {NULL}, 9024, "tcp"}, +{"swa-2", {NULL}, 9024, "udp"}, +{"swa-3", {NULL}, 9025, "tcp"}, +{"swa-3", {NULL}, 9025, "udp"}, +{"swa-4", {NULL}, 9026, "tcp"}, +{"swa-4", {NULL}, 9026, "udp"}, +{"versiera", {NULL}, 9050, "tcp"}, +{"fio-cmgmt", {NULL}, 9051, "tcp"}, +{"glrpc", {NULL}, 9080, "tcp"}, +{"glrpc", {NULL}, 9080, "udp"}, +{"lcs-ap", {NULL}, 9082, "sctp"}, +{"emc-pp-mgmtsvc", {NULL}, 9083, "tcp"}, +{"aurora", {NULL}, 9084, "tcp"}, +{"aurora", {NULL}, 9084, "udp"}, +{"aurora", {NULL}, 9084, "sctp"}, +{"ibm-rsyscon", {NULL}, 9085, "tcp"}, +{"ibm-rsyscon", {NULL}, 9085, "udp"}, +{"net2display", {NULL}, 9086, "tcp"}, +{"net2display", {NULL}, 9086, "udp"}, +{"classic", {NULL}, 9087, "tcp"}, +{"classic", {NULL}, 9087, "udp"}, +{"sqlexec", {NULL}, 9088, "tcp"}, +{"sqlexec", {NULL}, 9088, "udp"}, +{"sqlexec-ssl", {NULL}, 9089, "tcp"}, +{"sqlexec-ssl", {NULL}, 9089, "udp"}, +{"websm", {NULL}, 9090, "tcp"}, +{"websm", {NULL}, 9090, "udp"}, +{"xmltec-xmlmail", {NULL}, 9091, "tcp"}, +{"xmltec-xmlmail", {NULL}, 9091, "udp"}, +{"XmlIpcRegSvc", {NULL}, 9092, "tcp"}, +{"XmlIpcRegSvc", {NULL}, 9092, "udp"}, +{"hp-pdl-datastr", {NULL}, 9100, "tcp"}, +{"hp-pdl-datastr", {NULL}, 9100, "udp"}, +{"pdl-datastream", {NULL}, 9100, "tcp"}, +{"pdl-datastream", {NULL}, 9100, "udp"}, +{"bacula-dir", {NULL}, 9101, "tcp"}, +{"bacula-dir", {NULL}, 9101, "udp"}, +{"bacula-fd", {NULL}, 9102, "tcp"}, +{"bacula-fd", {NULL}, 9102, "udp"}, +{"bacula-sd", {NULL}, 9103, "tcp"}, +{"bacula-sd", {NULL}, 9103, "udp"}, +{"peerwire", {NULL}, 9104, "tcp"}, +{"peerwire", {NULL}, 9104, "udp"}, +{"xadmin", {NULL}, 9105, "tcp"}, +{"xadmin", {NULL}, 9105, "udp"}, +{"astergate", {NULL}, 9106, "tcp"}, +{"astergate-disc", {NULL}, 9106, "udp"}, +{"astergatefax", {NULL}, 9107, "tcp"}, +{"mxit", {NULL}, 9119, "tcp"}, +{"mxit", {NULL}, 9119, "udp"}, +{"dddp", {NULL}, 9131, "tcp"}, +{"dddp", {NULL}, 9131, "udp"}, +{"apani1", {NULL}, 9160, "tcp"}, +{"apani1", {NULL}, 9160, "udp"}, +{"apani2", {NULL}, 9161, "tcp"}, +{"apani2", {NULL}, 9161, "udp"}, +{"apani3", {NULL}, 9162, "tcp"}, +{"apani3", {NULL}, 9162, "udp"}, +{"apani4", {NULL}, 9163, "tcp"}, +{"apani4", {NULL}, 9163, "udp"}, +{"apani5", {NULL}, 9164, "tcp"}, +{"apani5", {NULL}, 9164, "udp"}, +{"sun-as-jpda", {NULL}, 9191, "tcp"}, +{"sun-as-jpda", {NULL}, 9191, "udp"}, +{"wap-wsp", {NULL}, 9200, "tcp"}, +{"wap-wsp", {NULL}, 9200, "udp"}, +{"wap-wsp-wtp", {NULL}, 9201, "tcp"}, +{"wap-wsp-wtp", {NULL}, 9201, "udp"}, +{"wap-wsp-s", {NULL}, 9202, "tcp"}, +{"wap-wsp-s", {NULL}, 9202, "udp"}, +{"wap-wsp-wtp-s", {NULL}, 9203, "tcp"}, +{"wap-wsp-wtp-s", {NULL}, 9203, "udp"}, +{"wap-vcard", {NULL}, 9204, "tcp"}, +{"wap-vcard", {NULL}, 9204, "udp"}, +{"wap-vcal", {NULL}, 9205, "tcp"}, +{"wap-vcal", {NULL}, 9205, "udp"}, +{"wap-vcard-s", {NULL}, 9206, "tcp"}, +{"wap-vcard-s", {NULL}, 9206, "udp"}, +{"wap-vcal-s", {NULL}, 9207, "tcp"}, +{"wap-vcal-s", {NULL}, 9207, "udp"}, +{"rjcdb-vcards", {NULL}, 9208, "tcp"}, +{"rjcdb-vcards", {NULL}, 9208, "udp"}, +{"almobile-system", {NULL}, 9209, "tcp"}, +{"almobile-system", {NULL}, 9209, "udp"}, +{"oma-mlp", {NULL}, 9210, "tcp"}, +{"oma-mlp", {NULL}, 9210, "udp"}, +{"oma-mlp-s", {NULL}, 9211, "tcp"}, +{"oma-mlp-s", {NULL}, 9211, "udp"}, +{"serverviewdbms", {NULL}, 9212, "tcp"}, +{"serverviewdbms", {NULL}, 9212, "udp"}, +{"serverstart", {NULL}, 9213, "tcp"}, +{"serverstart", {NULL}, 9213, "udp"}, +{"ipdcesgbs", {NULL}, 9214, "tcp"}, +{"ipdcesgbs", {NULL}, 9214, "udp"}, +{"insis", {NULL}, 9215, "tcp"}, +{"insis", {NULL}, 9215, "udp"}, +{"acme", {NULL}, 9216, "tcp"}, +{"acme", {NULL}, 9216, "udp"}, +{"fsc-port", {NULL}, 9217, "tcp"}, +{"fsc-port", {NULL}, 9217, "udp"}, +{"teamcoherence", {NULL}, 9222, "tcp"}, +{"teamcoherence", {NULL}, 9222, "udp"}, +{"mon", {NULL}, 9255, "tcp"}, +{"mon", {NULL}, 9255, "udp"}, +{"pegasus", {NULL}, 9278, "tcp"}, +{"pegasus", {NULL}, 9278, "udp"}, +{"pegasus-ctl", {NULL}, 9279, "tcp"}, +{"pegasus-ctl", {NULL}, 9279, "udp"}, +{"pgps", {NULL}, 9280, "tcp"}, +{"pgps", {NULL}, 9280, "udp"}, +{"swtp-port1", {NULL}, 9281, "tcp"}, +{"swtp-port1", {NULL}, 9281, "udp"}, +{"swtp-port2", {NULL}, 9282, "tcp"}, +{"swtp-port2", {NULL}, 9282, "udp"}, +{"callwaveiam", {NULL}, 9283, "tcp"}, +{"callwaveiam", {NULL}, 9283, "udp"}, +{"visd", {NULL}, 9284, "tcp"}, +{"visd", {NULL}, 9284, "udp"}, +{"n2h2server", {NULL}, 9285, "tcp"}, +{"n2h2server", {NULL}, 9285, "udp"}, +{"n2receive", {NULL}, 9286, "udp"}, +{"cumulus", {NULL}, 9287, "tcp"}, +{"cumulus", {NULL}, 9287, "udp"}, +{"armtechdaemon", {NULL}, 9292, "tcp"}, +{"armtechdaemon", {NULL}, 9292, "udp"}, +{"storview", {NULL}, 9293, "tcp"}, +{"storview", {NULL}, 9293, "udp"}, +{"armcenterhttp", {NULL}, 9294, "tcp"}, +{"armcenterhttp", {NULL}, 9294, "udp"}, +{"armcenterhttps", {NULL}, 9295, "tcp"}, +{"armcenterhttps", {NULL}, 9295, "udp"}, +{"vrace", {NULL}, 9300, "tcp"}, +{"vrace", {NULL}, 9300, "udp"}, +{"sphinxql", {NULL}, 9306, "tcp"}, +{"sphinxapi", {NULL}, 9312, "tcp"}, +{"secure-ts", {NULL}, 9318, "tcp"}, +{"secure-ts", {NULL}, 9318, "udp"}, +{"guibase", {NULL}, 9321, "tcp"}, +{"guibase", {NULL}, 9321, "udp"}, +{"mpidcmgr", {NULL}, 9343, "tcp"}, +{"mpidcmgr", {NULL}, 9343, "udp"}, +{"mphlpdmc", {NULL}, 9344, "tcp"}, +{"mphlpdmc", {NULL}, 9344, "udp"}, +{"ctechlicensing", {NULL}, 9346, "tcp"}, +{"ctechlicensing", {NULL}, 9346, "udp"}, +{"fjdmimgr", {NULL}, 9374, "tcp"}, +{"fjdmimgr", {NULL}, 9374, "udp"}, +{"boxp", {NULL}, 9380, "tcp"}, +{"boxp", {NULL}, 9380, "udp"}, +{"d2dconfig", {NULL}, 9387, "tcp"}, +{"d2ddatatrans", {NULL}, 9388, "tcp"}, +{"adws", {NULL}, 9389, "tcp"}, +{"otp", {NULL}, 9390, "tcp"}, +{"fjinvmgr", {NULL}, 9396, "tcp"}, +{"fjinvmgr", {NULL}, 9396, "udp"}, +{"mpidcagt", {NULL}, 9397, "tcp"}, +{"mpidcagt", {NULL}, 9397, "udp"}, +{"sec-t4net-srv", {NULL}, 9400, "tcp"}, +{"sec-t4net-srv", {NULL}, 9400, "udp"}, +{"sec-t4net-clt", {NULL}, 9401, "tcp"}, +{"sec-t4net-clt", {NULL}, 9401, "udp"}, +{"sec-pc2fax-srv", {NULL}, 9402, "tcp"}, +{"sec-pc2fax-srv", {NULL}, 9402, "udp"}, +{"git", {NULL}, 9418, "tcp"}, +{"git", {NULL}, 9418, "udp"}, +{"tungsten-https", {NULL}, 9443, "tcp"}, +{"tungsten-https", {NULL}, 9443, "udp"}, +{"wso2esb-console", {NULL}, 9444, "tcp"}, +{"wso2esb-console", {NULL}, 9444, "udp"}, +{"sntlkeyssrvr", {NULL}, 9450, "tcp"}, +{"sntlkeyssrvr", {NULL}, 9450, "udp"}, +{"ismserver", {NULL}, 9500, "tcp"}, +{"ismserver", {NULL}, 9500, "udp"}, +{"sma-spw", {NULL}, 9522, "udp"}, +{"mngsuite", {NULL}, 9535, "tcp"}, +{"mngsuite", {NULL}, 9535, "udp"}, +{"laes-bf", {NULL}, 9536, "tcp"}, +{"laes-bf", {NULL}, 9536, "udp"}, +{"trispen-sra", {NULL}, 9555, "tcp"}, +{"trispen-sra", {NULL}, 9555, "udp"}, +{"ldgateway", {NULL}, 9592, "tcp"}, +{"ldgateway", {NULL}, 9592, "udp"}, +{"cba8", {NULL}, 9593, "tcp"}, +{"cba8", {NULL}, 9593, "udp"}, +{"msgsys", {NULL}, 9594, "tcp"}, +{"msgsys", {NULL}, 9594, "udp"}, +{"pds", {NULL}, 9595, "tcp"}, +{"pds", {NULL}, 9595, "udp"}, +{"mercury-disc", {NULL}, 9596, "tcp"}, +{"mercury-disc", {NULL}, 9596, "udp"}, +{"pd-admin", {NULL}, 9597, "tcp"}, +{"pd-admin", {NULL}, 9597, "udp"}, +{"vscp", {NULL}, 9598, "tcp"}, +{"vscp", {NULL}, 9598, "udp"}, +{"robix", {NULL}, 9599, "tcp"}, +{"robix", {NULL}, 9599, "udp"}, +{"micromuse-ncpw", {NULL}, 9600, "tcp"}, +{"micromuse-ncpw", {NULL}, 9600, "udp"}, +{"streamcomm-ds", {NULL}, 9612, "tcp"}, +{"streamcomm-ds", {NULL}, 9612, "udp"}, +{"iadt-tls", {NULL}, 9614, "tcp"}, +{"erunbook_agent", {NULL}, 9616, "tcp"}, +{"erunbook_server", {NULL}, 9617, "tcp"}, +{"condor", {NULL}, 9618, "tcp"}, +{"condor", {NULL}, 9618, "udp"}, +{"odbcpathway", {NULL}, 9628, "tcp"}, +{"odbcpathway", {NULL}, 9628, "udp"}, +{"uniport", {NULL}, 9629, "tcp"}, +{"uniport", {NULL}, 9629, "udp"}, +{"peoctlr", {NULL}, 9630, "tcp"}, +{"peocoll", {NULL}, 9631, "tcp"}, +{"mc-comm", {NULL}, 9632, "udp"}, +{"pqsflows", {NULL}, 9640, "tcp"}, +{"xmms2", {NULL}, 9667, "tcp"}, +{"xmms2", {NULL}, 9667, "udp"}, +{"tec5-sdctp", {NULL}, 9668, "tcp"}, +{"tec5-sdctp", {NULL}, 9668, "udp"}, +{"client-wakeup", {NULL}, 9694, "tcp"}, +{"client-wakeup", {NULL}, 9694, "udp"}, +{"ccnx", {NULL}, 9695, "tcp"}, +{"ccnx", {NULL}, 9695, "udp"}, +{"board-roar", {NULL}, 9700, "tcp"}, +{"board-roar", {NULL}, 9700, "udp"}, +{"l5nas-parchan", {NULL}, 9747, "tcp"}, +{"l5nas-parchan", {NULL}, 9747, "udp"}, +{"board-voip", {NULL}, 9750, "tcp"}, +{"board-voip", {NULL}, 9750, "udp"}, +{"rasadv", {NULL}, 9753, "tcp"}, +{"rasadv", {NULL}, 9753, "udp"}, +{"tungsten-http", {NULL}, 9762, "tcp"}, +{"tungsten-http", {NULL}, 9762, "udp"}, +{"davsrc", {NULL}, 9800, "tcp"}, +{"davsrc", {NULL}, 9800, "udp"}, +{"sstp-2", {NULL}, 9801, "tcp"}, +{"sstp-2", {NULL}, 9801, "udp"}, +{"davsrcs", {NULL}, 9802, "tcp"}, +{"davsrcs", {NULL}, 9802, "udp"}, +{"sapv1", {NULL}, 9875, "tcp"}, +{"sapv1", {NULL}, 9875, "udp"}, +{"sd", {NULL}, 9876, "tcp"}, +{"sd", {NULL}, 9876, "udp"}, +{"cyborg-systems", {NULL}, 9888, "tcp"}, +{"cyborg-systems", {NULL}, 9888, "udp"}, +{"gt-proxy", {NULL}, 9889, "tcp"}, +{"gt-proxy", {NULL}, 9889, "udp"}, +{"monkeycom", {NULL}, 9898, "tcp"}, +{"monkeycom", {NULL}, 9898, "udp"}, +{"sctp-tunneling", {NULL}, 9899, "tcp"}, +{"sctp-tunneling", {NULL}, 9899, "udp"}, +{"iua", {NULL}, 9900, "tcp"}, +{"iua", {NULL}, 9900, "udp"}, +{"iua", {NULL}, 9900, "sctp"}, +{"enrp", {NULL}, 9901, "udp"}, +{"enrp-sctp", {NULL}, 9901, "sctp"}, +{"enrp-sctp-tls", {NULL}, 9902, "sctp"}, +{"domaintime", {NULL}, 9909, "tcp"}, +{"domaintime", {NULL}, 9909, "udp"}, +{"sype-transport", {NULL}, 9911, "tcp"}, +{"sype-transport", {NULL}, 9911, "udp"}, +{"apc-9950", {NULL}, 9950, "tcp"}, +{"apc-9950", {NULL}, 9950, "udp"}, +{"apc-9951", {NULL}, 9951, "tcp"}, +{"apc-9951", {NULL}, 9951, "udp"}, +{"apc-9952", {NULL}, 9952, "tcp"}, +{"apc-9952", {NULL}, 9952, "udp"}, +{"acis", {NULL}, 9953, "tcp"}, +{"acis", {NULL}, 9953, "udp"}, +{"odnsp", {NULL}, 9966, "tcp"}, +{"odnsp", {NULL}, 9966, "udp"}, +{"dsm-scm-target", {NULL}, 9987, "tcp"}, +{"dsm-scm-target", {NULL}, 9987, "udp"}, +{"nsesrvr", {NULL}, 9988, "tcp"}, +{"osm-appsrvr", {NULL}, 9990, "tcp"}, +{"osm-appsrvr", {NULL}, 9990, "udp"}, +{"osm-oev", {NULL}, 9991, "tcp"}, +{"osm-oev", {NULL}, 9991, "udp"}, +{"palace-1", {NULL}, 9992, "tcp"}, +{"palace-1", {NULL}, 9992, "udp"}, +{"palace-2", {NULL}, 9993, "tcp"}, +{"palace-2", {NULL}, 9993, "udp"}, +{"palace-3", {NULL}, 9994, "tcp"}, +{"palace-3", {NULL}, 9994, "udp"}, +{"palace-4", {NULL}, 9995, "tcp"}, +{"palace-4", {NULL}, 9995, "udp"}, +{"palace-5", {NULL}, 9996, "tcp"}, +{"palace-5", {NULL}, 9996, "udp"}, +{"palace-6", {NULL}, 9997, "tcp"}, +{"palace-6", {NULL}, 9997, "udp"}, +{"distinct32", {NULL}, 9998, "tcp"}, +{"distinct32", {NULL}, 9998, "udp"}, +{"distinct", {NULL}, 9999, "tcp"}, +{"distinct", {NULL}, 9999, "udp"}, +{"ndmp", {NULL}, 10000, "tcp"}, +{"ndmp", {NULL}, 10000, "udp"}, +{"scp-config", {NULL}, 10001, "tcp"}, +{"scp-config", {NULL}, 10001, "udp"}, +{"documentum", {NULL}, 10002, "tcp"}, +{"documentum", {NULL}, 10002, "udp"}, +{"documentum_s", {NULL}, 10003, "tcp"}, +{"documentum_s", {NULL}, 10003, "udp"}, +{"emcrmirccd", {NULL}, 10004, "tcp"}, +{"emcrmird", {NULL}, 10005, "tcp"}, +{"mvs-capacity", {NULL}, 10007, "tcp"}, +{"mvs-capacity", {NULL}, 10007, "udp"}, +{"octopus", {NULL}, 10008, "tcp"}, +{"octopus", {NULL}, 10008, "udp"}, +{"swdtp-sv", {NULL}, 10009, "tcp"}, +{"swdtp-sv", {NULL}, 10009, "udp"}, +{"rxapi", {NULL}, 10010, "tcp"}, +{"zabbix-agent", {NULL}, 10050, "tcp"}, +{"zabbix-agent", {NULL}, 10050, "udp"}, +{"zabbix-trapper", {NULL}, 10051, "tcp"}, +{"zabbix-trapper", {NULL}, 10051, "udp"}, +{"qptlmd", {NULL}, 10055, "tcp"}, +{"amanda", {NULL}, 10080, "tcp"}, +{"amanda", {NULL}, 10080, "udp"}, +{"famdc", {NULL}, 10081, "tcp"}, +{"famdc", {NULL}, 10081, "udp"}, +{"itap-ddtp", {NULL}, 10100, "tcp"}, +{"itap-ddtp", {NULL}, 10100, "udp"}, +{"ezmeeting-2", {NULL}, 10101, "tcp"}, +{"ezmeeting-2", {NULL}, 10101, "udp"}, +{"ezproxy-2", {NULL}, 10102, "tcp"}, +{"ezproxy-2", {NULL}, 10102, "udp"}, +{"ezrelay", {NULL}, 10103, "tcp"}, +{"ezrelay", {NULL}, 10103, "udp"}, +{"swdtp", {NULL}, 10104, "tcp"}, +{"swdtp", {NULL}, 10104, "udp"}, +{"bctp-server", {NULL}, 10107, "tcp"}, +{"bctp-server", {NULL}, 10107, "udp"}, +{"nmea-0183", {NULL}, 10110, "tcp"}, +{"nmea-0183", {NULL}, 10110, "udp"}, +{"netiq-endpoint", {NULL}, 10113, "tcp"}, +{"netiq-endpoint", {NULL}, 10113, "udp"}, +{"netiq-qcheck", {NULL}, 10114, "tcp"}, +{"netiq-qcheck", {NULL}, 10114, "udp"}, +{"netiq-endpt", {NULL}, 10115, "tcp"}, +{"netiq-endpt", {NULL}, 10115, "udp"}, +{"netiq-voipa", {NULL}, 10116, "tcp"}, +{"netiq-voipa", {NULL}, 10116, "udp"}, +{"iqrm", {NULL}, 10117, "tcp"}, +{"iqrm", {NULL}, 10117, "udp"}, +{"bmc-perf-sd", {NULL}, 10128, "tcp"}, +{"bmc-perf-sd", {NULL}, 10128, "udp"}, +{"bmc-gms", {NULL}, 10129, "tcp"}, +{"qb-db-server", {NULL}, 10160, "tcp"}, +{"qb-db-server", {NULL}, 10160, "udp"}, +{"snmptls", {NULL}, 10161, "tcp"}, +{"snmpdtls", {NULL}, 10161, "udp"}, +{"snmptls-trap", {NULL}, 10162, "tcp"}, +{"snmpdtls-trap", {NULL}, 10162, "udp"}, +{"trisoap", {NULL}, 10200, "tcp"}, +{"trisoap", {NULL}, 10200, "udp"}, +{"rsms", {NULL}, 10201, "tcp"}, +{"rscs", {NULL}, 10201, "udp"}, +{"apollo-relay", {NULL}, 10252, "tcp"}, +{"apollo-relay", {NULL}, 10252, "udp"}, +{"axis-wimp-port", {NULL}, 10260, "tcp"}, +{"axis-wimp-port", {NULL}, 10260, "udp"}, +{"blocks", {NULL}, 10288, "tcp"}, +{"blocks", {NULL}, 10288, "udp"}, +{"cosir", {NULL}, 10321, "tcp"}, +{"hip-nat-t", {NULL}, 10500, "udp"}, +{"MOS-lower", {NULL}, 10540, "tcp"}, +{"MOS-lower", {NULL}, 10540, "udp"}, +{"MOS-upper", {NULL}, 10541, "tcp"}, +{"MOS-upper", {NULL}, 10541, "udp"}, +{"MOS-aux", {NULL}, 10542, "tcp"}, +{"MOS-aux", {NULL}, 10542, "udp"}, +{"MOS-soap", {NULL}, 10543, "tcp"}, +{"MOS-soap", {NULL}, 10543, "udp"}, +{"MOS-soap-opt", {NULL}, 10544, "tcp"}, +{"MOS-soap-opt", {NULL}, 10544, "udp"}, +{"gap", {NULL}, 10800, "tcp"}, +{"gap", {NULL}, 10800, "udp"}, +{"lpdg", {NULL}, 10805, "tcp"}, +{"lpdg", {NULL}, 10805, "udp"}, +{"nbd", {NULL}, 10809, "tcp"}, +{"nmc-disc", {NULL}, 10810, "udp"}, +{"helix", {NULL}, 10860, "tcp"}, +{"helix", {NULL}, 10860, "udp"}, +{"rmiaux", {NULL}, 10990, "tcp"}, +{"rmiaux", {NULL}, 10990, "udp"}, +{"irisa", {NULL}, 11000, "tcp"}, +{"irisa", {NULL}, 11000, "udp"}, +{"metasys", {NULL}, 11001, "tcp"}, +{"metasys", {NULL}, 11001, "udp"}, +{"netapp-icmgmt", {NULL}, 11104, "tcp"}, +{"netapp-icdata", {NULL}, 11105, "tcp"}, +{"sgi-lk", {NULL}, 11106, "tcp"}, +{"sgi-lk", {NULL}, 11106, "udp"}, +{"vce", {NULL}, 11111, "tcp"}, +{"vce", {NULL}, 11111, "udp"}, +{"dicom", {NULL}, 11112, "tcp"}, +{"dicom", {NULL}, 11112, "udp"}, +{"suncacao-snmp", {NULL}, 11161, "tcp"}, +{"suncacao-snmp", {NULL}, 11161, "udp"}, +{"suncacao-jmxmp", {NULL}, 11162, "tcp"}, +{"suncacao-jmxmp", {NULL}, 11162, "udp"}, +{"suncacao-rmi", {NULL}, 11163, "tcp"}, +{"suncacao-rmi", {NULL}, 11163, "udp"}, +{"suncacao-csa", {NULL}, 11164, "tcp"}, +{"suncacao-csa", {NULL}, 11164, "udp"}, +{"suncacao-websvc", {NULL}, 11165, "tcp"}, +{"suncacao-websvc", {NULL}, 11165, "udp"}, +{"snss", {NULL}, 11171, "udp"}, +{"oemcacao-jmxmp", {NULL}, 11172, "tcp"}, +{"oemcacao-rmi", {NULL}, 11174, "tcp"}, +{"oemcacao-websvc", {NULL}, 11175, "tcp"}, +{"smsqp", {NULL}, 11201, "tcp"}, +{"smsqp", {NULL}, 11201, "udp"}, +{"wifree", {NULL}, 11208, "tcp"}, +{"wifree", {NULL}, 11208, "udp"}, +{"memcache", {NULL}, 11211, "tcp"}, +{"memcache", {NULL}, 11211, "udp"}, +{"imip", {NULL}, 11319, "tcp"}, +{"imip", {NULL}, 11319, "udp"}, +{"imip-channels", {NULL}, 11320, "tcp"}, +{"imip-channels", {NULL}, 11320, "udp"}, +{"arena-server", {NULL}, 11321, "tcp"}, +{"arena-server", {NULL}, 11321, "udp"}, +{"atm-uhas", {NULL}, 11367, "tcp"}, +{"atm-uhas", {NULL}, 11367, "udp"}, +{"hkp", {NULL}, 11371, "tcp"}, +{"hkp", {NULL}, 11371, "udp"}, +{"asgcypresstcps", {NULL}, 11489, "tcp"}, +{"tempest-port", {NULL}, 11600, "tcp"}, +{"tempest-port", {NULL}, 11600, "udp"}, +{"h323callsigalt", {NULL}, 11720, "tcp"}, +{"h323callsigalt", {NULL}, 11720, "udp"}, +{"intrepid-ssl", {NULL}, 11751, "tcp"}, +{"intrepid-ssl", {NULL}, 11751, "udp"}, +{"xoraya", {NULL}, 11876, "tcp"}, +{"xoraya", {NULL}, 11876, "udp"}, +{"x2e-disc", {NULL}, 11877, "udp"}, +{"sysinfo-sp", {NULL}, 11967, "tcp"}, +{"sysinfo-sp", {NULL}, 11967, "udp"}, +{"wmereceiving", {NULL}, 11997, "sctp"}, +{"wmedistribution", {NULL}, 11998, "sctp"}, +{"wmereporting", {NULL}, 11999, "sctp"}, +{"entextxid", {NULL}, 12000, "tcp"}, +{"entextxid", {NULL}, 12000, "udp"}, +{"entextnetwk", {NULL}, 12001, "tcp"}, +{"entextnetwk", {NULL}, 12001, "udp"}, +{"entexthigh", {NULL}, 12002, "tcp"}, +{"entexthigh", {NULL}, 12002, "udp"}, +{"entextmed", {NULL}, 12003, "tcp"}, +{"entextmed", {NULL}, 12003, "udp"}, +{"entextlow", {NULL}, 12004, "tcp"}, +{"entextlow", {NULL}, 12004, "udp"}, +{"dbisamserver1", {NULL}, 12005, "tcp"}, +{"dbisamserver1", {NULL}, 12005, "udp"}, +{"dbisamserver2", {NULL}, 12006, "tcp"}, +{"dbisamserver2", {NULL}, 12006, "udp"}, +{"accuracer", {NULL}, 12007, "tcp"}, +{"accuracer", {NULL}, 12007, "udp"}, +{"accuracer-dbms", {NULL}, 12008, "tcp"}, +{"accuracer-dbms", {NULL}, 12008, "udp"}, +{"edbsrvr", {NULL}, 12010, "tcp"}, +{"vipera", {NULL}, 12012, "tcp"}, +{"vipera", {NULL}, 12012, "udp"}, +{"vipera-ssl", {NULL}, 12013, "tcp"}, +{"vipera-ssl", {NULL}, 12013, "udp"}, +{"rets-ssl", {NULL}, 12109, "tcp"}, +{"rets-ssl", {NULL}, 12109, "udp"}, +{"nupaper-ss", {NULL}, 12121, "tcp"}, +{"nupaper-ss", {NULL}, 12121, "udp"}, +{"cawas", {NULL}, 12168, "tcp"}, +{"cawas", {NULL}, 12168, "udp"}, +{"hivep", {NULL}, 12172, "tcp"}, +{"hivep", {NULL}, 12172, "udp"}, +{"linogridengine", {NULL}, 12300, "tcp"}, +{"linogridengine", {NULL}, 12300, "udp"}, +{"warehouse-sss", {NULL}, 12321, "tcp"}, +{"warehouse-sss", {NULL}, 12321, "udp"}, +{"warehouse", {NULL}, 12322, "tcp"}, +{"warehouse", {NULL}, 12322, "udp"}, +{"italk", {NULL}, 12345, "tcp"}, +{"italk", {NULL}, 12345, "udp"}, +{"tsaf", {NULL}, 12753, "tcp"}, +{"tsaf", {NULL}, 12753, "udp"}, +{"i-zipqd", {NULL}, 13160, "tcp"}, +{"i-zipqd", {NULL}, 13160, "udp"}, +{"bcslogc", {NULL}, 13216, "tcp"}, +{"bcslogc", {NULL}, 13216, "udp"}, +{"rs-pias", {NULL}, 13217, "tcp"}, +{"rs-pias", {NULL}, 13217, "udp"}, +{"emc-vcas-tcp", {NULL}, 13218, "tcp"}, +{"emc-vcas-udp", {NULL}, 13218, "udp"}, +{"powwow-client", {NULL}, 13223, "tcp"}, +{"powwow-client", {NULL}, 13223, "udp"}, +{"powwow-server", {NULL}, 13224, "tcp"}, +{"powwow-server", {NULL}, 13224, "udp"}, +{"doip-data", {NULL}, 13400, "tcp"}, +{"doip-disc", {NULL}, 13400, "udp"}, +{"bprd", {NULL}, 13720, "tcp"}, +{"bprd", {NULL}, 13720, "udp"}, +{"bpdbm", {NULL}, 13721, "tcp"}, +{"bpdbm", {NULL}, 13721, "udp"}, +{"bpjava-msvc", {NULL}, 13722, "tcp"}, +{"bpjava-msvc", {NULL}, 13722, "udp"}, +{"vnetd", {NULL}, 13724, "tcp"}, +{"vnetd", {NULL}, 13724, "udp"}, +{"bpcd", {NULL}, 13782, "tcp"}, +{"bpcd", {NULL}, 13782, "udp"}, +{"vopied", {NULL}, 13783, "tcp"}, +{"vopied", {NULL}, 13783, "udp"}, +{"nbdb", {NULL}, 13785, "tcp"}, +{"nbdb", {NULL}, 13785, "udp"}, +{"nomdb", {NULL}, 13786, "tcp"}, +{"nomdb", {NULL}, 13786, "udp"}, +{"dsmcc-config", {NULL}, 13818, "tcp"}, +{"dsmcc-config", {NULL}, 13818, "udp"}, +{"dsmcc-session", {NULL}, 13819, "tcp"}, +{"dsmcc-session", {NULL}, 13819, "udp"}, +{"dsmcc-passthru", {NULL}, 13820, "tcp"}, +{"dsmcc-passthru", {NULL}, 13820, "udp"}, +{"dsmcc-download", {NULL}, 13821, "tcp"}, +{"dsmcc-download", {NULL}, 13821, "udp"}, +{"dsmcc-ccp", {NULL}, 13822, "tcp"}, +{"dsmcc-ccp", {NULL}, 13822, "udp"}, +{"bmdss", {NULL}, 13823, "tcp"}, +{"dta-systems", {NULL}, 13929, "tcp"}, +{"dta-systems", {NULL}, 13929, "udp"}, +{"medevolve", {NULL}, 13930, "tcp"}, +{"scotty-ft", {NULL}, 14000, "tcp"}, +{"scotty-ft", {NULL}, 14000, "udp"}, +{"sua", {NULL}, 14001, "tcp"}, +{"sua", {NULL}, 14001, "udp"}, +{"sua", {NULL}, 14001, "sctp"}, +{"sage-best-com1", {NULL}, 14033, "tcp"}, +{"sage-best-com1", {NULL}, 14033, "udp"}, +{"sage-best-com2", {NULL}, 14034, "tcp"}, +{"sage-best-com2", {NULL}, 14034, "udp"}, +{"vcs-app", {NULL}, 14141, "tcp"}, +{"vcs-app", {NULL}, 14141, "udp"}, +{"icpp", {NULL}, 14142, "tcp"}, +{"icpp", {NULL}, 14142, "udp"}, +{"gcm-app", {NULL}, 14145, "tcp"}, +{"gcm-app", {NULL}, 14145, "udp"}, +{"vrts-tdd", {NULL}, 14149, "tcp"}, +{"vrts-tdd", {NULL}, 14149, "udp"}, +{"vcscmd", {NULL}, 14150, "tcp"}, +{"vad", {NULL}, 14154, "tcp"}, +{"vad", {NULL}, 14154, "udp"}, +{"cps", {NULL}, 14250, "tcp"}, +{"cps", {NULL}, 14250, "udp"}, +{"ca-web-update", {NULL}, 14414, "tcp"}, +{"ca-web-update", {NULL}, 14414, "udp"}, +{"hde-lcesrvr-1", {NULL}, 14936, "tcp"}, +{"hde-lcesrvr-1", {NULL}, 14936, "udp"}, +{"hde-lcesrvr-2", {NULL}, 14937, "tcp"}, +{"hde-lcesrvr-2", {NULL}, 14937, "udp"}, +{"hydap", {NULL}, 15000, "tcp"}, +{"hydap", {NULL}, 15000, "udp"}, +{"xpilot", {NULL}, 15345, "tcp"}, +{"xpilot", {NULL}, 15345, "udp"}, +{"3link", {NULL}, 15363, "tcp"}, +{"3link", {NULL}, 15363, "udp"}, +{"cisco-snat", {NULL}, 15555, "tcp"}, +{"cisco-snat", {NULL}, 15555, "udp"}, +{"bex-xr", {NULL}, 15660, "tcp"}, +{"bex-xr", {NULL}, 15660, "udp"}, +{"ptp", {NULL}, 15740, "tcp"}, +{"ptp", {NULL}, 15740, "udp"}, +{"2ping", {NULL}, 15998, "udp"}, +{"programmar", {NULL}, 15999, "tcp"}, +{"fmsas", {NULL}, 16000, "tcp"}, +{"fmsascon", {NULL}, 16001, "tcp"}, +{"gsms", {NULL}, 16002, "tcp"}, +{"alfin", {NULL}, 16003, "udp"}, +{"jwpc", {NULL}, 16020, "tcp"}, +{"jwpc-bin", {NULL}, 16021, "tcp"}, +{"sun-sea-port", {NULL}, 16161, "tcp"}, +{"sun-sea-port", {NULL}, 16161, "udp"}, +{"solaris-audit", {NULL}, 16162, "tcp"}, +{"etb4j", {NULL}, 16309, "tcp"}, +{"etb4j", {NULL}, 16309, "udp"}, +{"pduncs", {NULL}, 16310, "tcp"}, +{"pduncs", {NULL}, 16310, "udp"}, +{"pdefmns", {NULL}, 16311, "tcp"}, +{"pdefmns", {NULL}, 16311, "udp"}, +{"netserialext1", {NULL}, 16360, "tcp"}, +{"netserialext1", {NULL}, 16360, "udp"}, +{"netserialext2", {NULL}, 16361, "tcp"}, +{"netserialext2", {NULL}, 16361, "udp"}, +{"netserialext3", {NULL}, 16367, "tcp"}, +{"netserialext3", {NULL}, 16367, "udp"}, +{"netserialext4", {NULL}, 16368, "tcp"}, +{"netserialext4", {NULL}, 16368, "udp"}, +{"connected", {NULL}, 16384, "tcp"}, +{"connected", {NULL}, 16384, "udp"}, +{"xoms", {NULL}, 16619, "tcp"}, +{"newbay-snc-mc", {NULL}, 16900, "tcp"}, +{"newbay-snc-mc", {NULL}, 16900, "udp"}, +{"sgcip", {NULL}, 16950, "tcp"}, +{"sgcip", {NULL}, 16950, "udp"}, +{"intel-rci-mp", {NULL}, 16991, "tcp"}, +{"intel-rci-mp", {NULL}, 16991, "udp"}, +{"amt-soap-http", {NULL}, 16992, "tcp"}, +{"amt-soap-http", {NULL}, 16992, "udp"}, +{"amt-soap-https", {NULL}, 16993, "tcp"}, +{"amt-soap-https", {NULL}, 16993, "udp"}, +{"amt-redir-tcp", {NULL}, 16994, "tcp"}, +{"amt-redir-tcp", {NULL}, 16994, "udp"}, +{"amt-redir-tls", {NULL}, 16995, "tcp"}, +{"amt-redir-tls", {NULL}, 16995, "udp"}, +{"isode-dua", {NULL}, 17007, "tcp"}, +{"isode-dua", {NULL}, 17007, "udp"}, +{"soundsvirtual", {NULL}, 17185, "tcp"}, +{"soundsvirtual", {NULL}, 17185, "udp"}, +{"chipper", {NULL}, 17219, "tcp"}, +{"chipper", {NULL}, 17219, "udp"}, +{"integrius-stp", {NULL}, 17234, "tcp"}, +{"integrius-stp", {NULL}, 17234, "udp"}, +{"ssh-mgmt", {NULL}, 17235, "tcp"}, +{"ssh-mgmt", {NULL}, 17235, "udp"}, +{"db-lsp", {NULL}, 17500, "tcp"}, +{"db-lsp-disc", {NULL}, 17500, "udp"}, +{"ea", {NULL}, 17729, "tcp"}, +{"ea", {NULL}, 17729, "udp"}, +{"zep", {NULL}, 17754, "tcp"}, +{"zep", {NULL}, 17754, "udp"}, +{"zigbee-ip", {NULL}, 17755, "tcp"}, +{"zigbee-ip", {NULL}, 17755, "udp"}, +{"zigbee-ips", {NULL}, 17756, "tcp"}, +{"zigbee-ips", {NULL}, 17756, "udp"}, +{"sw-orion", {NULL}, 17777, "tcp"}, +{"biimenu", {NULL}, 18000, "tcp"}, +{"biimenu", {NULL}, 18000, "udp"}, +{"radpdf", {NULL}, 18104, "tcp"}, +{"racf", {NULL}, 18136, "tcp"}, +{"opsec-cvp", {NULL}, 18181, "tcp"}, +{"opsec-cvp", {NULL}, 18181, "udp"}, +{"opsec-ufp", {NULL}, 18182, "tcp"}, +{"opsec-ufp", {NULL}, 18182, "udp"}, +{"opsec-sam", {NULL}, 18183, "tcp"}, +{"opsec-sam", {NULL}, 18183, "udp"}, +{"opsec-lea", {NULL}, 18184, "tcp"}, +{"opsec-lea", {NULL}, 18184, "udp"}, +{"opsec-omi", {NULL}, 18185, "tcp"}, +{"opsec-omi", {NULL}, 18185, "udp"}, +{"ohsc", {NULL}, 18186, "tcp"}, +{"ohsc", {NULL}, 18186, "udp"}, +{"opsec-ela", {NULL}, 18187, "tcp"}, +{"opsec-ela", {NULL}, 18187, "udp"}, +{"checkpoint-rtm", {NULL}, 18241, "tcp"}, +{"checkpoint-rtm", {NULL}, 18241, "udp"}, +{"gv-pf", {NULL}, 18262, "tcp"}, +{"gv-pf", {NULL}, 18262, "udp"}, +{"ac-cluster", {NULL}, 18463, "tcp"}, +{"ac-cluster", {NULL}, 18463, "udp"}, +{"rds-ib", {NULL}, 18634, "tcp"}, +{"rds-ib", {NULL}, 18634, "udp"}, +{"rds-ip", {NULL}, 18635, "tcp"}, +{"rds-ip", {NULL}, 18635, "udp"}, +{"ique", {NULL}, 18769, "tcp"}, +{"ique", {NULL}, 18769, "udp"}, +{"infotos", {NULL}, 18881, "tcp"}, +{"infotos", {NULL}, 18881, "udp"}, +{"apc-necmp", {NULL}, 18888, "tcp"}, +{"apc-necmp", {NULL}, 18888, "udp"}, +{"igrid", {NULL}, 19000, "tcp"}, +{"igrid", {NULL}, 19000, "udp"}, +{"j-link", {NULL}, 19020, "tcp"}, +{"opsec-uaa", {NULL}, 19191, "tcp"}, +{"opsec-uaa", {NULL}, 19191, "udp"}, +{"ua-secureagent", {NULL}, 19194, "tcp"}, +{"ua-secureagent", {NULL}, 19194, "udp"}, +{"keysrvr", {NULL}, 19283, "tcp"}, +{"keysrvr", {NULL}, 19283, "udp"}, +{"keyshadow", {NULL}, 19315, "tcp"}, +{"keyshadow", {NULL}, 19315, "udp"}, +{"mtrgtrans", {NULL}, 19398, "tcp"}, +{"mtrgtrans", {NULL}, 19398, "udp"}, +{"hp-sco", {NULL}, 19410, "tcp"}, +{"hp-sco", {NULL}, 19410, "udp"}, +{"hp-sca", {NULL}, 19411, "tcp"}, +{"hp-sca", {NULL}, 19411, "udp"}, +{"hp-sessmon", {NULL}, 19412, "tcp"}, +{"hp-sessmon", {NULL}, 19412, "udp"}, +{"fxuptp", {NULL}, 19539, "tcp"}, +{"fxuptp", {NULL}, 19539, "udp"}, +{"sxuptp", {NULL}, 19540, "tcp"}, +{"sxuptp", {NULL}, 19540, "udp"}, +{"jcp", {NULL}, 19541, "tcp"}, +{"jcp", {NULL}, 19541, "udp"}, +{"iec-104-sec", {NULL}, 19998, "tcp"}, +{"dnp-sec", {NULL}, 19999, "tcp"}, +{"dnp-sec", {NULL}, 19999, "udp"}, +{"dnp", {NULL}, 20000, "tcp"}, +{"dnp", {NULL}, 20000, "udp"}, +{"microsan", {NULL}, 20001, "tcp"}, +{"microsan", {NULL}, 20001, "udp"}, +{"commtact-http", {NULL}, 20002, "tcp"}, +{"commtact-http", {NULL}, 20002, "udp"}, +{"commtact-https", {NULL}, 20003, "tcp"}, +{"commtact-https", {NULL}, 20003, "udp"}, +{"openwebnet", {NULL}, 20005, "tcp"}, +{"openwebnet", {NULL}, 20005, "udp"}, +{"ss-idi-disc", {NULL}, 20012, "udp"}, +{"ss-idi", {NULL}, 20013, "tcp"}, +{"opendeploy", {NULL}, 20014, "tcp"}, +{"opendeploy", {NULL}, 20014, "udp"}, +{"nburn_id", {NULL}, 20034, "tcp"}, +{"nburn_id", {NULL}, 20034, "udp"}, +{"tmophl7mts", {NULL}, 20046, "tcp"}, +{"tmophl7mts", {NULL}, 20046, "udp"}, +{"mountd", {NULL}, 20048, "tcp"}, +{"mountd", {NULL}, 20048, "udp"}, +{"nfsrdma", {NULL}, 20049, "tcp"}, +{"nfsrdma", {NULL}, 20049, "udp"}, +{"nfsrdma", {NULL}, 20049, "sctp"}, +{"tolfab", {NULL}, 20167, "tcp"}, +{"tolfab", {NULL}, 20167, "udp"}, +{"ipdtp-port", {NULL}, 20202, "tcp"}, +{"ipdtp-port", {NULL}, 20202, "udp"}, +{"ipulse-ics", {NULL}, 20222, "tcp"}, +{"ipulse-ics", {NULL}, 20222, "udp"}, +{"emwavemsg", {NULL}, 20480, "tcp"}, +{"emwavemsg", {NULL}, 20480, "udp"}, +{"track", {NULL}, 20670, "tcp"}, +{"track", {NULL}, 20670, "udp"}, +{"athand-mmp", {NULL}, 20999, "tcp"}, +{"athand-mmp", {NULL}, 20999, "udp"}, +{"irtrans", {NULL}, 21000, "tcp"}, +{"irtrans", {NULL}, 21000, "udp"}, +{"dfserver", {NULL}, 21554, "tcp"}, +{"dfserver", {NULL}, 21554, "udp"}, +{"vofr-gateway", {NULL}, 21590, "tcp"}, +{"vofr-gateway", {NULL}, 21590, "udp"}, +{"tvpm", {NULL}, 21800, "tcp"}, +{"tvpm", {NULL}, 21800, "udp"}, +{"webphone", {NULL}, 21845, "tcp"}, +{"webphone", {NULL}, 21845, "udp"}, +{"netspeak-is", {NULL}, 21846, "tcp"}, +{"netspeak-is", {NULL}, 21846, "udp"}, +{"netspeak-cs", {NULL}, 21847, "tcp"}, +{"netspeak-cs", {NULL}, 21847, "udp"}, +{"netspeak-acd", {NULL}, 21848, "tcp"}, +{"netspeak-acd", {NULL}, 21848, "udp"}, +{"netspeak-cps", {NULL}, 21849, "tcp"}, +{"netspeak-cps", {NULL}, 21849, "udp"}, +{"snapenetio", {NULL}, 22000, "tcp"}, +{"snapenetio", {NULL}, 22000, "udp"}, +{"optocontrol", {NULL}, 22001, "tcp"}, +{"optocontrol", {NULL}, 22001, "udp"}, +{"optohost002", {NULL}, 22002, "tcp"}, +{"optohost002", {NULL}, 22002, "udp"}, +{"optohost003", {NULL}, 22003, "tcp"}, +{"optohost003", {NULL}, 22003, "udp"}, +{"optohost004", {NULL}, 22004, "tcp"}, +{"optohost004", {NULL}, 22004, "udp"}, +{"optohost004", {NULL}, 22005, "tcp"}, +{"optohost004", {NULL}, 22005, "udp"}, +{"dcap", {NULL}, 22125, "tcp"}, +{"gsidcap", {NULL}, 22128, "tcp"}, +{"wnn6", {NULL}, 22273, "tcp"}, +{"wnn6", {NULL}, 22273, "udp"}, +{"cis", {NULL}, 22305, "tcp"}, +{"cis", {NULL}, 22305, "udp"}, +{"cis-secure", {NULL}, 22343, "tcp"}, +{"cis-secure", {NULL}, 22343, "udp"}, +{"WibuKey", {NULL}, 22347, "tcp"}, +{"WibuKey", {NULL}, 22347, "udp"}, +{"CodeMeter", {NULL}, 22350, "tcp"}, +{"CodeMeter", {NULL}, 22350, "udp"}, +{"vocaltec-wconf", {NULL}, 22555, "tcp"}, +{"vocaltec-phone", {NULL}, 22555, "udp"}, +{"talikaserver", {NULL}, 22763, "tcp"}, +{"talikaserver", {NULL}, 22763, "udp"}, +{"aws-brf", {NULL}, 22800, "tcp"}, +{"aws-brf", {NULL}, 22800, "udp"}, +{"brf-gw", {NULL}, 22951, "tcp"}, +{"brf-gw", {NULL}, 22951, "udp"}, +{"inovaport1", {NULL}, 23000, "tcp"}, +{"inovaport1", {NULL}, 23000, "udp"}, +{"inovaport2", {NULL}, 23001, "tcp"}, +{"inovaport2", {NULL}, 23001, "udp"}, +{"inovaport3", {NULL}, 23002, "tcp"}, +{"inovaport3", {NULL}, 23002, "udp"}, +{"inovaport4", {NULL}, 23003, "tcp"}, +{"inovaport4", {NULL}, 23003, "udp"}, +{"inovaport5", {NULL}, 23004, "tcp"}, +{"inovaport5", {NULL}, 23004, "udp"}, +{"inovaport6", {NULL}, 23005, "tcp"}, +{"inovaport6", {NULL}, 23005, "udp"}, +{"s102", {NULL}, 23272, "udp"}, +{"elxmgmt", {NULL}, 23333, "tcp"}, +{"elxmgmt", {NULL}, 23333, "udp"}, +{"novar-dbase", {NULL}, 23400, "tcp"}, +{"novar-dbase", {NULL}, 23400, "udp"}, +{"novar-alarm", {NULL}, 23401, "tcp"}, +{"novar-alarm", {NULL}, 23401, "udp"}, +{"novar-global", {NULL}, 23402, "tcp"}, +{"novar-global", {NULL}, 23402, "udp"}, +{"aequus", {NULL}, 23456, "tcp"}, +{"aequus-alt", {NULL}, 23457, "tcp"}, +{"med-ltp", {NULL}, 24000, "tcp"}, +{"med-ltp", {NULL}, 24000, "udp"}, +{"med-fsp-rx", {NULL}, 24001, "tcp"}, +{"med-fsp-rx", {NULL}, 24001, "udp"}, +{"med-fsp-tx", {NULL}, 24002, "tcp"}, +{"med-fsp-tx", {NULL}, 24002, "udp"}, +{"med-supp", {NULL}, 24003, "tcp"}, +{"med-supp", {NULL}, 24003, "udp"}, +{"med-ovw", {NULL}, 24004, "tcp"}, +{"med-ovw", {NULL}, 24004, "udp"}, +{"med-ci", {NULL}, 24005, "tcp"}, +{"med-ci", {NULL}, 24005, "udp"}, +{"med-net-svc", {NULL}, 24006, "tcp"}, +{"med-net-svc", {NULL}, 24006, "udp"}, +{"filesphere", {NULL}, 24242, "tcp"}, +{"filesphere", {NULL}, 24242, "udp"}, +{"vista-4gl", {NULL}, 24249, "tcp"}, +{"vista-4gl", {NULL}, 24249, "udp"}, +{"ild", {NULL}, 24321, "tcp"}, +{"ild", {NULL}, 24321, "udp"}, +{"intel_rci", {NULL}, 24386, "tcp"}, +{"intel_rci", {NULL}, 24386, "udp"}, +{"tonidods", {NULL}, 24465, "tcp"}, +{"tonidods", {NULL}, 24465, "udp"}, +{"binkp", {NULL}, 24554, "tcp"}, +{"binkp", {NULL}, 24554, "udp"}, +{"canditv", {NULL}, 24676, "tcp"}, +{"canditv", {NULL}, 24676, "udp"}, +{"flashfiler", {NULL}, 24677, "tcp"}, +{"flashfiler", {NULL}, 24677, "udp"}, +{"proactivate", {NULL}, 24678, "tcp"}, +{"proactivate", {NULL}, 24678, "udp"}, +{"tcc-http", {NULL}, 24680, "tcp"}, +{"tcc-http", {NULL}, 24680, "udp"}, +{"cslg", {NULL}, 24754, "tcp"}, +{"find", {NULL}, 24922, "tcp"}, +{"find", {NULL}, 24922, "udp"}, +{"icl-twobase1", {NULL}, 25000, "tcp"}, +{"icl-twobase1", {NULL}, 25000, "udp"}, +{"icl-twobase2", {NULL}, 25001, "tcp"}, +{"icl-twobase2", {NULL}, 25001, "udp"}, +{"icl-twobase3", {NULL}, 25002, "tcp"}, +{"icl-twobase3", {NULL}, 25002, "udp"}, +{"icl-twobase4", {NULL}, 25003, "tcp"}, +{"icl-twobase4", {NULL}, 25003, "udp"}, +{"icl-twobase5", {NULL}, 25004, "tcp"}, +{"icl-twobase5", {NULL}, 25004, "udp"}, +{"icl-twobase6", {NULL}, 25005, "tcp"}, +{"icl-twobase6", {NULL}, 25005, "udp"}, +{"icl-twobase7", {NULL}, 25006, "tcp"}, +{"icl-twobase7", {NULL}, 25006, "udp"}, +{"icl-twobase8", {NULL}, 25007, "tcp"}, +{"icl-twobase8", {NULL}, 25007, "udp"}, +{"icl-twobase9", {NULL}, 25008, "tcp"}, +{"icl-twobase9", {NULL}, 25008, "udp"}, +{"icl-twobase10", {NULL}, 25009, "tcp"}, +{"icl-twobase10", {NULL}, 25009, "udp"}, +{"rna", {NULL}, 25471, "sctp"}, +{"sauterdongle", {NULL}, 25576, "tcp"}, +{"vocaltec-hos", {NULL}, 25793, "tcp"}, +{"vocaltec-hos", {NULL}, 25793, "udp"}, +{"tasp-net", {NULL}, 25900, "tcp"}, +{"tasp-net", {NULL}, 25900, "udp"}, +{"niobserver", {NULL}, 25901, "tcp"}, +{"niobserver", {NULL}, 25901, "udp"}, +{"nilinkanalyst", {NULL}, 25902, "tcp"}, +{"nilinkanalyst", {NULL}, 25902, "udp"}, +{"niprobe", {NULL}, 25903, "tcp"}, +{"niprobe", {NULL}, 25903, "udp"}, +{"quake", {NULL}, 26000, "tcp"}, +{"quake", {NULL}, 26000, "udp"}, +{"scscp", {NULL}, 26133, "tcp"}, +{"scscp", {NULL}, 26133, "udp"}, +{"wnn6-ds", {NULL}, 26208, "tcp"}, +{"wnn6-ds", {NULL}, 26208, "udp"}, +{"ezproxy", {NULL}, 26260, "tcp"}, +{"ezproxy", {NULL}, 26260, "udp"}, +{"ezmeeting", {NULL}, 26261, "tcp"}, +{"ezmeeting", {NULL}, 26261, "udp"}, +{"k3software-svr", {NULL}, 26262, "tcp"}, +{"k3software-svr", {NULL}, 26262, "udp"}, +{"k3software-cli", {NULL}, 26263, "tcp"}, +{"k3software-cli", {NULL}, 26263, "udp"}, +{"exoline-tcp", {NULL}, 26486, "tcp"}, +{"exoline-udp", {NULL}, 26486, "udp"}, +{"exoconfig", {NULL}, 26487, "tcp"}, +{"exoconfig", {NULL}, 26487, "udp"}, +{"exonet", {NULL}, 26489, "tcp"}, +{"exonet", {NULL}, 26489, "udp"}, +{"imagepump", {NULL}, 27345, "tcp"}, +{"imagepump", {NULL}, 27345, "udp"}, +{"jesmsjc", {NULL}, 27442, "tcp"}, +{"jesmsjc", {NULL}, 27442, "udp"}, +{"kopek-httphead", {NULL}, 27504, "tcp"}, +{"kopek-httphead", {NULL}, 27504, "udp"}, +{"ars-vista", {NULL}, 27782, "tcp"}, +{"ars-vista", {NULL}, 27782, "udp"}, +{"tw-auth-key", {NULL}, 27999, "tcp"}, +{"tw-auth-key", {NULL}, 27999, "udp"}, +{"nxlmd", {NULL}, 28000, "tcp"}, +{"nxlmd", {NULL}, 28000, "udp"}, +{"pqsp", {NULL}, 28001, "tcp"}, +{"siemensgsm", {NULL}, 28240, "tcp"}, +{"siemensgsm", {NULL}, 28240, "udp"}, +{"sgsap", {NULL}, 29118, "sctp"}, +{"otmp", {NULL}, 29167, "tcp"}, +{"otmp", {NULL}, 29167, "udp"}, +{"sbcap", {NULL}, 29168, "sctp"}, +{"iuhsctpassoc", {NULL}, 29169, "sctp"}, +{"pago-services1", {NULL}, 30001, "tcp"}, +{"pago-services1", {NULL}, 30001, "udp"}, +{"pago-services2", {NULL}, 30002, "tcp"}, +{"pago-services2", {NULL}, 30002, "udp"}, +{"kingdomsonline", {NULL}, 30260, "tcp"}, +{"kingdomsonline", {NULL}, 30260, "udp"}, +{"ovobs", {NULL}, 30999, "tcp"}, +{"ovobs", {NULL}, 30999, "udp"}, +{"autotrac-acp", {NULL}, 31020, "tcp"}, +{"yawn", {NULL}, 31029, "udp"}, +{"xqosd", {NULL}, 31416, "tcp"}, +{"xqosd", {NULL}, 31416, "udp"}, +{"tetrinet", {NULL}, 31457, "tcp"}, +{"tetrinet", {NULL}, 31457, "udp"}, +{"lm-mon", {NULL}, 31620, "tcp"}, +{"lm-mon", {NULL}, 31620, "udp"}, +{"dsx_monitor", {NULL}, 31685, "tcp"}, +{"gamesmith-port", {NULL}, 31765, "tcp"}, +{"gamesmith-port", {NULL}, 31765, "udp"}, +{"iceedcp_tx", {NULL}, 31948, "tcp"}, +{"iceedcp_tx", {NULL}, 31948, "udp"}, +{"iceedcp_rx", {NULL}, 31949, "tcp"}, +{"iceedcp_rx", {NULL}, 31949, "udp"}, +{"iracinghelper", {NULL}, 32034, "tcp"}, +{"iracinghelper", {NULL}, 32034, "udp"}, +{"t1distproc60", {NULL}, 32249, "tcp"}, +{"t1distproc60", {NULL}, 32249, "udp"}, +{"apm-link", {NULL}, 32483, "tcp"}, +{"apm-link", {NULL}, 32483, "udp"}, +{"sec-ntb-clnt", {NULL}, 32635, "tcp"}, +{"sec-ntb-clnt", {NULL}, 32635, "udp"}, +{"DMExpress", {NULL}, 32636, "tcp"}, +{"DMExpress", {NULL}, 32636, "udp"}, +{"filenet-powsrm", {NULL}, 32767, "tcp"}, +{"filenet-powsrm", {NULL}, 32767, "udp"}, +{"filenet-tms", {NULL}, 32768, "tcp"}, +{"filenet-tms", {NULL}, 32768, "udp"}, +{"filenet-rpc", {NULL}, 32769, "tcp"}, +{"filenet-rpc", {NULL}, 32769, "udp"}, +{"filenet-nch", {NULL}, 32770, "tcp"}, +{"filenet-nch", {NULL}, 32770, "udp"}, +{"filenet-rmi", {NULL}, 32771, "tcp"}, +{"filenet-rmi", {NULL}, 32771, "udp"}, +{"filenet-pa", {NULL}, 32772, "tcp"}, +{"filenet-pa", {NULL}, 32772, "udp"}, +{"filenet-cm", {NULL}, 32773, "tcp"}, +{"filenet-cm", {NULL}, 32773, "udp"}, +{"filenet-re", {NULL}, 32774, "tcp"}, +{"filenet-re", {NULL}, 32774, "udp"}, +{"filenet-pch", {NULL}, 32775, "tcp"}, +{"filenet-pch", {NULL}, 32775, "udp"}, +{"filenet-peior", {NULL}, 32776, "tcp"}, +{"filenet-peior", {NULL}, 32776, "udp"}, +{"filenet-obrok", {NULL}, 32777, "tcp"}, +{"filenet-obrok", {NULL}, 32777, "udp"}, +{"mlsn", {NULL}, 32801, "tcp"}, +{"mlsn", {NULL}, 32801, "udp"}, +{"retp", {NULL}, 32811, "tcp"}, +{"idmgratm", {NULL}, 32896, "tcp"}, +{"idmgratm", {NULL}, 32896, "udp"}, +{"aurora-balaena", {NULL}, 33123, "tcp"}, +{"aurora-balaena", {NULL}, 33123, "udp"}, +{"diamondport", {NULL}, 33331, "tcp"}, +{"diamondport", {NULL}, 33331, "udp"}, +{"dgi-serv", {NULL}, 33333, "tcp"}, +{"traceroute", {NULL}, 33434, "tcp"}, +{"traceroute", {NULL}, 33434, "udp"}, +{"snip-slave", {NULL}, 33656, "tcp"}, +{"snip-slave", {NULL}, 33656, "udp"}, +{"turbonote-2", {NULL}, 34249, "tcp"}, +{"turbonote-2", {NULL}, 34249, "udp"}, +{"p-net-local", {NULL}, 34378, "tcp"}, +{"p-net-local", {NULL}, 34378, "udp"}, +{"p-net-remote", {NULL}, 34379, "tcp"}, +{"p-net-remote", {NULL}, 34379, "udp"}, +{"dhanalakshmi", {NULL}, 34567, "tcp"}, +{"profinet-rt", {NULL}, 34962, "tcp"}, +{"profinet-rt", {NULL}, 34962, "udp"}, +{"profinet-rtm", {NULL}, 34963, "tcp"}, +{"profinet-rtm", {NULL}, 34963, "udp"}, +{"profinet-cm", {NULL}, 34964, "tcp"}, +{"profinet-cm", {NULL}, 34964, "udp"}, +{"ethercat", {NULL}, 34980, "tcp"}, +{"ethercat", {NULL}, 34980, "udp"}, +{"allpeers", {NULL}, 36001, "tcp"}, +{"allpeers", {NULL}, 36001, "udp"}, +{"s1-control", {NULL}, 36412, "sctp"}, +{"x2-control", {NULL}, 36422, "sctp"}, +{"m2ap", {NULL}, 36443, "sctp"}, +{"m3ap", {NULL}, 36444, "sctp"}, +{"kastenxpipe", {NULL}, 36865, "tcp"}, +{"kastenxpipe", {NULL}, 36865, "udp"}, +{"neckar", {NULL}, 37475, "tcp"}, +{"neckar", {NULL}, 37475, "udp"}, +{"unisys-eportal", {NULL}, 37654, "tcp"}, +{"unisys-eportal", {NULL}, 37654, "udp"}, +{"galaxy7-data", {NULL}, 38201, "tcp"}, +{"galaxy7-data", {NULL}, 38201, "udp"}, +{"fairview", {NULL}, 38202, "tcp"}, +{"fairview", {NULL}, 38202, "udp"}, +{"agpolicy", {NULL}, 38203, "tcp"}, +{"agpolicy", {NULL}, 38203, "udp"}, +{"turbonote-1", {NULL}, 39681, "tcp"}, +{"turbonote-1", {NULL}, 39681, "udp"}, +{"safetynetp", {NULL}, 40000, "tcp"}, +{"safetynetp", {NULL}, 40000, "udp"}, +{"cscp", {NULL}, 40841, "tcp"}, +{"cscp", {NULL}, 40841, "udp"}, +{"csccredir", {NULL}, 40842, "tcp"}, +{"csccredir", {NULL}, 40842, "udp"}, +{"csccfirewall", {NULL}, 40843, "tcp"}, +{"csccfirewall", {NULL}, 40843, "udp"}, +{"ortec-disc", {NULL}, 40853, "udp"}, +{"fs-qos", {NULL}, 41111, "tcp"}, +{"fs-qos", {NULL}, 41111, "udp"}, +{"tentacle", {NULL}, 41121, "tcp"}, +{"crestron-cip", {NULL}, 41794, "tcp"}, +{"crestron-cip", {NULL}, 41794, "udp"}, +{"crestron-ctp", {NULL}, 41795, "tcp"}, +{"crestron-ctp", {NULL}, 41795, "udp"}, +{"candp", {NULL}, 42508, "tcp"}, +{"candp", {NULL}, 42508, "udp"}, +{"candrp", {NULL}, 42509, "tcp"}, +{"candrp", {NULL}, 42509, "udp"}, +{"caerpc", {NULL}, 42510, "tcp"}, +{"caerpc", {NULL}, 42510, "udp"}, +{"reachout", {NULL}, 43188, "tcp"}, +{"reachout", {NULL}, 43188, "udp"}, +{"ndm-agent-port", {NULL}, 43189, "tcp"}, +{"ndm-agent-port", {NULL}, 43189, "udp"}, +{"ip-provision", {NULL}, 43190, "tcp"}, +{"ip-provision", {NULL}, 43190, "udp"}, +{"noit-transport", {NULL}, 43191, "tcp"}, +{"ew-mgmt", {NULL}, 43440, "tcp"}, +{"ew-disc-cmd", {NULL}, 43440, "udp"}, +{"ciscocsdb", {NULL}, 43441, "tcp"}, +{"ciscocsdb", {NULL}, 43441, "udp"}, +{"pmcd", {NULL}, 44321, "tcp"}, +{"pmcd", {NULL}, 44321, "udp"}, +{"pmcdproxy", {NULL}, 44322, "tcp"}, +{"pmcdproxy", {NULL}, 44322, "udp"}, +{"pcp", {NULL}, 44323, "udp"}, +{"rbr-debug", {NULL}, 44553, "tcp"}, +{"rbr-debug", {NULL}, 44553, "udp"}, +{"EtherNet/IP-2", {NULL}, 44818, "tcp"}, +{"EtherNet/IP-2", {NULL}, 44818, "udp"}, +{"invision-ag", {NULL}, 45054, "tcp"}, +{"invision-ag", {NULL}, 45054, "udp"}, +{"eba", {NULL}, 45678, "tcp"}, +{"eba", {NULL}, 45678, "udp"}, +{"qdb2service", {NULL}, 45825, "tcp"}, +{"qdb2service", {NULL}, 45825, "udp"}, +{"ssr-servermgr", {NULL}, 45966, "tcp"}, +{"ssr-servermgr", {NULL}, 45966, "udp"}, +{"mediabox", {NULL}, 46999, "tcp"}, +{"mediabox", {NULL}, 46999, "udp"}, +{"mbus", {NULL}, 47000, "tcp"}, +{"mbus", {NULL}, 47000, "udp"}, +{"winrm", {NULL}, 47001, "tcp"}, +{"dbbrowse", {NULL}, 47557, "tcp"}, +{"dbbrowse", {NULL}, 47557, "udp"}, +{"directplaysrvr", {NULL}, 47624, "tcp"}, +{"directplaysrvr", {NULL}, 47624, "udp"}, +{"ap", {NULL}, 47806, "tcp"}, +{"ap", {NULL}, 47806, "udp"}, +{"bacnet", {NULL}, 47808, "tcp"}, +{"bacnet", {NULL}, 47808, "udp"}, +{"nimcontroller", {NULL}, 48000, "tcp"}, +{"nimcontroller", {NULL}, 48000, "udp"}, +{"nimspooler", {NULL}, 48001, "tcp"}, +{"nimspooler", {NULL}, 48001, "udp"}, +{"nimhub", {NULL}, 48002, "tcp"}, +{"nimhub", {NULL}, 48002, "udp"}, +{"nimgtw", {NULL}, 48003, "tcp"}, +{"nimgtw", {NULL}, 48003, "udp"}, +{"nimbusdb", {NULL}, 48004, "tcp"}, +{"nimbusdbctrl", {NULL}, 48005, "tcp"}, +{"3gpp-cbsp", {NULL}, 48049, "tcp"}, +{"isnetserv", {NULL}, 48128, "tcp"}, +{"isnetserv", {NULL}, 48128, "udp"}, +{"blp5", {NULL}, 48129, "tcp"}, +{"blp5", {NULL}, 48129, "udp"}, +{"com-bardac-dw", {NULL}, 48556, "tcp"}, +{"com-bardac-dw", {NULL}, 48556, "udp"}, +{"iqobject", {NULL}, 48619, "tcp"}, +{"iqobject", {NULL}, 48619, "udp"}, +#endif /* USE_IANA_REGISTERED_PORTS */ +{ NULL, {NULL}, 0, NULL } +}; + +struct servent *getservbyport(int port, const char *proto) +{ + unsigned short u_port; + const char *protocol = NULL; + int i, error = 0; + + u_port = ntohs((unsigned short)port); + + if (proto) + { + switch (strlen(proto)) { + case 3: + if (!strncasecmp(proto, "tcp", 3)) + protocol = "tcp"; + else if (!strncasecmp(proto, "udp", 3)) + protocol = "udp"; + else + error = WSAEFAULT; + break; + case 4: + if (!strncasecmp(proto, "sctp", 4)) + protocol = "sctp"; + else if (!strncasecmp(proto, "dccp", 4)) + protocol = "dccp"; + else + error = WSAEFAULT; + break; + default: + error = WSAEFAULT; + } + } + + if (!error) + { + for (i = 0; i < (sizeof(IANAports) / sizeof(IANAports[0])) - 1; i++) + { + if (u_port == IANAports[i].s_port) + { + if (!protocol || !strcasecmp(protocol, IANAports[i].s_proto)) + return (struct servent *)&IANAports[i]; + } + } + error = WSANO_DATA; + } + + SET_SOCKERRNO(error); + return NULL; +} + +#endif /* _WIN32_WCE */ diff -Nru python-gevent-0.13.7/c-ares/ares_platform.h python-gevent-1.0/c-ares/ares_platform.h --- python-gevent-0.13.7/c-ares/ares_platform.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_platform.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,43 @@ +#ifndef HEADER_CARES_PLATFORM_H +#define HEADER_CARES_PLATFORM_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004 - 2011 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#if defined(WIN32) && !defined(MSDOS) + +typedef enum { + WIN_UNKNOWN, + WIN_3X, + WIN_9X, + WIN_NT, + WIN_CE +} win_platform; + +win_platform ares__getplatform(void); + +#endif + +#if defined(_WIN32_WCE) + +struct servent *getservbyport(int port, const char *proto); + +#endif + +#endif /* HEADER_CARES_PLATFORM_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_private.h python-gevent-1.0/c-ares/ares_private.h --- python-gevent-0.13.7/c-ares/ares_private.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_private.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,363 @@ +#ifndef __ARES_PRIVATE_H +#define __ARES_PRIVATE_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2010 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +#define WIN32 +#endif + +#include +#include + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef WATT32 +#include +#include +#define writev(s,v,c) writev_s(s,v,c) +#define HAVE_WRITEV 1 +#endif + +#ifdef NETWARE +#include +#endif + +#define DEFAULT_TIMEOUT 5000 /* milliseconds */ +#define DEFAULT_TRIES 4 +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +#if defined(WIN32) && !defined(WATT32) + +#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" +#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define NAMESERVER "NameServer" +#define DHCPNAMESERVER "DhcpNameServer" +#define DATABASEPATH "DatabasePath" +#define WIN_PATH_HOSTS "\\hosts" + +#elif defined(WATT32) + +#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" + +#elif defined(NETWARE) + +#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" +#define PATH_HOSTS "sys:/etc/hosts" + +#elif defined(__riscos__) + +#define PATH_HOSTS "InetDBase:Hosts" + +#else + +#define PATH_RESOLV_CONF "/etc/resolv.conf" +#ifdef ETC_INET +#define PATH_HOSTS "/etc/inet/hosts" +#else +#define PATH_HOSTS "/etc/hosts" +#endif + +#endif + +#define ARES_ID_KEY_LEN 31 + +#include "ares_ipv6.h" +#include "ares_llist.h" + +#ifndef HAVE_GETENV +# include "ares_getenv.h" +# define getenv(ptr) ares_getenv(ptr) +#endif + +#ifndef HAVE_STRDUP +# include "ares_strdup.h" +# define strdup(ptr) ares_strdup(ptr) +#endif + +#ifndef HAVE_STRCASECMP +# include "ares_strcasecmp.h" +# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) +#endif + +#ifndef HAVE_STRNCASECMP +# include "ares_strcasecmp.h" +# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) +#endif + +#ifndef HAVE_WRITEV +# include "ares_writev.h" +# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt) +#endif + +/********* EDNS defines section ******/ +#define EDNSPACKETSZ 1280 /* Reasonable UDP payload size, as suggested + in RFC2671 */ +#define MAXENDSSZ 4096 /* Maximum (local) limit for edns packet size */ +#define EDNSFIXEDSZ 11 /* Size of EDNS header */ +/********* EDNS defines section ******/ + +struct ares_addr { + int family; + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; +}; +#define addrV4 addr.addr4 +#define addrV6 addr.addr6 + +struct query; + +struct send_request { + /* Remaining data to send */ + const unsigned char *data; + size_t len; + + /* The query for which we're sending this data */ + struct query* owner_query; + /* The buffer we're using, if we have our own copy of the packet */ + unsigned char *data_storage; + + /* Next request in queue */ + struct send_request *next; +}; + +struct server_state { + struct ares_addr addr; + ares_socket_t udp_socket; + ares_socket_t tcp_socket; + + /* Mini-buffer for reading the length word */ + unsigned char tcp_lenbuf[2]; + int tcp_lenbuf_pos; + int tcp_length; + + /* Buffer for reading actual TCP data */ + unsigned char *tcp_buffer; + int tcp_buffer_pos; + + /* TCP output queue */ + struct send_request *qhead; + struct send_request *qtail; + + /* Which incarnation of this connection is this? We don't want to + * retransmit requests into the very same socket, but if the server + * closes on us and we re-open the connection, then we do want to + * re-send. */ + int tcp_connection_generation; + + /* Circular, doubly-linked list of outstanding queries to this server */ + struct list_node queries_to_server; + + /* Link back to owning channel */ + ares_channel channel; + + /* Is this server broken? We mark connections as broken when a + * request that is queued for sending times out. + */ + int is_broken; +}; + +/* State to represent a DNS query */ +struct query { + /* Query ID from qbuf, for faster lookup, and current timeout */ + unsigned short qid; + struct timeval timeout; + + /* + * Links for the doubly-linked lists in which we insert a query. + * These circular, doubly-linked lists that are hash-bucketed based + * the attributes we care about, help making most important + * operations O(1). + */ + struct list_node queries_by_qid; /* hopefully in same cache line as qid */ + struct list_node queries_by_timeout; + struct list_node queries_to_server; + struct list_node all_queries; + + /* Query buf with length at beginning, for TCP transmission */ + unsigned char *tcpbuf; + int tcplen; + + /* Arguments passed to ares_send() (qbuf points into tcpbuf) */ + const unsigned char *qbuf; + int qlen; + ares_callback callback; + void *arg; + + /* Query status */ + int try_count; /* Number of times we tried this query already. */ + int server; /* Server this query has last been sent to. */ + struct query_server_info *server_info; /* per-server state */ + int using_tcp; + int error_status; + int timeouts; /* number of timeouts we saw for this request */ +}; + +/* Per-server state for a query */ +struct query_server_info { + int skip_server; /* should we skip server, due to errors, etc? */ + int tcp_connection_generation; /* into which TCP connection did we send? */ +}; + +/* An IP address pattern; matches an IP address X if X & mask == addr */ +#define PATTERN_MASK 0x1 +#define PATTERN_CIDR 0x2 + +struct apattern { + union + { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; + union + { + struct in_addr addr4; + struct ares_in6_addr addr6; + unsigned short bits; + } mask; + int family; + unsigned short type; +}; + +typedef struct rc4_key +{ + unsigned char state[256]; + unsigned char x; + unsigned char y; +} rc4_key; + +struct ares_channeldata { + /* Configuration data */ + int flags; + int timeout; /* in milliseconds */ + int tries; + int ndots; + int rotate; /* if true, all servers specified are used */ + int udp_port; + int tcp_port; + int socket_send_buffer_size; + int socket_receive_buffer_size; + char **domains; + int ndomains; + struct apattern *sortlist; + int nsort; + char *lookups; + int ednspsz; + + /* For binding to local devices and/or IP addresses. Leave + * them null/zero for no binding. + */ + char local_dev_name[32]; + unsigned int local_ip4; + unsigned char local_ip6[16]; + + int optmask; /* the option bitfield passed in at init time */ + + /* Server addresses and communications state */ + struct server_state *servers; + int nservers; + + /* ID to use for next query */ + unsigned short next_id; + /* key to use when generating new ids */ + rc4_key id_key; + + /* Generation number to use for the next TCP socket open/close */ + int tcp_connection_generation; + + /* The time at which we last called process_timeouts(). Uses integer seconds + just to draw the line somewhere. */ + time_t last_timeout_processed; + + /* Last server we sent a query to. */ + int last_server; + + /* Circular, doubly-linked list of queries, bucketed various ways.... */ + /* All active queries in a single list: */ + struct list_node all_queries; + /* Queries bucketed by qid, for quickly dispatching DNS responses: */ +#define ARES_QID_TABLE_SIZE 2048 + struct list_node queries_by_qid[ARES_QID_TABLE_SIZE]; + /* Queries bucketed by timeout, for quickly handling timeouts: */ +#define ARES_TIMEOUT_TABLE_SIZE 1024 + struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE]; + + ares_sock_state_cb sock_state_cb; + void *sock_state_cb_data; + + ares_sock_create_callback sock_create_cb; + void *sock_create_cb_data; +}; + +/* return true if now is exactly check time or later */ +int ares__timedout(struct timeval *now, + struct timeval *check); +/* add the specific number of milliseconds to the time in the first argument */ +int ares__timeadd(struct timeval *now, + int millisecs); +/* return time offset between now and (future) check, in milliseconds */ +long ares__timeoffset(struct timeval *now, + struct timeval *check); +/* returns ARES_SUCCESS if library has been initialized */ +int ares_library_initialized(void); +void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); +void ares__send_query(ares_channel channel, struct query *query, + struct timeval *now); +void ares__close_sockets(ares_channel channel, struct server_state *server); +int ares__get_hostent(FILE *fp, int family, struct hostent **host); +int ares__read_line(FILE *fp, char **buf, size_t *bufsize); +void ares__free_query(struct query *query); +unsigned short ares__generate_new_id(rc4_key* key); +struct timeval ares__tvnow(void); +int ares__expand_name_for_response(const unsigned char *encoded, + const unsigned char *abuf, int alen, + char **s, long *enclen); +void ares__init_servers_state(ares_channel channel); +void ares__destroy_servers_state(ares_channel channel); +#if 0 /* Not used */ +long ares__tvdiff(struct timeval t1, struct timeval t2); +#endif + +#define ARES_SWAP_BYTE(a,b) \ + { unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; } + +#define SOCK_STATE_CALLBACK(c, s, r, w) \ + do { \ + if ((c)->sock_state_cb) \ + (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \ + } WHILE_FALSE + +#ifdef CURLDEBUG +/* This is low-level hard-hacking memory leak tracking and similar. Using the + libcurl lowlevel code from within library is ugly and only works when + c-ares is built and linked with a similarly curldebug-enabled libcurl, + but we do this anyway for convenience. */ +#include "../lib/memdebug.h" +#endif + +#endif /* __ARES_PRIVATE_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_process.c python-gevent-1.0/c-ares/ares_process.c --- python-gevent-0.13.7/c-ares/ares_process.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_process.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1318 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2012 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_UIO_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETINET_TCP_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef NETWARE +# include +#endif + +#include +#include +#include +#include +#include + +#include "ares.h" +#include "ares_dns.h" +#include "ares_nowarn.h" +#include "ares_private.h" + + +static int try_again(int errnum); +static void write_tcp_data(ares_channel channel, fd_set *write_fds, + ares_socket_t write_fd, struct timeval *now); +static void read_tcp_data(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now); +static void read_udp_packets(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now); +static void advance_tcp_send_queue(ares_channel channel, int whichserver, + ssize_t num_bytes); +static void process_timeouts(ares_channel channel, struct timeval *now); +static void process_broken_connections(ares_channel channel, + struct timeval *now); +static void process_answer(ares_channel channel, unsigned char *abuf, + int alen, int whichserver, int tcp, + struct timeval *now); +static void handle_error(ares_channel channel, int whichserver, + struct timeval *now); +static void skip_server(ares_channel channel, struct query *query, + int whichserver); +static void next_server(ares_channel channel, struct query *query, + struct timeval *now); +static int open_tcp_socket(ares_channel channel, struct server_state *server); +static int open_udp_socket(ares_channel channel, struct server_state *server); +static int same_questions(const unsigned char *qbuf, int qlen, + const unsigned char *abuf, int alen); +static int same_address(struct sockaddr *sa, struct ares_addr *aa); +static void end_query(ares_channel channel, struct query *query, int status, + unsigned char *abuf, int alen); + +/* return true if now is exactly check time or later */ +int ares__timedout(struct timeval *now, + struct timeval *check) +{ + long secs = (now->tv_sec - check->tv_sec); + + if(secs > 0) + return 1; /* yes, timed out */ + if(secs < 0) + return 0; /* nope, not timed out */ + + /* if the full seconds were identical, check the sub second parts */ + return (now->tv_usec - check->tv_usec >= 0); +} + +/* add the specific number of milliseconds to the time in the first argument */ +int ares__timeadd(struct timeval *now, + int millisecs) +{ + now->tv_sec += millisecs/1000; + now->tv_usec += (millisecs%1000)*1000; + + if(now->tv_usec >= 1000000) { + ++(now->tv_sec); + now->tv_usec -= 1000000; + } + + return 0; +} + +/* return time offset between now and (future) check, in milliseconds */ +long ares__timeoffset(struct timeval *now, + struct timeval *check) +{ + return (check->tv_sec - now->tv_sec)*1000 + + (check->tv_usec - now->tv_usec)/1000; +} + + +/* + * generic process function + */ +static void processfds(ares_channel channel, + fd_set *read_fds, ares_socket_t read_fd, + fd_set *write_fds, ares_socket_t write_fd) +{ + struct timeval now = ares__tvnow(); + + write_tcp_data(channel, write_fds, write_fd, &now); + read_tcp_data(channel, read_fds, read_fd, &now); + read_udp_packets(channel, read_fds, read_fd, &now); + process_timeouts(channel, &now); + process_broken_connections(channel, &now); +} + +/* Something interesting happened on the wire, or there was a timeout. + * See what's up and respond accordingly. + */ +void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds) +{ + processfds(channel, read_fds, ARES_SOCKET_BAD, write_fds, ARES_SOCKET_BAD); +} + +/* Something interesting happened on the wire, or there was a timeout. + * See what's up and respond accordingly. + */ +void ares_process_fd(ares_channel channel, + ares_socket_t read_fd, /* use ARES_SOCKET_BAD or valid + file descriptors */ + ares_socket_t write_fd) +{ + processfds(channel, NULL, read_fd, NULL, write_fd); +} + + +/* Return 1 if the specified error number describes a readiness error, or 0 + * otherwise. This is mostly for HP-UX, which could return EAGAIN or + * EWOULDBLOCK. See this man page + * + * http://devrsrc1.external.hp.com/STKS/cgi-bin/man2html? + * manpage=/usr/share/man/man2.Z/send.2 + */ +static int try_again(int errnum) +{ +#if !defined EWOULDBLOCK && !defined EAGAIN +#error "Neither EWOULDBLOCK nor EAGAIN defined" +#endif + switch (errnum) + { +#ifdef EWOULDBLOCK + case EWOULDBLOCK: + return 1; +#endif +#if defined EAGAIN && EAGAIN != EWOULDBLOCK + case EAGAIN: + return 1; +#endif + } + return 0; +} + +/* If any TCP sockets select true for writing, write out queued data + * we have for them. + */ +static void write_tcp_data(ares_channel channel, + fd_set *write_fds, + ares_socket_t write_fd, + struct timeval *now) +{ + struct server_state *server; + struct send_request *sendreq; + struct iovec *vec; + int i; + ssize_t scount; + ssize_t wcount; + size_t n; + + if(!write_fds && (write_fd == ARES_SOCKET_BAD)) + /* no possible action */ + return; + + for (i = 0; i < channel->nservers; i++) + { + /* Make sure server has data to send and is selected in write_fds or + write_fd. */ + server = &channel->servers[i]; + if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD || + server->is_broken) + continue; + + if(write_fds) { + if(!FD_ISSET(server->tcp_socket, write_fds)) + continue; + } + else { + if(server->tcp_socket != write_fd) + continue; + } + + if(write_fds) + /* If there's an error and we close this socket, then open + * another with the same fd to talk to another server, then we + * don't want to think that it was the new socket that was + * ready. This is not disastrous, but is likely to result in + * extra system calls and confusion. */ + FD_CLR(server->tcp_socket, write_fds); + + /* Count the number of send queue items. */ + n = 0; + for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) + n++; + + /* Allocate iovecs so we can send all our data at once. */ + vec = malloc(n * sizeof(struct iovec)); + if (vec) + { + /* Fill in the iovecs and send. */ + n = 0; + for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) + { + vec[n].iov_base = (char *) sendreq->data; + vec[n].iov_len = sendreq->len; + n++; + } + wcount = (ssize_t)writev(server->tcp_socket, vec, (int)n); + free(vec); + if (wcount < 0) + { + if (!try_again(SOCKERRNO)) + handle_error(channel, i, now); + continue; + } + + /* Advance the send queue by as many bytes as we sent. */ + advance_tcp_send_queue(channel, i, wcount); + } + else + { + /* Can't allocate iovecs; just send the first request. */ + sendreq = server->qhead; + + scount = swrite(server->tcp_socket, sendreq->data, sendreq->len); + if (scount < 0) + { + if (!try_again(SOCKERRNO)) + handle_error(channel, i, now); + continue; + } + + /* Advance the send queue by as many bytes as we sent. */ + advance_tcp_send_queue(channel, i, scount); + } + } +} + +/* Consume the given number of bytes from the head of the TCP send queue. */ +static void advance_tcp_send_queue(ares_channel channel, int whichserver, + ssize_t num_bytes) +{ + struct send_request *sendreq; + struct server_state *server = &channel->servers[whichserver]; + while (num_bytes > 0) { + sendreq = server->qhead; + if ((size_t)num_bytes >= sendreq->len) { + num_bytes -= sendreq->len; + server->qhead = sendreq->next; + if (sendreq->data_storage) + free(sendreq->data_storage); + free(sendreq); + if (server->qhead == NULL) { + SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 0); + server->qtail = NULL; + + /* qhead is NULL so we cannot continue this loop */ + break; + } + } + else { + sendreq->data += num_bytes; + sendreq->len -= num_bytes; + num_bytes = 0; + } + } +} + +/* If any TCP socket selects true for reading, read some data, + * allocate a buffer if we finish reading the length word, and process + * a packet if we finish reading one. + */ +static void read_tcp_data(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now) +{ + struct server_state *server; + int i; + ssize_t count; + + if(!read_fds && (read_fd == ARES_SOCKET_BAD)) + /* no possible action */ + return; + + for (i = 0; i < channel->nservers; i++) + { + /* Make sure the server has a socket and is selected in read_fds. */ + server = &channel->servers[i]; + if (server->tcp_socket == ARES_SOCKET_BAD || server->is_broken) + continue; + + if(read_fds) { + if(!FD_ISSET(server->tcp_socket, read_fds)) + continue; + } + else { + if(server->tcp_socket != read_fd) + continue; + } + + if(read_fds) + /* If there's an error and we close this socket, then open another + * with the same fd to talk to another server, then we don't want to + * think that it was the new socket that was ready. This is not + * disastrous, but is likely to result in extra system calls and + * confusion. */ + FD_CLR(server->tcp_socket, read_fds); + + if (server->tcp_lenbuf_pos != 2) + { + /* We haven't yet read a length word, so read that (or + * what's left to read of it). + */ + count = sread(server->tcp_socket, + server->tcp_lenbuf + server->tcp_lenbuf_pos, + 2 - server->tcp_lenbuf_pos); + if (count <= 0) + { + if (!(count == -1 && try_again(SOCKERRNO))) + handle_error(channel, i, now); + continue; + } + + server->tcp_lenbuf_pos += (int)count; + if (server->tcp_lenbuf_pos == 2) + { + /* We finished reading the length word. Decode the + * length and allocate a buffer for the data. + */ + server->tcp_length = server->tcp_lenbuf[0] << 8 + | server->tcp_lenbuf[1]; + server->tcp_buffer = malloc(server->tcp_length); + if (!server->tcp_buffer) + handle_error(channel, i, now); + server->tcp_buffer_pos = 0; + } + } + else + { + /* Read data into the allocated buffer. */ + count = sread(server->tcp_socket, + server->tcp_buffer + server->tcp_buffer_pos, + server->tcp_length - server->tcp_buffer_pos); + if (count <= 0) + { + if (!(count == -1 && try_again(SOCKERRNO))) + handle_error(channel, i, now); + continue; + } + + server->tcp_buffer_pos += (int)count; + if (server->tcp_buffer_pos == server->tcp_length) + { + /* We finished reading this answer; process it and + * prepare to read another length word. + */ + process_answer(channel, server->tcp_buffer, server->tcp_length, + i, 1, now); + if (server->tcp_buffer) + free(server->tcp_buffer); + server->tcp_buffer = NULL; + server->tcp_lenbuf_pos = 0; + server->tcp_buffer_pos = 0; + } + } + } +} + +/* If any UDP sockets select true for reading, process them. */ +static void read_udp_packets(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now) +{ + struct server_state *server; + int i; + ssize_t count; + unsigned char buf[MAXENDSSZ + 1]; +#ifdef HAVE_RECVFROM + ares_socklen_t fromlen; + union { + struct sockaddr sa; + struct sockaddr_in sa4; + struct sockaddr_in6 sa6; + } from; +#endif + + if(!read_fds && (read_fd == ARES_SOCKET_BAD)) + /* no possible action */ + return; + + for (i = 0; i < channel->nservers; i++) + { + /* Make sure the server has a socket and is selected in read_fds. */ + server = &channel->servers[i]; + + if (server->udp_socket == ARES_SOCKET_BAD || server->is_broken) + continue; + + if(read_fds) { + if(!FD_ISSET(server->udp_socket, read_fds)) + continue; + } + else { + if(server->udp_socket != read_fd) + continue; + } + + if(read_fds) + /* If there's an error and we close this socket, then open + * another with the same fd to talk to another server, then we + * don't want to think that it was the new socket that was + * ready. This is not disastrous, but is likely to result in + * extra system calls and confusion. */ + FD_CLR(server->udp_socket, read_fds); + + /* To reduce event loop overhead, read and process as many + * packets as we can. */ + do { + if (server->udp_socket == ARES_SOCKET_BAD) + count = 0; + + else { +#ifdef HAVE_RECVFROM + if (server->addr.family == AF_INET) + fromlen = sizeof(from.sa4); + else + fromlen = sizeof(from.sa6); + count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, + sizeof(buf), 0, &from.sa, &fromlen); +#else + count = sread(server->udp_socket, buf, sizeof(buf)); +#endif + } + + if (count == -1 && try_again(SOCKERRNO)) + continue; + else if (count <= 0) + handle_error(channel, i, now); +#ifdef HAVE_RECVFROM + else if (!same_address(&from.sa, &server->addr)) + /* The address the response comes from does not match the address we + * sent the request to. Someone may be attempting to perform a cache + * poisoning attack. */ + break; +#endif + else + process_answer(channel, buf, (int)count, i, 0, now); + } while (count > 0); + } +} + +/* If any queries have timed out, note the timeout and move them on. */ +static void process_timeouts(ares_channel channel, struct timeval *now) +{ + time_t t; /* the time of the timeouts we're processing */ + struct query *query; + struct list_node* list_head; + struct list_node* list_node; + + /* Process all the timeouts that have fired since the last time we processed + * timeouts. If things are going well, then we'll have hundreds/thousands of + * queries that fall into future buckets, and only a handful of requests + * that fall into the "now" bucket, so this should be quite quick. + */ + for (t = channel->last_timeout_processed; t <= now->tv_sec; t++) + { + list_head = &(channel->queries_by_timeout[t % ARES_TIMEOUT_TABLE_SIZE]); + for (list_node = list_head->next; list_node != list_head; ) + { + query = list_node->data; + list_node = list_node->next; /* in case the query gets deleted */ + if (query->timeout.tv_sec && ares__timedout(now, &query->timeout)) + { + query->error_status = ARES_ETIMEOUT; + ++query->timeouts; + next_server(channel, query, now); + } + } + } + channel->last_timeout_processed = now->tv_sec; +} + +/* Handle an answer from a server. */ +static void process_answer(ares_channel channel, unsigned char *abuf, + int alen, int whichserver, int tcp, + struct timeval *now) +{ + int tc, rcode, packetsz; + unsigned short id; + struct query *query; + struct list_node* list_head; + struct list_node* list_node; + + /* If there's no room in the answer for a header, we can't do much + * with it. */ + if (alen < HFIXEDSZ) + return; + + /* Grab the query ID, truncate bit, and response code from the packet. */ + id = DNS_HEADER_QID(abuf); + tc = DNS_HEADER_TC(abuf); + rcode = DNS_HEADER_RCODE(abuf); + + /* Find the query corresponding to this packet. The queries are + * hashed/bucketed by query id, so this lookup should be quick. Note that + * both the query id and the questions must be the same; when the query id + * wraps around we can have multiple outstanding queries with the same query + * id, so we need to check both the id and question. + */ + query = NULL; + list_head = &(channel->queries_by_qid[id % ARES_QID_TABLE_SIZE]); + for (list_node = list_head->next; list_node != list_head; + list_node = list_node->next) + { + struct query *q = list_node->data; + if ((q->qid == id) && same_questions(q->qbuf, q->qlen, abuf, alen)) + { + query = q; + break; + } + } + if (!query) + return; + + packetsz = PACKETSZ; + /* If we use EDNS and server answers with one of these RCODES, the protocol + * extension is not understood by the responder. We must retry the query + * without EDNS enabled. + */ + if (channel->flags & ARES_FLAG_EDNS) + { + packetsz = channel->ednspsz; + if (rcode == NOTIMP || rcode == FORMERR || rcode == SERVFAIL) + { + int qlen = alen - EDNSFIXEDSZ; + channel->flags ^= ARES_FLAG_EDNS; + query->tcplen -= EDNSFIXEDSZ; + query->qlen -= EDNSFIXEDSZ; + query->tcpbuf[0] = (unsigned char)((qlen >> 8) & 0xff); + query->tcpbuf[1] = (unsigned char)(qlen & 0xff); + DNS_HEADER_SET_ARCOUNT(query->tcpbuf + 2, 0); + query->tcpbuf = realloc(query->tcpbuf, query->tcplen); + ares__send_query(channel, query, now); + return; + } + } + + /* If we got a truncated UDP packet and are not ignoring truncation, + * don't accept the packet, and switch the query to TCP if we hadn't + * done so already. + */ + if ((tc || alen > packetsz) && !tcp && !(channel->flags & ARES_FLAG_IGNTC)) + { + if (!query->using_tcp) + { + query->using_tcp = 1; + ares__send_query(channel, query, now); + } + return; + } + + /* Limit alen to PACKETSZ if we aren't using TCP (only relevant if we + * are ignoring truncation. + */ + if (alen > packetsz && !tcp) + alen = packetsz; + + /* If we aren't passing through all error packets, discard packets + * with SERVFAIL, NOTIMP, or REFUSED response codes. + */ + if (!(channel->flags & ARES_FLAG_NOCHECKRESP)) + { + if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED) + { + skip_server(channel, query, whichserver); + if (query->server == whichserver) + next_server(channel, query, now); + return; + } + } + + end_query(channel, query, ARES_SUCCESS, abuf, alen); +} + +/* Close all the connections that are no longer usable. */ +static void process_broken_connections(ares_channel channel, + struct timeval *now) +{ + int i; + for (i = 0; i < channel->nservers; i++) + { + struct server_state *server = &channel->servers[i]; + if (server->is_broken) + { + handle_error(channel, i, now); + } + } +} + +static void handle_error(ares_channel channel, int whichserver, + struct timeval *now) +{ + struct server_state *server; + struct query *query; + struct list_node list_head; + struct list_node* list_node; + + server = &channel->servers[whichserver]; + + /* Reset communications with this server. */ + ares__close_sockets(channel, server); + + /* Tell all queries talking to this server to move on and not try this + * server again. We steal the current list of queries that were in-flight to + * this server, since when we call next_server this can cause the queries to + * be re-sent to this server, which will re-insert these queries in that + * same server->queries_to_server list. + */ + ares__init_list_head(&list_head); + ares__swap_lists(&list_head, &(server->queries_to_server)); + for (list_node = list_head.next; list_node != &list_head; ) + { + query = list_node->data; + list_node = list_node->next; /* in case the query gets deleted */ + assert(query->server == whichserver); + skip_server(channel, query, whichserver); + next_server(channel, query, now); + } + /* Each query should have removed itself from our temporary list as + * it re-sent itself or finished up... + */ + assert(ares__is_list_empty(&list_head)); +} + +static void skip_server(ares_channel channel, struct query *query, + int whichserver) +{ + /* The given server gave us problems with this query, so if we have the + * luxury of using other servers, then let's skip the potentially broken + * server and just use the others. If we only have one server and we need to + * retry then we should just go ahead and re-use that server, since it's our + * only hope; perhaps we just got unlucky, and retrying will work (eg, the + * server timed out our TCP connection just as we were sending another + * request). + */ + if (channel->nservers > 1) + { + query->server_info[whichserver].skip_server = 1; + } +} + +static void next_server(ares_channel channel, struct query *query, + struct timeval *now) +{ + /* We need to try each server channel->tries times. We have channel->nservers + * servers to try. In total, we need to do channel->nservers * channel->tries + * attempts. Use query->try to remember how many times we already attempted + * this query. Use modular arithmetic to find the next server to try. */ + while (++(query->try_count) < (channel->nservers * channel->tries)) + { + struct server_state *server; + + /* Move on to the next server. */ + query->server = (query->server + 1) % channel->nservers; + server = &channel->servers[query->server]; + + /* We don't want to use this server if (1) we decided this connection is + * broken, and thus about to be closed, (2) we've decided to skip this + * server because of earlier errors we encountered, or (3) we already + * sent this query over this exact connection. + */ + if (!server->is_broken && + !query->server_info[query->server].skip_server && + !(query->using_tcp && + (query->server_info[query->server].tcp_connection_generation == + server->tcp_connection_generation))) + { + ares__send_query(channel, query, now); + return; + } + + /* You might think that with TCP we only need one try. However, even + * when using TCP, servers can time-out our connection just as we're + * sending a request, or close our connection because they die, or never + * send us a reply because they get wedged or tickle a bug that drops + * our request. + */ + } + + /* If we are here, all attempts to perform query failed. */ + end_query(channel, query, query->error_status, NULL, 0); +} + +void ares__send_query(ares_channel channel, struct query *query, + struct timeval *now) +{ + struct send_request *sendreq; + struct server_state *server; + int timeplus; + + server = &channel->servers[query->server]; + if (query->using_tcp) + { + /* Make sure the TCP socket for this server is set up and queue + * a send request. + */ + if (server->tcp_socket == ARES_SOCKET_BAD) + { + if (open_tcp_socket(channel, server) == -1) + { + skip_server(channel, query, query->server); + next_server(channel, query, now); + return; + } + } + sendreq = calloc(1, sizeof(struct send_request)); + if (!sendreq) + { + end_query(channel, query, ARES_ENOMEM, NULL, 0); + return; + } + /* To make the common case fast, we avoid copies by using the query's + * tcpbuf for as long as the query is alive. In the rare case where the + * query ends while it's queued for transmission, then we give the + * sendreq its own copy of the request packet and put it in + * sendreq->data_storage. + */ + sendreq->data_storage = NULL; + sendreq->data = query->tcpbuf; + sendreq->len = query->tcplen; + sendreq->owner_query = query; + sendreq->next = NULL; + if (server->qtail) + server->qtail->next = sendreq; + else + { + SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 1); + server->qhead = sendreq; + } + server->qtail = sendreq; + query->server_info[query->server].tcp_connection_generation = + server->tcp_connection_generation; + } + else + { + if (server->udp_socket == ARES_SOCKET_BAD) + { + if (open_udp_socket(channel, server) == -1) + { + skip_server(channel, query, query->server); + next_server(channel, query, now); + return; + } + } + if (swrite(server->udp_socket, query->qbuf, query->qlen) == -1) + { + /* FIXME: Handle EAGAIN here since it likely can happen. */ + skip_server(channel, query, query->server); + next_server(channel, query, now); + return; + } + } + timeplus = channel->timeout << (query->try_count / channel->nservers); + timeplus = (timeplus * (9 + (rand () & 7))) / 16; + query->timeout = *now; + ares__timeadd(&query->timeout, + timeplus); + /* Keep track of queries bucketed by timeout, so we can process + * timeout events quickly. + */ + ares__remove_from_list(&(query->queries_by_timeout)); + ares__insert_in_list( + &(query->queries_by_timeout), + &(channel->queries_by_timeout[query->timeout.tv_sec % + ARES_TIMEOUT_TABLE_SIZE])); + + /* Keep track of queries bucketed by server, so we can process server + * errors quickly. + */ + ares__remove_from_list(&(query->queries_to_server)); + ares__insert_in_list(&(query->queries_to_server), + &(server->queries_to_server)); +} + +/* + * setsocknonblock sets the given socket to either blocking or non-blocking + * mode based on the 'nonblock' boolean argument. This function is highly + * portable. + */ +static int setsocknonblock(ares_socket_t sockfd, /* operate on this */ + int nonblock /* TRUE or FALSE */) +{ +#if defined(USE_BLOCKING_SOCKETS) + + return 0; /* returns success */ + +#elif defined(HAVE_FCNTL_O_NONBLOCK) + + /* most recent unix versions */ + int flags; + flags = fcntl(sockfd, F_GETFL, 0); + if (FALSE != nonblock) + return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); + else + return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); + +#elif defined(HAVE_IOCTL_FIONBIO) + + /* older unix versions */ + int flags = nonblock ? 1 : 0; + return ioctl(sockfd, FIONBIO, &flags); + +#elif defined(HAVE_IOCTLSOCKET_FIONBIO) + +#ifdef WATT32 + char flags = nonblock ? 1 : 0; +#else + /* Windows */ + unsigned long flags = nonblock ? 1UL : 0UL; +#endif + return ioctlsocket(sockfd, FIONBIO, &flags); + +#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) + + /* Amiga */ + long flags = nonblock ? 1L : 0L; + return IoctlSocket(sockfd, FIONBIO, flags); + +#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) + + /* BeOS */ + long b = nonblock ? 1L : 0L; + return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); + +#else +# error "no non-blocking method was found/used/set" +#endif +} + +static int configure_socket(ares_socket_t s, int family, ares_channel channel) +{ + union { + struct sockaddr sa; + struct sockaddr_in sa4; + struct sockaddr_in6 sa6; + } local; + + setsocknonblock(s, TRUE); + +#if defined(FD_CLOEXEC) && !defined(MSDOS) + /* Configure the socket fd as close-on-exec. */ + if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) + return -1; +#endif + + /* Set the socket's send and receive buffer sizes. */ + if ((channel->socket_send_buffer_size > 0) && + setsockopt(s, SOL_SOCKET, SO_SNDBUF, + (void *)&channel->socket_send_buffer_size, + sizeof(channel->socket_send_buffer_size)) == -1) + return -1; + + if ((channel->socket_receive_buffer_size > 0) && + setsockopt(s, SOL_SOCKET, SO_RCVBUF, + (void *)&channel->socket_receive_buffer_size, + sizeof(channel->socket_receive_buffer_size)) == -1) + return -1; + +#ifdef SO_BINDTODEVICE + if (channel->local_dev_name[0]) { + if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, + channel->local_dev_name, sizeof(channel->local_dev_name))) { + /* Only root can do this, and usually not fatal if it doesn't work, so */ + /* just continue on. */ + } + } +#endif + + if (family == AF_INET) { + if (channel->local_ip4) { + memset(&local.sa4, 0, sizeof(local.sa4)); + local.sa4.sin_family = AF_INET; + local.sa4.sin_addr.s_addr = htonl(channel->local_ip4); + if (bind(s, &local.sa, sizeof(local.sa4)) < 0) + return -1; + } + } + else if (family == AF_INET6) { + if (memcmp(channel->local_ip6, &ares_in6addr_any, + sizeof(channel->local_ip6)) != 0) { + memset(&local.sa6, 0, sizeof(local.sa6)); + local.sa6.sin6_family = AF_INET6; + memcpy(&local.sa6.sin6_addr, channel->local_ip6, + sizeof(channel->local_ip6)); + if (bind(s, &local.sa, sizeof(local.sa6)) < 0) + return -1; + } + } + + return 0; +} + +static int open_tcp_socket(ares_channel channel, struct server_state *server) +{ + ares_socket_t s; + int opt; + ares_socklen_t salen; + union { + struct sockaddr_in sa4; + struct sockaddr_in6 sa6; + } saddr; + struct sockaddr *sa; + + switch (server->addr.family) + { + case AF_INET: + sa = (void *)&saddr.sa4; + salen = sizeof(saddr.sa4); + memset(sa, 0, salen); + saddr.sa4.sin_family = AF_INET; + saddr.sa4.sin_port = aresx_sitous(channel->tcp_port); + memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, + sizeof(server->addr.addrV4)); + break; + case AF_INET6: + sa = (void *)&saddr.sa6; + salen = sizeof(saddr.sa6); + memset(sa, 0, salen); + saddr.sa6.sin6_family = AF_INET6; + saddr.sa6.sin6_port = aresx_sitous(channel->tcp_port); + memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, + sizeof(server->addr.addrV6)); + break; + default: + return -1; + } + + /* Acquire a socket. */ + s = socket(server->addr.family, SOCK_STREAM, 0); + if (s == ARES_SOCKET_BAD) + return -1; + + /* Configure it. */ + if (configure_socket(s, server->addr.family, channel) < 0) + { + sclose(s); + return -1; + } + +#ifdef TCP_NODELAY + /* + * Disable the Nagle algorithm (only relevant for TCP sockets, and thus not + * in configure_socket). In general, in DNS lookups we're pretty much + * interested in firing off a single request and then waiting for a reply, + * so batching isn't very interesting. + */ + opt = 1; + if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, + (void *)&opt, sizeof(opt)) == -1) + { + sclose(s); + return -1; + } +#endif + + /* Connect to the server. */ + if (connect(s, sa, salen) == -1) + { + int err = SOCKERRNO; + + if (err != EINPROGRESS && err != EWOULDBLOCK) + { + sclose(s); + return -1; + } + } + + if (channel->sock_create_cb) + { + int err = channel->sock_create_cb(s, SOCK_STREAM, + channel->sock_create_cb_data); + if (err < 0) + { + sclose(s); + return err; + } + } + + SOCK_STATE_CALLBACK(channel, s, 1, 0); + server->tcp_buffer_pos = 0; + server->tcp_socket = s; + server->tcp_connection_generation = ++channel->tcp_connection_generation; + return 0; +} + +static int open_udp_socket(ares_channel channel, struct server_state *server) +{ + ares_socket_t s; + ares_socklen_t salen; + union { + struct sockaddr_in sa4; + struct sockaddr_in6 sa6; + } saddr; + struct sockaddr *sa; + + switch (server->addr.family) + { + case AF_INET: + sa = (void *)&saddr.sa4; + salen = sizeof(saddr.sa4); + memset(sa, 0, salen); + saddr.sa4.sin_family = AF_INET; + saddr.sa4.sin_port = aresx_sitous(channel->udp_port); + memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, + sizeof(server->addr.addrV4)); + break; + case AF_INET6: + sa = (void *)&saddr.sa6; + salen = sizeof(saddr.sa6); + memset(sa, 0, salen); + saddr.sa6.sin6_family = AF_INET6; + saddr.sa6.sin6_port = aresx_sitous(channel->udp_port); + memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, + sizeof(server->addr.addrV6)); + break; + default: + return -1; + } + + /* Acquire a socket. */ + s = socket(server->addr.family, SOCK_DGRAM, 0); + if (s == ARES_SOCKET_BAD) + return -1; + + /* Set the socket non-blocking. */ + if (configure_socket(s, server->addr.family, channel) < 0) + { + sclose(s); + return -1; + } + + /* Connect to the server. */ + if (connect(s, sa, salen) == -1) + { + int err = SOCKERRNO; + + if (err != EINPROGRESS && err != EWOULDBLOCK) + { + sclose(s); + return -1; + } + } + + if (channel->sock_create_cb) + { + int err = channel->sock_create_cb(s, SOCK_DGRAM, + channel->sock_create_cb_data); + if (err < 0) + { + sclose(s); + return err; + } + } + + SOCK_STATE_CALLBACK(channel, s, 1, 0); + + server->udp_socket = s; + return 0; +} + +static int same_questions(const unsigned char *qbuf, int qlen, + const unsigned char *abuf, int alen) +{ + struct { + const unsigned char *p; + int qdcount; + char *name; + long namelen; + int type; + int dnsclass; + } q, a; + int i, j; + + if (qlen < HFIXEDSZ || alen < HFIXEDSZ) + return 0; + + /* Extract qdcount from the request and reply buffers and compare them. */ + q.qdcount = DNS_HEADER_QDCOUNT(qbuf); + a.qdcount = DNS_HEADER_QDCOUNT(abuf); + if (q.qdcount != a.qdcount) + return 0; + + /* For each question in qbuf, find it in abuf. */ + q.p = qbuf + HFIXEDSZ; + for (i = 0; i < q.qdcount; i++) + { + /* Decode the question in the query. */ + if (ares_expand_name(q.p, qbuf, qlen, &q.name, &q.namelen) + != ARES_SUCCESS) + return 0; + q.p += q.namelen; + if (q.p + QFIXEDSZ > qbuf + qlen) + { + free(q.name); + return 0; + } + q.type = DNS_QUESTION_TYPE(q.p); + q.dnsclass = DNS_QUESTION_CLASS(q.p); + q.p += QFIXEDSZ; + + /* Search for this question in the answer. */ + a.p = abuf + HFIXEDSZ; + for (j = 0; j < a.qdcount; j++) + { + /* Decode the question in the answer. */ + if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen) + != ARES_SUCCESS) + { + free(q.name); + return 0; + } + a.p += a.namelen; + if (a.p + QFIXEDSZ > abuf + alen) + { + free(q.name); + free(a.name); + return 0; + } + a.type = DNS_QUESTION_TYPE(a.p); + a.dnsclass = DNS_QUESTION_CLASS(a.p); + a.p += QFIXEDSZ; + + /* Compare the decoded questions. */ + if (strcasecmp(q.name, a.name) == 0 && q.type == a.type + && q.dnsclass == a.dnsclass) + { + free(a.name); + break; + } + free(a.name); + } + + free(q.name); + if (j == a.qdcount) + return 0; + } + return 1; +} + +static int same_address(struct sockaddr *sa, struct ares_addr *aa) +{ + void *addr1; + void *addr2; + + if (sa->sa_family == aa->family) + { + switch (aa->family) + { + case AF_INET: + addr1 = &aa->addrV4; + addr2 = &((struct sockaddr_in *)sa)->sin_addr; + if (memcmp(addr1, addr2, sizeof(aa->addrV4)) == 0) + return 1; /* match */ + break; + case AF_INET6: + addr1 = &aa->addrV6; + addr2 = &((struct sockaddr_in6 *)sa)->sin6_addr; + if (memcmp(addr1, addr2, sizeof(aa->addrV6)) == 0) + return 1; /* match */ + break; + default: + break; + } + } + return 0; /* different */ +} + +static void end_query (ares_channel channel, struct query *query, int status, + unsigned char *abuf, int alen) +{ + int i; + + /* First we check to see if this query ended while one of our send + * queues still has pointers to it. + */ + for (i = 0; i < channel->nservers; i++) + { + struct server_state *server = &channel->servers[i]; + struct send_request *sendreq; + for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) + if (sendreq->owner_query == query) + { + sendreq->owner_query = NULL; + assert(sendreq->data_storage == NULL); + if (status == ARES_SUCCESS) + { + /* We got a reply for this query, but this queued sendreq + * points into this soon-to-be-gone query's tcpbuf. Probably + * this means we timed out and queued the query for + * retransmission, then received a response before actually + * retransmitting. This is perfectly fine, so we want to keep + * the connection running smoothly if we can. But in the worst + * case we may have sent only some prefix of the query, with + * some suffix of the query left to send. Also, the buffer may + * be queued on multiple queues. To prevent dangling pointers + * to the query's tcpbuf and handle these cases, we just give + * such sendreqs their own copy of the query packet. + */ + sendreq->data_storage = malloc(sendreq->len); + if (sendreq->data_storage != NULL) + { + memcpy(sendreq->data_storage, sendreq->data, sendreq->len); + sendreq->data = sendreq->data_storage; + } + } + if ((status != ARES_SUCCESS) || (sendreq->data_storage == NULL)) + { + /* We encountered an error (probably a timeout, suggesting the + * DNS server we're talking to is probably unreachable, + * wedged, or severely overloaded) or we couldn't copy the + * request, so mark the connection as broken. When we get to + * process_broken_connections() we'll close the connection and + * try to re-send requests to another server. + */ + server->is_broken = 1; + /* Just to be paranoid, zero out this sendreq... */ + sendreq->data = NULL; + sendreq->len = 0; + } + } + } + + /* Invoke the callback */ + query->callback(query->arg, status, query->timeouts, abuf, alen); + ares__free_query(query); + + /* Simple cleanup policy: if no queries are remaining, close all network + * sockets unless STAYOPEN is set. + */ + if (!(channel->flags & ARES_FLAG_STAYOPEN) && + ares__is_list_empty(&(channel->all_queries))) + { + for (i = 0; i < channel->nservers; i++) + ares__close_sockets(channel, &channel->servers[i]); + } +} + +void ares__free_query(struct query *query) +{ + /* Remove the query from all the lists in which it is linked */ + ares__remove_from_list(&(query->queries_by_qid)); + ares__remove_from_list(&(query->queries_by_timeout)); + ares__remove_from_list(&(query->queries_to_server)); + ares__remove_from_list(&(query->all_queries)); + /* Zero out some important stuff, to help catch bugs */ + query->callback = NULL; + query->arg = NULL; + /* Deallocate the memory associated with the query */ + free(query->tcpbuf); + free(query->server_info); + free(query); +} diff -Nru python-gevent-0.13.7/c-ares/ares_query.c python-gevent-1.0/c-ares/ares_query.c --- python-gevent-0.13.7/c-ares/ares_query.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_query.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,183 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_private.h" + +struct qquery { + ares_callback callback; + void *arg; +}; + +static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen); + +void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len) +{ + unsigned char x; + unsigned char y; + unsigned char* state; + unsigned char xorIndex; + short counter; + + x = key->x; + y = key->y; + + state = &key->state[0]; + for(counter = 0; counter < buffer_len; counter ++) + { + x = (unsigned char)((x + 1) % 256); + y = (unsigned char)((state[x] + y) % 256); + ARES_SWAP_BYTE(&state[x], &state[y]); + + xorIndex = (unsigned char)((state[x] + state[y]) % 256); + + buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]); + } + key->x = x; + key->y = y; +} + +static struct query* find_query_by_id(ares_channel channel, unsigned short id) +{ + unsigned short qid; + struct list_node* list_head; + struct list_node* list_node; + DNS_HEADER_SET_QID(((unsigned char*)&qid), id); + + /* Find the query corresponding to this packet. */ + list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]); + for (list_node = list_head->next; list_node != list_head; + list_node = list_node->next) + { + struct query *q = list_node->data; + if (q->qid == qid) + return q; + } + return NULL; +} + + +/* a unique query id is generated using an rc4 key. Since the id may already + be used by a running query (as infrequent as it may be), a lookup is + performed per id generation. In practice this search should happen only + once per newly generated id +*/ +static unsigned short generate_unique_id(ares_channel channel) +{ + unsigned short id; + + do { + id = ares__generate_new_id(&channel->id_key); + } while (find_query_by_id(channel, id)); + + return (unsigned short)id; +} + +void ares_query(ares_channel channel, const char *name, int dnsclass, + int type, ares_callback callback, void *arg) +{ + struct qquery *qquery; + unsigned char *qbuf; + int qlen, rd, status; + + /* Compose the query. */ + rd = !(channel->flags & ARES_FLAG_NORECURSE); + status = ares_create_query(name, dnsclass, type, channel->next_id, rd, &qbuf, + &qlen, (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0); + if (status != ARES_SUCCESS) + { + if (qbuf != NULL) free(qbuf); + callback(arg, status, 0, NULL, 0); + return; + } + + channel->next_id = generate_unique_id(channel); + + /* Allocate and fill in the query structure. */ + qquery = malloc(sizeof(struct qquery)); + if (!qquery) + { + ares_free_string(qbuf); + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + qquery->callback = callback; + qquery->arg = arg; + + /* Send it off. qcallback will be called when we get an answer. */ + ares_send(channel, qbuf, qlen, qcallback, qquery); + ares_free_string(qbuf); +} + +static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen) +{ + struct qquery *qquery = (struct qquery *) arg; + unsigned int ancount; + int rcode; + + if (status != ARES_SUCCESS) + qquery->callback(qquery->arg, status, timeouts, abuf, alen); + else + { + /* Pull the response code and answer count from the packet. */ + rcode = DNS_HEADER_RCODE(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + + /* Convert errors. */ + switch (rcode) + { + case NOERROR: + status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA; + break; + case FORMERR: + status = ARES_EFORMERR; + break; + case SERVFAIL: + status = ARES_ESERVFAIL; + break; + case NXDOMAIN: + status = ARES_ENOTFOUND; + break; + case NOTIMP: + status = ARES_ENOTIMP; + break; + case REFUSED: + status = ARES_EREFUSED; + break; + } + qquery->callback(qquery->arg, status, timeouts, abuf, alen); + } + free(qquery); +} diff -Nru python-gevent-0.13.7/c-ares/ares__read_line.c python-gevent-1.0/c-ares/ares__read_line.c --- python-gevent-0.13.7/c-ares/ares__read_line.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares__read_line.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,71 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include +#include +#include +#include "ares.h" +#include "ares_nowarn.h" +#include "ares_private.h" + +/* This is an internal function. Its contract is to read a line from + * a file into a dynamically allocated buffer, zeroing the trailing + * newline if there is one. The calling routine may call + * ares__read_line multiple times with the same buf and bufsize + * pointers; *buf will be reallocated and *bufsize adjusted as + * appropriate. The initial value of *buf should be NULL. After the + * calling routine is done reading lines, it should free *buf. + */ +int ares__read_line(FILE *fp, char **buf, size_t *bufsize) +{ + char *newbuf; + size_t offset = 0; + size_t len; + + if (*buf == NULL) + { + *buf = malloc(128); + if (!*buf) + return ARES_ENOMEM; + *bufsize = 128; + } + + for (;;) + { + int bytestoread = aresx_uztosi(*bufsize - offset); + + if (!fgets(*buf + offset, bytestoread, fp)) + return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; + len = offset + strlen(*buf + offset); + if ((*buf)[len - 1] == '\n') + { + (*buf)[len - 1] = 0; + break; + } + offset = len; + if(len < *bufsize - 1) + continue; + + /* Allocate more space. */ + newbuf = realloc(*buf, *bufsize * 2); + if (!newbuf) + return ARES_ENOMEM; + *buf = newbuf; + *bufsize *= 2; + } + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_rules.h python-gevent-1.0/c-ares/ares_rules.h --- python-gevent-0.13.7/c-ares/ares_rules.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_rules.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,144 @@ +#ifndef __CARES_RULES_H +#define __CARES_RULES_H + + +/* Copyright (C) 2009 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* ================================================================ */ +/* COMPILE TIME SANITY CHECKS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * All checks done in this file are intentionally placed in a public + * header file which is pulled by ares.h when an application is + * being built using an already built c-ares library. Additionally + * this file is also included and used when building the library. + * + * If compilation fails on this file it is certainly sure that the + * problem is elsewhere. It could be a problem in the ares_build.h + * header file, or simply that you are using different compilation + * settings than those used to build the library. + * + * Nothing in this file is intended to be modified or adjusted by the + * c-ares library user nor by the c-ares library builder. + * + * Do not deactivate any check, these are done to make sure that the + * library is properly built and used. + * + * You can find further help on the c-ares development mailing list: + * http://cool.haxx.se/mailman/listinfo/c-ares/ + * + * NOTE 2 + * ------ + * + * Some of the following compile time checks are based on the fact + * that the dimension of a constant array can not be a negative one. + * In this way if the compile time verification fails, the compilation + * will fail issuing an error. The error description wording is compiler + * dependent but it will be quite similar to one of the following: + * + * "negative subscript or subscript is too large" + * "array must have at least one element" + * "-1 is an illegal array size" + * "size of array is negative" + * + * If you are building an application which tries to use an already + * built c-ares library and you are getting this kind of errors on + * this file, it is a clear indication that there is a mismatch between + * how the library was built and how you are trying to use it for your + * application. Your already compiled or binary library provider is the + * only one who can give you the details you need to properly use it. + */ + +/* + * Verify that some macros are actually defined. + */ + +#ifndef CARES_SIZEOF_LONG +# error "CARES_SIZEOF_LONG definition is missing!" + Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing +#endif + +#ifndef CARES_TYPEOF_ARES_SOCKLEN_T +# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing +#endif + +#ifndef CARES_SIZEOF_ARES_SOCKLEN_T +# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing +#endif + +/* + * Macros private to this header file. + */ + +#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1 + +#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 + +/* + * Verify that the size previously defined and expected for long + * is the same as the one reported by sizeof() at compile time. + */ + +typedef char + __cares_rule_01__ + [CareschkszEQ(long, CARES_SIZEOF_LONG)]; + +/* + * Verify that the size previously defined and expected for + * ares_socklen_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __cares_rule_02__ + [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; + +/* + * Verify at compile time that the size of ares_socklen_t as reported + * by sizeof() is greater or equal than the one reported for int for + * the current compilation. + */ + +typedef char + __cares_rule_03__ + [CareschkszGE(ares_socklen_t, int)]; + +/* ================================================================ */ +/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ +/* ================================================================ */ + +/* + * Get rid of macros private to this header file. + */ + +#undef CareschkszEQ +#undef CareschkszGE + +/* + * Get rid of macros not intended to exist beyond this point. + */ + +#undef CARES_PULL_WS2TCPIP_H +#undef CARES_PULL_SYS_TYPES_H +#undef CARES_PULL_SYS_SOCKET_H + +#undef CARES_TYPEOF_ARES_SOCKLEN_T + +#endif /* __CARES_RULES_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_search.c python-gevent-1.0/c-ares/ares_search.c --- python-gevent-0.13.7/c-ares/ares_search.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_search.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,321 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#include +#include +#include +#include + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include "ares.h" +#include "ares_private.h" + +struct search_query { + /* Arguments passed to ares_search */ + ares_channel channel; + char *name; /* copied into an allocated buffer */ + int dnsclass; + int type; + ares_callback callback; + void *arg; + + int status_as_is; /* error status from trying as-is */ + int next_domain; /* next search domain to try */ + int trying_as_is; /* current query is for name as-is */ + int timeouts; /* number of timeouts we saw for this request */ + int ever_got_nodata; /* did we ever get ARES_ENODATA along the way? */ +}; + +static void search_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen); +static void end_squery(struct search_query *squery, int status, + unsigned char *abuf, int alen); +static int cat_domain(const char *name, const char *domain, char **s); +static int single_domain(ares_channel channel, const char *name, char **s); + +void ares_search(ares_channel channel, const char *name, int dnsclass, + int type, ares_callback callback, void *arg) +{ + struct search_query *squery; + char *s; + const char *p; + int status, ndots; + + /* If name only yields one domain to search, then we don't have + * to keep extra state, so just do an ares_query(). + */ + status = single_domain(channel, name, &s); + if (status != ARES_SUCCESS) + { + callback(arg, status, 0, NULL, 0); + return; + } + if (s) + { + ares_query(channel, s, dnsclass, type, callback, arg); + free(s); + return; + } + + /* Allocate a search_query structure to hold the state necessary for + * doing multiple lookups. + */ + squery = malloc(sizeof(struct search_query)); + if (!squery) + { + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + squery->channel = channel; + squery->name = strdup(name); + if (!squery->name) + { + free(squery); + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + squery->dnsclass = dnsclass; + squery->type = type; + squery->status_as_is = -1; + squery->callback = callback; + squery->arg = arg; + squery->timeouts = 0; + squery->ever_got_nodata = 0; + + /* Count the number of dots in name. */ + ndots = 0; + for (p = name; *p; p++) + { + if (*p == '.') + ndots++; + } + + /* If ndots is at least the channel ndots threshold (usually 1), + * then we try the name as-is first. Otherwise, we try the name + * as-is last. + */ + if (ndots >= channel->ndots) + { + /* Try the name as-is first. */ + squery->next_domain = 0; + squery->trying_as_is = 1; + ares_query(channel, name, dnsclass, type, search_callback, squery); + } + else + { + /* Try the name as-is last; start with the first search domain. */ + squery->next_domain = 1; + squery->trying_as_is = 0; + status = cat_domain(name, channel->domains[0], &s); + if (status == ARES_SUCCESS) + { + ares_query(channel, s, dnsclass, type, search_callback, squery); + free(s); + } + else + { + /* failed, free the malloc()ed memory */ + free(squery->name); + free(squery); + callback(arg, status, 0, NULL, 0); + } + } +} + +static void search_callback(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + struct search_query *squery = (struct search_query *) arg; + ares_channel channel = squery->channel; + char *s; + + squery->timeouts += timeouts; + + /* Stop searching unless we got a non-fatal error. */ + if (status != ARES_ENODATA && status != ARES_ESERVFAIL + && status != ARES_ENOTFOUND) + end_squery(squery, status, abuf, alen); + else + { + /* Save the status if we were trying as-is. */ + if (squery->trying_as_is) + squery->status_as_is = status; + + /* + * If we ever get ARES_ENODATA along the way, record that; if the search + * should run to the very end and we got at least one ARES_ENODATA, + * then callers like ares_gethostbyname() may want to try a T_A search + * even if the last domain we queried for T_AAAA resource records + * returned ARES_ENOTFOUND. + */ + if (status == ARES_ENODATA) + squery->ever_got_nodata = 1; + + if (squery->next_domain < channel->ndomains) + { + /* Try the next domain. */ + status = cat_domain(squery->name, + channel->domains[squery->next_domain], &s); + if (status != ARES_SUCCESS) + end_squery(squery, status, NULL, 0); + else + { + squery->trying_as_is = 0; + squery->next_domain++; + ares_query(channel, s, squery->dnsclass, squery->type, + search_callback, squery); + free(s); + } + } + else if (squery->status_as_is == -1) + { + /* Try the name as-is at the end. */ + squery->trying_as_is = 1; + ares_query(channel, squery->name, squery->dnsclass, squery->type, + search_callback, squery); + } + else { + if (squery->status_as_is == ARES_ENOTFOUND && squery->ever_got_nodata) { + end_squery(squery, ARES_ENODATA, NULL, 0); + } + else + end_squery(squery, squery->status_as_is, NULL, 0); + } + } +} + +static void end_squery(struct search_query *squery, int status, + unsigned char *abuf, int alen) +{ + squery->callback(squery->arg, status, squery->timeouts, abuf, alen); + free(squery->name); + free(squery); +} + +/* Concatenate two domains. */ +static int cat_domain(const char *name, const char *domain, char **s) +{ + size_t nlen = strlen(name); + size_t dlen = strlen(domain); + + *s = malloc(nlen + 1 + dlen + 1); + if (!*s) + return ARES_ENOMEM; + memcpy(*s, name, nlen); + (*s)[nlen] = '.'; + memcpy(*s + nlen + 1, domain, dlen); + (*s)[nlen + 1 + dlen] = 0; + return ARES_SUCCESS; +} + +/* Determine if this name only yields one query. If it does, set *s to + * the string we should query, in an allocated buffer. If not, set *s + * to NULL. + */ +static int single_domain(ares_channel channel, const char *name, char **s) +{ + size_t len = strlen(name); + const char *hostaliases; + FILE *fp; + char *line = NULL; + int status; + size_t linesize; + const char *p, *q; + int error; + + /* If the name contains a trailing dot, then the single query is the name + * sans the trailing dot. + */ + if (name[len - 1] == '.') + { + *s = strdup(name); + return (*s) ? ARES_SUCCESS : ARES_ENOMEM; + } + + if (!(channel->flags & ARES_FLAG_NOALIASES) && !strchr(name, '.')) + { + /* The name might be a host alias. */ + hostaliases = getenv("HOSTALIASES"); + if (hostaliases) + { + fp = fopen(hostaliases, "r"); + if (fp) + { + while ((status = ares__read_line(fp, &line, &linesize)) + == ARES_SUCCESS) + { + if (strncasecmp(line, name, len) != 0 || + !ISSPACE(line[len])) + continue; + p = line + len; + while (ISSPACE(*p)) + p++; + if (*p) + { + q = p + 1; + while (*q && !ISSPACE(*q)) + q++; + *s = malloc(q - p + 1); + if (*s) + { + memcpy(*s, p, q - p); + (*s)[q - p] = 0; + } + free(line); + fclose(fp); + return (*s) ? ARES_SUCCESS : ARES_ENOMEM; + } + } + free(line); + fclose(fp); + if (status != ARES_SUCCESS && status != ARES_EOF) + return status; + } + else + { + error = ERRNO; + switch(error) + { + case ENOENT: + case ESRCH: + break; + default: + DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error))); + DEBUGF(fprintf(stderr, "Error opening file: %s\n", + hostaliases)); + *s = NULL; + return ARES_EFILE; + } + } + } + } + + if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0) + { + /* No domain search to do; just try the name as-is. */ + *s = strdup(name); + return (*s) ? ARES_SUCCESS : ARES_ENOMEM; + } + + *s = NULL; + return ARES_SUCCESS; +} diff -Nru python-gevent-0.13.7/c-ares/ares_send.c python-gevent-1.0/c-ares/ares_send.c --- python-gevent-0.13.7/c-ares/ares_send.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_send.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,137 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include +#include "ares.h" +#include "ares_dns.h" +#include "ares_private.h" + +void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, + ares_callback callback, void *arg) +{ + struct query *query; + int i, packetsz; + struct timeval now; + + /* Verify that the query is at least long enough to hold the header. */ + if (qlen < HFIXEDSZ || qlen >= (1 << 16)) + { + callback(arg, ARES_EBADQUERY, 0, NULL, 0); + return; + } + + /* Allocate space for query and allocated fields. */ + query = malloc(sizeof(struct query)); + if (!query) + { + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + query->tcpbuf = malloc(qlen + 2); + if (!query->tcpbuf) + { + free(query); + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + query->server_info = malloc(channel->nservers * + sizeof(query->server_info[0])); + if (!query->server_info) + { + free(query->tcpbuf); + free(query); + callback(arg, ARES_ENOMEM, 0, NULL, 0); + return; + } + + /* Compute the query ID. Start with no timeout. */ + query->qid = DNS_HEADER_QID(qbuf); + query->timeout.tv_sec = 0; + query->timeout.tv_usec = 0; + + /* Form the TCP query buffer by prepending qlen (as two + * network-order bytes) to qbuf. + */ + query->tcpbuf[0] = (unsigned char)((qlen >> 8) & 0xff); + query->tcpbuf[1] = (unsigned char)(qlen & 0xff); + memcpy(query->tcpbuf + 2, qbuf, qlen); + query->tcplen = qlen + 2; + + /* Fill in query arguments. */ + query->qbuf = query->tcpbuf + 2; + query->qlen = qlen; + query->callback = callback; + query->arg = arg; + + /* Initialize query status. */ + query->try_count = 0; + + /* Choose the server to send the query to. If rotation is enabled, keep track + * of the next server we want to use. */ + query->server = channel->last_server; + if (channel->rotate == 1) + channel->last_server = (channel->last_server + 1) % channel->nservers; + + for (i = 0; i < channel->nservers; i++) + { + query->server_info[i].skip_server = 0; + query->server_info[i].tcp_connection_generation = 0; + } + + packetsz = (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : PACKETSZ; + query->using_tcp = (channel->flags & ARES_FLAG_USEVC) || qlen > packetsz; + + query->error_status = ARES_ECONNREFUSED; + query->timeouts = 0; + + /* Initialize our list nodes. */ + ares__init_list_node(&(query->queries_by_qid), query); + ares__init_list_node(&(query->queries_by_timeout), query); + ares__init_list_node(&(query->queries_to_server), query); + ares__init_list_node(&(query->all_queries), query); + + /* Chain the query into the list of all queries. */ + ares__insert_in_list(&(query->all_queries), &(channel->all_queries)); + /* Keep track of queries bucketed by qid, so we can process DNS + * responses quickly. + */ + ares__insert_in_list( + &(query->queries_by_qid), + &(channel->queries_by_qid[query->qid % ARES_QID_TABLE_SIZE])); + + /* Perform the first query action. */ + now = ares__tvnow(); + ares__send_query(channel, query, &now); +} diff -Nru python-gevent-0.13.7/c-ares/ares_setup.h python-gevent-1.0/c-ares/ares_setup.h --- python-gevent-0.13.7/c-ares/ares_setup.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_setup.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,217 @@ +#ifndef HEADER_CARES_SETUP_H +#define HEADER_CARES_SETUP_H + + +/* Copyright (C) 2004 - 2012 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +#define WIN32 +#endif + +/* + * Include configuration script results or hand-crafted + * configuration file for platforms which lack config tool. + */ + +#ifdef HAVE_CONFIG_H +#include "ares_config.h" +#else + +#ifdef WIN32 +#include "config-win32.h" +#endif + +#endif /* HAVE_CONFIG_H */ + +/* ================================================================ */ +/* Definition of preprocessor macros/symbols which modify compiler */ +/* behaviour or generated code characteristics must be done here, */ +/* as appropriate, before any system header file is included. It is */ +/* also possible to have them defined in the config file included */ +/* before this point. As a result of all this we frown inclusion of */ +/* system header files in our config files, avoid this at any cost. */ +/* ================================================================ */ + +/* + * AIX 4.3 and newer needs _THREAD_SAFE defined to build + * proper reentrant code. Others may also need it. + */ + +#ifdef NEED_THREAD_SAFE +# ifndef _THREAD_SAFE +# define _THREAD_SAFE +# endif +#endif + +/* + * Tru64 needs _REENTRANT set for a few function prototypes and + * things to appear in the system header files. Unixware needs it + * to build proper reentrant code. Others may also need it. + */ + +#ifdef NEED_REENTRANT +# ifndef _REENTRANT +# define _REENTRANT +# endif +#endif + +/* ================================================================ */ +/* If you need to include a system header file for your platform, */ +/* please, do it beyond the point further indicated in this file. */ +/* ================================================================ */ + +/* + * c-ares external interface definitions are also used internally, + * and might also include required system header files to define them. + */ + +#include + +/* + * Compile time sanity checks must also be done when building the library. + */ + +#include + +/* ================================================================= */ +/* No system header file shall be included in this file before this */ +/* point. The only allowed ones are those included from ares_build.h */ +/* ================================================================= */ + +/* + * Include header files for windows builds before redefining anything. + * Use this preproessor block only to include or exclude windows.h, + * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs + * to any other further and independent block. Under Cygwin things work + * just as under linux (e.g. ) and the winsock headers should + * never be included when __CYGWIN__ is defined. configure script takes + * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H, + * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined. + */ + +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +/* + * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else + * define USE_WINSOCK to 1 if we have and use WINSOCK API, else + * undefine USE_WINSOCK. + */ + +#undef USE_WINSOCK + +#ifdef HAVE_WINSOCK2_H +# define USE_WINSOCK 2 +#else +# ifdef HAVE_WINSOCK_H +# define USE_WINSOCK 1 +# endif +#endif + +/* + * Work-arounds for systems without configure support + */ + +#ifndef HAVE_CONFIG_H + +#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__) +#define HAVE_SYS_TIME_H +#endif + +#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER) +#define HAVE_UNISTD_H 1 +#endif + +#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS) +#define HAVE_SYS_UIO_H +#endif + +#endif /* HAVE_CONFIG_H */ + +/* + * Arg 2 type for gethostname in case it hasn't been defined in config file. + */ + +#ifndef GETHOSTNAME_TYPE_ARG2 +# ifdef USE_WINSOCK +# define GETHOSTNAME_TYPE_ARG2 int +# else +# define GETHOSTNAME_TYPE_ARG2 size_t +# endif +#endif + +#ifdef __POCC__ +# include +# include +# define ESRCH 3 +#endif + +/* + * Android does have the arpa/nameser.h header which is detected by configure + * but it appears to be empty with recent NDK r7b / r7c, so we undefine here. + */ +#if (defined(ANDROID) || defined(__ANDROID__)) && defined(HAVE_ARPA_NAMESER_H) +# undef HAVE_ARPA_NAMESER_H +#endif + +/* + * Recent autoconf versions define these symbols in ares_config.h. We don't + * want them (since they collide with the libcurl ones when we build + * --enable-debug) so we undef them again here. + */ + +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef VERSION +#undef PACKAGE + +/* IPv6 compatibility */ +#if !defined(HAVE_AF_INET6) +#if defined(HAVE_PF_INET6) +#define AF_INET6 PF_INET6 +#else +#define AF_INET6 AF_MAX+1 +#endif +#endif + +/* + * Include macros and defines that should only be processed once. + */ + +#ifndef __SETUP_ONCE_H +#include "setup_once.h" +#endif + +#endif /* HEADER_CARES_SETUP_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_strcasecmp.c python-gevent-1.0/c-ares/ares_strcasecmp.c --- python-gevent-0.13.7/c-ares/ares_strcasecmp.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_strcasecmp.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,66 @@ + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares_strcasecmp.h" + +#ifndef HAVE_STRCASECMP +int ares_strcasecmp(const char *a, const char *b) +{ +#if defined(HAVE_STRCMPI) + return strcmpi(a, b); +#elif defined(HAVE_STRICMP) + return stricmp(a, b); +#else + size_t i; + + for (i = 0; i < (size_t)-1; i++) { + int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; + int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; + if (c1 != c2) + return c1-c2; + if (!c1) + break; + } + return 0; +#endif +} +#endif + +#ifndef HAVE_STRNCASECMP +int ares_strncasecmp(const char *a, const char *b, size_t n) +{ +#if defined(HAVE_STRNCMPI) + return strncmpi(a, b, n); +#elif defined(HAVE_STRNICMP) + return strnicmp(a, b, n); +#else + size_t i; + + for (i = 0; i < n; i++) { + int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; + int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; + if (c1 != c2) + return c1-c2; + if (!c1) + break; + } + return 0; +#endif +} +#endif + diff -Nru python-gevent-0.13.7/c-ares/ares_strcasecmp.h python-gevent-1.0/c-ares/ares_strcasecmp.h --- python-gevent-0.13.7/c-ares/ares_strcasecmp.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_strcasecmp.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,30 @@ +#ifndef HEADER_CARES_STRCASECMP_H +#define HEADER_CARES_STRCASECMP_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifndef HAVE_STRCASECMP +extern int ares_strcasecmp(const char *a, const char *b); +#endif + +#ifndef HAVE_STRNCASECMP +extern int ares_strncasecmp(const char *a, const char *b, size_t n); +#endif + +#endif /* HEADER_CARES_STRCASECMP_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_strdup.c python-gevent-1.0/c-ares/ares_strdup.c --- python-gevent-0.13.7/c-ares/ares_strdup.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_strdup.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares_strdup.h" + +#ifndef HAVE_STRDUP +char *ares_strdup(const char *s1) +{ + size_t sz; + char * s2; + + if(s1) { + sz = strlen(s1); + if(sz < (size_t)-1) { + sz++; + if(sz < ((size_t)-1) / sizeof(char)) { + s2 = malloc(sz * sizeof(char)); + if(s2) { + memcpy(s2, s1, sz * sizeof(char)); + return s2; + } + } + } + } + return (char *)NULL; +} +#endif diff -Nru python-gevent-0.13.7/c-ares/ares_strdup.h python-gevent-1.0/c-ares/ares_strdup.h --- python-gevent-0.13.7/c-ares/ares_strdup.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_strdup.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef HEADER_CARES_STRDUP_H +#define HEADER_CARES_STRDUP_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifndef HAVE_STRDUP +extern char *ares_strdup(const char *s1); +#endif + +#endif /* HEADER_CARES_STRDUP_H */ diff -Nru python-gevent-0.13.7/c-ares/ares_strerror.c python-gevent-1.0/c-ares/ares_strerror.c --- python-gevent-0.13.7/c-ares/ares_strerror.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_strerror.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,56 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include +#include "ares.h" + +const char *ares_strerror(int code) +{ + /* Return a string literal from a table. */ + const char *errtext[] = { + "Successful completion", + "DNS server returned answer with no data", + "DNS server claims query was misformatted", + "DNS server returned general failure", + "Domain name not found", + "DNS server does not implement requested operation", + "DNS server refused query", + "Misformatted DNS query", + "Misformatted domain name", + "Unsupported address family", + "Misformatted DNS reply", + "Could not contact DNS servers", + "Timeout while contacting DNS servers", + "End of file", + "Error reading file", + "Out of memory", + "Channel is being destroyed", + "Misformatted string", + "Illegal flags specified", + "Given hostname is not numeric", + "Illegal hints flags specified", + "c-ares library initialization not yet performed", + "Error loading iphlpapi.dll", + "Could not find GetNetworkParams function", + "DNS query cancelled" + }; + + if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) + return errtext[code]; + else + return "unknown"; +} diff -Nru python-gevent-0.13.7/c-ares/ares_timeout.c python-gevent-1.0/c-ares/ares_timeout.c --- python-gevent-0.13.7/c-ares/ares_timeout.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_timeout.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,81 @@ + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#include + +#include "ares.h" +#include "ares_private.h" + +/* WARNING: Beware that this is linear in the number of outstanding + * requests! You are probably far better off just calling ares_process() + * once per second, rather than calling ares_timeout() to figure out + * when to next call ares_process(). + */ +struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, + struct timeval *tvbuf) +{ + struct query *query; + struct list_node* list_head; + struct list_node* list_node; + struct timeval now; + struct timeval nextstop; + long offset, min_offset; + + /* No queries, no timeout (and no fetch of the current time). */ + if (ares__is_list_empty(&(channel->all_queries))) + return maxtv; + + /* Find the minimum timeout for the current set of queries. */ + now = ares__tvnow(); + min_offset = -1; + + list_head = &(channel->all_queries); + for (list_node = list_head->next; list_node != list_head; + list_node = list_node->next) + { + query = list_node->data; + if (query->timeout.tv_sec == 0) + continue; + offset = ares__timeoffset(&now, &query->timeout); + if (offset < 0) + offset = 0; + if (min_offset == -1 || offset < min_offset) + min_offset = offset; + } + + /* If we found a minimum timeout and it's sooner than the one specified in + * maxtv (if any), return it. Otherwise go with maxtv. + */ + if (min_offset != -1) + { + nextstop.tv_sec = min_offset/1000; + nextstop.tv_usec = (min_offset%1000)*1000; + + if (!maxtv || ares__timedout(maxtv, &nextstop)) + { + *tvbuf = nextstop; + return tvbuf; + } + } + + return maxtv; +} diff -Nru python-gevent-0.13.7/c-ares/ares__timeval.c python-gevent-1.0/c-ares/ares__timeval.c --- python-gevent-0.13.7/c-ares/ares__timeval.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares__timeval.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,111 @@ + +/* Copyright (C) 2008 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" + +#if defined(WIN32) && !defined(MSDOS) + +struct timeval ares__tvnow(void) +{ + /* + ** GetTickCount() is available on _all_ Windows versions from W95 up + ** to nowadays. Returns milliseconds elapsed since last system boot, + ** increases monotonically and wraps once 49.7 days have elapsed. + */ + struct timeval now; + DWORD milliseconds = GetTickCount(); + now.tv_sec = milliseconds / 1000; + now.tv_usec = (milliseconds % 1000) * 1000; + return now; +} + +#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) + +struct timeval ares__tvnow(void) +{ + /* + ** clock_gettime() is granted to be increased monotonically when the + ** monotonic clock is queried. Time starting point is unspecified, it + ** could be the system start-up time, the Epoch, or something else, + ** in any case the time starting point does not change once that the + ** system has started up. + */ + struct timeval now; + struct timespec tsnow; + if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { + now.tv_sec = tsnow.tv_sec; + now.tv_usec = tsnow.tv_nsec / 1000; + } + /* + ** Even when the configure process has truly detected monotonic clock + ** availability, it might happen that it is not actually available at + ** run-time. When this occurs simply fallback to other time source. + */ +#ifdef HAVE_GETTIMEOFDAY + else + (void)gettimeofday(&now, NULL); +#else + else { + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + } +#endif + return now; +} + +#elif defined(HAVE_GETTIMEOFDAY) + +struct timeval ares__tvnow(void) +{ + /* + ** gettimeofday() is not granted to be increased monotonically, due to + ** clock drifting and external source time synchronization it can jump + ** forward or backward in time. + */ + struct timeval now; + (void)gettimeofday(&now, NULL); + return now; +} + +#else + +struct timeval ares__tvnow(void) +{ + /* + ** time() returns the value of time in seconds since the Epoch. + */ + struct timeval now; + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + return now; +} + +#endif + +#if 0 /* Not used */ +/* + * Make sure that the first argument is the more recent time, as otherwise + * we'll get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long ares__tvdiff(struct timeval newer, struct timeval older) +{ + return (newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000; +} +#endif + diff -Nru python-gevent-0.13.7/c-ares/ares_version.c python-gevent-1.0/c-ares/ares_version.c --- python-gevent-0.13.7/c-ares/ares_version.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_version.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,11 @@ + +#include "ares_setup.h" +#include "ares.h" + +const char *ares_version(int *version) +{ + if(version) + *version = ARES_VERSION; + + return ARES_VERSION_STR; +} diff -Nru python-gevent-0.13.7/c-ares/ares_version.h python-gevent-1.0/c-ares/ares_version.h --- python-gevent-0.13.7/c-ares/ares_version.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_version.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,24 @@ + +#ifndef ARES__VERSION_H +#define ARES__VERSION_H + +/* This is the global package copyright */ +#define ARES_COPYRIGHT "2004 - 2012 Daniel Stenberg, ." + +#define ARES_VERSION_MAJOR 1 +#define ARES_VERSION_MINOR 10 +#define ARES_VERSION_PATCH 0 +#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ + (ARES_VERSION_MINOR<<8)|\ + (ARES_VERSION_PATCH)) +#define ARES_VERSION_STR "1.10.0-DEV" + +#if (ARES_VERSION >= 0x010700) +# define CARES_HAVE_ARES_LIBRARY_INIT 1 +# define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 +#else +# undef CARES_HAVE_ARES_LIBRARY_INIT +# undef CARES_HAVE_ARES_LIBRARY_CLEANUP +#endif + +#endif diff -Nru python-gevent-0.13.7/c-ares/ares_writev.c python-gevent-1.0/c-ares/ares_writev.c --- python-gevent-0.13.7/c-ares/ares_writev.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_writev.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,79 @@ + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +#ifdef HAVE_LIMITS_H +# include +#endif + +#include "ares.h" +#include "ares_private.h" + +#ifndef HAVE_WRITEV +ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) +{ + char *buffer, *bp; + int i; + size_t bytes = 0; + ssize_t result; + + /* Validate iovcnt */ + if (iovcnt <= 0) + { + SET_ERRNO(EINVAL); + return (-1); + } + + /* Validate and find the sum of the iov_len values in the iov array */ + for (i = 0; i < iovcnt; i++) + { + if (iov[i].iov_len > INT_MAX - bytes) + { + SET_ERRNO(EINVAL); + return (-1); + } + bytes += iov[i].iov_len; + } + + if (bytes == 0) + return (0); + + /* Allocate a temporary buffer to hold the data */ + buffer = malloc(bytes); + if (!buffer) + { + SET_ERRNO(ENOMEM); + return (-1); + } + + /* Copy the data into buffer */ + for (bp = buffer, i = 0; i < iovcnt; ++i) + { + memcpy (bp, iov[i].iov_base, iov[i].iov_len); + bp += iov[i].iov_len; + } + + /* Send buffer contents */ + result = swrite(s, buffer, bytes); + + free(buffer); + + return (result); +} +#endif + diff -Nru python-gevent-0.13.7/c-ares/ares_writev.h python-gevent-1.0/c-ares/ares_writev.h --- python-gevent-0.13.7/c-ares/ares_writev.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/ares_writev.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,36 @@ +#ifndef HEADER_CARES_WRITEV_H +#define HEADER_CARES_WRITEV_H + + +/* Copyright 1998 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares.h" + +#ifndef HAVE_WRITEV + +/* Structure for scatter/gather I/O. */ +struct iovec +{ + void *iov_base; /* Pointer to data. */ + size_t iov_len; /* Length of data. */ +}; + +extern ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); + +#endif + +#endif /* HEADER_CARES_WRITEV_H */ diff -Nru python-gevent-0.13.7/c-ares/AUTHORS python-gevent-1.0/c-ares/AUTHORS --- python-gevent-0.13.7/c-ares/AUTHORS 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/AUTHORS 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,58 @@ +c-ares is based on ares, and these are the people that have worked on it since +the fork was made: + +Albert Chin +Alexander Lazic +Alexey Simak +Andreas Rieke +Andrew C. Morrow +Ashish Sharma +Ben Greear +Ben Noordhuis +BogDan Vatra +Brad House +Brad Spencer +Bram Matthys +Dan Fandrich +Daniel Johnson +Daniel Stenberg +David Stuart +Denis Bilenko +Dima Tisnek +Dirk Manske +Dominick Meglio +Doug Goldstein +Duncan Wilcox +Eino Tuominen +Erik Kline +George Neill +Gisle Vanem +Guenter Knauf +Guilherme Balena Versiani +Gunter Knauf +Henrik Stoerner +Jakub Hrozek +James Bursa +Jérémy Lal +Marko Kreen +Michael Wallner +Mike Crowe +Nick Alcock +Nick Mathewson +Patrik Thunstrom +Peter Pentchev +Phil Blundell +Poul Thomas Lomholt +Ravi Pratap +Robin Cornelius +Sebastian at basti79.de +Shmulik Regev +Stefan Bühler +Steinar H. Gunderson +Tofu Linden +Tom Hughes +Tor Arntsen +Vlad Dinulescu +William Ahern +Yang Tse +liren at vivisimo.com diff -Nru python-gevent-0.13.7/c-ares/bitncmp.c python-gevent-1.0/c-ares/bitncmp.c --- python-gevent-0.13.7/c-ares/bitncmp.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/bitncmp.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,59 @@ + +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef HAVE_BITNCMP + +#include "ares_setup.h" +#include "bitncmp.h" + +/* + * int + * bitncmp(l, r, n) + * compare bit masks l and r, for n bits. + * return: + * -1, 1, or 0 in the libc tradition. + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0x11110000 in its fourth octet. + * author: + * Paul Vixie (ISC), June 1996 + */ +int +ares_bitncmp(const void *l, const void *r, int n) { + unsigned int lb, rb; + int x, b; + + b = n / 8; + x = memcmp(l, r, b); + if (x || (n % 8) == 0) + return (x); + + lb = ((const unsigned char *)l)[b]; + rb = ((const unsigned char *)r)[b]; + for (b = n % 8; b > 0; b--) { + if ((lb & 0x80) != (rb & 0x80)) { + if (lb & 0x80) + return (1); + return (-1); + } + lb <<= 1; + rb <<= 1; + } + return (0); +} +#endif diff -Nru python-gevent-0.13.7/c-ares/bitncmp.h python-gevent-1.0/c-ares/bitncmp.h --- python-gevent-0.13.7/c-ares/bitncmp.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/bitncmp.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef __ARES_BITNCMP_H +#define __ARES_BITNCMP_H + + +/* Copyright (C) 2005 by Dominick Meglio + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifndef HAVE_BITNCMP +int ares_bitncmp(const void *l, const void *r, int n); +#else +#define ares_bitncmp(x,y,z) bitncmp(x,y,z) +#endif + +#endif /* __ARES_BITNCMP_H */ diff -Nru python-gevent-0.13.7/c-ares/CHANGELOG.git python-gevent-1.0/c-ares/CHANGELOG.git --- python-gevent-0.13.7/c-ares/CHANGELOG.git 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/CHANGELOG.git 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,3216 @@ + cHangelog for the c-ares project. Generated with git2changes.pl + +Daniel Stenberg (24 Aug 2012) +- [Gisle Vanem brought this change] + + adig: perror() doesn't work for socket errors on windows + + ... so print the SOCKERRNO instead + +- get_DNS_AdaptersAddresses: fix IPv6 parsing + + Use of the wrong define made the function not parse IPv6 addresses + properly. + + Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-06/0028.shtml + Reported by: Saúl Ibarra Corretgé + +- version: bumped to 1.10.0 + + Due to the newly added function: ares_create_query() + +- AUTHORS: synced with 83093ac450 + + Added 21 authors since this document was last updated + +- ares_create_query.3: mention when this is added + +- [hpopescu@ixiacom.com brought this change] + + Added new feature (rfc2671) + +- code police: fix indents, < 80 columns, reflowed comments + +Guenter Knauf (11 Jul 2012) +- Cleaned up version awk script. + +Daniel Stenberg (30 Jun 2012) +- [Gisle Vanem brought this change] + + read_udp_packets: bail out loop on bad sockets + + I can see that recvfrom() in ares_process.c many times is called with + 'udp_socket' == ARES_SOCKET_BAD. The code takes care not to call + recv/recvfrom with ARES_SOCKET_BAD in the outer-loop. So should the + inner-loop. + +Yang Tse (29 Jun 2012) +- cares-compilers.m4: remove -Wstrict-aliasing=3 from clang + + Currently it is unknown if there is any version of clang that + actually supports -Wstrict-aliasing. What is known is that there + are several that don't support it. + +- cares-compilers.m4: -Wstrict-aliasing=3 for warning enabled gcc and clang builds + +Daniel Stenberg (18 Jun 2012) +- version: work towards 1.9.2 (at least) + +Version 1.9.1 (18 Jun 2012) + +Daniel Stenberg (18 Jun 2012) +- RELEASE-NOTES: 1.9.1 coming up + +Version 1.9.0 (16 Jun 2012) + +Daniel Stenberg (16 Jun 2012) +- ares_version.h: next version is 1.9.0 + +- [Marko Kreen brought this change] + + ares_data.h: ARES_DATATYPE_SOA_REPLY is added in 1.9.0 + +- RELEASE-NOTES: synced with 979bf951d + + Next release deemed to become 1.9.0 due to the new function + +- [Marko Kreen brought this change] + + SOA parser added + + I need to do SOA queries, so here is a parser for them. + + - ares_soa_reply: new struct + - ares_malloc_data/ares_free_soa: ARES_DATATYPE_SOA_REPLY + - ares_parse_soa_reply: actual function + +Yang Tse (14 Jun 2012) +- Kill compiler warning + +- Fix libcares.pc generation for static MingW* cross builds + +Daniel Stenberg (21 May 2012) +- [Nick Alcock brought this change] + + Fix UDP and TCP port byte order in saved options. + + The UDP and TCP port are stored in network byte order in the + ares_channeldata, but are passed in to ares_init_options() in host byte + order. Thus we must return them from ares_save_options() in host byte + order too, or a duplicated channel will convert them again, leading to a + nonfunctional channel and a mysterious connection refused error from + ares_gethostbyname(). This breaks ares_dup(), thus the curl easy API + when c-ares is used by curl, and thus all the curl easy API's users. + +Yang Tse (28 Apr 2012) +- version: start working on 1.8.1-DEV + +Version 1.8.0 (27 Apr 2012) + +Daniel Stenberg (27 Apr 2012) +- RELEASE-NOTES: call next 1.8 instead + + Since we added a function, let's use a stricter bumping scheme + +Yang Tse (25 Apr 2012) +- INSTALL: some adjustments + +Daniel Stenberg (25 Apr 2012) +- GIT-INFO: mention buildconf + +Yang Tse (25 Apr 2012) +- INSTALL: remove more sections that don't apply to c-ares + +- ares_timeout.c: fix compiler warning + +Daniel Stenberg (25 Apr 2012) +- [Ben Noordhuis brought this change] + + Makefile.m32: fix mingw32 build + + * add . to include path so ares_build.h is picked up + * make ar configurable to ease cross-compiling + +- RELEASE-NOTES: added what's happened since 1.7.5 + +Guenter Knauf (22 Apr 2012) +- Updated copyright year. + +Yang Tse (21 Apr 2012) +- ares_init.c: Further refactoring of Windows system's DNS fetching code + +Guenter Knauf (20 Apr 2012) +- Android: small changes to dns property part. + + Prefix prop vars; kill var; use DNS_PROP_NAME_PREFIX macro. + +- Handle CNAME-only in ares_parse_aaaa_reply(). + + posted to the c-ares list by Peter Griess . + +- Add support for multiple DNS servers on Android. + + Before, c-ares always used the first DNS server on Android, causing + network problems if this DNS server was not available. + + Signed-off-by: Geert Uytterhoeven + +- Added INSTALL so it gets into tarballs. + +- Added some more ifdefs to silent compiler warnings. + +Yang Tse (17 Apr 2012) +- INSTALL: remove a non c-ares section + +- cares-compilers.m4: -Wno-pedantic-ms-format for Windows gcc 4.5 builds + + When building a Windows target with gcc 4.5 or newer and strict compiler + warnings enabled use -Wno-pedantic-ms-format in addition to other flags. + +- setup_once.h: tighten requirements for stdbool.h header inclusion + + Include stdbool.h only when it is available and configure is capable of + detecting a proper 'bool' data type when the header is included. + +- configure: NATIVE_WINDOWS no longer defined in config file + +- cares-compilers.m4: double underscore decoration for visibility attribute + +- build adjustments: CARES_SYMBOL_HIDING no longer defined in config files + + configure script now provides conditional definitions for Makefile.am + that result in CARES_SYMBOL_HIDING being defined by resulting makefiles + when appropriate. + +- configure: Windows cross-compilation fixes + + CARES_BUILDING_LIBRARY and CARES_STATICLIB no longer defined in ares_config.h, + configure will generate appropriate conditionals so that mentioned symbols + get defined and used in Makefile derived from Makefile.am at compilation time. + +Guenter Knauf (17 Apr 2012) +- Added INSTALL file adapted from libcurl. + + Not yet ready, and needs further edits. + +Yang Tse (16 Apr 2012) +- ares_init.c: get_iphlpapi_dns_info() refactoring + +Guenter Knauf (16 Apr 2012) +- Kill some more compiler warnings. + +- Kill compiler warning about unused var. + +- Fixed my last commit: wrong preprocessor directive. + +- Check for __ANDROID__ in addition to ANDROID macro. + +- Check for __ANDROID__ in addition to ANDROID macro. + + Posted to c-ares list by Wayne. + +- Fix for Android to disable useless arpa/nameser.h. + +- Fix for Android to include sys/select.h for fd_set. + +Yang Tse (17 Mar 2012) +- ares_data.c: some NAPTR related fixes + +Daniel Stenberg (16 Mar 2012) +- port numbers: convert them to network order! + + When the config options ARES_OPT_UDP_PORT or ARES_OPT_TCP_PORT are used, + make sure to convert them to network byte order! + + Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-02/0004.shtml + +- white space cleanup + + - Keep code within 80 columns + + - Removed funny spaces after open paren and before closing paren + +- [Poul Thomas Lomholt brought this change] + + get_iphlpapi_dns_info: fix buffer overrun + + I experienced a buffer overrun exception in c-ares on Windows and + tracked it down to be an error in the calculation of the 'left' variable + in get_iphlpapi_dns_info(). + + I changed the variable type of 'left' to a _signed_ type because of the + subtraction arithmetic; not sure if a long is the best choice + +- Merge pull request #7 from saghul/naptr + + Added support for parsing NAPTR records + +saghul (23 Feb 2012) +- Added support for parsing NAPTR records + +Yang Tse (19 Jan 2012) +- ares_init.c: fix compiler warning on winsock builds + +- configure: libtool 1.5 tweaks + +Daniel Stenberg (19 Dec 2011) +- ares_timeout.3: fix the NAME section + + It was clearly a copy n' paste error + +Yang Tse (27 Sep 2011) +- [Albert Chin brought this change] + + configure - m4: make CURL_CHECK_DEF ignore leading whitespace on symbol def + + When using Sun C compiler the preprocessor somehow inserts an extra space + in front of replaced symbol, breaking CURL_CHECK_DEF macro. To workaround + this, macro CURL_CHECK_DEF now ignores all leading whitespace in front of + symbol substitution result. + +- ares_init.c: fix segfault triggered in ares_init_options() upon previous + failure of init_by_defaults() and incomplete cleanup there. + +- ares_process.c: fix compiler warning + +- fix MSVC compiler warning 'conditional expression is constant' + +- setup_once.h cleanup and sync + +- [Denis Bilenko brought this change] + + ares_getnameinfo: fix random results with c-ares 1.7.5 + + In ares_getnameinfo memcpy did not copy enough bytes, causing + it to return arbitrary memory contents as a result. + +- warnings: fix another 'conversion may lose significant bits' compiler warning + +- ares_dns.h: adjust DNS__16BIT and DNS__32BIT macro definitions + + Fixing compiler warnings existing definitions triggered on these. + +- ares_destroy.c: fix segfault in ares_destroy_options() + +Daniel Stenberg (21 Aug 2011) +- ares_parse_srv_reply: silence compiler warnings + + ... by adding ugly typecasts. + +- CHANGES: generate from script + + The CHANGES file is now generated automatically with 'git2changes.pl', + invoked by the maketgz script which is used to build release archives. + + The former human edited CHANGES file was renamed to CHANGES.0 in git. + +Yang Tse (21 Aug 2011) +- Makefile.netware: SIZEOF_SHORT definition + +- warnings: fix some 'conversion may lose significant bits' compiler warnings + +- configure: fix symbol hiding usability check + + A more thorough test is done now in order to determine visibility attribute + usability, given that some compilers don't support visibility attribute on + all configurations. + +Daniel Stenberg (16 Aug 2011) +- 1.7.6: start working... + +Version 1.7.5 (16 Aug 2011) + +Daniel Stenberg (16 Aug 2011) +- CHANGES: synced for 1.7.5 release + +- RELEASE-NOTES: synced with bb4096effef7f000 + +Jakub Hrozek (15 Aug 2011) +- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses + +Yang Tse (10 Aug 2011) +- [Gisle Vanem brought this change] + + ares_iphlpapi.h: Watcom C fix + + Added "!defined(_WS2DEF_)" since Watcom doesn't have + a per type guard for the typedefs 'CSADDR_INFO' (that MingW has) or + 'SOCKET_ADDRESS' (that MSVC has). But we can use the header-guard for + instead. + +- [Gisle Vanem brought this change] + + Makefile.Watcom: + * The 'NTDDI_VERSION' needs to be raised to 0x05010000 + in order for SOCKADDR_STORAGE etc. to be typedefed. + * Replaced '-dUSE_WATT32' with '-dWATT32'. + * Added $(DEMOS) to the 'all' target and removed the 'demos' + target to be consistent with e.g. Makefile.msvc etc. + * 'ENABLE_IPV6' is no longer used. Hence removed the '%use_ipv6' construct. + * object-file order seems to be important (Watcom v.19). Hence + 'ares_getopt.obj' must be put after the .obj that references getopt(). + +- cares-compilers.m4: CARES_CONVERT_INCLUDE_TO_ISYSTEM adjustments + + Add CARES_CHECK_COMPILER as a requirement. + + Ensure macro does nothing unless GNU_C or CLANG compiler is used. + + This should allow usage of this macro in unforeseen placements. + +- config-win32.h: comments adjustments - followup + +- config-win32.h: comments adjustments + +Daniel Stenberg (5 Aug 2011) +- [Tom Hughes brought this change] + + ares_parse_a_reply: fix memleak + +Yang Tse (29 Jul 2011) +- cares-functions.m4 serial # bump + +- Revert "configure: additional flag checks for fcntl() and socket()" + + This reverts commit 5f2a3b0e48f26d24cb1fefea0dccb92d417dcbf7. + +- configure: additional flag checks for fcntl() and socket() + +- xc-translit.m4 fix quoting + +- configure: avoid direct usage of AS_TR_* macros + +- xc-translit.m4 provides transliteration macros with well defined behavior. + +Jakub Hrozek (15 Jun 2011) +- Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses" + + This reverts commit b5823d65706af687c0e5110af8f0cfdcd068997d. + + This patch was not reviewed properly before pushing + +- Revert "Do not use sized constants in public headers" + + This reverts commit 22c01e96f7b2ae9923e1baa50bfe3c0d22297a7d. + + This is a Red Hat specific patch that does not belong into upstream + +- Use correct sizeof in ares_getnameinfo() + +- Do not leak rr_name on failures inside ares_parse_ptr_reply + +- Do not leak rr_name on failures inside ares_parse_a_reply + +- Do not leak rr_name on failures inside ares_parse_aaaa_reply + +- Do not leak rr_name on failures inside ares_parse_ns_reply + +- Fix incorrect sizeof() in ares_save_options + +- Fix incorrect allocation in ares_parse_ptr_reply() + +- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses + +- Do not use sized constants in public headers + +Daniel Stenberg (13 Jun 2011) +- [Jakub Hrozek brought this change] + + ares_free_hostent(NULL) should be a noop + +Yang Tse (8 Jun 2011) +- configure: fix recvfrom 5th arg type qualifier detection (followup) + +- configure: fix recvfrom 5th arg type qualifier detection + + Additionally remove whitespace from EOL + +Daniel Stenberg (4 Jun 2011) +- strlen: use size_t to receive the return + +Yang Tse (4 Jun 2011) +- xlc: avoid preprocessor definition usage when linking + +- ares_nowarn: icc 9.1 workaround + +- ares_nowarn: header inclusion fix + +- ares_init: make ares_private.h last included header again + +- compiler warning: fix + + Fix compiler warning: conversion may lose significant bits + +- compiler warning: fix + + Fix compiler warning: variable was set but never used + + Fix compiler warning: clobber ignored + +- ares_iphlpapi: fix compiler warnings + +- winsock: compilation fixes + + Provide winsock iphlpapi alternative definitions to prevent compilation + failures when using a variety of winsock header implementations. + +Daniel Stenberg (17 May 2011) +- [David Stuart brought this change] + + IPv6-on-windows: find DNS servers correctly + +- man pages: docs for the c-ares utility programs + +- ares_parse_ns_reply.c: remove CVSism + +Yang Tse (27 Mar 2011) +- build: fix header inclusion + +- getservbyport replacement for Win CE + +- renamed getplatform() to ares__getplatform() to avoid namespace pollution + +- configure: fix libtool warning + + Recent versions of libtool are now tracing usage of AC_CONFIG_MACRO_DIR + macro and warn heavily when not used in configure script along with + ACLOCAL_AMFLAGS in Makefile.am. So in order to make libtool happy + while keeping backwards compatibility this is added. + +- adig: RFC4034 resource record type detection + + Can be tested with: adig -s 8.8.8.8 -t ANY example.com + +- nameser.h: RFC4034 resource record type definitions + +- build: move platform stuff to ares_platform.c and ares_platform.h + +- build: find out windows platform using GetVersionEx() + +- build: use getenv() replacement function for systems which lack it + +- setup_once: system error codes for Windows CE + +- ares_search: use ERRNO macro for portability sake + +- System's errno.h inclusion cleanup follow-up. + + System's errno.h is conditionally included from setup_once.h + +- Windows CE specific adjustment + + All versions of Windows CE support Winsock 1.1 + +- System's errno.h inclusion cleanup. + + System's errno.h is conditionally included from setup_once.h + +- ares_init: fix gethostname error detection on winsock platforms + +- configure: r-enable temporarily disabled detection of system's inet_ntop() + + Detection was temporarily disabled in commit 674e044ccb21f2f63537da53565fce868f + +Daniel Stenberg (15 Mar 2011) +- configure: stop using the deprecated AM_INIT_AUTOMAKE syntax + +- [Gisle Vanem brought this change] + + Watt-32: use errno + + Make sure Watt-32 programs use 'errno' even on Win32 targets + +Guenter Knauf (18 Feb 2011) +- Removed commented CLFAGS no longer needed. + +- Fixed CFLAGS for NetWare. + + Added -m32 to enable compilation with x86_64 compilers; + added conditional to set -fpcc-struct-return only for gcc compiler. + +Daniel Stenberg (18 Feb 2011) +- [Gisle Vanem brought this change] + + Watt32: fix server init + + Somewhere in the process, programs using the Watt-32 tcp/ip stack + stopped working. + +- [Dima Tisnek brought this change] + + config_sortlist: (win32) missing else + + Without an else there, contents of "pat" that could have been + successfully set just above, may be clobbered by successive unsuccessful + calls to "xxx_pton" or "ip_addr". + +Yang Tse (17 Jan 2011) +- Makefile.msvc: add a couple of VS version strings + +- Makefile.msvc: add a couple of VS version strings + +- build: add install target to Makefile.msvc + +Daniel Stenberg (27 Dec 2010) +- ares_set_servers_csv: remove unused variables + +- init_by_resolv_conf: fix compiler warnings + + The code received the return codes in the 'status' variable without + using it. Instead we just ignore those particular errors. + +- getv4: Value stored to 'dst' is never read + +- advance_tcp_send_queue: avoid NULL ptr dereference + + If given a too large 'num_bytes' value, it would cause a NULL ptr + dereference. Instead the code will now break out of the loop at the end + of the list. + +- [Peter Pentchev brought this change] + + configure: fix a bashism + +- cleanup: avoid unsafe typecasts + + Avoid the risk of reading 16bit data from an unaligned address by using + a macro that is adapted for this. + +- [Stefan Bühler brought this change] + + ares_expand_name: Fix encoded length for indirect root + +Yang Tse (18 Dec 2010) +- build: add some explicit file references to VS project files + +- config-win32: provide HAVE_ASSERT_H definition + +- build: include ares_nowarn in sample program VS project files + +- build: include ares_nowarn among SAMPLESOURCES and SAMPLEHEADERS + +- configure: temporarily disable detection of system's inet_ntop() + + This is done to allow compilation of ares_inet_ntop() by some daily + builds picky compilers that otherwise do not need this function. + +- changes: mention last fix + +- ares_inet_ntop: remove definition and usage of macro SPRINTF + + Existing definition of SPRINTF always resulted in sprintf() being used, + and sprintf() returning 'int' is already used throughout the library. + +- ares_inet_ntop: reapply changes from previous c-ares version (III) + + - Replace 'u_char' with 'unsigned char'. + - Replace 'u_int' with 'unsigned int'. + - use macros ERRNO and SET_ERRNO() for errno handling. + +- ares_inet_ntop: reapply changes from previous c-ares version (II) + + - Remove rcsid. + - Adjust header file inclusions. + - ares_inet_ntop used only on systems without a proper inet_ntop function. + +- ares_inet_ntop: reapply changes from previous c-ares version (I) + + - Replace tabs with spaces. + - Use ANSI C style for function declarations and definitions. + - Use sizeof with parentheses. + +- ares_inet_ntop: fix off by one error triggering out of bounds write + + ares_inet_ntop would trigger an out of bounds write when the representation + of the address required 15 characters, due to not taking in account null + termination character. + + Full import of inet_ntop.c from bind-9.5.3rc1 to pull additional fixes. + +- ares_nowarn: add conditional inclusion of assert.h header + +- fix compiler warning: conversion may lose significant bits + +- ares_inet_net_pton: fix non-rejection of some malformed literals + + ares_inet_net_pton would return wrong values when excessively large, + and invalid, netmasks are used. Fixes are from bind-9.5.3rc1, + issue also described in the WLB-2008080064 advisory. + +- setup_once: provide ISASCII macro + +- configure: inet_net_pton function check adjustments + + Define HAVE_INET_NET_PTON only when system's inet_net_pton function is IPv6 + capable and is not affected by the WLB-2008080064 advisory. + + HAVE_INET_NET_PTON_IPV6 is no longer defined nor used. + +- ares_init: fix detection of semicolon comments in resolv.conf + + File resolv.conf may either use a hash '#' or a semicolon ';' character as an + indication that the rest of the line is a comment. This fixes not recognizing + the semicolon as a valid comment indicator in resolv.conf. + +- version: start working on 1.7.5 + +Version 1.7.4 (8 Dec 2010) + +Daniel Stenberg (8 Dec 2010) +- release-preps: CHANGES and RELEASE-NOTES synced + +- ares_set_local_*: added in 1.7.4, not before + +Yang Tse (3 Dec 2010) +- build: provide SIZEOF_SIZE_T definition for non-configure builds + +- build: config.dos renamed to config-dos.h + +- build: provide SIZEOF_SIZE_T netware definition + +- ares_gethostbyaddr: fix compiler warning: conversion may lose significant bits + +- configure: undo using autobuilds to temporarily verify strict aliasing warnings. + +- fix compiler warning: rounding, sign extension, or loss of accuracy may result + +Daniel Stenberg (2 Dec 2010) +- [Ben Noordhuis brought this change] + + ares_parse_a_reply: fix CNAME response parsing + + Reply to a CNAME query doesn't contain addresses, causing + ares_parse_a_reply() to bail out with ARES_ENODATA + + Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b + +Yang Tse (1 Dec 2010) +- fix compiler warning: conversion may lose significant bits + +- atoi: remove atoi usage + +- ares_init: fix compiler warning: conversion may lose significant bits + +- configure: fix autoconf warning + +- inet_pton: fix compiler warning + +- configure: use autobuilds to temporarily verify strict aliasing warnings. + + Temporarily, When cross-compiling with gcc 3.0 or later, enable strict aliasing + rules and warnings. Given that cross-compiled targets autobuilds do not run the + test-suite, there is no risk of running code that violates strict aliasing rules + +- ares_getnameinfo: Partially revert commit 85520d66e0ac7ac73411bc25e98769a88b2f + + Upon socket address family and length validation failure return ARES_ENOTIMP + in callback again, this is the error code documented in man page and used + mostly all over the library. + +- ares_getnameinfo: Validate socket address family and length. + + Validate socket address family and that the socket address length is appropriate + for the specified family. Failure is reported with ARES_EBADFAMILY in callback. + +- ares_getnameinfo: fix two compiler warnings + +- Added another VS10 version string + +- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'. + +- Revert commit 494274e653936335c255a47599970de3df21e7c4 + +- configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected in body + +- Fix compiler warning: array subscript has type 'char' + +- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'. + +- Revert following commits: + 07bc7ea79509bcc9ef6e09151e81766ed00d3392 + 3392a50ea3f8573ea4b7a9d82b9833dab60cb0e9 + 9912637d32c9987719a1ea12db591aee2941891c + + The purpose of the whole patch was to silence a compiler warning triggered + with GCC 4 on file ares_process.c The specific compiler warning was + 'dereferencing type-punned pointer might break strict-aliasing rules'. + + A simpler patch will follow to equally silence the warning. + +- ares_options: reorder header inclusions to make inclusion of + ares_private.h the last included one again. + +Daniel Stenberg (12 Nov 2010) +- [Patrik Thunstrom brought this change] + + adig: fix NAPTR parsing + + I ran across a small "issue" in your adig example. + + It is simply the last part of the NAPTR record, the replacement element, + which is not a string, as currently handled in adig, but a domain name. + +- ares_save_options: assignments instead of memcpy + +- init_by_options: don't copy an empty sortlist + + If there aren't any sort items to copy, don't bother. Without this + little precaution it would do a malloc(0) which causes undefined + behaviors and is frowned upon by curl's memdebug-system. + +Guenter Knauf (3 Oct 2010) +- Minor Watcom makefile tweaks. + +Daniel Stenberg (30 Sep 2010) +- [Mike Crowe brought this change] + + Fix lookup with HOSTALIASES set. + + ares__read_line returns ARES_EOF when it reaches the end of the + file. This will happen every time when reading to the end of the + HOSTALIASES file. Unfortunately single_domain treats this error as + being fatal. + + Signed-off-by: Mike Crowe + +Ben Greear (24 Aug 2010) +- Add missing break that caused get_ares_servers to fail. + + Reported-by: Ning Dong + Signed-off-by: Ben Greear + +Yang Tse (11 Aug 2010) +- configure: werror related adjustments + +Guenter Knauf (8 Aug 2010) +- Added copyright string to ares_version.h and make use of it in other files. + +- Block created ares_build.h for NetWare to avoid usage from other platforms. + +- Fix to overwrite default libname. + +- Some more Watcom makefile massage ... + +- Some more Watcom makefile massage ... + +Ben Greear (4 Aug 2010) +- sock-addr-storage: Detect and deal with lack of .ss_family member. + + AIX, at least, does not have sockaddr_storage.ss_family member. + Detect this in the configure logic and use proper #ifdefs in the + ares_process logic. + + Signed-off-by: Ben Greear + Tested-by: Tor Arntsen + +Guenter Knauf (3 Aug 2010) +- Added Watcom makefile based on libcurl's Makefile.Watcom. + +Ben Greear (31 Jul 2010) +- typo: Fix compile bug for platforms that don't have sockaddr_storage. + + Bug was introduced by me in previous commit. + + Signed-off-by: Ben Greear + +- Fix aliasing warning in gcc 4.4.4 (at least). + + Should be no functional change, though the code gets a bit + ugglier. + + Signed-off-by: Ben Greear + +Daniel Stenberg (31 Jul 2010) +- ares_set_servers_csv: use ISDIGIT + + The IS*() set of macros are preferred to the regular is*() functions as + they help us avoid the most common pitfalls. + +Ben Greear (30 Jul 2010) +- cast arg to isdigit to int + + Looks like it might silence a warning on Netware build. + + Signed-off-by: Ben Greear + +- remove all uses of uint32_t + + Previous fix forgot a few. + + Signed-off-by: Ben Greear + +- fix signed v/s unsigned casts warning in ares_gethostbyaddr.c + + Signed-off-by: Ben Greear + +- local-bind-fixup: Fix inet_pton warning. + + Conditionally include for inet_pton + headers. + + Signed-off-by: Ben Greear + +- build: Enable compiling with -Werror. + + This helps find compile warnings because they simply break + the build. + + To use: + ./configure --enable-warnings --enable-werror + + Signed-off-by: Ben Greear + +- ipv6: Fix some build issues related to the local-bind feature. + + Signed-off-by: Ben Greear + +Guenter Knauf (29 Jul 2010) +- Replaced uint32_t with unsigned int to fix broken builds on a couple of platforms. + +Daniel Stenberg (18 Jul 2010) +- [Ben Greear brought this change] + + local-bind: Support binding to local interface/IPs + + Add 3 new functions to set the local binding for the out-going + socket connection, and add ares_set_servers_csv() to set a + list of servers at once as a comma-separated string. + + Signed-off-by: Ben Greear + +- version: now start on 1.7.4 + +- [Andrew C. Morrow brought this change] + + fix memory leak in ares_getnameinfo + +Version 1.7.3 (11 Jun 2010) + +Daniel Stenberg (11 Jun 2010) +- changelogs: updated for 1.7.3 + +- [BogDan Vatra brought this change] + + init: allow c-ares to work on Android OS + +- changelog: fill in the 1.7.2 changes + +- added another pdf to ignore + +Yang Tse (11 Jun 2010) +- add ares_parse_mx_reply.c to VS dsp file + +Daniel Stenberg (10 Jun 2010) +- tarball: add $(CSOURCES) $(HHEADERS) to EXTRA_DIST + + It's not clear to me why we need this, but we apparently may + otherwise not get all files bundled in the dist tarball. + +- version: start working on 1.7.3 + +Version 1.7.2 (10 Jun 2010) + +Daniel Stenberg (10 Jun 2010) +- RELEASE-NOTES: 1.7.2 details added + +- [Jakub Hrozek brought this change] + + ares_init: Last, not first instance of domain or search should win + +- style: make code less than 80 columns wide + +Yang Tse (31 May 2010) +- [Tor Arntsen brought this change] + + improve alternative definition of bool to use enum instead of unsigned char + +- fix VS2010 compiler warnings + +Daniel Stenberg (18 Apr 2010) +- [Jérémy Lal brought this change] + + added ares_parse_mx_reply + +- repair the file mode + +- remove all $Id$ lines + +- remove all .cvsignore files + +- spell fix + + reported by Gregor Jasny on the mailing list + +- [Peter Pentchev brought this change] + + Fix a couple of typos and grammar nits. + +- ignore the GPG signature files too + +- start the journey towards 1.7.2 + +- no longer CVS tagging + +- ignore generated PDFs + +Version 1.7.1 (23 Mar 2010) + +Daniel Stenberg (23 Mar 2010) +- 1.7.1 + +- made README the primary readme file + + ... and did README.cares to contain a historic reason etc. + +- s/CVS/git + +- git now, not CVS + +- ignore lots of generated files + +- [Daniel Johnson brought this change] + + Fix warnings for clang + +Yang Tse (17 Mar 2010) +- replaced intel compiler option -no-ansi-alias with -fno-strict-aliasing + +- update outdated serial number + +- fix compiler warning + +- watt32 compilation fix + +- Added another VS10 version string + +- fix line break + +- removed usage of 's6_addr', fixing compilation issue triggered with no + longer using 'in6_addr' but only our 'ares_in6_addr' struct + +Daniel Stenberg (5 Mar 2010) +- Daniel Johnson provided fixes for building with the clang compiler + +Yang Tse (5 Mar 2010) +- Added IPv6 name servers support + +Gisle Vanem (5 Mar 2010) +- Ops!. Readded ares_nowarn.h. + +- Added ares_nowarn.c. + +Yang Tse (28 Feb 2010) +- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems + +- Added ares_nowarn.* to VC6 project file + +- Added SIZEOF_INT definition + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +Daniel Stenberg (17 Feb 2010) +- ares_reinit() + + - To allow an app to force a re-read of /etc/resolv.conf etc, pretty much + like the res_init() resolver function offers + +- - Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't + check for broken connections like ares_process() did. Based on that, I + merged the two functions into a single generic one with two front-ends. + +Yang Tse (30 Dec 2009) +- VMS specific preprocessor symbol checking adjustments + +- Mention last changes + +- - Fix configure_socket() to use ares_socket_t instead of int data type. + +- - Where run-time error checks enabling compiler option /GZ was used it is now + replaced with equivalent /RTCsu for Visual Studio 2003 and newer versions. + + - Compiler option /GX is now replaced with equivalent /EHsc for all versions. + +- - Ingmar Runge noticed that Windows config-win32.h configuration file + did not include a definition for HAVE_CLOSESOCKET which resulted in + function close() being inappropriately used to close sockets. + +Daniel Stenberg (30 Nov 2009) +- start working on 1.7.1 + +Version 1.7.0 (27 Nov 2009) + +Yang Tse (27 Nov 2009) +- Preserve empty line following last target + +- - Larry Lansing fixed ares_parse_srv_reply to properly parse replies + which might contain non-SRV answers, skipping over potential non-SRV + ones such as CNAMEs. + +- When using icc, compile with -fpic and link with intel dynamic libraries. + +- Added 'currently' in italics to insist on transient situation. + +- Fix language + +- Daniel wants upcoming release to be 1.7.0 + +- Mention last changes + +- - Removed from external interface preprocessor symbol definition for + CARES_HAVE_ARES_FREE_DATA. Current functionality of ares_free_data() + makes it unnecessary. + +- Added README.msvc + +- Changed c-ares naming conventions when using MSVC as described in README.msvc + +- - Mention other recent changes + +- - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and + ares_addr6ttl in order to prevent name space pollution, along with + necessary changes to code base and man pages.This change does not break + ABI, there is no need to recompile existing applications. But existing + applications using these structs with the old name will need source code + adjustments when recompiled using c-ares 1.6.1. + +- - Jakub Hrozek fixed more function prototypes in man pages to sync them + with the ones declared in ares.h + +- Make configure remove the ares_build.h file included in distribution tarballs. + +- Fix macro redefinition. + +- Fix name space pollution. + +- Allow using different extra import libraries for debug and release builds. + +- Add manifest stuff to msvc makefile + +- Sync man page with reality + +- Add missing external API decoration for ares_set_socket_callback() + +- Add ares_free_data() man page. + +- - Provide in external interface preprocessor symbol definitions for + CARES_HAVE_ARES_FREE_DATA as an indication of function availability. + +- Remove typecast + +- Fix comment + +- Add ares_data.c and ares_data.h + +- Jakub Hrozek modified ares_parse_srv_reply() and ares_parse_txt_reply() API + to return a linked lists of results. These were also modified to internally + use the ares_data memory struct and as such its result must be free'ed with + ares_free_data(). + +- Initial support for the generic ares_free_data() function that will allow + applications to free memory allocated and returned by some c-ares funtions. + +- Make usage of calloc()'s arguments consistent with rest of code base + +- workaround icc 9.1 optimizer issue + +- Add icc fvisibility bug test + +- Fix icc 9.0 compiler warning: external definition with no prior declaration + +- Fix three var names + +- Add check for assert.h header file + +- getaddrinfo is fully thread safe on solaris versions which + implement the function even when h_errno is not a macro. + + The h_errno macro test now only done on systems for which there + is no hard coded knowledge about getaddrinfo's thread safeness. + +- Remove files generated on previous buildconf/configure run + +- Remove enable-thread / disable-thread configure option. These were only placebo + options. The library is always built as thread safe as possible on every system. + +- Refactor how preprocessor symbol _THREAD_SAFE definition is done. + +- Assume that getaddrinfo is thread safe, unless hard coded + knowledge says the contrary or h_errno is not defined. + +- Related with the threadsafe capability of getaddrinfo: + + - Constantine Sapuntzakis reported that Darwin 6.0 a.k.a. MAC OS X 10.2 + and newer have a threadsafe getaddrinfo. + + - Fix Dragonfly BSD triplet detection. + + - In case the hard-coded knowledge says that getaddrinfo is threadsafe, + an additional check is done to verify that h_errno is also defined. + If h_errno isn't defined, we finally assume that it isn't threadsafe. + Jamie Lokier provided the inspiration for this extra check. + +- AIX 5.2 and newer have threadsafe getaddrinfo. + + Add some comments to better understand what the regex's pretend to achieve. + +- HP-UX 11.11 and later have threadsafe getaddrinfo + +- Check if getaddrinfo is threadsafe when function check allows it to be used + +- Renamed fpGetNetworkParams and fpSystemFunction036 to avoid namespace pollution with static library + +- Add kernel32.lib + +- Mention last changes + +- Reinstate copyright symbol lost in previous commit + +- Make some strings different in resource file for debug or release builds + +- Ignore more subdirs + +- Fix compiler warning: conditional expression is constant + +- Sync linker and resource compiler options with Makefile.msvc + +- Follow Makefile.msvc subdirectory naming scheme, and sync compiler options + +- Updated MSVC makefile that allows building dynamic and static + c-ares libraries in debug and release flavours. + + Additionally each of the three sample programs is built against + each of the four possible c-ares libraries, generating all this + a total number of 12 executables and 4 libraries. + +- Test for USE_WINSOCK since it is more restrictive than WIN32 + +- Make header inclusion depend on HAVE_*_H definition + +- Remove unneeded preprocessor directives + +- Adjust c-ares include paths for memory tracking enabled (--enable-curldebug) builds + +- source files used by sample programs + +- Renamed c-ares setup.h to ares_setup.h + +- Adjust include paths to take in account that currently: + + c-ares with --enable-curldebug uses memdebug.h from libcurl's lib subdirectory. + + memdebug.h needs access to libcurl's setup.h from libcurl's lib subdirectory + and also needs access to libcurl's generated curl_config.h + +- Undo old temporary change once used for testing purposes + +- Mention many changes + +- Mention --enable-symbol-hiding configure option + +- Symbol hiding configure options renamed to the hopefully less ambiguous + --enable-symbol-hiding and --disable-symbol-hiding as well as related + macro names and some internal variables used for them. + + Related configuration file preprocessor symbols named to + CARES_SYMBOL_HIDING and CARES_SYMBOL_SCOPE_EXTERN. + +- Header inclusion depending on HAVE_* symbol. + Fix two typos. + +- Comparison of the Initial revision of this file with ares_parse_a_reply.c + shows that this one is actually a modified copy of ares_parse_a_reply.c. + + In order to comply with ares_parse_a_reply.c's M.I.T. license, the old + 1998 M.I.T. copyright notice is now also preserved in this file the same + as it is done in other ares_parse_*.c files. + +- Add CVS Id tag. + Fix identation of some license lines. + +- Add CVS Id tag. + +- Fix comment + +- In no particular order, changed/fixed all of the following in + ares_parse_txt_reply() current version: + + - Fixed a couple of potential double free's. + + - Fixed memory leaks upon out of memory condition. + + - Fixed pointer arithmetic. + + - Setting ntxtreply to zero upon entry for all failure cases. + + - Changed data type to size_t for variables substr_len, str_len and + the length member of ares_txt_reply struct. + + - Avoided a couple of memcpy() calls. + + - Changed i data type to unsigned int to prevent compiler warnings. + + - Adjusted a comment. + + - Use ARES_SUCCESS literal for successfull completion. + + - Added CVS Id tag. + +- Add c-ares DLL resource file to distribution archive + +- ignore files + +- Empty subdir + +- Updated MSVC 6.0 workspace and project files that allows building + dynamic and static c-ares libraries in debug and release flavours. + + Additionally each of the three sample programs is built against + each of the four possible c-ares libraries, generating all this + a total number of 12 executables and 4 libraries. + +Daniel Stenberg (29 Oct 2009) +- no need to check for NULL pointers before dereferencing, as the pointers + MUST be valid and they are dereferenced further down in the function + unconditionally! + +- shorten the descriptions somewhat + +- update to the new struct name + +- Jakub Hrozek added ares_parse_txt_reply() for TXT parsing + +- use 'ares_srv_reply' for proper name-spacing + +Yang Tse (29 Oct 2009) +- Add reference for ares_parse_srv_reply.pdf + +- Add reference for ares_parse_srv_reply docs + +- External API function linkage decoration adjustment + +- External API function linkage decoration adjustment + +- Initial step towards the ability to reduce c-ares exported symbols + based on the 'visibility' attribute for GNUC and __global for Sun + compilers, taking also in account __declspec function decoration + for Win32 and Symbian DLL's. + + Introducing configure options --enable-hidden-symbols and + --disable-hidden-symbols following libcurl's naming. + +- Fix comment + +- Fix spelling + +- Fix Pelles C Win32 target compilation issues + +- John Engelhart noticed an unreleased problem relative to a duplicate + ARES_ECANCELLED error code value and missing error code description. + +- Fix compiler warning: local variable may be used without having been initialized + +- Use *_CHECK_PATH_SEPARATOR_REQUIRED to ensure that *_CHECK_PATH_SEPARATOR + is only expanded and included once in the configure script. + +- Our _AS_PATH_SEPARATOR_PREPARE override is now m4_defun'd instead of m4_define'd + due to autoconf 2.64 m4_require'ing it in _AS_SHELL_SANITIZE indirectly through + _AS_PATH_WALK. + +- Fix compiler warning: argument is incompatible with corresponding format string conversion + +- Fix potential out-of-bounds read + +- Fix compiler warning: loop without body + +- Fix compiler warning + +- Fix compiler warning + +- Fix compiler warning + +- Fix compiler warning: addition result could be truncated before cast to bigger sized type + +- Overhauled ares__get_hostent() + + - Fixing out of bounds memory overwrite triggered with malformed /etc/hosts file. + - Improving parsing of /etc/hosts file. + - Validating requested address family. + - Ensuring that failures always return a NULL pointer. + - Adjusting header inclusions. + +- Fix ssize_t redefinition errors on WIN64 reported by Alexey Simak + +- more files to ignore + +- Check if _REENTRANT definition is required to + make errno available as a preprocessor macro. + +- Attempt to silence bogus compiler warning: "Potential null pointer dereference" + +- ignore more files + +Gisle Vanem (7 Sep 2009) +- Suppress warnings about unused prototypes in Watt32 and Win32 programs. + +- Update email address. + +- Update my email address. Add ares_config.h as dependency for 'make depend'. + +Yang Tse (6 Sep 2009) +- T_SRV portability check + +Gunter Knauf (5 Sep 2009) +- changed includes to match style how we do with all other *.c files. + +- changed u_int16_t to unsigned short because it is the only place within ares and curl where such a type would be used; + also it broke many autobuilds. We should probably introduce an ares_port_t if we want to use a type here. + +Gisle Vanem (5 Sep 2009) +- Replace 'uint16_t' with 'u_int16_t' since the latter is used in ares.h. + +- Added 'ares_parse_srv_reply.obj'. Added definition of 'u_int16_t'. This is I don't like; we should not depend on such non-universal types in a public header. But this is just a quick fix. + +Daniel Stenberg (4 Sep 2009) +- - Jakub Hrozek added ares_parse_srv_reply() for SRV parsing + +Steinar H. Gunderson (27 Aug 2009) +- Support lookup of IPv4 literals in ares_gethostbyname(), even when the address family is set to AF_INET6. + +Gisle Vanem (3 Aug 2009) +- Remove call to LoadLibrary(). (leftover from debugging). + +- Fix bad sentence. + +Daniel Stenberg (3 Aug 2009) +- - Timo Teras changed the reason code used in the resolve callback done when + ares_cancel() is used, to be ARES_ECANCELLED instead of ARES_ETIMEOUT to + better allow the callback to know what's happening. + +- - Joshua Kwan fixed the init routine to fill in the defaults for stuff that + fails to get inited by other means. This fixes a case of when the c-ares + init fails when internet access is fone. + +Gunter Knauf (16 Jul 2009) +- test if adding ../lib to includes can fix the current break ... + +- renamed generated config.h to ares_config.h in order to avoid clashes when libcurl is used with other projects which also have a config.h. + +Yang Tse (21 Jun 2009) +- Refactor how libraries are checked for connect() function, follow-up. + +- Refactor how libraries are checked for connect() function, + and check for connect() as it is done for other functions. + +Gisle Vanem (20 Jun 2009) +- Remove unneeded defines. + +- Use select_s() and not select(). + +Yang Tse (19 Jun 2009) +- sclose() function-like macro definition used to close a socket, + now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL + config file preprocessor definitions. + +- add CloseSocket camel case function check + +- check for socket() and closesocket() as it is done for other functions + +- Remove HAVE_CONFIG_H definition from here, + CFLAGS from common.dj already defines it. + +- initial step towards decoupling c-ares from libcurl for DOS + +- don't ignore these subdirs, they must be removed first + +- Remove DEBUGBUILD symbol definition, is not required for programs using the library. + +- DEBUGBUILD symbol definition for debug builds + +- ignore some subdirs + +- fix comment + +- Try to make more clear that --enable-curldebug has nothing to do with --enable-debug for this library. + +- Revert last change, it is inappropriate. + +Gisle Vanem (12 Jun 2009) +- Replace CURLDEBUG with DEBUGBUILD. + +Yang Tse (11 Jun 2009) +- when running automake copy missing files instead of symlinking them + +- Adjusted to take in account that... + + With the curl memory tracking feature decoupled from the debug build feature, + CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows: + + CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug) + + DEBUGBUILD used for debug enabled specific code (--enable-debug) + +- c-ares' --enable-debug --enable-curldebug decoupling follow-up + +- mention last changes + +- Remove buildconf.bat from release and daily snapshot archives. + + buildconf.bat is only for CVS tree builds. + +- Ensure that buildconf.bat does nothing unless it is used with a CVS checkout. + +- CVS-INFO file only present in CVS tree, never in release nor daily snapshot + archives. Used as a sentinel file in buildconf.bat to differentiate CVS builds. + +Gisle Vanem (8 Jun 2009) +- Update comment about "ML". Removed "-D_USE_32BIT_TIME_T" (not a requirement). + +Yang Tse (8 Jun 2009) +- just comment it out + +- For debugging purposes... + + Disable the '-export-symbols-regex' to discard this as the origin + of link failures related with shared libraries and non-GNU linkers. + +- c-ares Makefile.am back to using $(top_builddir) for *_LDADD + +- c-ares' -no-undefined and --enable-curldebug adjustments + +- Use relative path to built c-ares tree libtool library + +- John E. Malmberg noticed that the configure script was failing to detect the + timeval struct on VMS when building with _XOPEN_SOURCE_EXTENDED undefined due + to definition taking place in socket.h instead of time.h + +- Fix compiler warning: out of bound access + +- fix compilation on AIX + +- c-ares' --enable-curldebug adjustments + +- Remove temporarily introduced memory leak. + +- Temporarily introduce a memory leak to verify curl debug memory tracking works. + +- Allow curl debug memory tracking when building a shared library on + systems which support external, undefined, symbols in shared libraries. + +Daniel Stenberg (26 May 2009) +- language fix + +Yang Tse (26 May 2009) +- Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOTINITIALIZED + if library initialization has not been performed calling ares_library_init(). + +- c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug + +- Prevent copying 'sourced' manpages for build targets that don't use them. + +Daniel Stenberg (23 May 2009) +- minor edits + +Yang Tse (21 May 2009) +- Include .pdf versions of c-ares man pages in distribution tarball. + +- Allow generation of .html and .pdf versions of c-ares man pages. + +Gisle Vanem (21 May 2009) +- $(OBJ_DIR)/ares_getopt.o must be cleaned explicitly. + +Yang Tse (20 May 2009) +- Mention last changes + +- Initial ares_library_cleanup(3) man page + +- Update man page + +- Update man page + +- Initial ares_library_init(3) man page attempt + +- Force revision update, to force CVS to update the $Id date string format + +- Add same copyright notice as other c-ares files + +- Fix case + +- Remove run-time requirement for advapi32.dll since + c-ares can work even with no advapi32.dll at all. + +- Intentionally avoid checking if the address of SystemFunction036, a.k.a. + RtlGenRandom, has been located or not. This function is only available on + WinXP and later. When unavailable c-ares uses portable rand() function. + +- - Provide in external interface preprocessor symbol definitions for + CARES_HAVE_ARES_LIBRARY_INIT and CARES_HAVE_ARES_LIBRARY_CLEANUP + to ease the use of new capabilities. + + - Move ares_version() prototype to ares.h + +- Introduction of ares_library_init() and ares_library_cleanup() + +- Introduction of ares_library_init() and ares_library_cleanup() + +- remove outdated comment + +- Fix preprocessor conditional expression + +- fiX *__SOCKLEN_T definitions for remaining targets + +- *__SOCKLEN_T definitions for OS400 already fixed + +- fIX *__SOCKLEN_T definitions for SYMBIAN32 and VMS targets + +Daniel Stenberg (11 May 2009) +- - Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to + only expose functions starting with ares_. + +Yang Tse (11 May 2009) +- Remove experimental check. Currently there's no need for it. + +- Fix an m4 overquoting triggering a spurious 'AS_TR_CPP' symbol definition + attempt in generated config.h + +- Proper naming for the experimental compiler test and moved to *-compilers.m4 + +- Moved *_CHECK_COMPILER_HALT_ON_ERROR and *_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE to *-compilers.m4 along with other *_CHECK_COMPILER_* + +- fIX *__SOCKLEN_T definitions for OS400 and generic GCC targets + +- fIX *__SOCKLEN_T definitions for MVS and 370 targets + +- fIX *__SOCKLEN_T definitions for several Windows target tool-chains + +- HP-UX's X/Open network library requirement check follow-up + +- HP-UX's X/Open network library requirement check follow-up + +- Use build-time configured ares_socklen_t instead of socklen_t + +- David McCreedy's "TPF-platform specific changes to various files" patch follow-up + +Daniel Stenberg (1 May 2009) +- s/libcurl/c-ares + +- version number typo fix + +Yang Tse (1 May 2009) +- David McCreedy's "TPF-platform specific changes to various files" patch + +- Check definition of _XOPEN_SOURCE_EXTENDED with the compiler + +- Check if X/Open network library is required + +- cope with ares_build.h and ares_rules.h follow-up + +- Added some notes regarding ares_build.h + +- fix EOL + +- fix EOL + +- cope with ares_build.h and ares_rules.h + +- buildconf.bat for CVS-tree c-ares + +- Use 'unsigned int' instead of size_t attempting to avoid header inclusion + +- NetWare LibC's getpeername() third argument data type is size_t + +- Remove temporary debug tracing for ares_socklen_t Windows targets + +- ares_socklen_t follow-up + +- ares_build.h Windows follow-up + +- Add temporary debug tracing for ares_socklen_t Windows targets + +- ares_build.h NetWare follow-up + +- ares_build.h NetWare attempt + +- Initial step towards a configure time ares_socklen_t definition + +- ignore stamp-h* + +- Added CARES_INCLUDES_SYS_TYPES + +- Initial step towards a configure time curl_socklen_t definition + +- avoid use of alloca() + +- Moved potential inclusion of system's malloc.h and memory.h header files to + setup_once.h. Inclusion of each header file is based on the definition of + NEED_MALLOC_H and NEED_MEMORY_H respectively. + +- ignore + +Gisle Vanem (18 Apr 2009) +- Added '-DHAVE_LIMITS_H'. + +Yang Tse (17 Apr 2009) +- remove compiler options used while debugging the icc 9.1 optimizer issue + +- moved HAVE_LIMITS_H to common defines + +- Set HP-UX compiler warning level back to the one that exposes + the socklen_t issue on this platform. + +- HAVE_LIMITS_H definition for NetWare CLIB + +- use HAVE_LIMITS_H symbol to protect limits.h inclusion + +- fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value + +- s/u_long/unsigned long/ + +- Do not halt compilation when using VS2008 to build a Windows 2000 target + +- ignore + +Phil Blundell (3 Feb 2009) +- * February 3 2009 (Phil Blundell) + - If the server returns garbage or nothing at all in response to an AAAA query, + go on and ask for A records anyway. + +Daniel Stenberg (31 Jan 2009) +- - ares_gethostbyname() now accepts 'AF_UNSPEC' as a family for resolving + either AF_INET6 or AF_INET. It works by accepting any of the looksups in the + hosts file, and it resolves the AAAA field with a fallback to A. + +Gisle Vanem (18 Jan 2009) +- fopen() returns error in 'errno' even on Windows. + So don't use ERRNO (GetLastError()). Trimmed trailing + blanks. + +- Constified some arguments in local functions. + +Daniel Stenberg (14 Jan 2009) +- - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but instead it + now declares the private struct ares_in6_addr for all systems instead of + relying on one possibly not present in the system. + +Phil Blundell (13 Jan 2009) +- - ares__send_query() now varies the retry timeout pseudo-randomly to avoid + packet storms when several queries were started at the same time. + +Daniel Stenberg (11 Jan 2009) +- - Phil Blundell added the internal function ares__expand_name_for_response() + that is now used by the ares_parse_*_reply() functions instead of the + ares_expand_name() simply to easier return ARES_EBADRESP for the cases where + the name expansion fails as in responses that really isn't expected. + +Gunter Knauf (30 Dec 2008) +- added HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID to ares Makefile.netware and sync'd with other Makefile.netware. + +Daniel Stenberg (9 Dec 2008) +- use the new URL + +- start over on the 1.6.1 release... + +Version 1.6.0 (9 Dec 2008) + +Daniel Stenberg (9 Dec 2008) +- add space + +Gisle Vanem (9 Dec 2008) +- Fix for Win32 targets using Watt-32. + +Dan Fandrich (9 Dec 2008) +- C89 compilers (like Minix' ACK) only need to handle 31 functions arguments + so split a long sprintf into two calls to get below that number. + +Gisle Vanem (8 Dec 2008) +- Added needed defines for Watt-32 on Windows. + +- Undefine 'optarg', 'optind' and 'opterr' when using Watt-32 + (to get correct linkage on Windows). + +- ares_writev() shall not be exported when using Watt-32 (has writev). + Added _USE_32BIT_TIME_T to avoid runtime warning. Applies to + VC-2008+ only. + +- Removed unneeded defines HAVE_SIGNAL_H, HAVE_SIG_ATOMIC_T, + RETSIGTYPE and HAVE_PROCESS_H. + +Daniel Stenberg (4 Dec 2008) +- the initial version of the ares_set_socket_callback man page + +- Gregor Jasny provided the patch that introduces ares_set_socket_callback(), + and I edited it to also get duped by ares_dup(). + +Dan Fandrich (4 Dec 2008) +- Bring the sys/include.h include test in line with curl's. + +Daniel Stenberg (3 Dec 2008) +- Let's not call ares_save_options() deprecated just yet + +- Introduce ares_dup(3) and new thoughts about API/ABI and how to move forwards. + Also discussed on the ml. + +Dan Fandrich (2 Dec 2008) +- Make sure sys/socket.h is included before netinet/in.h (required by + OpenWatcom C, and condoned by SUS) + +Daniel Stenberg (1 Dec 2008) +- minor indent fix + +- Convert the public config struct to the same binary size/construct as in the + latest releases to remain ABI compatible. + +Gisle Vanem (29 Nov 2008) +- Added '-DHAVE_GETHOSTNAME'. + +Dan Fandrich (29 Nov 2008) +- Make sure sys/socket.h is included before netinet/in.h (required by + OpenWatcom C) + +- Netware has gethostname() + +- Fixed a couple of typos + +- Don't tweak the HAVE_* macros when using autoconf + +- Make use of gethostname() conditional on it being available + +- Only set TCP_NODELAY when it exists + +Daniel Stenberg (28 Nov 2008) +- updated with changes, preparing for a release soon + +Yang Tse (26 Nov 2008) +- Gerald Combs fixed a bug in ares_parse_ptr_reply() which would cause a + buffer to shrink instead of expand if a reply contained 8 or more records. + +- Brad Spencer provided changes to allow buildconf to work on OS X. + +- In preparation for the upcomming IPv6 nameservers patch, the internal + ares_addr union is now changed into an internal struct which also holds + the address family. + +Dan Fandrich (20 Nov 2008) +- Make checking for struct ifreq a prerequisite for setting + HAVE_IOCTL_SIOCGIFADDR since it's needed to use SIOCGIFADDR and Watcom C + doesn't currently define it. + +Daniel Stenberg (20 Nov 2008) +- use unsigned short better intead of mixing with ints to prevent compiler + warnings + +- please the picky compilers by staying with short as the data we get is short + only + +- - Brad Spencer brought the new function ares_gethostbyname_file() which simply + resolves a host name from the given file, using the regular hosts syntax. + +Yang Tse (19 Nov 2008) +- user provided PATH_SEPARATOR always overrides auto-detected one + +- attempting to keep lines below 80 chars + +- provide a common PATH_SEPARATOR check method which is required by + upcomming work to support the broadest range of Autoconf versions + +- check for gethostbyaddr and gethostbyname as it is done for other functions + +- Make configure script check if ioctl with the SIOCGIFADDR command can be + used, and define HAVE_IOCTL_SIOCGIFADDR if appropriate. + +- fix leftover from previous commit + +- fix inet_pton() runtime configure check + +- trim down configure script size + +Daniel Stenberg (15 Nov 2008) +- Fixed an OOM condition reported by Jim Meyering + +Yang Tse (14 Nov 2008) +- fix typo affecting inclusion of in configure + checks for inet_ntoa_r() inet_ntop() and inet_pton() + +- #include in the getaddrinfo() runtime check for the memset() prototype + +- fix symbol definition check for fcntl.h inclusion + +- Refactor configure script detection of functions used to set sockets into + non-blocking mode, and decouple function detection from function capability. + +Daniel Stenberg (1 Nov 2008) +- Added a TODO file to list things we want changed, added or fixed. + +- - Carlo Contavalli added support for the glibc "rotate" option, as documented + in man resolv.conf: + + causes round robin selection of nameservers from among those listed. This + has the effect of spreading the query load among all listed servers, rather + than having all clients try the first listed server first every time. + + You can enable it with ARES_OPT_ROTATE + +Yang Tse (1 Nov 2008) +- Adjust WIN32 freeaddrinfo, getaddrinfo and getnameinfo availability + +- WIN32 availability of freeaddrinfo, getaddrinfo and getnameinfo functions is quite + convoluted, compiler dependant and in some cases even build target dependat. + +- check for freeaddrinfo() at configuration phase + +- update aclocal file serial number + +- remove verification of the freeability of the addrinfo struct pointer members + +- fix comment + +- make CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_ADDR + and CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_CANONNAME + internal to CHECK_FUNC_GETADDRINFO + +- fix leftover + +- Initial attempt to detect at configuration time if the getaddrinfo() + function returns an addrinfo with an unfreeable ai_canonname member ptr. + +- Initial attempt to detect at configuration time if the getaddrinfo() + function returns an addrinfo with an unfreeable ai_addr member ptr. + +- icc adjustments: + + Select ANSI C89 dialect plus GNU extensions, again. + +- some more temporary magic for the icc seg-fault issue + +- icc permanent adjustment: + + Select precise floating-point model, otherwise doubles are less than 64-bit wide + + icc test adjustment: + + Select c89 dialect + +- icc adjustments: + + Enable more icc warnings. + + Optimization disabling options used only for icc 9.1 + +- #include for exit() prototype + +- some more temporary magic for the icc seg-fault issue + +- remove from configure.ac temporary magic for the icc seg-fault issue + +- some more temporary magic for the icc seg-fault issue + +- Charles Hardin patch: + + - handles the EINPROGRESS for UDP connects + - uses closesocket instead of close on some paths that were noticed + +- some more temporary magic for the icc seg-fault issue + +- messages initially intended only for debug purposes, now become permanent + since these are extremely useful when compiler rejects a set of options. + +- fix compiler warning + +- fix missing double-quotes + +Daniel Stenberg (17 Oct 2008) +- Charles Hardin made adig support a regular numerical dotted IP address for the + -s option as well. + +Yang Tse (16 Oct 2008) +- some more temporary magic for the icc seg-fault issue + +- Ensure that shell variable contents which have active meaning + to the shell echo command are not interpreted when trying to + remove extra whitespace from shell variable content. + +- Adjust Watcom C warnings: + + Disable warnings on structure members padding. + +- With this change Solaris target builds will now be done with _REENTRANT defined. + +- Adjust Tiny C basic options: + + Remove -b from debug-enabled configuration, as Tiny C might have + been built without the memory and bounds checker support. + +- Adjust GCC warnings: + + Better disable following warnings when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers: + + -Wmissing-declarations + -Wmissing-prototypes + -Wunused + -Wshadow + +- fix syntax error + +- Initial attempt to detect Watcom C compiler + +- make naming scheme more consistent across whole file + +- Adjust GCC warnings: + + Disable following warnings when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers: + + -Wmissing-prototypes + -Wunused + -Wshadow + +- Adjust GCC --enable-warnings: + + Do not enable -pedantic when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers. + +- adjust SGI MIPSpro C detection + +- LCC compiler adjustments: + + Highest warning level is double -A, next is single -A. + Due to the big number of warnings these trigger on third + party header files it is impratical for us to use any of + them here. If you want them simply define it in CPPFLAGS. + +- remove extra space + +- split SGI compiler check. One for MIPS C and another for MIPSpro C + +- LCC compiler adjustments: + + Warning level reduced from double -A to single -A + +- Initial attempt to detect Tiny C compiler + +- Initial attempt to detect LCC compiler + +- 1) fix bug in CONVERT_INCLUDE_TO_ISYSTEM + + 2) Disable SGI remark: controlling expression is constant + +- simplify SGI C compiler check + +- HP C adjustments: + + Due to the HP-UX socklen_t issue it is insane to use the +w1 warning level. + It generates more than 1100 warnings on socklen_t related statements. + + Until the issue is somehow fixed we will just use the +w2 warning level. + +- Add debug tracing for COMPILER_WORKS_IFELSE + +- configure will also warn on 'strict compiler warning' rejected options + +- convert rejected compiler options messages into a warnings + +- remove extra whitespace from string in SGI C check + +- oops + +- Initial attempt to detect SGI C compiler + +- HP C adjustments: + + Disallow run-time dereferencing of null pointers. + + Disable some remarks: + + #4227: padding struct with n bytes to align member. + + #4255: padding size of struct with n bytes to alignment boundary. + +- improve presentation of accepted/rejected debug/optimizer options + +- refactoring of COMPILER_BASIC_OPTS + +- Initial attempt to detect SUN C compiler + +- Initial attempt to detect HP C compiler + +- fix compiler warning: 'dot_4' may be used uninitialized in this function + +- adjust ICC_windows settings + +- fix VAR_STRIP + +- Sync up with reality + +- Initial attempt to support configure's --(dis|en)able-optimize + option to specify dis(activation) of compiler optimizations. + + If option is specified, it will be honored independant of the + --(dis|en)able-debug option. + +- fix comment + +- Initial attempt to support configure's --(dis|en)able-warnings + option to specify dis(activation) of picky compiler warnings. + + If option is specified, it will be honored independant of the + --(dis|en)able-debug option. + + If option is not specified, it will follow --(dis|en)able-debug + setting, whose default is disabled if not specified. + +- fix compiler warning: dereferencing type-punned pointer will break strict-aliasing rules + +- now compiler warnings are activated for all gcc builds, not only debug ones. + +- Use CFLAGS for icc linker options instead of LDFLAGS, + otherwise gethostbyname() is not detected. + +- use ac_cv_compiler and ac_cv_compiler_num to keep compiler ID and version number + +- Temporary icc adjustment: + + Disable floating point optimizations + +- HAVE_INET_PTON will only be defined when an IPv6 capable working + inet_pton function is available. + +- HAVE_INET_NTOP will only be defined when an IPv6 capable working + inet_ntop function is available. + +- ntoa() and inet_ntoa_r() no longer used + +- icc adjustments for icc 9.0 and prior versions: + + Disable remark #279: controlling expression is constant + + Remark triggered mostly on va_arg() and FD_ZERO() macros. + +- attempt to make work the gethostname function + check for winsock build target configurations + +Gisle Vanem (21 Sep 2008) +- Added HAVE_NETDB_H, HAVE_ARPA_INET_H, HAVE_STRCASECMP + and HAVE_STRNCASECMP. + +Yang Tse (19 Sep 2008) +- icc adjustments: + + Disable remark #981: operands are evaluated in unspecified order + + Function calls which are triggering this remark, today, do not depend + on the order of evaluation of its arguments. + + Disable remark #1469: "cc" clobber ignored + + Remark triggered on htons() and ntohs() due to glibc header files. + +- icc adjustments + +- fix netdb.h prerequisite inclusion + +- improve detection of getservbyport_r() + +- On Linux Intel's icc uses gcc's header files, so + we select ANSI C89 dialect plus GNU extensions. + +- improve detection of gethostname() + +- NetWare builds include "nameser.h" from the c-ares subdir + +- include + +- Sync up with reality + +- adjust inclusion of "nameser.h" + +- reorder some lines in file + +- code cleanup + +- NetWare seems to have writev() + +- rearrange to allow internal/private use of ares_writev to any system + that lacks the writev function. + +- NetWare CLIB target has stricmp() and strnicmp() + +- include header file only when available + +- rearrange to allow internal/private use of ares_strcasecmp to any system that + lacks the strcasecmp function. + +- improve detection of: + strcasecmp() + strcmpi() + stricmp() + strncasecmp() + strncmpi() + strnicmp() + +- *** empty log message *** + +Gisle Vanem (12 Sep 2008) +- djgpp does have strdup(). + +Yang Tse (12 Sep 2008) +- change CRLF into LF line endings + +- strdup() clone for systems/configurations which lack it + +- move inclusion of ares_private.h last + +- icc adjustments + +- icc adjustments + +- Select strict ANSI C89 conformance for icc + +- remove unnecessary typecasting of malloc() + +- remove unnecessary typecasting of realloc() + +Daniel Stenberg (29 Aug 2008) +- we start over working towards 1.5.4 + +Version 1.5.3 (29 Aug 2008) + +Daniel Stenberg (29 Aug 2008) +- Version 1.5.3 + +- added the three people from RELEASE-NOTES and sorted the list alphabetically + +Yang Tse (27 Aug 2008) +- Don't abort configuration if recvfrom() is not available. + +- Functionality only possible if recvfrom() is available. + +- George Neill's fix acountry sample application compilation failure. + +- Brad House's validation that DNS response address matches the request address + +- fix the output name + +- Get rid of ENABLE_64BIT symbol definition and usage. + + Improve HAVE_LONGLONG symbol description. + +- Export 'ares_process_fd' too. + +Gisle Vanem (16 Aug 2008) +- Ops, remove 'use_vc'. + +- Support Watt-32 under Win32. + +Yang Tse (10 Aug 2008) +- Fix: Remove now this SIZEOF_CURL_OFF_T symbol definition. + + This should have been done with the initial 64-bit curl_off_t patch. + +- Improve CURL_CHECK_DEF + +- Fix IBM C and DEC/Compaq C compiler detection + +- Initial support of curlbuild.h and curlrules.h which allows + to have a curl_off_t data type no longer gated to off_t. + +- The minimum autoconf version required for this file is 2.50 + + Avoid dot notation in aclocal serial file number, use a single number now. + +Daniel Stenberg (4 Aug 2008) +- - Fix by Tofu Linden: + + The symptom: + * Users (usually, but not always) on 2-Wire routers and the Comcast service + and a wired connection to their router would find that the second and + subsequent DNS lookups from fresh processes using c-ares to resolve the same + address would cause the process to never see a reply (it keeps polling for + around 1m15s before giving up). + + The repro: + * On such a machine (and yeah, it took us a lot of QA to find the systems + that reproduce such a specific problem!), do 'ahost www.secondlife.com', + then do it again. The first process's lookup will work, subsequent lookups + will time-out and fail. + + The cause: + * init_id_key() was calling randomize_key() *before* it initialized + key->state, meaning that the randomness generated by randomize_key() is + immediately overwritten with deterministic values. (/dev/urandom was also + being read incorrectly in the c-ares version we were using, but this was + fixed in a later version.) + * This makes the stream of generated query-IDs from any new c-ares process + be an identical and predictable sequence of IDs. + * This makes the 2-Wire's default built-in DNS server detect these queries + as probable-duplicates and (erroneously) not respond at all. + +Yang Tse (4 Aug 2008) +- Autoconf 2.62 has changed the behaviour of the AC_AIX macro which we use. + Prior versions of autoconf defined _ALL_SOURCE if _AIX was defined. But, + autoconf 2.62 version of AC_AIX defines _ALL_SOURCE along with other four + preprocessor symbols no matter if the system is AIX or not. To keep the + traditional behaviour, as well as an uniform one, across autoconf versions + AC_AIX is replaced with our own internal macro. + +- Adjust DEC/Compaq C compiler settings. + +- Another AC_TRY_LINK conversion to AC_LINK_IFELSE. + Proper definition of HAVE_function if function is found deeper. + +- Sync up with reality + +- Rename reentrant.m4 to avoid filename clash. + +- Add file version serial number that might be used by 'aclocal' and others. + + Keep the '#' character as the first one on the line. + +- Update copyright year. + +- Sync comment with reality. + +- Reinstate the 'aclocal -I m4' in buildconf and 'ACLOCAL_AMFLAGS = -I m4' way of + including our local m4/reentrant.m4 file. This even takes care of including the + file in the distribution tarball. + +- Add quoting for the AC_DEFINE arguments. + +- Also remove the whitespace. + +- Also remove the extra quoting. + +- Replace some '@%:@' quadigraphs by its actual representation '#'. + + This quadigraph used before a C preprocessor 'define' directive could + be fooling M4, when processing this file, and make it think that the + line contains a pure M4 'define' macro. + +- Tests done using 'aclocal -I m4' in buildconf and 'ACLOCAL_AMFLAGS = -I m4 + in top Makefile.am triggered a problem that prevented aclocal from running + successfully on SunOS 5.10 with GNU m4 1.4.5 and GNU Autoconf 2.61 + + A tarball which reproduces mentioned problem is the one dated July-28-2008 + http://cool.haxx.se/curl-daily/curl-7.19.0-20080728.tar.gz + + We actually don't need all the bells and whistles that the above mechanism + provides. We only need to include our m4/reentrant.m4 file in acinclude.m4 + so here we go with this simpler mechanism. + +- for debugging purposes show ACLOCAL_FLAGS + +- These lines were unintentionally removed in previous commit + +- Partially undo change that prevented SED, GREP, EGREP and AR from being changed by libtool or autoconf. + +- Assert that SED and GREP are set + +- Require autoconf 2.57 or newer + +- When calling aclocal, user defined ACLOCAL_FLAGS will now precede ours. + +- move ACLOCAL_AMFLAGS after AUTOMAKE_OPTIONS + +- setup.h handles definition of _REENTRANT based on NEED_REENTRANT + definition which might be defined in config.h or config-*.h files + +- Remove explicit inclusion of our m4 files first. It was interesting as a test, + but it breaks aclocal execution on some systems, with the following error: + + Can't locate object method "rel2abs" via package "File::Spec" at /usr/local/bin/aclocal line 256. + +- Another step towards detecting if _REENTRANT is already defined or actually + needed, and being able to define it if appropriate for further configure tests + as well as for the generated config file. + +- Explicitly include our m4 files first. This might minimize the impact + that other package's underquoted m4 function definitions have on ours. + +- Add a 3 argument check for getprotobyname_r + +- move reentrant.m4 to the m4 subdirectory to avoid infinite loop inclusion problem + +- add checks for strtok_r and getprotobyname_r + +- Another step towards detecting if _REENTRANT is already defined or actually + needed, and being able to define it if appropriate for further configure tests + as well as for the generated config file. + + Introduced reentrant.m4 intended for our reentrant related autotools/m4 macros. + +- reorder argument number detection for getservbyport_r to + actually verify if the test is properly working + +- Make sure that configure process tests are done with the same _REENTRANT + setting as the one actually used when finally building the library. + +- Change recvfrom's sixth argument data type to the 'historically standard' 'int' + data type for systems where this sixth argument is prototyped as a void pointer. + + Start of thread: http://curl.haxx.se/mail/lib-2008-07/0153.html + +- use prototypes to improve getservbyport_r detection + +- Adjust recvfrom's sixth arg data type definition for NetWare (LIBC) + +- Use the sreadfrom() wrapper to replace recvfrom() in our code. + +- when recvfrom prototype uses a void pointer for arguments 2, 5 or 6 this will + now cause the definition of RECVFROM_TYPE_ARG2_IS_VOID, RECVFROM_TYPE_ARG5_IS_VOID + or RECVFROM_TYPE_ARG6_IS_VOID, as appropriate. + +- Adjust DEC/Compaq C compiler settings + +- Added "pointer to void" as another data type to check for the sixth argument of + function recvfrom as a result of the info additionally logged when running on a + Solaris system. + + The compiler error showed that the prototype being used on Solaris was the one + declared in line 427 of "/usr/include/sys/socket.h" as: + + function(int, + pointer to void, + unsigned int, + int, + pointer to struct sockaddr, + pointer to void) returning int + +- Adjust DEC/Compaq C compiler settings + +- RECVFROM_TYPE_ARG2, RECVFROM_TYPE_ARG5 and RECVFROM_TYPE_ARG6 are now defined + to the data type pointed by its respective argument and not the pointer type. + +- Configure process now checks availability of recvfrom() socket function and + finds out its return type and the types of its arguments. Added definitions + for non-configure systems config files, and introduced macro sreadfrom which + will be used on udp sockets as a recvfrom() wrapper. + +- Initial DEC/Compaq C compiler detection and flags + +- Improved configure detection of number of arguments for getservbyport_r + +- Allow --enable-largefile and --disable-largefile configurations. + Configure process no longer needs nor checks size of curl_off_t. + Library will now be built with _REENTRANT symbol defined. + +- fix compiler warning + +- since Jun 30 2008 MAXHOSTNAMELEN define is no longer used + +- fix c-ares version reported in generated libcares.pc file when building + from CVS tree. + +- egrep and ar are also mandatory + +Daniel Stenberg (3 Jul 2008) +- just to clarify that c-ares actually have some ipv6 support + +- ares_gethostbyname() fallback from AAA to A records with CNAME present + +- - Phil Blundell: If you ask ares_gethostbyname() to do an AF_INET6 lookup and + the target host has only A records, it automatically falls back to an + AF_INET lookup and gives you the A results. However, if the target host has + a CNAME record, this behaviour is defeated since the original query does + return some data even though ares_parse_aaa_reply() doesn't consider it + relevant. Here's a small patch to make it behave the same with and without + the CNAME. + +Yang Tse (2 Jul 2008) +- The configure process will now halt when sed or grep are unavailable + +- fallback to gettimeofday when monotonic clock is unavailable at run-time + +- IBM C/C++ compiler predefined macro check + +- set earlier in configure process IBM compilers optimization flags + +- make check message wording more precise + +Daniel Stenberg (30 Jun 2008) +- - As was pointed out to me by Andreas Schuldei, the MAXHOSTNAMELEN define is + not posix or anything and thus c-ares failed to build on hurd (and possibly + elsewhere). The define was also somewhat artificially used in the windows + port. Now, I instead rewrote the use of gethostbyname to enlarge the host + name buffer in case of need and totally avoid the use of the MAXHOSTNAMELEN + define. I thus also removed the defien from the namser.h file where it was + once added for the windows build. + + I also fixed init_by_defaults() function to not leak memory in case if + error. + +Yang Tse (29 Jun 2008) +- fix C style comment + +- John Lightsey filed bug report #1999181: "CLOCK_MONOTONIC always fails on + some systems" (http://curl.haxx.se/bug/view.cgi?id=1999181). The problem was + that the configure script did not use the _POSIX_MONOTONIC_CLOCK feature test + macro when checking monotonic clock availability. This is now fixed and the + monotonic clock will not be used unless the feature test macro is defined + with a value greater than zero indicating always supported. + +- Modified configuration script to actually verify if the compiler is good + enough at detecting compilation errors or at least it has been properly + configured to do so. Configuration heavily depends on this capability, so + if this compiler sanity check fails the configuration process will now fail. + +- No longer break out of a shell "for" statement from inside + AC_FOO_IFELSE macros, otherwise temp files are not removed. + + Identation adjustment. + +Gunter Knauf (11 Jun 2008) +- enable additional CFLAGS from commandline. + +Yang Tse (9 Jun 2008) +- fix pkg-config reporting of private libraries needed for static linking + +- MSVC does build Windows native targets + +- Brad House fixed a missing header file inclusion in adig sample program + +Daniel Stenberg (29 May 2008) +- start working on 1.5.3 + +Version 1.5.2 (29 May 2008) + +Daniel Stenberg (29 May 2008) +- 1.5.2 + +Yang Tse (26 May 2008) +- fix compiler warning: unreferenced formal parameter + +Daniel Stenberg (23 May 2008) +- list all local sources the (demo) tools need, add a few missing scripts to + the dist tarball and remove a two duplicate file names from EXTRA_DIST + (most of it pointed out by Yang Tse) + +- this is not used (anymore) + +- make sure the configure.ac file with the correct version number is shipped + in the tarball + +Yang Tse (22 May 2008) +- MSVC6+ clean-up targets must also remove acountry.exe + +- sync with reality + +- fix: [action-if-found] part of AC_CHECK_TYPE macro cannot be quoted when empty + +- fix: remove need and definition of HAVE_SOCKLEN_T symbol + +- fix: socklen_t definition comment + +- update several macros using AC_TRY_LINK with AC_LINK_IFELSE + +- fix underquoting of AC_LANG_PROGRAM arguments + +- if'def out private function ares__tvdiff(), it is not in use yet. + +- update several macros using AC_TRY_LINK with AC_LINK_IFELSE + +- fix socklen_t equivalent detection when cross compiling Windows target + +- if WINSOCK2 API is used link with 'ws2_32', else + + if WINSOCK API is used under WinCE link with 'winsock', else + + if WINSOCK API is used link with 'wsock32'. + +- on winsock systems linking is done using library 'ws2_32' when + winsock2.h is available, and library 'winsock' is used when only + winsock.h is available. + +- minor change for wince-cegcc and wince-mingw32ce support + +- millisecond resolution support followup + +Gisle Vanem (15 May 2008) +- Replaced "-DHAVE_FIONBIO" with "-DHAVE_IOCTLSOCKET". + Added "-DHAVE_GETTIMEOFDAY". Trimmed lines. + +Yang Tse (15 May 2008) +- sync with reality + +- remove compilation time generated files + +- use same time source for timeout initialization and processing + +- Improve toolchain detection for WinCE cross compilation: + + When cross compiling WinCE with the arm-wince-cegcc-gcc C compiler + symbol __CEGCC__ is defined and the unix-like compatibility layer + is used. For our purposes this is not a native Windows build. + + When cross compiling WinCE with the arm-wince-mingw32ce-gcc C compiler + symbol __MINGW32CE__ is defined and the unix-like compatibility layer + is not used. For our purposes this _is_ a native Windows build. + +- skip checks for Windows specific header files + when build target is not a native Windows one + +- WinCE cross compilation adjustments: + + HAVE_WINSOCK2_H shall not be defined. + HAVE_WS2TCPIP_H shall not be defined. + +Daniel Stenberg (13 May 2008) +- - Introducing millisecond resolution support for the timeout option. See + ares_init_options()'s ARES_OPT_TIMEOUTMS. + +Yang Tse (13 May 2008) +- also ignore this + +- also ignore this + +- ignore this compilation time generated files + +- don't keep in CVS this compilation time generated file + +- add MSVC6 project for acountry sample program + +- update MSVC6 projects to use the multithreaded DLL runtime library + +- add MSVC6 project for acountry sample program + +- skip libtool C++ preprocessor compiler and linker checks + +- ignore libcares.pc + +- configure script will now define HAVE_CLOCK_GETTIME_MONOTONIC symbol only + when function clock_gettime() is available and the monotonic timer is + also available. Otherwise, in some cases, librt or libposix4 could be used + for linking even when finally not using the clock_gettime() function due + to lack of the monotonic clock. + +- fix syntax error: missing semicolon + +- Add library checking for clock_gettime() support + +- Use monotonic time source if available. + +Daniel Stenberg (9 May 2008) +- Removed AC_PROG_CC_STDC again. It enforces C99/gnu99 stdandard which is too + liberal for me. Also, autoconf 2.61 and earlier doesn't work with icc 10.1 + for this macro. (2.62 confirmed to work though). See discusson on the mailing + list starting here: + + http://daniel.haxx.se/projects/c-ares/mail/c-ares-archive-2008-05/0001.shtml + +- include strings.h (if available) for the strcasecmp() proto + +- check for strings.h in configure and use it for the strcasecmp() proto + +- adjusted to work with the updated configure.ac + +- - Sebastian made c-ares able to return all PTR-records when doing reverse + lookups. It is not common practice to have multiple PTR-Records for a single + IP, but its perfectly legal and some sites have those. + +- - Doug Goldstein provided a configure patch: updates autoconf 2.13 usage to + autoconf 2.57 usage (which is the version you have specified as the minimum + version). It's a minor change but it does clean up some warnings with newer + autoconf (specifically 2.62). + +Yang Tse (5 May 2008) +- Improved parsing of resolver configuration files + +- make previous compiler warning fix more portable + +- fix compiler warning: indirection to slightly different base types + +- fix compiler warning: local variable may be used without having been initialized + +- fix compiler warning: unreferenced formal parameter + +- fix compiler warning: assignment within conditional expression + +Daniel Stenberg (4 Apr 2008) +- - Alexey Simak fixed the VC dsp file by adding the missing source file + ares_expand_string.c + +- Alexey Simak made adig support NAPTR records + +- Eino Tuominen improved the code when a file is used to seed the randomizer + +Yang Tse (29 Feb 2008) +- Force AIX xlc to fail and not generate object code if the source code has + compiled with errors. This behaviour is needed for autoconf macros which + rely on the ability to compile with or without errors, and is safer than + xlc's default of failing only upon severe errors. + +Gunter Knauf (27 Feb 2008) +- added get_ver.awk since c-ares is a standalone project, and should therefore also compile when cURL is absent. + +- a couple of small fixes to the makefile: + fixed comments; fixed INSTDIR define, simplified rules; + changed to use get_ver.awk in current dir rather than the curl one. + +- fixed linker def file for tools when compiled with gcc/nlmconv. + +- added some files which were missing in release tarballs. + +- updated copyright for new year. + +Gisle Vanem (2 Jan 2008) +- Added '-d' option for Watt-32 debugging. + +Yang Tse (18 Dec 2007) +- MSVC 9.0 (VS2008) does not support Windows build targets prior to WinXP, + and makes wrong asumptions of build target when it isn't specified. So, + if no build target has been defined we will target WinXP when building + with MSVC 9.0 (VS2008). + +Daniel Stenberg (11 Dec 2007) +- build acountry too + +Gisle Vanem (11 Dec 2007) +- Added acountry.c. + +- Added build of acountry.nlm. + +- Added build of acountry.exe. + +- Build acountry.exe. Added 'socklen_t' define. + +- Another sample application that returns country-code and + name from an IPv4-address or host-name. Using the service of + countries.nerd.dk. + +Daniel Stenberg (10 Dec 2007) +- grrr, the previous commit was meant to properly make sure that we don't + link any executables when doing debug builds since they kind of assume + symbols provided by libcurl, but it also wrongly included acountry.c + +- when building + +- build ahost and adig by default but don't install them + +Gisle Vanem (10 Dec 2007) +- Fix for targets that do have 'struct in6_addr', but which doesn't + define 's6_addr' as a macro. + +Yang Tse (3 Dec 2007) +- Fix three issues previous cleanup introduces. + +Daniel Stenberg (3 Dec 2007) +- Erik Kline cleaned up ares_gethostbyaddr.c:next_lookup() somewhat + +- Brad Spencer fixed the configure script to assume that there's no + /dev/urandom when built cross-compiled as then the script cannot check for + it. + +- the gethostbyname fix applied here as well + +- fix next_lookup() to continue searching even if c-ares failed to load the + /etc/hosts file, pointed out by Erik Kline: + http://daniel.haxx.se/projects/c-ares/mail/c-ares-archive-2007-11/0027.shtml + +- Remove the check for libdl since that isn't actually used and it causes + warnings. Pointed out by Robin Cornelius. + +- pkgconfig fix by Andreas Schuldei + +- spellfix + +- and we start on 1.5.2! + +Version 1.5.1 (21 Nov 2007) + +Daniel Stenberg (21 Nov 2007) +- change + +- oops + +- start working on 1.5.1 now + +Version 1.5.0 (21 Nov 2007) + +Daniel Stenberg (21 Nov 2007) +- this is what 1.5.0 is + +- fill in missing copyrights + +Gunter Knauf (18 Nov 2007) +- removed now obsolete defines; + updated external library versions to latest. + +Steinar H. Gunderson (16 Nov 2007) +- Fix a double free. + +Yang Tse (15 Nov 2007) +- Needed now that in6_addr is referenced in ares.h + +Steinar H. Gunderson (15 Nov 2007) +- When looking up in DNS and then in the hosts file, return the error code from DNS if both fail, instead of returning the error code from the hosts file, as today. Patch from the Google tree. + +- Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inclined. Patch from the Google tree. + +Yang Tse (8 Nov 2007) +- Define WIN32 when build target is Win32 API. + This also defines it for WinCE even though it is a subset of WIN32. + +- The only libraries actually needed for sample programs adig and + ahost are ws2_32.lib and advapi32.lib + +- MSVC versions prior to VS2005 do not complain about portable C functions + +- Windows build targets have socklen_t definition in ws2tcpip.h but some + versions of ws2tcpip.h do not have the definition. It seems that when + the socklen_t definition is missing from ws2tcpip.h the definition for + INET_ADDRSTRLEN is also missing, and that when one definition is present + the other one also is available. + +Gunter Knauf (22 Oct 2007) +- removed dependency on gettimeofday() since we use only 1 sec resolution here. + +Yang Tse (20 Oct 2007) +- Fix compiler warning: conversion from "int" to "unsigned short" may lose significant bits + +- Fix message shown when detecting icc version + +- Avoid shadowing a global declaration + +- Renamed a variable to avoid shadowing a global declaration + +- Renamed internal function to avoid a variable shadowing it + +- Fix compiler warning: feupdateenv is not implemented and will always fail. + Specifically for linux x86-64 with Intel's icc. + +- Sync PLATFORM_AIX_V3 detection and CURL_CC_DEBUG_OPTS() + icc warning level with libcurl's + +- Fix compiler warning: conversion from "int" to "unsigned char" + may lose significant bits + +- actually sync with lib/setup_once.h + +- sync with lib/setup_once.h + +Steinar H. Gunderson (16 Oct 2007) +- Fix a bug where fallback from AF_INET6 to AF_INET would not work properly together with relative search; if you had a search path of .a.com and .b.com, and foo.a.com would return ARES_ENODATA and foo.b.com would return ARES_ENOTFOUND, the lookup would not properly retry with AF_INET as it forgot the first ARES_ENODATA. + +Dan Fandrich (15 Oct 2007) +- Mention first version with CURLOPT_COPYPOSTFIELDS. + Don't confuse NUL with NULL. + +Gisle Vanem (8 Oct 2007) +- Added needed 'HAVE_*' defines. + +- 'FD_CLOXEC' is meaningless on MSDOS/Watt-32. + +Steinar H. Gunderson (4 Oct 2007) +- Removed a piece of redundant code (process_answer already takes care of it). + +- Another timeout fix in ares_getnameinfo(). + +- Send the timeout count in ares_getnameinfo(). + +- Moved the NULL check for channel upwards in ares_destroy(). + +- Clarified the comment over ares_cancel. + +Yang Tse (2 Oct 2007) +- Avoid a segfault when generating a DNS "Transaction ID" in internal + function init_id_key() under low memory conditions. + +- Add ares_llist.c and ares_llist.h to MSCV project file. + +Daniel Stenberg (2 Oct 2007) +- Fixed the problem where next_lookup would use 'status' uninitialized. Now + it gets passed the initial value as an argument. + +Yang Tse (2 Oct 2007) +- Avoid inline C99ism, and move c-ares routines for managing doubly-linked lists. + +Daniel Stenberg (1 Oct 2007) +- ares_strerror() segfaulted if the input error number was out of the currently + supported range. + +- Prevent ares_strerror() from segfaulting if an invalid error code is passed + in as argument! + +Yang Tse (30 Sep 2007) +- Fix compiler warning + +- check availability of + +- improve portability, defining MAXDNAME and MAXCDNAME + +Steinar H. Gunderson (30 Sep 2007) +- Fix a memory leak that I recently inadvertedly introduced. + +- Use ISDIGIT instead of isdigit; fixes a gcc warning. + +- Port the TCP socket fix made in ares_fds() to ares_getsock() as well. + +- Previously, processing a large batch of timeouts was O(n^2) in the number of + outstanding queries, and processing a DNS response packet was O(n) in the + number of outstanding queries. To speed things up in Google, we added a few circular, + doubly-linked lists of queries that are hash-bucketed based on + the attributes we care about, so most important operations are now O(1). + + It might be that the number of buckets are higher than most people would need, + but on a quick calculation it should only be 100kB or so even on a 64-bit + system, so I've let it stay as-is. + +Gisle Vanem (29 Sep 2007) +- We should standarise on C comments. + +- Fix compiler warning in setsockopt(). + +Steinar H. Gunderson (29 Sep 2007) +- TCP queries can time out too, not just UDP queries. (Patch from the Google tree.) + +- Read and process as many packets as possible in read_udp_packets, to avoid having to run the entire event loop once per packet. (Patch from the Google tree.) + +- There are two different places in write_tcp_data() that advance the send_queue; however, they are slightly different and only the first one properly uses a while loop. Consolidate both into a single function that DTTR. (Patch from the Google tree.) + +- Reject names that are longer than 255 characters, to avoid problems with strict or buggy DNS server implementations. (Patch from the Google tree) + +- In ares_mkquery, make sure we set buflen and buf to reasonable values if there's an error. (Patch from the Google tree) + +- Be stricter about what's a valid IP address in fake_hostent. (Patch from the Google tree.) + +- Handle the root of the DNS tree correctly in ares_expand_name. + +Daniel Stenberg (28 Sep 2007) +- today's modifications by Steinar and me + +- Bumped version to 1.5.0 for next release and soname bumped to 2 due to ABI + and API changes in the progress callback (and possibly more coming up from + Steinar) + +Steinar H. Gunderson (28 Sep 2007) +- Unrevert previous 'missing' hunks. They were missing since the patch is still in for review :-) + +- Yet more missing hunks... Nggh. + +- Always register for TCP events even if there are no outstanding queries, as the other side could always close the connection, which is a valid event which should be responded to. + +- Forgot to include a few hunks from ares_process.c earlier. Fixing now. + +- Support a few more socket options, and refactor the option setting a bit. (Patch from the Google tree.) + +- Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.) + +- Three fixes in one commit (sorry): a) Take care of the tcpbuf if it ends while queued for transmission, note broken servers and close them in the main loop, and store TCP socket generation number in order not to send the same query twice over the same socket. + +- Don't skip a server if it's the only one. (Bugfix from the Google tree.) + +Daniel Stenberg (27 Sep 2007) +- wrong, revert the previous "fix" and instead check that the fd_set pointer + is non-NULL before we FD_CLR + +- eek, fix the conditions to return on either problem instead of requiring + both to occur + +- Steinar H. Gunderson fixed: Correctly clear sockets from the fd_set on in + several functions (write_tcp_data, read_tcp_data, read_udp_packets) so that + if it fails and the socket is closed the following code doesn't try to use + the file descriptor. + +- Steinar H. Gunderson modified c-ares to now also do to DNS retries even when + TCP is used since there are several edge cases where it still makes sense. + +- Brad House provided a fix for ares_save_options(): Apparently I overlooked + something with the ares_save_options() where it would try to do a malloc(0) + when no options of that type needed to be saved. On most platforms, this was + fine because malloc(0) doesn't actually return NULL, but on AIX it does, so + ares_save_options would return ARES_ENOMEM. + +- added initial pkg-config file (attempt) + +Gunter Knauf (20 Jul 2007) +- added curl include for debug builds. + +Daniel Stenberg (14 Jul 2007) +- added another SEE ALSO + +- Brad House's fix to hish a win32 compiler warning + +- added Vlad's entire description of his valgrind fix + +- Vlad Dinulescu fixed two outstanding valgrind reports + +Gunter Knauf (8 Jul 2007) +- added better CodeWarrior detection. + +- removed some obsolete include paths and defines. + +- add test for gettimeofday() so that HAVE_GETTIMEOFDAY gets defined. + +- although the check for HAVE_STRUCT_TIMEVAL solved the redefine it is incorrect; lets see if a check for HAVE_GETTIMEOFDAY also works; if gettimeofday() is present then we can assume we have the timezone struct too. + +- added check for sys/param.h. + +- trial to catch problem with Daniels cross-mingw ares builds. + +- added NetWare CLIB-own header to solve gcc warnings. + +- few minor changes to make ares compile for NetWare CLIB architecture. + +- changed to build for CLIB / LIBC. + +- sync'd with lib makefile changes: use var for awk; fixed RECV* / SEND* defines; debug var can be overwritten; added better compiler path handling. + +Daniel Stenberg (8 Jun 2007) +- start working on 1.4.1 + +Version 1.4.0 (8 Jun 2007) + +Daniel Stenberg (8 Jun 2007) +- 1.4.0 preps + +- the revert + +- Revered Ashish Sharma's multiple entries patch, as it caused memory madness + +- minor edit since getting an ID seems pointless when failure happens + +- fix the bad bad bad mess this caused on name resolves returning more than + one name... Reported by James Bursa + +- Brad Spencer found and fixed three flaws in the code, found with the new + gcc 4.2.0 warning: -Waddress + +- Brad House fixed VS2005 compiler warnings due to time_t being 64bit. + He also made recent Microsoft compilers use _strdup() instead of strdup(). + +- Ashish Sharma provided a patch for supporting multiple entries in the + /etc/hosts file. Patch edited for coding style and functionality by me + (Daniel). + +- ares_destroy_options() and ares_save_options() man pages by Brad House + +- make next version 1.4.0 + +- first take at detecting a random device and seeding the random key using data + from it in randomize_key() + +- Shmulik Regev brought cryptographically secure transaction IDs + +- Brad House added ares_save_options() and ares_destroy_options() that can be + used to keep options for later re-usal when ares_init_options() is used. + +- added ares_process_fd() to allow applications to ask for processing on + specific sockets and thus avoiding select() and associated functions/macros. + This function will be used by upcoming libcurl releases for this very + reason. It also made me export the ares_socket_t type in the public ares.h + header file, since ares_process_fd() uses that type for two of the arguments. + +- Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows + that could cause it to return a bad return code. + +Yang Tse (25 Apr 2007) +- Steve Little's fixes to allow compilation on VMS 64-bit mode + +Gunter Knauf (21 Apr 2007) +- fixed ARFLAGS for CodeWarrior build. + +- added ranlib when library is created with ar. + +Gisle Vanem (16 Apr 2007) +- No need for USE_MANUAL. Use select_s() instead of select(). + Added ares_getopt.o to program sample objects. + +Yang Tse (16 Apr 2007) +- move linkage var declarations to ares_getopt.h + +Gunter Knauf (16 Apr 2007) +- use Makefile.inc to determine sources. + +- ares_getopt() command-line parser function does not belong to actual c-ares library. It is just a convinience source code helper function for use in example programs adig.c and ahost.c + +Yang Tse (16 Apr 2007) +- ares_getopt() command-line parser function does not belong to actual + c-ares library. It is just a convinience source code helper function + for use in example programs adig.c and ahost.c + +- ares_getopt() command-line parser function does not belong to actual + c-ares library. It is just a convinience source code helper function + for use in example programs adig.c and ahost.c + +- update MSVC project files with ares_getopt() + +- use ares_getopt for all platforms + +- add ares_getopt prototype + +- Rename function as ares_getopt() + +- Replace tabs with spaces + +- Add file ares_getopt.c + + Original file name getopt.c Initial import into the c-ares source tree + on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with + the modified BSD license, BSD license without the advertising clause. + +- convenience SIG_ATOMIC_T macro definition + +- move WinSock definitions of EBADF, EINTR, EINVAL and EAFNOSUPPORT to setup_once.h + +- update copyright year + +- Cleanup. Warnings related with FD_SET, FD_ISSET, and FD_ZERO macros + are not icc 9.0 specific. + +Gunter Knauf (27 Mar 2007) +- added variadic macro stuff. + +- added CVS Id tag. + +- fixed build to use compiler-default lib extension. + +Yang Tse (22 Mar 2007) +- attempt to keep message length below 80 chars + +Gisle Vanem (17 Mar 2007) +- Added a hack to work around the circular dependency when + CURL_DEBUG is defined. + +Yang Tse (15 Mar 2007) +- show better description for AMD64-linux static libraries PIC check + +- remove code superceeded by the new method used to force + libtool to skip C++ and Fortran checks in patchset: + http://cool.haxx.se/cvs.cgi/curl/ares/configure.ac.diff?r1=1.60&r2=1.64 + +- fix test leftover in previous commit + +- force libtool to build static libraries with PIC on AMD64 + +- Autoconf redefines the M4 builtin macro 'm4_undefine' in such a way that + it fails if the macro that is being undefined is not already defined. To + make this work under all cases and be sure that at a certain point some + specific macro isn't defined we must use the following style in configure: + + m4_ifdef([macro], [m4_undefine([macro])]) + +Dan Fandrich (6 Mar 2007) +- Autoconf 2.57 didn't like these m4_undefine for some reason (probably a bug). + Luckily, they weren't needed. + +Yang Tse (6 Mar 2007) +- skip libtool C++ and Fortran linker checks + +- skip libtool C++ and Fortran checks + +Gisle Vanem (27 Feb 2007) +- Added TOPDIR variable. Put dependencies in external file. + Added -DHAVE_STRUCT_TIMEVAL to CFLAGS. + +- Removed inclusion of in .c-files + since it's already included through "setup.h". + +Yang Tse (22 Feb 2007) +- include when checking availability of the bool type + +- Check for stdbool.h at configuration stage, and include it if available. + + Check for lowercase 'bool' type at configuration stage. If not available + provide a suitable replacement with a type definition of 'unsigned char' + in setup_once.h + + Move definitions of TRUE and FALSE to setup_once.h + +- curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h + +Gisle Vanem (21 Feb 2007) +- Cleanup WIN32 target using WSACleanup(). + +Yang Tse (20 Feb 2007) +- Move header file inclusion logic and definition of timeval + struct for platforms that don't have it to setup_once.h + +Gisle Vanem (19 Feb 2007) +- Added ares_parse_ns_reply.obj etc. + +- INADDR_NONE no longer used. + +- Fixed typo. + +Daniel Stenberg (19 Feb 2007) +- Vlad Dinulescu added ares_parse_ns_reply() + +Yang Tse (19 Feb 2007) +- compiler warning fix + +- add debug messages for initialization failures + +- fix ENAMETOOLONG and ENOTEMPTY may already be defined in errno.h + +- Move portable error number symbolic name definitions to setup_once.h + +- compiler warning fix + +- compiler warning fix + +- add debug messages for fopen() failures + +- use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling + +- compiler warning fix + +- introduce uppercase macros SOCKERRNO, SET_SOCKERRNO(), ERRNO and SET_ERRNO() + making them available to any source code file which includes "setup.h". + + Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno + (or equivalent) on this platform to hide platform details to code using it. + + Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno + (or equivalent) on this platform to hide platform details to code using it. + +- icc 9.0 when compiling its generated code for its own FD_SET, + FD_ISSET, and FD_ZERO macros emits warnings #1469 and #593. + So for icc 9.0 we also ignore warnings #1469 and #593. + * 593 warns on "variable __d0 was set but never used" + * 1469 warns on "cc clobber ignored" + +- compiler warning fix + +- Oops, missing argument separator comma + +- in debug messages also show error description + +- avoid using funtion isblank() and just use our ISBLANK + macro to provide this functionality on all platforms + +- check for isblank() at configuration stage. If not available + provide a suitable replacement for use in our ISBLANK macro + +- use our own ISUPPER and ISLOWER macros + +- use our own ISBLANK macro + +- Fix c-ares failing to get the search sequence of /etc/hosts and + DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when + /etc/resolv.conf did not exist or was unable to read it. + +- compiler warning fix + +- use macro AC_AIX to define `_ALL_SOURCE', if on AIX. + +- use same AIX XLC compiler options as curl's + +- *) Remove duplicate declaration of TYPE_SOCKADDR_STORAGE + *) Update CURL_CC_DEBUG_OPTS from curl's script + +Gisle Vanem (6 Feb 2007) +- INADDR_NONE no longer used. + +- Added debug option ('-d') for Watt-32 programs. + +- Added HAVE_PROCESS_H for DOS/Win32. + Include for getpid() in ares_init.c. + +- Fix compiler warning. + +- Include and inside HAVE_x_H. + Added 'optind' and 'optarg' as in adig.c. + +- Include and inside HAVE_x_H. diff -Nru python-gevent-0.13.7/c-ares/CHANGES python-gevent-1.0/c-ares/CHANGES --- python-gevent-0.13.7/c-ares/CHANGES 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/CHANGES 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,7 @@ +This file no longer holds the changelog. Now you can generate it yourself +like this: + + $ git log --pretty=fuller --no-color --date=short --decorate=full -1000 | + ./git2changes.pl + +The older, manually edited, changelog is found in git named CHANGES.0 diff -Nru python-gevent-0.13.7/c-ares/CHANGES.0 python-gevent-1.0/c-ares/CHANGES.0 --- python-gevent-0.13.7/c-ares/CHANGES.0 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/CHANGES.0 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1218 @@ + Changelog for the c-ares project + +Version 1.7.5 (August 16, 2011) + +Fixed: + + o detection of semicolon comments in resolv.conf + o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory + o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory + o replacement ares_inet_ntop affected by potential out of bounds write + o added install target to Makefile.msvc + o only fall back to AF_INET searches when looking for AF_UNSPEC addresses + o fixed ares_parse_*_reply memory leaks + o Use correct sizeof in ares_getnameinfo() + o IPv6-on-windows: find DNS servers correctly + o man pages: docs for the c-ares utility programs + o getservbyport replacement for Win CE + o config_sortlist: (win32) missing else + o advance_tcp_send_queue: avoid NULL ptr dereference + o configure: fix a bashism + o ares_expand_name: Fix encoded length for indirect root + +Version 1.7.4 (December 9, 2010) + +Changed: + + o local-bind: Support binding to local interface/IPs, see + ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev + +Fixed: + + o memory leak in ares_getnameinfo + o add missing break that caused get_ares_servers to fail + o ares_parse_a_reply: fix CNAME response parsing + o init_by_options: don't copy an empty sortlist + o Replaced uint32_t with unsigned int to fix broken builds + on a couple of platforms + o Fix lookup with HOSTALIASES set + o adig: fix NAPTR parsing + o compiler warning cleanups + +Version 1.7.3 (June 11, 2010) + +Fixed: + + o builds on Android + o now includes all files necessary to build it (1.7.2 lacked a file) + +Version 1.7.2 (June 10, 2010) + +Changed: + + o Added ares_parse_mx_reply() + +Fixed: + + o ares_init: Last, not first instance of domain or search should win + o improve alternative definition of bool + o fix VS2010 compiler warnings + + +Version 1.7.1 (Mar 23, 2010) + +* May 31, 2010 (Jakub Hrozek) +- Use the last instance of domain/search, not the first one + +* March 23, 2010 (Daniel Stenberg) +- We switched from CVS to git. See http://github.com/bagder/c-ares + +* March 5, 2010 (Daniel Stenberg) +- Daniel Johnson provided fixes for building with the clang compiler. + +* March 5, 2010 (Yang Tse) +- Added IPv6 name servers support. Implementation has been based on code, + comments and feedback provided November and December of 2008 by Daniel + Stenberg, Gregor Jasny, Phil Blundell and myself, December 2009 by Cedric + Bail, and February 2010 by Jakub Hrozek on the c-ares mailing list. On + March I reviewed all that, selected the best of each, and adjusted or + extended parts of it to make the best fit. + + The external and visible result of all this is that two new functions are + added to the external API, ares_get_servers() and ares_set_servers(), which + becomes now the preferred way of getting and setting name servers for any + ares channel as these support both IPv4 and IPv6 name servers. + + In order to not break ABI compatibility, ares_init_options() with option + mask ARES_OPT_SERVERS and ares_save_options() may still be used in code + which is intended to run on IPv4-only stacks. But remember that these + functions do not support IPv6 name servers. This implies that if the user + is capable of defining or providing an IPv6 name server, and the app is + using ares_init_options() or ares_save_options() at some point to handle + the name servers, the app will likely lose IPv6 name servers. + +* January 28, 2010 (Daniel Stenberg) +- Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't + check for broken connections like ares_process() did. Based on that, I + merged the two functions into a single generic one with two front-ends. + +* December 29, 2009 (Yang Tse) +- Laszlo Tamas Szabo adjusted Makefile.msvc compiler options so that where + run-time error checks enabling compiler option /GZ was used it is replaced + with equivalent /RTCsu for Visual Studio 2003 and newer versions. Option + /GX is replaced with equivalent /EHsc for all versions. Also fixed socket + data type for internal configure_socket function. + +* December 21, 2009 (Yang Tse) +- Ingmar Runge noticed that Windows config-win32.h configuration file + did not include a definition for HAVE_CLOSESOCKET which resulted in + function close() being inappropriately used to close sockets. + +Version 1.7.0 (Nov 30, 2009) + +* November 26, 2009 (Yang Tse) +- Larry Lansing fixed ares_parse_srv_reply to properly parse replies + which might contain non-SRV answers, skipping over potential non-SRV + ones such as CNAMEs. + +* November 23, 2009 (Yang Tse) +- Changed naming convention for c-ares libraries built with MSVC, details + and build instructions provided in README.msvc file. + +* November 22, 2009 (Yang Tse) +- Jakub Hrozek fixed more function prototypes in man pages to sync them + with the ones declared in ares.h + +- Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and + ares_addr6ttl in order to prevent name space pollution, along with + necessary changes to code base and man pages.This change does not break + ABI, there is no need to recompile existing applications. But existing + applications using these structs with the old name will need source code + adjustments when recompiled using c-ares 1.7.0. + +* November 21, 2009 (Yang Tse) +- Added manifest stuff to Makefile.msvc. + +* November 20, 2009 (Yang Tse) +- Fixed several function prototypes in man pages that were out of sync + with the ones declared in ares.h. Added ares_free_data() along with + man page. Updated ares_parse_srv_reply() and ares_parse_txt_reply() + with changes from Jakub Hrozek making these now return linked lists + instead of arrays, and merging the ares_free_data() adjustments. + +* November 10, 2009 (Yang Tse) +- Updated MSVC 6.0 project files to match settings from Makefile.msvc. + +* November 9, 2009 (Yang Tse) +- Makefile.msvc is now the reference method to build c-ares and sample + programs with any MSVC compiler or MS Visual Studio version. If no + option or target are specified it builds dynamic and static c-ares + libraries in debug and release flavours and also builds all sample + programs using each of the different c-ares libraries. + +* November 2, 2009 (Yang Tse) +- Renamed c-ares setup.h to ares_setup.h + +* October 31, 2009 (Yang Tse) +- Symbol hiding configure options are named now --enable-symbol-hiding + and --disable-symbol-hiding in an attempt to make them less ambiguous. + +* October 30, 2009 (Yang Tse) +- Many fixes for ares_parse_txt_reply() + +* October 29, 2009 (Daniel Stenberg) +- Jakub Hrozek added ares_parse_txt_reply() for TXT parsing + +* October 29, 2009 (Yang Tse) +- Updated MSVC 6.0 workspace and project files that allows building + dynamic and static c-ares libraries in debug and release flavours. + Additionally each of the three sample programs is built against + each of the four possible c-ares libraries, generating all this + a total number of 12 executables and 4 libraries. + +* October 28, 2009 (Yang Tse) +- Initial step towards the ability to reduce c-ares exported symbols + when built as a shared library based on the 'visibility' attribute + for GNUC and Intel compilers and based on __global for Sun compilers, + taking also in account __declspec function decoration for Win32 and + Symbian DLL's. + +* October 27, 2009 (Yang Tse) +- Fixed Pelles C Win32 target compilation issues. + +* October 23, 2009 (Yang Tse) +- John Engelhart noticed an unreleased problem relative to a duplicate + ARES_ECANCELLED error code value and missing error code description. + +* October 7, 2009 (Yang Tse) +- Overhauled ares__get_hostent() Fixing out of bounds memory overwrite + triggered with malformed /etc/hosts file. Improving parsing of /etc/hosts + file. Validating requested address family. Ensuring that failures always + return a NULL pointer. Adjusting header inclusions. + +* October 6, 2009 (Yang Tse) +- Fix ssize_t redefinition errors on WIN64 reported by Alexey Simak. + +* September 29, 2009 (Yang Tse) +- Make configure script also check if _REENTRANT definition is required to + make errno available as a preprocessor macro. + +* September 7, 2009 (Yang Tse) +- Add T_SRV portability check to ares_parse_srv_reply.c + +* 4 Sep 2009 (Daniel Stenberg) +- Jakub Hrozek added ares_parse_srv_reply() for SRV parsing + +* 3 Aug 2009 (Daniel Stenberg) +- Joshua Kwan fixed the init routine to fill in the defaults for stuff that + fails to get inited by other means. This fixes a case of when the c-ares + init fails when internet access is fone. + +- Timo Teras changed the reason code used in the resolve callback done when + ares_cancel() is used, to be ARES_ECANCELLED instead of ARES_ETIMEOUT to + better allow the callback to know what's happening. + +* 14 Jul 2009 (Guenter Knauf) +- renamed generated config.h to ares_config.h to avoid any future clashes + with config.h from other projects. + +* June 20 2009 (Yang Tse) +- Refactor how libraries are checked for connect() function in configure + script and check for connect() as it is done for other functions. + +* June 19 2009 (Yang Tse) +- Make sclose() function-like macro definition used to close a socket, + now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL + config file preprocessor definitions + +* June 18 2009 (Yang Tse) +- Add CloseSocket camel case function check for configure script. + +* June 17 2009 (Yang Tse) +- Check for socket() and closesocket() as it is done for other functions + in configure script. + +* June 11 2009 (Yang Tse) +- Modified buildconf so that when automake runs it copies missing files + instead of symlinking them. + +* June 8 2009 (Yang Tse) +- Removed buildconf.bat from release and daily snapshot archives. This + file is only for CVS tree checkout builds. + +* May 26 2009 (Yang Tse) +- Added --enable-curldebug configure option to enable and disable building + with the low-level curl debug memory tracking 'feature' to allow decoupled + setting from --enable-debug, allowing again to build c-ares independently + out of the CVS tree. + + For the c-ares library option --enable-debug enables debug build features + which are _not_ related with memory tracking. For the c-ares library when + --enable-debug is given it does not enable the memory tracking feature. If + you wish to enable the curl debug memory tracking you must use configure + option --enable-curldebug explicitily to do so. + + Internally, definition of preprocessor symbol DEBUGBUILD restricts code + which is only compiled for debug enabled builds. And symbol CURLDEBUG is + used to differentiate code which is _only_ used for memory tracking. + + Make ares_init(), ares_dup() and ares_init_options() fail returning + ARES_ENOTINITIALIZED if library initialization has not been performed + calling ares_library_init(). + +* May 20 2009 (Yang Tse) +- Added ares_library_init() and ares_library_cleanup() man pages. + +* May 19 2009 (Yang Tse) +- Introduced ares_library_init() and ares_library_cleanup() functions. + + This is an API and ABI break for Win32/64 systems. Non-Win32/64 build targets + using c-ares 1.7.0 can still survive without calling these functions. Read all + the details on ares_library_init(3) and ares_library_cleanup(3) man pages that + are included. + + curl/libcurl 7.19.5 is fully compatible with c-ares 1.7.0 on all systems. + + In order to use c-ares 1.7.0 with curl/libcurl on Win32/64 systems it is + required that curl/libcurl is 7.19.5 or newer. In other words, it is not + possible on Win32/64 to use c-ares 1.7.0 with a curl/libcurl version less + than 7.19.5 + +* May 11 2009 (Daniel Stenberg) +- Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to + only expose functions starting with ares_. + +* May 7 2009 (Yang Tse) +- Fix an m4 overquoting triggering a spurious 'AS_TR_CPP' symbol definition + attempt in generated config.h + +* May 2 2009 (Yang Tse) +- Use a build-time configured ares_socklen_t data type instead of socklen_t. + +* April 21 2009 (Yang Tse) +- Moved potential inclusion of system's malloc.h and memory.h header files to + setup_once.h. Inclusion of each header file is based on the definition of + NEED_MALLOC_H and NEED_MEMORY_H respectively. + +* March 11 2009 (Yang Tse) +- Japheth Cleaver fixed acountry.c replacing u_long with unsigned long. + +* February 20 2009 (Yang Tse) +- Do not halt compilation when using VS2008 to build a Windows 2000 target. + +* February 3 2009 (Phil Blundell) +- If the server returns garbage or nothing at all in response to an AAAA query, + go on and ask for A records anyway. + +* January 31 2009 (Daniel Stenberg) +- ares_gethostbyname() now accepts 'AF_UNSPEC' as a family for resolving + either AF_INET6 or AF_INET. It works by accepting any of the looksups in the + hosts file, and it resolves the AAAA field with a fallback to A. + +* January 14 2009 (Daniel Stenberg) +- ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but instead it + now declares the private struct ares_in6_addr for all systems instead of + relying on one possibly not present in the system. + +* January 13 2009 (Phil Blundell) +- ares__send_query() now varies the retry timeout pseudo-randomly to avoid + packet storms when several queries were started at the same time. + +* January 11 2009 (Daniel Stenberg) +- Phil Blundell added the internal function ares__expand_name_for_response() + that is now used by the ares_parse_*_reply() functions instead of the + ares_expand_name() simply to easier return ARES_EBADRESP for the cases where + the name expansion fails as in responses that really isn't expected. + +Version 1.6.0 (Dec 9, 2008) + +* December 9 2008 (Gisle Vanem) + + Fixes for Win32 targets using the Watt-32 tcp/ip stack. + +* Dec 4 2008 (Daniel Stenberg) + + Gregor Jasny provided the patch that introduces ares_set_socket_callback(), + and I edited it to also get duped by ares_dup(). + +* Dec 3 2008 (Daniel Stenberg) + + API changes: + + I made sure the public ares_config struct looks like before and yet it + supports the ROTATE option thanks to c-ares now storing the "optmask" + internally. Thus we should be ABI compatible with the past release(s) + now. My efforts mentioned below should not break backwards ABI compliance. + + Here's how I suggest we proceed with the API: + + ares_init() will be primary "channel creator" function. + + ares_init_options() will continue to work exactly like now and before. For + starters, it will be the (only) way to set the existing options. + + ares_save_options() will continue to work like today, but will ONLY save + options that you can set today (including ARES_OPT_ROTATE actually) but new + options that we add may not be saved with this. + + Instead we introduce: + + ares_dup() that instead can make a new channel and clone the config used + from an existing channel. It will then clone all config options, including + future new things we add. + + ares_set_*() style functions that set (new) config options. As a start we + simply add these for new functionality, but over time we can also introduce + them for existing "struct ares_options" so that we can eventually deprecate + the two ares_*_options() functions. + + ares_get_*() style functions for extracting info from a channel handle that + should be used instead of ares_save_options(). + +* Nov 26 2008 (Yang Tse) +- Brad Spencer provided changes to allow buildconf to work on OS X. + +- Gerald Combs fixed a bug in ares_parse_ptr_reply() which would cause a + buffer to shrink instead of expand if a reply contained 8 or more records. + +* Nov 25 2008 (Yang Tse) +- In preparation for the upcomming IPv6 nameservers patch, the internal + ares_addr union is now changed into an internal struct which also holds + the address family. + +* Nov 19 2008 (Daniel Stenberg) +- Brad Spencer brought the new function ares_gethostbyname_file() which simply + resolves a host name from the given file, using the regular hosts syntax. + +* Nov 1 2008 (Daniel Stenberg) +- Carlo Contavalli added support for the glibc "rotate" option, as documented + in man resolv.conf: + + causes round robin selection of nameservers from among those listed. This + has the effect of spreading the query load among all listed servers, rather + than having all clients try the first listed server first every time. + + You can enable it with ARES_OPT_ROTATE + +* Oct 21 2008 (Yang Tse) + Charles Hardin added handling of EINPROGRESS for UDP connects. + +* Oct 18 2008 (Daniel Stenberg) + Charles Hardin made adig support a regular numerical dotted IP address for the + -s option as well. + +* Oct 7 2008 (Yang Tse) +- Added --enable-optimize configure option to enable and disable compiler + optimizations to allow decoupled setting from --enable-debug. + +* Oct 2 2008 (Yang Tse) +- Added --enable-warnings configure option to enable and disable strict + compiler warnings to allow decoupled setting from --enable-debug. + +* Sep 17 2008 (Yang Tse) +- Code reorganization to allow internal/private use of "nameser.h" to any + system that lacks arpa/nameser.h or arpa/nameser_compat.h header files. + +* Sep 16 2008 (Yang Tse) +- Code reorganization to allow internal/private use of ares_writev to any + system that lacks the writev function. + +* Sep 15 2008 (Yang Tse) +- Code reorganization to allow internal/private use of ares_strcasecmp to any + system that lacks the strcasecmp function. + +- Improve configure detection of some string functions. + +* Sep 11 2008 (Yang Tse) +- Code reorganization to allow internal/private use of ares_strdup to any + system that lacks the strdup function. + +Version 1.5.3 (Aug 29, 2008) + +* Aug 25 2008 (Yang Tse) +- Improvement by Brad House: + + This patch addresses an issue in which a response could be sent back to the + source port of a client from a different address than the request was made to. + This is one form of a DNS cache poisoning attack. + + The patch simply uses recvfrom() rather than recv() and validates that the + address returned from recvfrom() matches the address of the server we have + connected to. Only necessary on UDP sockets as they are connection-less, TCP + is unaffected. + +- Fix by George Neill: + Fixed compilation of acountry sample application failure on some systems. + +* Aug 4 2008 (Daniel Stenberg) +- Fix by Tofu Linden: + + The symptom: + * Users (usually, but not always) on 2-Wire routers and the Comcast service + and a wired connection to their router would find that the second and + subsequent DNS lookups from fresh processes using c-ares to resolve the same + address would cause the process to never see a reply (it keeps polling for + around 1m15s before giving up). + + The repro: + * On such a machine (and yeah, it took us a lot of QA to find the systems + that reproduce such a specific problem!), do 'ahost www.secondlife.com', + then do it again. The first process's lookup will work, subsequent lookups + will time-out and fail. + + The cause: + * init_id_key() was calling randomize_key() *before* it initialized + key->state, meaning that the randomness generated by randomize_key() is + immediately overwritten with deterministic values. (/dev/urandom was also + being read incorrectly in the c-ares version we were using, but this was + fixed in a later version.) + * This makes the stream of generated query-IDs from any new c-ares process + be an identical and predictable sequence of IDs. + * This makes the 2-Wire's default built-in DNS server detect these queries + as probable-duplicates and (erroneously) not respond at all. + + +* Aug 4 2008 (Yang Tse) +- Autoconf 2.62 has changed the behaviour of the AC_AIX macro which we use. + Prior versions of autoconf defined _ALL_SOURCE if _AIX was defined. 2.62 + version of AC_AIX defines _ALL_SOURCE and other four preprocessor symbols + no matter if the system is AIX or not. To keep the traditional behaviour, + and an uniform one across autoconf versions AC_AIX is replaced with our + own internal macro CARES_CHECK_AIX_ALL_SOURCE. + +* Aug 1 2008 (Yang Tse) +- Configure process now checks if the preprocessor _REENTRANT symbol is already + defined. If it isn't currently defined a set of checks are performed to test + if its definition is required to make visible to the compiler a set of *_r + functions. Finally, if _REENTRANT is already defined or needed it takes care + of making adjustments necessary to ensure that it is defined equally for the + configure process tests and generated config file. + +* Jul 20 2008 (Yang Tse) +- When recvfrom prototype uses a void pointer for arguments 2, 5 or 6 this will + now cause the definition, as appropriate, of RECVFROM_TYPE_ARG2_IS_VOID, + RECVFROM_TYPE_ARG5_IS_VOID or RECVFROM_TYPE_ARG6_IS_VOID. + +* Jul 17 2008 (Yang Tse) +- RECVFROM_TYPE_ARG2, RECVFROM_TYPE_ARG5 and RECVFROM_TYPE_ARG6 are now defined + to the data type pointed by its respective argument and not the pointer type. + +* Jul 16 2008 (Yang Tse) +- Improved configure detection of number of arguments for getservbyport_r. + Detection is now based on compilation checks instead of linker ones. + +- Configure process now checks availability of recvfrom() socket function and + finds out its return type and the types of its arguments. Added definitions + for non-configure systems config files, and introduced macro sreadfrom which + will be used on udp sockets as a recvfrom() wrapper in the future. + +* Jul 15 2008 (Yang Tse) +- Introduce definition of _REENTRANT symbol in setup.h to improve library + usability. Previously the configure process only used the AC_SYS_LARGEFILE + macro for debug builds, now it is also used for non-debug ones enabling the + use of configure options --enable-largefile and --disable-largefile which + might be needed for library compatibility. Remove checking the size of + curl_off_t, it is no longer needed. + +* Jul 3 2008 (Daniel Stenberg) +- Phil Blundell: If you ask ares_gethostbyname() to do an AF_INET6 lookup and + the target host has only A records, it automatically falls back to an + AF_INET lookup and gives you the A results. However, if the target host has + a CNAME record, this behaviour is defeated since the original query does + return some data even though ares_parse_aaa_reply() doesn't consider it + relevant. Here's a small patch to make it behave the same with and without + the CNAME. + +* Jul 2 2008 (Yang Tse) +- Fallback to gettimeofday when monotonic clock is unavailable at run-time. + +* Jun 30 2008 (Daniel Stenberg) + +- As was pointed out to me by Andreas Schuldei, the MAXHOSTNAMELEN define is + not posix or anything and thus c-ares failed to build on hurd (and possibly + elsewhere). The define was also somewhat artificially used in the windows + port. Now, I instead rewrote the use of gethostbyname to enlarge the host + name buffer in case of need and totally avoid the use of the MAXHOSTNAMELEN + define. I thus also removed the defien from the namser.h file where it was + once added for the windows build. + + I also fixed init_by_defaults() function to not leak memory in case if + error. + +* Jun 9 2008 (Yang Tse) + +- Make libcares.pc generated file for pkg-config include information relative + to the libraries needed for the static linking of c-ares. + +* May 30 2008 (Yang Tse) + +- Brad House fixed a missing header file inclusion in adig sample program. + +Version 1.5.2 (May 29, 2008) + +* May 13 2008 (Daniel Stenberg) + +- Introducing millisecond resolution support for the timeout option. See + ares_init_options()'s ARES_OPT_TIMEOUTMS. + +* May 9 2008 (Yang Tse) + +- Use monotonic time source if available, for private function ares__tvnow() + +* May 7 2008 (Daniel Stenberg) + +- Sebastian made c-ares able to return all PTR-records when doing reverse + lookups. It is not common practice to have multiple PTR-Records for a single + IP, but its perfectly legal and some sites have those. + +- Doug Goldstein provided a configure patch: updates autoconf 2.13 usage to + autoconf 2.57 usage (which is the version you have specified as the minimum + version). It's a minor change but it does clean up some warnings with newer + autoconf (specifically 2.62). + +* May 5 2008 (Yang Tse) + +- Improved parsing of resolver configuration files. + +* April 4 2008 (Daniel Stenberg) + +- Eino Tuominen improved the code when a file is used to seed the randomizer. + +- Alexey Simak made adig support NAPTR records + +- Alexey Simak fixed the VC dsp file by adding the missing source file + ares_expand_string.c + +* December 11 2007 (Gisle Vanem) + +- Added another sample application; acountry.c which converts an + IPv4-address(es) and/or host-name(s) to country-name and country-code. + This uses the service of the DNSBL at countries.nerd.dk. + +* December 3 2007 (Daniel Stenberg) + +- Brad Spencer fixed the configure script to assume that there's no + /dev/urandom when built cross-compiled as then the script cannot check for + it. + +- Erik Kline cleaned up ares_gethostbyaddr.c:next_lookup() somewhat + +Version 1.5.1 (Nov 21, 2007) + +* November 21 2007 (Daniel Stenberg) + +- Robin Cornelius pointed out that ares_llist.h was missing in the release + archive for 1.5.0 + +Version 1.5.0 (Nov 21, 2007) + +* October 2 2007 (Daniel Stenberg) + +- ares_strerror() segfaulted if the input error number was out of the currently + supported range. + +- Yang Tse: Avoid a segfault when generating a DNS "Transaction ID" in + internal function init_id_key() under low memory conditions. + +* September 28 2007 (Daniel Stenberg) + +- Bumped version to 1.5.0 for next release and soname bumped to 2 due to ABI + and API changes in the progress callback (and possibly more coming up from + Steinar) + +* September 28 2007 (Steinar H. Gunderson) + +- Don't skip a server if it's the only one. (Bugfix from the Google tree.) + +- Made the query callbacks receive the number of timeouts that happened during + the execution of a query, and updated documentation accordingly. (Patch from + the Google tree.) + +- Support a few more socket options: ARES_OPT_SOCK_SNDBUF and + ARES_OPT_SOCK_RCVBUF + +- Always register for TCP events even if there are no outstanding queries, as + the other side could always close the connection, which is a valid event + which should be responded to. + +* September 22 2007 (Daniel Stenberg) + +- Steinar H. Gunderson fixed: Correctly clear sockets from the fd_set on in + several functions (write_tcp_data, read_tcp_data, read_udp_packets) so that + if it fails and the socket is closed the following code doesn't try to use + the file descriptor. + +- Steinar H. Gunderson modified c-ares to now also do to DNS retries even when + TCP is used since there are several edge cases where it still makes sense. + +- Brad House provided a fix for ares_save_options(): + + Apparently I overlooked something with the ares_save_options() where it + would try to do a malloc(0) when no options of that type needed to be saved. + On most platforms, this was fine because malloc(0) doesn't actually return + NULL, but on AIX it does, so ares_save_options would return ARES_ENOMEM. + +* July 14 2007 (Daniel Stenberg) + +- Vlad Dinulescu fixed two outstanding valgrind reports: + + 1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short + int variable) with qid, which is declared as an int variable. Moreover, + DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID + sets only the first two bytes of qid. I think that qid should be declared as + "unsigned short" in this function. + + 2. The same problem occurs in ares_process.c, process_answer() . query->qid + (an unsigned short integer variable) is compared with id, which is an + integer variable. Moreover, id is initialized from DNS_HEADER_QID which sets + only the first two bytes of id. I think that the id variable should be + declared as "unsigned short" in this function. + + Even after declaring these variables as "unsigned short", the valgrind + errors are still there. Which brings us to the third problem. + + 3. The third problem is that Valgrind assumes that query->qid is not + initialised correctly. And it does that because query->qid is set from + DNS_HEADER_QID(qbuf); Valgrind says that qbuf has unitialised bytes. And + qbuf has uninitialised bytes because of channel->next_id . And next_id is + set by ares_init.c:ares__generate_new_id() . I found that putting short r=0 + in this function (instead of short r) makes all Valgrind warnings go away. + I have studied ares__rc4() too, and this is the offending line: + + buffer_ptr[counter] ^= state[xorIndex]; (ares_query.c:62) + + This is what triggers Valgrind.. buffer_ptr is unitialised in this function, + and by applying ^= on it, it remains unitialised. + +Version 1.4.0 (June 8, 2007) + +* June 4 2007 (Daniel Stenberg) + +- James Bursa reported a major memory problem when resolving multi-IP names + and I found and fixed the problem. It was added by Ashish Sharma's patch + two days ago. + + When I then tried to verify multiple entries in /etc/hosts after my fix, I + got another segfault and decided this code was not ripe for inclusion and I + reverted the patch. + +* June 2 2007 + +- Brad Spencer found and fixed three flaws in the code, found with the new + gcc 4.2.0 warning: -Waddress + +- Brad House fixed VS2005 compiler warnings due to time_t being 64bit. + He also made recent Microsoft compilers use _strdup() instead of strdup(). + +- Brad House's man pages for ares_save_options() and ares_destroy_options() + were added. + +- Ashish Sharma provided a patch for supporting multiple entries in the + /etc/hosts file. Patch edited for coding style and functionality by me + (Daniel). + +* May 30 2007 + +- Shmulik Regev brought cryptographically secure transaction IDs: + + The c-ares library implementation uses a DNS "Transaction ID" field that is + seeded with a pseudo random number (based on gettimeofday) which is + incremented (++) between consecutive calls and is therefore rather + predictable. In general, predictability of DNS Transaction ID is a well + known security problem (e.g. + http://bak.spc.org/dms/archive/dns_id_attack.txt) and makes a c-ares based + implementation vulnerable to DNS poisoning. Credit goes to Amit Klein + (Trusteer) for identifying this problem. + + The patch I wrote changes the implementation to use a more secure way of + generating unique IDs. It starts by obtaining a key with reasonable entropy + which is used with an RC4 stream to generate the cryptographically secure + transaction IDs. + + Note that the key generation code (in ares_init:randomize_key) has two + versions, the Windows specific one uses a cryptographically safe function + provided (but undocumented :) by the operating system (described at + http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx). The + default implementation is a bit naive and uses the standard 'rand' + function. Surely a better way to generate random keys exists for other + platforms. + + The patch can be tested by using the adig utility and using the '-s' option. + +- Brad House added ares_save_options() and ares_destroy_options() that can be + used to keep options for later re-usal when ares_init_options() is used. + + Problem: Calling ares_init() for each lookup can be unnecessarily resource + intensive. On windows, it must LoadLibrary() or search the registry + on each call to ares_init(). On unix, it must read and parse + multiple files to obtain the necessary configuration information. In + a single-threaded environment, it would make sense to only + ares_init() once, but in a heavily multi-threaded environment, it is + undesirable to ares_init() and ares_destroy() for each thread created + and track that. + + Solution: Create ares_save_options() and ares_destroy_options() functions to + retrieve and free options obtained from an initialized channel. The + options populated can be used to pass back into ares_init_options(), + it should populate all needed fields and not retrieve any information + from the system. Probably wise to destroy the cache every minute or + so to prevent the data from becoming stale. + +- Daniel S added ares_process_fd() to allow applications to ask for processing + on specific sockets and thus avoiding select() and associated + functions/macros. This function will be used by upcoming libcurl releases + for this very reason. It also made me export the ares_socket_t type in the + public ares.h header file, since ares_process_fd() uses that type for two of + the arguments. + +* May 25 2007 + +- Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows + that could cause it to return a bad return code. + +* April 16 2007 + +- Yang Tse: Provide ares_getopt() command-line parser function as a source + code helper function, not belonging to the actual c-ares library. + +* February 19 2007 + +- Vlad Dinulescu added ares_parse_ns_reply(). + +* February 13 2007 + +- Yang Tse: Fix failure to get the search sequence of /etc/hosts and + DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when + /etc/resolv.conf did not exist or was unable to read it. + +* November 22 2006 + +- Install ares_dns.h too + +- Michael Wallner fixed this problem: When I set domains in the options + struct, and there are domain/search entries in /etc/resolv.conf, the domains + of the options struct will be overridden. + +* November 6 2006 + +- Yang Tse removed a couple of potential zero size memory allocations. + +- Andreas Rieke fixed the line endings in the areslib.dsp file that I (Daniel) + broke in the 1.3.2 release. We should switch to a system where that file is + auto-generated. We could rip some code for that from curl... + +Version 1.3.2 (November 3, 2006) + +* October 12 2006 + +- Prevent ares_getsock() to overflow if more than 16 sockets are used. + +* September 11 2006 + +- Guilherme Balena Versiani: I noted a strange BUG in Win32 port + (ares_init.c/get_iphlpapi_dns_info() function): when I disable the network + by hand or disconnect the network cable in Windows 2000 or Windows XP, my + application gets 127.0.0.1 as the only name server. The problem comes from + 'GetNetworkParams' function, that returns the empty string "" as the only + name server in that case. Moreover, the Windows implementation of + inet_addr() returns INADDR_LOOPBACK instead of INADDR_NONE. + +* August 29 2006 + +- Brad Spencer did + + o made ares_version.h use extern "C" for c++ compilers + o fixed compiler warnings in ares_getnameinfo.c + o fixed a buffer position init for TCP reads + +* August 3 2006 + +- Ravi Pratap fixed ares_getsock() to actually return the proper bitmap and + not always zero! + +Version 1.3.1 (June 24, 2006) + +* July 23, 2006 + +- Gisle Vanem added getopt() to the ahost program. Currently accepts + only [-t {a|aaaa}] to specify address family in ares_gethostbyname(). + +* June 19, 2006 + +- (wahern) Removed "big endian" DNS section and RR data integer parser + macros from ares_dns.h, which break c-ares on my Sparc64. Bit-wise + operations in C operate on logical values. And in any event the octets are + already in big-endian (aka network) byte order so they're being reversed + (thus the source of the breakage). + +* June 18, 2006 + +- William Ahern handles EAGAIN/EWOULDBLOCK errors in most of the I/O calls + from area_process.c. + + TODO: Handle one last EAGAIN for a UDP socket send(2) in + ares__send_query(). + +* May 10, 2006 + +- Bram Matthys brought my attention to a libtool peculiarity where detecting + things such as C++ compiler actually is a bad thing and since we don't need + that detection I added a work-around, much inspired by a previous patch by + Paolo Bonzini. This also shortens the configure script quite a lot. + +* May 3, 2006 + +- Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes + c-ares call a callback on socket state changes. A better way than the + ares_getsock() to get full control over the socket state. + +* January 9, 2006 + +- Alexander Lazic improved the getservbyport_r() configure check. + +* January 6, 2006 + +- Alexander Lazic pointed out that the buildconf should use the ACLOCAL_FLAGS + variable for easier controlling what it does and how it runs. + +* January 5, 2006 + +- James Bursa fixed c-ares to find the hosts file on RISC OS, and made it + build with newer gcc versions that no longer defines "riscos". + +* December 22 + +- Daniel Stenberg added ares_getsock() that extracts the set of sockets to + wait for action on. Similar to ares_fds() but not restricted to using + select() for the waiting. + +* November 25 + +- Yang Tse fixed some send() / recv() compiler warnings + +* September 18 + +- Added constants that will be used by ares_getaddrinfo + +- Made ares_getnameinfo use the reentrant getservbyport (getservbyport_r) if it + is available to ensure it works properly in a threaded environment. + +* September 10 + +- configure fix for detecting a member in the sockaddr_in6 struct which failed + on ipv6-enabled HP-UX 11.00 + +Version 1.3.0 (August 29, 2005) + +* August 21 + +- Alfredo Tupone provided a fix for the Windows code in get_iphlpapi_dns_info() + when getting the DNS server etc. + +* June 19 + +- Added some checks for the addrinfo structure. + +* June 2 + +- William Ahern: + + Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a + read event can come back from poll() on a valid SOCK_DGRAM socket but + recv(2) will still block. This patch doesn't ignore EAGAIN in + read_udp_packets(), though maybe it should. (This patch was edited by Daniel + Stenberg and a new configure test was added (imported from curl's configure) + to properly detect what non-blocking socket approach to use.) + + I'm not quite sure how this was happening, but I've been seeing PTR queries + which seem to return empty responses. At least, they were empty when calling + ares_expand_name() on the record. Here's a patch which guarantees to + NUL-terminate the expanded name. The old behavior failed to NUL-terminate if + len was 0, and this was causing strlen() to run past the end of the buffer + after calling ares_expand_name() and getting ARES_SUCCESS as the return + value. If q is not greater than *s then it's equal and *s is always + allocated with at least one byte. + +* May 16 + +- Added ares_getnameinfo which mimics the getnameinfo API (another feature + that could use testing). + +* May 14 + +- Added an inet_ntop function from BIND for systems that do not have it. + +* April 9 + +- Made sortlist support IPv6 (this can probably use some testing). + +- Made sortlist support CIDR matching for IPv4. + +* April 8 + +- Added preliminary IPv6 support to ares_gethostbyname. Currently, sortlist + does not work with IPv6. Also provided an implementation of bitncmp from + BIND for systems that do not supply this function. This will be used to add + IPv6 support to sortlist. + +- Made ares_gethostbyaddr support IPv6 by specifying AF_INET6 as the family. + The function can lookup IPv6 addresses both from files (/etc/hosts) and + DNS lookups. + +* April 7 + +- Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac + OS X. + +* April 5 + +- Dominick Meglio: Provided implementations of inet_net_pton and inet_pton + from BIND for systems that do not include these functions. + +* March 11, 2005 + +- Dominick Meglio added ares_parse_aaaa_reply.c and did various + adjustments. The first little steps towards IPv6 support! + +* November 7 + +- Fixed the VC project and makefile to use ares_cancel and ares_version + +* October 24 + +- The released ares_version.h from 1.2.1 says 1.2.0 due to a maketgz flaw. + This is now fixed. + +Version 1.2.1 (October 20, 2004) + +* September 29 + +- Henrik Stoerner fix: got a report that Tru64 Unix (the unix from Digital + when they made Alpha's) uses /etc/svc.conf for the purpose fixed below for + other OSes. He made c-ares check for and understand it if present. + +- Now c-ares will use local host name lookup _before_ DNS resolving by default + if nothing else is told. + +* September 26 + +- Henrik Stoerner: found out that c-ares does not look at the /etc/host.conf + file to determine the sequence in which to search /etc/hosts and DNS. So on + systems where this order is defined by /etc/host.conf instead of a "lookup" + entry in /etc/resolv.conf, c-ares will always default to looking in DNS + first, and /etc/hosts second. + + c-ares now looks at + + 1) resolv.conf (for the "lookup" line); + 2) nsswitch.fon (for the "hosts:" line); + 3) host.conf (for the "order" line). + + First match wins. + +- Dominick Meglio patched: C-ares on Windows assumed that the HOSTS file is + located in a static location. It assumed + C:\Windows\System32\Drivers\Etc. This is a poor assumption to make. In fact, + the location of the HOSTS file can be changed via a registry setting. + + There is a key called DatabasePath which specifies the path to the HOSTS + file: + http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx + + The patch will make c-ares correctly consult the registry for the location + of this file. + +* August 29 + +- Gisle Vanem fixed the MSVC build files. + +* August 20 + +- Gisle Vanem made c-ares build and work with his Watt-32 TCP/IP stack. + +* August 13 + +- Harshal Pradhan made a minor syntax change in ares_init.c to make it build + fine with MSVC 7.1 + +* July 24 + +- Made the lib get built static only if --enable-debug is used. + +- Gisle Vanem fixed: + + Basically in loops like handle_errors(), 'query->next' was assigned a local + variable and then query was referenced after the memory was freed by + next_server(). I've changed that so next_server() and end_query() returns + the next query. So callers should use this ret-value. + + The next problem was that 'server->tcp_buffer_pos' had a random value at + entry to 1st recv() (luckily causing Winsock to return ENOBUFS). + + I've also added a ares_writev() for Windows to streamline the code a bit + more. + +* July 20 +- Fixed a few variable return types for some system calls. Made configure + check for ssize_t to make it possible to use that when receiving the send() + error code. This is necessary to prevent compiler warnings on some systems. + +- Made configure create config.h, and all source files now include setup.h that + might include the proper config.h (or a handicrafted alternative). + +- Switched to 'ares_socket_t' type for sockets in ares, since Windows don't + use 'int' for that. + +- automake-ified and libool-ified c-ares. Now it builds libcares as a shared + lib on most platforms if wanted. (This bloated the size of the release + archive with another 200K!) + +- Makefile.am now uses Makefile.inc for the c sources, h headers and man + pages, to make it easier for other makefiles to use the exact same set of + files. + +- Adjusted 'maketgz' to use the new automake magic when building distribution + archives. + +- Anyone desires HTML and/or PDF versions of the man pages in the release + archives? + +* July 3 +- Gnter Knauf made c-ares build and run on Novell Netware. + +* July 1 +- Gisle Vanem provided Makefile.dj to build with djgpp, added a few more djgpp + fixes and made ares not use 'errno' to provide further info on Windows. + +* June 30 +- Gisle Vanem made it build with djgpp and run fine with the Watt-32 stack. + +* June 10 +- Gisle Vanem's init patch for Windows: + + The init_by_resolv_conf() function fetches the DNS-server(s) + from a series of registry branches. + + This can be wrong in the case where DHCP has assigned nameservers, but the + user has overridden these servers with other prefered settings. Then it's + wrong to use the DHCPNAMESERVER setting in registry. + + In the case of no global DHCP-assigned or fixed servers, but DNS server(s) + per adapter, one has to query the adapter branches. But how can c-ares know + which adapter is valid for use? AFAICS it can't. There could be one adapter + that is down (e.g. a VPN adapter). + + So it's better to leave this to the IP Helper API (iphlapi) available in + Win-98/2000 and later. My patch falls-back to the old way if not available. + +* June 8 +- James Bursa fixed an init issue for RISC OS. + +* May 11 +- Nico Stappenbelt reported that when processing domain and search lines in + the resolv.conf file, the first entry encountered is processed and used as + the search list. According to the manual pages for both Linux, Solaris and + Tru64, the last entry of either a domain or a search field is used. + + This is now adjusted in the code + +Version 1.2.0 (April 13, 2004) + +* April 2, 2004 +- Updated various man pages to look nicer when converted to HTML on the web + site. + +* April 1, 2004 +- Dirk Manske provided a new function that is now named ares_cancel(). It is + used to cancel/cleanup a resolve/request made using ares functions on the + given ares channel. It does not destroy/kill the ares channel itself. + +- Dominick Meglio cleaned up the formatting in several man pages. + +* March 30, 2004 +- Dominick Meglio's new ares_expand_string. A helper function when decoding + incoming DNS packages. + +- Daniel Stenberg modified the Makefile.in to use a for loop for the man page + installation to improve overview and make it easier to add man pages. + +Version 1.1.0 (March 11, 2004) + +* March 9, 2004 +- Gisle Vanem improved build on Windows. + +* February 25, 2004 +- Dan Fandrich found a flaw in the Feb 22 fix. + +- Added better configure --enable-debug logic (taken from the curl configure + script). Added acinclude.m4 to the tarball. + +* February 23, 2004 +- Removed ares_free_errmem(), the function, the file and the man page. It was + not used and it did nothing. + +- Fixed a lot of code that wasn't "64bit clean" and thus caused a lot of + compiler warnings on picky compilers. + +* February 22, 2004 +- Dominick Meglio made ares init support multiple name servers in the + NameServer key on Windows. + +* February 16, 2004 +- Modified ares_private.h to include libcurl's memory debug header if + CURLDEBUG is set. This makes all the ares-functions supervised properly by + the curl test suite. This also forced me to add inclusion of the + ares_private.h header in a few more files that are using some kind of + memory-related resources. + +- Made the makefile only build ahost and adig if 'make demos' is used. + +* February 10, 2004 +- Dirk Manske made ares_version.h installed with 'make install' + +* February 4, 2004 +- ares_free_errmem() is subject for removal, it is simply present for future + purposes, and since we removed the extra parameter in strerror() it won't + be used by c-ares! +- configure --enable-debug now enables picky compiler options if gcc is used +- fixed several compiler warnings --enable-debug showed and Joerg Mueller-Tolk + reported + +Version 1.0.0 (February 3, 2004) + +* February 3, 2004 +- now we produce the libcares.a library instead of the previous libares.a + since we are no longer compatible + +* February 2, 2004 + +- ares_strerror() has one argument less. This is the first official + modification of the existing provided ares API. + +* January 29, 2004 + +- Dirk Manske fixed how the socket is set non-blocking. + +* January 4, 2004 + +- Dominick Meglio made the private gettimeofday() become ares_gettimeofday() + instead in order to not pollute the name space and risk colliding with + other libraries' versions of this function. + +* October 24, 2003. Daniel Stenberg + + Added ares_version(). + +Version 1.0-pre1 (8 October 2003) + +- James Bursa made it run on RISC OS + +- Dominick Meglio made it run fine on NT4 + +- Duncan Wilcox made it work fine on Mac OS X + +- Daniel Stenberg adjusted the windows port + +- liren at vivisimo.com made the initial windows port + +* Imported the sources from ares 1.1.1 diff -Nru python-gevent-0.13.7/c-ares/config.guess python-gevent-1.0/c-ares/config.guess --- python-gevent-0.13.7/c-ares/config.guess 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/config.guess 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1530 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-02-10' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru python-gevent-0.13.7/c-ares/config.sub python-gevent-1.0/c-ares/config.sub --- python-gevent-0.13.7/c-ares/config.sub 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/config.sub 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1773 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-02-10' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i386-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru python-gevent-0.13.7/c-ares/configure python-gevent-1.0/c-ares/configure --- python-gevent-0.13.7/c-ares/configure 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/configure 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,28596 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for c-ares -. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + + + if test -z "$cares_cv_PATH_SEPARATOR"; then + if test -z "$PATH"; then + as_fn_error $? "PATH not set. Cannot continue without PATH being set." + fi + tst_dirs_col=0 + tst_save_IFS=$IFS; IFS=':' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1` + done + IFS=$tst_save_IFS + tst_dirs_sem=0 + tst_save_IFS=$IFS; IFS=';' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1` + done + IFS=$tst_save_IFS + if test $tst_dirs_sem -eq $tst_dirs_col; then + if test -z "$PATH_SEPARATOR"; then + as_fn_error $? "PATH_SEPARATOR not set. Cannot continue without it." + fi + else + if test $tst_dirs_sem -gt $tst_dirs_col; then + tst_auto_separator=';' + else + tst_auto_separator=':' + fi + if test -z "$PATH_SEPARATOR"; then + PATH_SEPARATOR="$tst_auto_separator" + fi + fi + cares_cv_PATH_SEPARATOR="$PATH_SEPARATOR" + fi + + + + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and c-ares mailing +$0: list: http://cool.haxx.se/mailman/listinfo/c-ares about +$0: your system, including any error possibly output before +$0: this message. Then install a modern shell, or manually +$0: run the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='c-ares' +PACKAGE_TARNAME='c-ares' +PACKAGE_VERSION='-' +PACKAGE_STRING='c-ares -' +PACKAGE_BUGREPORT='c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares' +PACKAGE_URL='' + +ac_unique_file="ares_ipv6.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +CARES_CFLAG_EXTRAS +CARES_PRIVATE_LIBS +CFLAG_CARES_SYMBOL_HIDING +DOING_CARES_SYMBOL_HIDING_FALSE +DOING_CARES_SYMBOL_HIDING_TRUE +RANDOM_FILE +DOING_NATIVE_WINDOWS_FALSE +DOING_NATIVE_WINDOWS_TRUE +CURLDEBUG_FALSE +CURLDEBUG_TRUE +NO_UNDEFINED_FALSE +NO_UNDEFINED_TRUE +CPPFLAG_CARES_STATICLIB +USE_CPPFLAG_CARES_STATICLIB_FALSE +USE_CPPFLAG_CARES_STATICLIB_TRUE +USE_CPPFLAG_CARES_BUILDING_LIBRARY_FALSE +USE_CPPFLAG_CARES_BUILDING_LIBRARY_TRUE +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +LIBTOOL +OBJDUMP +DLLTOOL +AS +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +AR +EGREP +GREP +SED +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +SHELL +PATH +PATH_SEPARATOR' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_debug +enable_optimize +enable_warnings +enable_werror +enable_curldebug +enable_symbol_hiding +enable_dependency_tracking +enable_largefile +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_libgcc +with_random +enable_nonblocking +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures c-ares - to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/c-ares] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of c-ares -:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-debug Enable debug build options + --disable-debug Disable debug build options + --enable-optimize(=OPT) Enable compiler optimizations (default=-O2) + --disable-optimize Disable compiler optimizations + --enable-warnings Enable strict compiler warnings + --disable-warnings Disable strict compiler warnings + --enable-werror Enable compiler warnings as errors + --disable-werror Disable compiler warnings as errors + --enable-curldebug Enable curl debug memory tracking + --disable-curldebug Disable curl debug memory tracking + --enable-symbol-hiding Enable hiding of library internal symbols + --disable-symbol-hiding Disable hiding of library internal symbols + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-largefile omit support for large files + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-libgcc use libgcc when linking + --enable-nonblocking Enable non-blocking communications + --disable-nonblocking Disable non-blocking communications + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-random=FILE read randomness from FILE (default=/dev/urandom) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +c-ares configure - +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define $2 innocuous_$2 +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $2 +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------------------------------------------------- ## +## Report this to c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares ## +## ------------------------------------------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int main (void) +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by c-ares $as_me -, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + +# using cares-override.m4 + + + +ac_config_headers="$ac_config_headers ares_config.h ares_build.h" + +: + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debug build options" >&5 +$as_echo_n "checking whether to enable debug build options... " >&6; } + OPT_DEBUG_BUILD="default" + # Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; OPT_DEBUG_BUILD=$enableval +fi + + case "$OPT_DEBUG_BUILD" in + no) + want_debug="no" + ;; + default) + want_debug="no" + ;; + *) + want_debug="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_debug" >&5 +$as_echo "$want_debug" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler optimizer" >&5 +$as_echo_n "checking whether to enable compiler optimizer... " >&6; } + OPT_COMPILER_OPTIMIZE="default" + # Check whether --enable-optimize was given. +if test "${enable_optimize+set}" = set; then : + enableval=$enable_optimize; OPT_COMPILER_OPTIMIZE=$enableval +fi + + case "$OPT_COMPILER_OPTIMIZE" in + no) + want_optimize="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + default) + if test "$want_debug" = "yes"; then + want_optimize="assume_no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not specified (assuming no)" >&5 +$as_echo "not specified (assuming no)" >&6; } + else + want_optimize="assume_yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not specified (assuming yes)" >&5 +$as_echo "not specified (assuming yes)" >&6; } + fi + ;; + *) + want_optimize="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable strict compiler warnings" >&5 +$as_echo_n "checking whether to enable strict compiler warnings... " >&6; } + OPT_COMPILER_WARNINGS="default" + # Check whether --enable-warnings was given. +if test "${enable_warnings+set}" = set; then : + enableval=$enable_warnings; OPT_COMPILER_WARNINGS=$enableval +fi + + case "$OPT_COMPILER_WARNINGS" in + no) + want_warnings="no" + ;; + default) + want_warnings="$want_debug" + ;; + *) + want_warnings="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_warnings" >&5 +$as_echo "$want_warnings" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler warnings as errors" >&5 +$as_echo_n "checking whether to enable compiler warnings as errors... " >&6; } + OPT_COMPILER_WERROR="default" + # Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; OPT_COMPILER_WERROR=$enableval +fi + + case "$OPT_COMPILER_WERROR" in + no) + want_werror="no" + ;; + default) + want_werror="no" + ;; + *) + want_werror="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_werror" >&5 +$as_echo "$want_werror" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable curl debug memory tracking" >&5 +$as_echo_n "checking whether to enable curl debug memory tracking... " >&6; } + OPT_CURLDEBUG_BUILD="default" + # Check whether --enable-curldebug was given. +if test "${enable_curldebug+set}" = set; then : + enableval=$enable_curldebug; OPT_CURLDEBUG_BUILD=$enableval +fi + + case "$OPT_CURLDEBUG_BUILD" in + no) + want_curldebug="no" + ;; + default) + want_curldebug="no" + ;; + *) + want_curldebug="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_curldebug" >&5 +$as_echo "$want_curldebug" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable hiding of library internal symbols" >&5 +$as_echo_n "checking whether to enable hiding of library internal symbols... " >&6; } + OPT_SYMBOL_HIDING="default" + # Check whether --enable-symbol-hiding was given. +if test "${enable_symbol_hiding+set}" = set; then : + enableval=$enable_symbol_hiding; OPT_SYMBOL_HIDING=$enableval +fi + + case "$OPT_SYMBOL_HIDING" in + no) + want_symbol_hiding="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + default) + want_symbol_hiding="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) + want_symbol_hiding="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac + + + + + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SED" && ac_cv_path_SED="not_found" + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test -z "$SED" || test "$SED" = "not_found"; then + as_fn_error $? "sed not found in PATH. Cannot continue without sed." "$LINENO" 5 +fi + + +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="not_found" + ;; +esac +fi +GREP=$ac_cv_path_GREP +if test -n "$GREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 +$as_echo "$GREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test -z "$GREP" || test "$GREP" = "not_found"; then + as_fn_error $? "grep not found in PATH. Cannot continue without grep." "$LINENO" 5 +fi + + +if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } + EGREP="$GREP -E" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 +$as_echo "$EGREP" >&6; } +else + # Extract the first word of "egrep", so it can be a program name with args. +set dummy egrep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $EGREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_EGREP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_EGREP" && ac_cv_path_EGREP="not_found" + ;; +esac +fi +EGREP=$ac_cv_path_EGREP +if test -n "$EGREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 +$as_echo "$EGREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$EGREP" || test "$EGREP" = "not_found"; then + as_fn_error $? "egrep not found in PATH. Cannot continue without egrep." "$LINENO" 5 +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +AR=$ac_cv_path_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_AR"; then + ac_pt_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_AR=$ac_cv_path_ac_pt_AR +if test -n "$ac_pt_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5 +$as_echo "$ac_pt_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_AR" = x; then + AR="not_found" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_pt_AR + fi +else + AR="$ac_cv_path_AR" +fi + +if test -z "$AR" || test "$AR" = "not_found"; then + as_fn_error $? "ar not found in PATH. Cannot continue without ar." "$LINENO" 5 +fi + + +if test -f ${srcdir}/ares_build.h; then + rm -f ${srcdir}/ares_build.h +fi + +am__api_version='1.11' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='c-ares' + VERSION='-' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +cat >>confdefs.h <<_ACEOF +#define OS "${host}" +_ACEOF + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + ac_save_CFLAGS="$CFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int main (void) +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + CFLAGS="$ac_save_CFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS" + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OS is AIX (to define _ALL_SOURCE)" >&5 +$as_echo_n "checking if OS is AIX (to define _ALL_SOURCE)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _AIX + yes_this_is_aix +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes_this_is_aix" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is already defined" >&5 +$as_echo_n "checking if _THREAD_SAFE is already defined... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#ifdef _THREAD_SAFE + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tmp_thread_safe_initially_defined="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tmp_thread_safe_initially_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + if test "$tmp_thread_safe_initially_defined" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is actually needed" >&5 +$as_echo_n "checking if _THREAD_SAFE is actually needed... " >&6; } + + case $host_os in + aix[123].* | aix4.[012].*) + tmp_need_thread_safe="no" + ;; + aix*) + tmp_need_thread_safe="yes" + ;; + *) + tmp_need_thread_safe="no" + ;; + esac + + if test "$tmp_need_thread_safe" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is onwards defined" >&5 +$as_echo_n "checking if _THREAD_SAFE is onwards defined... " >&6; } + if test "$tmp_thread_safe_initially_defined" = "yes" || + test "$tmp_need_thread_safe" = "yes"; then + + +$as_echo "#define NEED_THREAD_SAFE 1" >>confdefs.h + +cat >>confdefs.h <<_EOF +#ifndef _THREAD_SAFE +# define _THREAD_SAFE +#endif +_EOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + # + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is already defined" >&5 +$as_echo_n "checking if _REENTRANT is already defined... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#ifdef _REENTRANT + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tmp_reentrant_initially_defined="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tmp_reentrant_initially_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + if test "$tmp_reentrant_initially_defined" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is actually needed" >&5 +$as_echo_n "checking if _REENTRANT is actually needed... " >&6; } + + case $host_os in + solaris*) + tmp_need_reentrant="yes" + ;; + *) + tmp_need_reentrant="no" + ;; + esac + + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + if(0 != errno) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="yes" + +else + + tmp_errno="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_errno" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="errno_macro_defined" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _REENTRANT +#include + +int main (void) +{ + +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="errno_macro_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gmtime_r innocuous_gmtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gmtime_r +#ifdef __cplusplus +extern "C" +#endif +char gmtime_r (); +#if defined __stub_gmtime_r || defined __stub___gmtime_r +choke me +#endif + +int main (void) +{ +return gmtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gmtime_r="yes" + +else + + tmp_gmtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gmtime_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gmtime_r" >/dev/null 2>&1; then : + + tmp_gmtime_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gmtime_r" >/dev/null 2>&1; then : + + tmp_gmtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define localtime_r innocuous_localtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef localtime_r +#ifdef __cplusplus +extern "C" +#endif +char localtime_r (); +#if defined __stub_localtime_r || defined __stub___localtime_r +choke me +#endif + +int main (void) +{ +return localtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_localtime_r="yes" + +else + + tmp_localtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_localtime_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "localtime_r" >/dev/null 2>&1; then : + + tmp_localtime_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "localtime_r" >/dev/null 2>&1; then : + + tmp_localtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strerror_r innocuous_strerror_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strerror_r +#ifdef __cplusplus +extern "C" +#endif +char strerror_r (); +#if defined __stub_strerror_r || defined __stub___strerror_r +choke me +#endif + +int main (void) +{ +return strerror_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_strerror_r="yes" + +else + + tmp_strerror_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_strerror_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror_r" >/dev/null 2>&1; then : + + tmp_strerror_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror_r" >/dev/null 2>&1; then : + + tmp_strerror_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strtok_r innocuous_strtok_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strtok_r +#ifdef __cplusplus +extern "C" +#endif +char strtok_r (); +#if defined __stub_strtok_r || defined __stub___strtok_r +choke me +#endif + +int main (void) +{ +return strtok_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_strtok_r="yes" + +else + + tmp_strtok_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_strtok_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtok_r" >/dev/null 2>&1; then : + + tmp_strtok_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtok_r" >/dev/null 2>&1; then : + + tmp_strtok_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_ntoa_r innocuous_inet_ntoa_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_ntoa_r +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa_r (); +#if defined __stub_inet_ntoa_r || defined __stub___inet_ntoa_r +choke me +#endif + +int main (void) +{ +return inet_ntoa_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_inet_ntoa_r="yes" + +else + + tmp_inet_ntoa_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_inet_ntoa_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : + + tmp_inet_ntoa_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : + + tmp_inet_ntoa_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyaddr_r innocuous_gethostbyaddr_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyaddr_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyaddr_r (); +#if defined __stub_gethostbyaddr_r || defined __stub___gethostbyaddr_r +choke me +#endif + +int main (void) +{ +return gethostbyaddr_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gethostbyaddr_r="yes" + +else + + tmp_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gethostbyaddr_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : + + tmp_gethostbyaddr_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : + + tmp_gethostbyaddr_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyname_r innocuous_gethostbyname_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyname_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname_r (); +#if defined __stub_gethostbyname_r || defined __stub___gethostbyname_r +choke me +#endif + +int main (void) +{ +return gethostbyname_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gethostbyname_r="yes" + +else + + tmp_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gethostbyname_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname_r" >/dev/null 2>&1; then : + + tmp_gethostbyname_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname_r" >/dev/null 2>&1; then : + + tmp_gethostbyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getprotobyname_r innocuous_getprotobyname_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getprotobyname_r +#ifdef __cplusplus +extern "C" +#endif +char getprotobyname_r (); +#if defined __stub_getprotobyname_r || defined __stub___getprotobyname_r +choke me +#endif + +int main (void) +{ +return getprotobyname_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_getprotobyname_r="yes" + +else + + tmp_getprotobyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_getprotobyname_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getprotobyname_r" >/dev/null 2>&1; then : + + tmp_getprotobyname_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getprotobyname_r" >/dev/null 2>&1; then : + + tmp_getprotobyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getservbyport_r innocuous_getservbyport_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getservbyport_r +#ifdef __cplusplus +extern "C" +#endif +char getservbyport_r (); +#if defined __stub_getservbyport_r || defined __stub___getservbyport_r +choke me +#endif + +int main (void) +{ +return getservbyport_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_getservbyport_r="yes" + +else + + tmp_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_getservbyport_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + tmp_getservbyport_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + tmp_getservbyport_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + + fi + if test "$tmp_need_reentrant" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is onwards defined" >&5 +$as_echo_n "checking if _REENTRANT is onwards defined... " >&6; } + if test "$tmp_reentrant_initially_defined" = "yes" || + test "$tmp_need_reentrant" = "yes"; then + + +$as_echo "#define NEED_REENTRANT 1" >>confdefs.h + +cat >>confdefs.h <<_EOF +#ifndef _REENTRANT +# define _REENTRANT +#endif +_EOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + # + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + + +case $host_os in + solaris*) + +$as_echo "#define ETC_INET 1" >>confdefs.h + + ;; +esac + +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="${ac_tool_prefix}as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AS=$ac_ct_AS + fi +else + AS="$ac_cv_prog_AS" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + + ;; +esac + +test -z "$AS" && AS=as + + + + + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)" >&5 +$as_echo_n "checking if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)... " >&6; } +case $host in + x86_64*linux*|amd64*freebsd*|ia64*freebsd*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_pic=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is icc (to build with PIC)" >&5 +$as_echo_n "checking if compiler is icc (to build with PIC)... " >&6; } +case $CC in + icc | */icc) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_pic=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv -f conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv -f $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv -f $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need CARES_BUILDING_LIBRARY" >&5 +$as_echo_n "checking if we need CARES_BUILDING_LIBRARY... " >&6; } +use_cppflag_cares_building_library="no" +use_cppflag_cares_staticlib="no" +CPPFLAG_CARES_STATICLIB="" +case $host in + *-*-mingw*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + use_cppflag_cares_building_library="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need CARES_STATICLIB" >&5 +$as_echo_n "checking if we need CARES_STATICLIB... " >&6; } + if test "X$enable_shared" = "Xno" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + use_cppflag_cares_staticlib="yes" + CPPFLAG_CARES_STATICLIB="-DCARES_STATICLIB" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + if test x$use_cppflag_cares_building_library = xyes; then + USE_CPPFLAG_CARES_BUILDING_LIBRARY_TRUE= + USE_CPPFLAG_CARES_BUILDING_LIBRARY_FALSE='#' +else + USE_CPPFLAG_CARES_BUILDING_LIBRARY_TRUE='#' + USE_CPPFLAG_CARES_BUILDING_LIBRARY_FALSE= +fi + + if test x$use_cppflag_cares_staticlib = xyes; then + USE_CPPFLAG_CARES_STATICLIB_TRUE= + USE_CPPFLAG_CARES_STATICLIB_FALSE='#' +else + USE_CPPFLAG_CARES_STATICLIB_TRUE='#' + USE_CPPFLAG_CARES_STATICLIB_FALSE= +fi + + + + + + # + compiler_id="unknown" + compiler_num="0" + # + flags_dbg_all="unknown" + flags_dbg_yes="unknown" + flags_dbg_off="unknown" + flags_opt_all="unknown" + flags_opt_yes="unknown" + flags_opt_off="unknown" + # + flags_prefer_cppflags="no" + # + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is DEC/Compaq/HP C" >&5 +$as_echo_n "checking if compiler is DEC/Compaq/HP C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __DECC +CURL_DEF_TOKEN __DECC +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___DECC=no + + else + curl_cv_have_def___DECC=yes + curl_cv_def___DECC=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __DECC_VER +CURL_DEF_TOKEN __DECC_VER +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC_VER"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___DECC_VER=no + + else + curl_cv_have_def___DECC_VER=yes + curl_cv_def___DECC_VER=$tmp_exp + + fi + + if test "$curl_cv_have_def___DECC" = "yes" && + test "$curl_cv_have_def___DECC_VER" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="DEC_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" + flags_opt_yes="-O1" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is HP-UX C" >&5 +$as_echo_n "checking if compiler is HP-UX C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __HP_cc +CURL_DEF_TOKEN __HP_cc +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__HP_cc"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___HP_cc=no + + else + curl_cv_have_def___HP_cc=yes + curl_cv_def___HP_cc=$tmp_exp + + fi + + if test "$curl_cv_have_def___HP_cc" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="HP_UX_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" + flags_opt_yes="+O2" + flags_opt_off="+O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is IBM C" >&5 +$as_echo_n "checking if compiler is IBM C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __IBMC__ +CURL_DEF_TOKEN __IBMC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__IBMC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___IBMC__=no + + else + curl_cv_have_def___IBMC__=yes + curl_cv_def___IBMC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___IBMC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="IBM_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" + flags_opt_all="$flags_opt_all -qnooptimize" + flags_opt_all="$flags_opt_all -qoptimize=0" + flags_opt_all="$flags_opt_all -qoptimize=1" + flags_opt_all="$flags_opt_all -qoptimize=2" + flags_opt_all="$flags_opt_all -qoptimize=3" + flags_opt_all="$flags_opt_all -qoptimize=4" + flags_opt_all="$flags_opt_all -qoptimize=5" + flags_opt_yes="-O2" + flags_opt_off="-qnooptimize" + flags_prefer_cppflags="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Intel C" >&5 +$as_echo_n "checking if compiler is Intel C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __INTEL_COMPILER +CURL_DEF_TOKEN __INTEL_COMPILER +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__INTEL_COMPILER"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___INTEL_COMPILER=no + + else + curl_cv_have_def___INTEL_COMPILER=yes + curl_cv_def___INTEL_COMPILER=$tmp_exp + + fi + + if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_num="$curl_cv_def___INTEL_COMPILER" + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __unix__ +CURL_DEF_TOKEN __unix__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = ""; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___unix__=no + + else + curl_cv_have_def___unix__=yes + curl_cv_def___unix__=$tmp_exp + + fi + + if test "$curl_cv_have_def___unix__" = "yes"; then + compiler_id="INTEL_UNIX_C" + flags_dbg_all="-g -g0" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="INTEL_WINDOWS_C" + flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" + flags_dbg_all="$flags_dbg_all /debug" + flags_dbg_all="$flags_dbg_all /debug:none" + flags_dbg_all="$flags_dbg_all /debug:minimal" + flags_dbg_all="$flags_dbg_all /debug:partial" + flags_dbg_all="$flags_dbg_all /debug:full" + flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" + flags_dbg_all="$flags_dbg_all /debug:extended" + flags_dbg_yes="/Zi /Oy-" + flags_dbg_off="/debug:none /Oy-" + flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" + flags_opt_yes="/O2" + flags_opt_off="/Od" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is clang" >&5 +$as_echo_n "checking if compiler is clang... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __clang__ +CURL_DEF_TOKEN __clang__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__clang__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___clang__=no + + else + curl_cv_have_def___clang__=yes + curl_cv_def___clang__=$tmp_exp + + fi + + if test "$curl_cv_have_def___clang__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="CLANG" + clangver=`$CC -dumpversion` + clangvhi=`echo $clangver | cut -d . -f1` + clangvlo=`echo $clangver | cut -d . -f2` + compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" + flags_opt_yes="-Os" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is GNU C" >&5 +$as_echo_n "checking if compiler is GNU C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "yes" && + test "$compiler_id" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="GNU_C" + gccver=`$CC -dumpversion` + gccvhi=`echo $gccver | cut -d . -f1` + gccvlo=`echo $gccver | cut -d . -f2` + compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef _WIN32 +CURL_DEF_TOKEN _WIN32 +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "_WIN32"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def__WIN32=no + + else + curl_cv_have_def__WIN32=yes + curl_cv_def__WIN32=$tmp_exp + + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is LCC" >&5 +$as_echo_n "checking if compiler is LCC... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __LCC__ +CURL_DEF_TOKEN __LCC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__LCC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___LCC__=no + + else + curl_cv_have_def___LCC__=yes + curl_cv_def___LCC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___LCC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="LCC" + flags_dbg_all="-g" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPSpro C" >&5 +$as_echo_n "checking if compiler is SGI MIPSpro C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef _COMPILER_VERSION +CURL_DEF_TOKEN _COMPILER_VERSION +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "_COMPILER_VERSION"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def__COMPILER_VERSION=no + + else + curl_cv_have_def__COMPILER_VERSION=yes + curl_cv_def__COMPILER_VERSION=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef _SGI_COMPILER_VERSION +CURL_DEF_TOKEN _SGI_COMPILER_VERSION +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "_SGI_COMPILER_VERSION"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def__SGI_COMPILER_VERSION=no + + else + curl_cv_have_def__SGI_COMPILER_VERSION=yes + curl_cv_def__SGI_COMPILER_VERSION=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "no" && + (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" || + test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SGI_MIPSPRO_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPS C" >&5 +$as_echo_n "checking if compiler is SGI MIPS C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __sgi +CURL_DEF_TOKEN __sgi +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__sgi"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___sgi=no + + else + curl_cv_have_def___sgi=yes + curl_cv_def___sgi=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "no" && + test "$curl_cv_have_def___sgi" = "yes" && + test "$compiler_id" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SGI_MIPS_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SunPro C" >&5 +$as_echo_n "checking if compiler is SunPro C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __SUNPRO_C +CURL_DEF_TOKEN __SUNPRO_C +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__SUNPRO_C"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___SUNPRO_C=no + + else + curl_cv_have_def___SUNPRO_C=yes + curl_cv_def___SUNPRO_C=$tmp_exp + + fi + + if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SUNPRO_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" + flags_opt_yes="-xO2" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Tiny C" >&5 +$as_echo_n "checking if compiler is Tiny C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __TINYC__ +CURL_DEF_TOKEN __TINYC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__TINYC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___TINYC__=no + + else + curl_cv_have_def___TINYC__=yes + curl_cv_def___TINYC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___TINYC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="TINY_C" + flags_dbg_all="-g -b" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Watcom C" >&5 +$as_echo_n "checking if compiler is Watcom C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __WATCOMC__ +CURL_DEF_TOKEN __WATCOMC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__WATCOMC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___WATCOMC__=no + + else + curl_cv_have_def___WATCOMC__=yes + curl_cv_def___WATCOMC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___WATCOMC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __UNIX__ +CURL_DEF_TOKEN __UNIX__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__UNIX__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___UNIX__=no + + else + curl_cv_have_def___UNIX__=yes + curl_cv_def___UNIX__=$tmp_exp + + fi + + if test "$curl_cv_have_def___UNIX__" = "yes"; then + compiler_id="WATCOM_UNIX_C" + flags_dbg_all="-g1 -g1+ -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="" + flags_opt_all="-O0 -O1 -O2 -O3" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="WATCOM_WINDOWS_C" + flags_dbg_all="" + flags_dbg_yes="" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + # + if test "$compiler_id" = "unknown"; then + cat <<_EOF 1>&2 +*** +*** Warning: This configure script does not have information about the +*** compiler you are using, relative to the flags required to enable or +*** disable generation of debug info, optimization options or warnings. +*** +*** Whatever settings are present in CFLAGS will be used for this run. +*** +*** If you wish to help the c-ares project to better support your compiler +*** you can report this and the required info on the c-ares development +*** mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ +*** +_EOF + fi + + +squeeze() { + _sqz_result="" + eval _sqz_input=\$$1 + for _sqz_token in $_sqz_input; do + if test -z "$_sqz_result"; then + _sqz_result="$_sqz_token" + else + _sqz_result="$_sqz_result $_sqz_token" + fi + done + eval $1=\$_sqz_result + return 0 +} + + + # + if test "$compiler_id" != "unknown"; then + # + if test "$compiler_id" = "GNU_C" || + test "$compiler_id" = "CLANG"; then + + if test "$compiler_id" = "GNU_C" || + test "$compiler_id" = "CLANG"; then + tmp_has_include="no" + tmp_chg_FLAGS="$CFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CFLAGS="$tmp_chg_FLAGS" + squeeze CFLAGS + fi + tmp_has_include="no" + tmp_chg_FLAGS="$CPPFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CPPFLAGS="$tmp_chg_FLAGS" + squeeze CPPFLAGS + fi + fi + + fi + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" + ;; + # + DEC_C) + # + tmp_CFLAGS="$tmp_CFLAGS -std1" + tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" + tmp_CFLAGS="$tmp_CFLAGS -warnprotos" + tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" + ;; + # + GNU_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + HP_UX_C) + # + tmp_CFLAGS="$tmp_CFLAGS -z" + tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" + ;; + # + IBM_C) + # + tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded" + tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias" + tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e" + ;; + # + INTEL_UNIX_C) + # + tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" + tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266" + tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469" + ;; + # + INTEL_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + tmp_CFLAGS="$tmp_CFLAGS -n" + ;; + # + SGI_MIPS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SGI_MIPSPRO_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SUNPRO_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + TINY_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_UNIX_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts some basic options" >&5 +$as_echo_n "checking if compiler accepts some basic options... " >&6; } + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + + ac_var_stripped="" + for word1 in $tmp_CFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_dbg_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CFLAGS="$ac_var_stripped" + squeeze tmp_CFLAGS + + + ac_var_stripped="" + for word1 in $tmp_CPPFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_dbg_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CPPFLAGS="$ac_var_stripped" + squeeze tmp_CPPFLAGS + + # + if test "$want_debug" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug enabling options" >&5 +$as_echo_n "checking if compiler accepts debug enabling options... " >&6; } + tmp_options="$flags_dbg_yes" + fi + if test "$want_debug" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug disabling options" >&5 +$as_echo_n "checking if compiler accepts debug disabling options... " >&6; } + tmp_options="$flags_dbg_off" + fi + # + if test "$flags_prefer_cppflags" = "yes"; then + CPPFLAGS="$tmp_CPPFLAGS $tmp_options" + CFLAGS="$tmp_CFLAGS" + else + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + fi + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 +$as_echo "$as_me: compiler options added: $tmp_options" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + honor_optimize_option="yes" + # + # + if test "$want_optimize" = "assume_no" || + test "$want_optimize" = "assume_yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler optimizer assumed setting might be used" >&5 +$as_echo_n "checking if compiler optimizer assumed setting might be used... " >&6; } + + + ac_var_match_word="no" + for word1 in $tmp_CFLAGS; do + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_match_word="yes" + fi + done + done + + if test "$ac_var_match_word" = "yes"; then + + honor_optimize_option="no" + + + fi + + + + ac_var_match_word="no" + for word1 in $tmp_CPPFLAGS; do + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_match_word="yes" + fi + done + done + + if test "$ac_var_match_word" = "yes"; then + + honor_optimize_option="no" + + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $honor_optimize_option" >&5 +$as_echo "$honor_optimize_option" >&6; } + if test "$honor_optimize_option" = "yes"; then + if test "$want_optimize" = "assume_yes"; then + want_optimize="yes" + fi + if test "$want_optimize" = "assume_no"; then + want_optimize="no" + fi + fi + fi + # + if test "$honor_optimize_option" = "yes"; then + + ac_var_stripped="" + for word1 in $tmp_CFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CFLAGS="$ac_var_stripped" + squeeze tmp_CFLAGS + + + ac_var_stripped="" + for word1 in $tmp_CPPFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CPPFLAGS="$ac_var_stripped" + squeeze tmp_CPPFLAGS + + if test "$want_optimize" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer enabling options" >&5 +$as_echo_n "checking if compiler accepts optimizer enabling options... " >&6; } + tmp_options="$flags_opt_yes" + fi + if test "$want_optimize" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer disabling options" >&5 +$as_echo_n "checking if compiler accepts optimizer disabling options... " >&6; } + tmp_options="$flags_opt_off" + fi + if test "$flags_prefer_cppflags" = "yes"; then + CPPFLAGS="$tmp_CPPFLAGS $tmp_options" + CFLAGS="$tmp_CFLAGS" + else + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + fi + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 +$as_echo "$as_me: compiler options added: $tmp_options" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + tmp_CFLAGS="$tmp_CFLAGS -Wshadow" + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32" + # + if test "$compiler_num" -ge "101"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused" + fi + fi + ;; + # + DEC_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" + fi + ;; + # + GNU_C) + # + if test "$want_warnings" = "yes"; then + # + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + fi + # + tmp_CFLAGS="$tmp_CFLAGS -Wall -W" + # + if test "$compiler_num" -ge "104"; then + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow" + fi + fi + # + if test "$compiler_num" -ge "207"; then + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + fi + fi + # + if test "$compiler_num" -ge "295"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + fi + # + if test "$compiler_num" -ge "296"; then + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + fi + # + if test "$compiler_num" -ge "297"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + fi + # + if test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS" + fi + # + if test "$compiler_num" -ge "303"; then + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + fi + # + if test "$compiler_num" -ge "304"; then + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + fi + # + if test "$compiler_num" -ge "400"; then + tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3" + fi + # + if test "$compiler_num" -ge "402"; then + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + fi + # + if test "$compiler_num" -ge "403"; then + tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" + tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" + tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla" + fi + # + if test "$compiler_num" -ge "405"; then + if test "$curl_cv_have_def__WIN32" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format" + fi + fi + # + fi + # + if test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + else + if test "x$cross_compiling" = "xyes"; then + if test "$compiler_num" -ge "104"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" + fi + if test "$compiler_num" -ge "207"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" + fi + fi + fi + ;; + # + HP_UX_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS +w1" + fi + ;; + # + IBM_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + INTEL_UNIX_C) + # + if test "$want_warnings" = "yes"; then + if test "$compiler_num" -gt "600"; then + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" + fi + fi + tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" + tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" + tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" + if test "$compiler_num" -ge "1000"; then + tmp_CFLAGS="$tmp_CFLAGS -vec-report0" + fi + ;; + # + INTEL_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS" + fi + ;; + # + SGI_MIPS_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + fi + ;; + # + SGI_MIPSPRO_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + tmp_CFLAGS="$tmp_CFLAGS -woff 1209" + fi + ;; + # + SUNPRO_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -v" + fi + ;; + # + TINY_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -Wall" + tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings" + tmp_CFLAGS="$tmp_CFLAGS -Wunsupported" + fi + ;; + # + WATCOM_UNIX_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + fi + ;; + # + WATCOM_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts strict warning options" >&5 +$as_echo_n "checking if compiler accepts strict warning options... " >&6; } + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + +if test "$compiler_id" = "INTEL_UNIX_C"; then + # + if test "$compiler_num" -ge "1000"; then + CFLAGS="$CFLAGS -shared-intel" + elif test "$compiler_num" -ge "900"; then + CFLAGS="$CFLAGS -i-dynamic" + fi + # +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on compilation errors" >&5 +$as_echo_n "checking if compiler halts on compilation errors... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + force compilation error + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "compiler does not halt on compilation errors." "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on negative sized arrays" >&5 +$as_echo_n "checking if compiler halts on negative sized arrays... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; + +int main (void) +{ + + bad_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "compiler does not halt on negative sized arrays." "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports hiding library internal symbols" >&5 +$as_echo_n "checking if compiler supports hiding library internal symbols... " >&6; } + supports_symbol_hiding="no" + symbol_hiding_CFLAGS="" + symbol_hiding_EXTERN="" + tmp_CFLAGS="" + tmp_EXTERN="" + case "$compiler_id" in + CLANG) + tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" + tmp_CFLAGS="-fvisibility=hidden" + supports_symbol_hiding="yes" + ;; + GNU_C) + if test "$compiler_num" -ge "304"; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then + tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" + tmp_CFLAGS="-fvisibility=hidden" + supports_symbol_hiding="yes" + fi + fi + ;; + INTEL_UNIX_C) + if test "$compiler_num" -ge "900"; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then + tmp_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# include + +int main (void) +{ + + printf("icc fvisibility bug test"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" + tmp_CFLAGS="-fvisibility=hidden" + supports_symbol_hiding="yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$tmp_save_CFLAGS" + fi + fi + ;; + SUNPRO_C) + if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then + tmp_EXTERN="__global" + tmp_CFLAGS="-xldscope=hidden" + supports_symbol_hiding="yes" + fi + ;; + esac + if test "$supports_symbol_hiding" = "yes"; then + tmp_save_CFLAGS="$CFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CFLAGS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_EXTERN char *dummy(char *buff); + char *dummy(char *buff) + { + if(buff) + return ++buff; + else + return buff; + } + +int main (void) +{ + + char b[16]; + char *r = dummy(&b[0]); + if(r) + return (int)*r; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + supports_symbol_hiding="yes" + if test -f conftest.err; then + grep 'visibility' conftest.err >/dev/null + if test "$?" -eq "0"; then + supports_symbol_hiding="no" + fi + fi + +else + + supports_symbol_hiding="no" + echo " " >&6 + sed 's/^/cc-src: /' conftest.$ac_ext >&6 + sed 's/^/cc-err: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$tmp_save_CFLAGS" + fi + if test "$supports_symbol_hiding" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + symbol_hiding_CFLAGS="$tmp_CFLAGS" + symbol_hiding_EXTERN="$tmp_EXTERN" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if shared libraries need -no-undefined" >&5 +$as_echo_n "checking if shared libraries need -no-undefined... " >&6; } + need_no_undefined="no" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*) + need_no_undefined="yes" + ;; + esac + if test "x$allow_undefined" = "xno"; then + need_no_undefined="yes" + elif test "x$allow_undefined_flag" = "xunsupported"; then + need_no_undefined="yes" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $need_no_undefined" >&5 +$as_echo "$need_no_undefined" >&6; } + + if test x$need_no_undefined = xyes; then + NO_UNDEFINED_TRUE= + NO_UNDEFINED_FALSE='#' +else + NO_UNDEFINED_TRUE='#' + NO_UNDEFINED_FALSE= +fi + + + + cares_builddir=`pwd` + supports_curldebug="unknown" + if test "$want_curldebug" = "yes"; then + if test "x$enable_shared" != "xno" && + test "x$enable_shared" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_shared setting." >&5 +$as_echo "$as_me: WARNING: unknown enable_shared setting." >&2;} + supports_curldebug="no" + fi + if test "x$enable_static" != "xno" && + test "x$enable_static" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_static setting." >&5 +$as_echo "$as_me: WARNING: unknown enable_static setting." >&2;} + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + if test "$enable_shared" = "yes" && + test "$need_no_undefined" = "yes"; then + supports_curldebug="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared library does not support undefined symbols." >&5 +$as_echo "$as_me: WARNING: shared library does not support undefined symbols." >&2;} + fi + if test ! -f "$srcdir/../include/curl/curlbuild.h.dist"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: c-ares source not embedded in curl's CVS tree." >&5 +$as_echo "$as_me: WARNING: c-ares source not embedded in curl's CVS tree." >&2;} + supports_curldebug="no" + elif test ! -f "$srcdir/../include/curl/Makefile.in"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: curl's buildconf has not been run." >&5 +$as_echo "$as_me: WARNING: curl's buildconf has not been run." >&2;} + supports_curldebug="no" + elif test ! -f "$cares_builddir/../libcurl.pc" || + test ! -f "$cares_builddir/../include/curl/curlbuild.h"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: curl's configure has not been run." >&5 +$as_echo "$as_me: WARNING: curl's configure has not been run." >&2;} + supports_curldebug="no" + elif test ! -f "$cares_builddir/../lib/curl_config.h"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcurl's curl_config.h is missing." >&5 +$as_echo "$as_me: WARNING: libcurl's curl_config.h is missing." >&2;} + supports_curldebug="no" + elif test ! -f "$cares_builddir/../config.status"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: curl's config.status is missing." >&5 +$as_echo "$as_me: WARNING: curl's config.status is missing." >&2;} + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + grep '^#define USE_ARES' "$cares_builddir/../lib/curl_config.h" >/dev/null + if test "$?" -ne "0"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcurl configured without c-ares support." >&5 +$as_echo "$as_me: WARNING: libcurl configured without c-ares support." >&2;} + supports_curldebug="no" + fi + fi + if test "$supports_curldebug" != "no"; then + grep 'CPPFLAGS.*CURLDEBUG' "$cares_builddir/../config.status" >/dev/null + if test "$?" -ne "0"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcurl configured without curldebug support." >&5 +$as_echo "$as_me: WARNING: libcurl configured without curldebug support." >&2;} + supports_curldebug="no" + fi + fi + fi + fi + # + if test "$want_curldebug" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if curl debug memory tracking can be enabled" >&5 +$as_echo_n "checking if curl debug memory tracking can be enabled... " >&6; } + test "$supports_curldebug" = "no" || supports_curldebug="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports_curldebug" >&5 +$as_echo "$supports_curldebug" >&6; } + if test "$supports_curldebug" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable curl debug memory tracking." >&5 +$as_echo "$as_me: WARNING: cannot enable curl debug memory tracking." >&2;} + want_curldebug="no" + fi + fi + # + if test "$want_curldebug" = "yes"; then + +$as_echo "#define BUILDING_LIBCURL 1" >>confdefs.h + + CPPFLAGS="-DCURLDEBUG $CPPFLAGS" + squeeze CPPFLAGS + fi + # + if test "$want_debug" = "yes"; then + CPPFLAGS="-DDEBUGBUILD $CPPFLAGS" + squeeze CPPFLAGS + fi + + if test x$want_curldebug = xyes; then + CURLDEBUG_TRUE= + CURLDEBUG_FALSE='#' +else + CURLDEBUG_TRUE='#' + CURLDEBUG_FALSE= +fi + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if ${ac_cv_header_windows_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build target is a native Windows one" >&5 +$as_echo_n "checking whether build target is a native Windows one... " >&6; } +if ${ac_cv_native_windows+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$ac_cv_header_windows_h" = "no"; then + ac_cv_native_windows="no" + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ + (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) + int dummy=1; +#else + Not a native Windows build target. +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_native_windows="yes" + +else + + ac_cv_native_windows="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_native_windows" >&5 +$as_echo "$ac_cv_native_windows" >&6; } + if test "x$ac_cv_native_windows" = xyes; then + DOING_NATIVE_WINDOWS_TRUE= + DOING_NATIVE_WINDOWS_FALSE='#' +else + DOING_NATIVE_WINDOWS_TRUE='#' + DOING_NATIVE_WINDOWS_FALSE= +fi + + +case X-"$ac_cv_native_windows" in + X-yes) + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 +$as_echo_n "checking for winsock.h... " >&6; } +if ${ac_cv_header_winsock_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINSOCK_H shall not be defined. +#else + int dummy=WSACleanup(); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock_h="yes" + +else + + ac_cv_header_winsock_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock_h" >&5 +$as_echo "$ac_cv_header_winsock_h" >&6; } + case "$ac_cv_header_winsock_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if ${ac_cv_header_winsock2_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 +$as_echo_n "checking for ws2tcpip.h... " >&6; } +if ${ac_cv_header_ws2tcpip_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WS2TCPIP_H shall not be defined. +#else + int dummy=2*IP_PKTINFO; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ws2tcpip_h="yes" + +else + + ac_cv_header_ws2tcpip_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ws2tcpip_h" >&5 +$as_echo "$ac_cv_header_ws2tcpip_h" >&6; } + case "$ac_cv_header_ws2tcpip_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 +_ACEOF + + ;; + esac + + ;; + *) + ac_cv_header_winsock_h="no" + ac_cv_header_winsock2_h="no" + ac_cv_header_ws2tcpip_h="no" + ;; +esac + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if X/Open network library is required" >&5 +$as_echo_n "checking if X/Open network library is required... " >&6; } + tst_lib_xnet_required="no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int main (void) +{ +#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) + return 0; +#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) + return 0; +#else + force compilation error +#endif +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_lib_xnet_required="yes" + LIBS="$LIBS -lxnet" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_lib_xnet_required" >&5 +$as_echo "$tst_lib_xnet_required" >&6; } + + +ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = xyes; then : + HAVE_GETHOSTBYNAME="1" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nsl_gethostbyname=yes +else + ac_cv_lib_nsl_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnsl" + +fi + + +fi + + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lsocket" >&5 +$as_echo_n "checking for gethostbyname in -lsocket... " >&6; } +if ${ac_cv_lib_socket_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_gethostbyname=yes +else + ac_cv_lib_socket_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_gethostbyname" >&5 +$as_echo "$ac_cv_lib_socket_gethostbyname" >&6; } +if test "x$ac_cv_lib_socket_gethostbyname" = xyes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lsocket" + +fi + +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname with both nsl and socket libs" >&5 +$as_echo_n "checking for gethostbyname with both nsl and socket libs... " >&6; } + my_ac_save_LIBS=$LIBS + LIBS="-lnsl -lsocket $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + gethostbyname(); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS=$my_ac_save_LIBS + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + if test "$ac_cv_header_windows_h" = "yes"; then + if test "$ac_cv_header_winsock_h" = "yes"; then + case $host in + *-*-mingw32ce*) + winsock_LIB="-lwinsock" + ;; + *) + winsock_LIB="-lwsock32" + ;; + esac + fi + if test "$ac_cv_header_winsock2_h" = "yes"; then + winsock_LIB="-lws2_32" + fi + if test ! -z "$winsock_LIB"; then + my_ac_save_LIBS=$LIBS + LIBS="$winsock_LIB $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in $winsock_LIB" >&5 +$as_echo_n "checking for gethostbyname in $winsock_LIB... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + winsock_LIB="" + LIBS=$my_ac_save_LIBS + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + fi +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for Minix 3" >&5 +$as_echo_n "checking for gethostbyname for Minix 3... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +/* Older Minix versions may need here instead */ +#include + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for eCos" >&5 +$as_echo_n "checking for gethostbyname for eCos... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnet" >&5 +$as_echo_n "checking for gethostbyname in -lnet... " >&6; } +if ${ac_cv_lib_net_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnet $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_net_gethostbyname=yes +else + ac_cv_lib_net_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_gethostbyname" >&5 +$as_echo "$ac_cv_lib_net_gethostbyname" >&6; } +if test "x$ac_cv_lib_net_gethostbyname" = xyes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnet" + +fi + +fi + + +if test "$HAVE_GETHOSTBYNAME" != "1"; then + as_fn_error $? "couldn't find libraries for gethostbyname()" "$LINENO" 5 +fi + +ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" +if test "x$ac_cv_func_strcasecmp" = xyes; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolve" >&5 +$as_echo_n "checking for strcasecmp in -lresolve... " >&6; } +if ${ac_cv_lib_resolve_strcasecmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolve $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +int main (void) +{ +return strcasecmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolve_strcasecmp=yes +else + ac_cv_lib_resolve_strcasecmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolve_strcasecmp" >&5 +$as_echo "$ac_cv_lib_resolve_strcasecmp" >&6; } +if test "x$ac_cv_lib_resolve_strcasecmp" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRESOLVE 1 +_ACEOF + + LIBS="-lresolve $LIBS" + +fi + +fi + + +if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolve" >&5 +$as_echo_n "checking for strcasecmp in -lresolve... " >&6; } +if ${ac_cv_lib_resolve_strcasecmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolve -lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +int main (void) +{ +return strcasecmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolve_strcasecmp=yes +else + ac_cv_lib_resolve_strcasecmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolve_strcasecmp" >&5 +$as_echo "$ac_cv_lib_resolve_strcasecmp" >&6; } +if test "x$ac_cv_lib_resolve_strcasecmp" = xyes; then : + LIBS="-lresolve $LIBS" +fi + +fi +ac_cv_func_strcasecmp="no" + + +cares_includes_winsock2="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif +/* includes end */" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if ${ac_cv_header_windows_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 +$as_echo_n "checking for winsock.h... " >&6; } +if ${ac_cv_header_winsock_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINSOCK_H shall not be defined. +#else + int dummy=WSACleanup(); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock_h="yes" + +else + + ac_cv_header_winsock_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock_h" >&5 +$as_echo "$ac_cv_header_winsock_h" >&6; } + case "$ac_cv_header_winsock_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if ${ac_cv_header_winsock2_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in libraries" >&5 +$as_echo_n "checking for connect in libraries... " >&6; } + tst_connect_save_LIBS="$LIBS" + tst_connect_need_LIBS="unknown" + for tst_lib in '' '-lsocket' ; do + if test "$tst_connect_need_LIBS" = "unknown"; then + LIBS="$tst_lib $tst_connect_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + #ifndef HAVE_WINDOWS_H + int connect(int, void*, int); + #endif + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tst_connect_need_LIBS="$tst_lib" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + LIBS="$tst_connect_save_LIBS" + # + case X-"$tst_connect_need_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find connect" >&5 +$as_echo "cannot find connect" >&6; } + as_fn_error $? "cannot find connect function in libraries." "$LINENO" 5 + ;; + X-) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_connect_need_LIBS" >&5 +$as_echo "$tst_connect_need_LIBS" >&6; } + LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" + ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + + for ac_header in sys/types.h sys/time.h time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for monotonic clock_gettime" >&5 +$as_echo_n "checking for monotonic clock_gettime... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ac_cv_func_clock_gettime="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_clock_gettime="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + # + if test "$ac_cv_func_clock_gettime" = "yes"; then + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in libraries" >&5 +$as_echo_n "checking for clock_gettime in libraries... " >&6; } + # + curl_cv_save_LIBS="$LIBS" + curl_cv_gclk_LIBS="unknown" + # + for x_xlibs in '' '-lrt' '-lposix4' ; do + if test "$curl_cv_gclk_LIBS" = "unknown"; then + if test -z "$x_xlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_xlibs $curl_cv_save_LIBS" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + curl_cv_gclk_LIBS="$x_xlibs" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_gclk_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find clock_gettime" >&5 +$as_echo "cannot find clock_gettime" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} + ac_cv_func_clock_gettime="no" + ;; + X-) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no additional lib required" >&5 +$as_echo "no additional lib required" >&6; } + ac_cv_func_clock_gettime="yes" + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_gclk_LIBS" + else + LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_gclk_LIBS" >&5 +$as_echo "$curl_cv_gclk_LIBS" >&6; } + ac_cv_func_clock_gettime="yes" + ;; + esac + # + if test "x$cross_compiling" != "xyes" && + test "$ac_cv_func_clock_gettime" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if monotonic clock_gettime works" >&5 +$as_echo_n "checking if monotonic clock_gettime works... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(0); + else + exit(1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} + ac_cv_func_clock_gettime="no" + LIBS="$curl_cv_save_LIBS" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + case "$ac_cv_func_clock_gettime" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME_MONOTONIC 1 +_ACEOF + + ;; + esac + # + fi + # + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5 +$as_echo_n "checking whether to use libgcc... " >&6; } +# Check whether --enable-libgcc was given. +if test "${enable_libgcc+set}" = set; then : + enableval=$enable_libgcc; case "$enableval" in + yes) + LIBS="$LIBS -lgcc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc.h" >&5 +$as_echo_n "checking for malloc.h... " >&6; } +if ${ac_cv_header_malloc_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_malloc_h="yes" + +else + + ac_cv_header_malloc_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_malloc_h" >&5 +$as_echo "$ac_cv_header_malloc_h" >&6; } + if test "$ac_cv_header_malloc_h" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_MALLOC_H 1 +_ACEOF + + # + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_need_header_malloc_h="no" + +else + + curl_cv_need_header_malloc_h="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + case "$curl_cv_need_header_malloc_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NEED_MALLOC_H 1 +_ACEOF + + ;; + esac + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory.h" >&5 +$as_echo_n "checking for memory.h... " >&6; } +if ${ac_cv_header_memory_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_memory_h="yes" + +else + + ac_cv_header_memory_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_memory_h" >&5 +$as_echo "$ac_cv_header_memory_h" >&6; } + if test "$ac_cv_header_memory_h" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_MEMORY_H 1 +_ACEOF + + # + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_need_header_memory_h="no" + +else + + curl_cv_need_header_memory_h="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + case "$curl_cv_need_header_memory_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NEED_MEMORY_H 1 +_ACEOF + + ;; + esac + fi + + +for ac_header in sys/types.h \ + sys/time.h \ + sys/select.h \ + sys/socket.h \ + sys/ioctl.h \ + sys/param.h \ + sys/uio.h \ + assert.h \ + netdb.h \ + netinet/in.h \ + netinet/tcp.h \ + net/if.h \ + errno.h \ + socket.h \ + strings.h \ + stdbool.h \ + time.h \ + limits.h \ + arpa/nameser.h \ + arpa/nameser_compat.h \ + arpa/inet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_ARPA_NAMESER_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + + for ac_header in sys/types.h sys/time.h time.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 +$as_echo_n "checking for struct timeval... " >&6; } +if ${ac_cv_struct_timeval+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +int main (void) +{ + + struct timeval ts; + ts.tv_sec = 0; + ts.tv_usec = 0; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_struct_timeval="yes" + +else + + ac_cv_struct_timeval="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_timeval" >&5 +$as_echo "$ac_cv_struct_timeval" >&6; } + case "$ac_cv_struct_timeval" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_TIMEVAL 1 +_ACEOF + + ;; + esac + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if ${ac_cv_sizeof_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if ${ac_cv_sizeof_short+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + + + if test -z "$ac_cv_sizeof_long" || + test "$ac_cv_sizeof_long" -eq "0"; then + as_fn_error $? "cannot find out size of long." "$LINENO" 5 + fi + +cat >>confdefs.h <<_EOF +#define CARES_SIZEOF_LONG $ac_cv_sizeof_long +_EOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if ${ac_cv_sizeof_time_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_time_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t +_ACEOF + + + +ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" +if test "x$ac_cv_type_long_long" = xyes; then : + +$as_echo "#define HAVE_LONGLONG 1" >>confdefs.h + + longlong="yes" + +fi + + +if test "xyes" = "x$longlong"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if numberLL works" >&5 +$as_echo_n "checking if numberLL works... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + long long val = 1000LL; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LL 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + +# check for ssize_t +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +$as_echo "#define ssize_t int" >>confdefs.h + +fi + + +# check for bool type +ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + +" +if test "x$ac_cv_type_bool" = xyes; then : + + +$as_echo "#define HAVE_BOOL_T 1" >>confdefs.h + + +fi + + + +cares_includes_ws2tcpip="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# endif +#endif +/* includes end */" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if ${ac_cv_header_windows_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if ${ac_cv_header_winsock2_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 +$as_echo_n "checking for ws2tcpip.h... " >&6; } +if ${ac_cv_header_ws2tcpip_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WS2TCPIP_H shall not be defined. +#else + int dummy=2*IP_PKTINFO; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ws2tcpip_h="yes" + +else + + ac_cv_header_ws2tcpip_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ws2tcpip_h" >&5 +$as_echo "$ac_cv_header_ws2tcpip_h" >&6; } + case "$ac_cv_header_ws2tcpip_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 +_ACEOF + + ;; + esac + + + +cares_includes_sys_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_sys_socket +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +cares_preprocess_callconv="\ +/* preprocess start */ +#ifdef HAVE_WINDOWS_H +# define FUNCALLCONV __stdcall +#else +# define FUNCALLCONV +#endif +/* preprocess end */" + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ares_socklen_t data type" >&5 +$as_echo_n "checking for ares_socklen_t data type... " >&6; } + cares_typeof_ares_socklen_t="unknown" + for arg1 in int SOCKET; do + for arg2 in 'struct sockaddr' void; do + for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do + if test "$cares_typeof_ares_socklen_t" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_preprocess_callconv + extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); + +int main (void) +{ + + $t *lenptr = 0; + if(0 != getpeername(0, 0, lenptr)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + cares_typeof_ares_socklen_t="$t" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + for t in socklen_t int; do + if test "$cares_typeof_ares_socklen_t" = "void"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_sys_socket + typedef $t ares_socklen_t; + +int main (void) +{ + + ares_socklen_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + cares_typeof_ares_socklen_t="$t" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cares_typeof_ares_socklen_t" >&5 +$as_echo "$cares_typeof_ares_socklen_t" >&6; } + if test "$cares_typeof_ares_socklen_t" = "void" || + test "$cares_typeof_ares_socklen_t" = "unknown"; then + as_fn_error $? "cannot find data type for ares_socklen_t." "$LINENO" 5 + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ares_socklen_t" >&5 +$as_echo_n "checking size of ares_socklen_t... " >&6; } + cares_sizeof_ares_socklen_t="unknown" + cares_pull_headers_socklen_t="unknown" + if test "$ac_cv_header_ws2tcpip_h" = "yes"; then + tst_pull_header_checks='none ws2tcpip' + tst_size_checks='4' + else + tst_pull_header_checks='none systypes syssocket' + tst_size_checks='4 8 2' + fi + for tst_size in $tst_size_checks; do + for tst_pull_headers in $tst_pull_header_checks; do + if test "$cares_sizeof_ares_socklen_t" = "unknown"; then + case $tst_pull_headers in + ws2tcpip) + tmp_includes="$cares_includes_ws2tcpip" + ;; + systypes) + tmp_includes="$cares_includes_sys_types" + ;; + syssocket) + tmp_includes="$cares_includes_sys_socket" + ;; + *) + tmp_includes="" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_includes + typedef $cares_typeof_ares_socklen_t ares_socklen_t; + typedef char dummy_arr[sizeof(ares_socklen_t) == $tst_size ? 1 : -1]; + +int main (void) +{ + + ares_socklen_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + cares_sizeof_ares_socklen_t="$tst_size" + cares_pull_headers_socklen_t="$tst_pull_headers" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cares_sizeof_ares_socklen_t" >&5 +$as_echo "$cares_sizeof_ares_socklen_t" >&6; } + if test "$cares_sizeof_ares_socklen_t" = "unknown"; then + as_fn_error $? "cannot find out size of ares_socklen_t." "$LINENO" 5 + fi + # + case $cares_pull_headers_socklen_t in + ws2tcpip) + +cat >>confdefs.h <<_EOF +#define CARES_PULL_WS2TCPIP_H 1 +_EOF + + ;; + systypes) + +cat >>confdefs.h <<_EOF +#define CARES_PULL_SYS_TYPES_H 1 +_EOF + + ;; + syssocket) + +cat >>confdefs.h <<_EOF +#define CARES_PULL_SYS_TYPES_H 1 +_EOF + + +cat >>confdefs.h <<_EOF +#define CARES_PULL_SYS_SOCKET_H 1 +_EOF + + ;; + esac + +cat >>confdefs.h <<_EOF +#define CARES_TYPEOF_ARES_SOCKLEN_T $cares_typeof_ares_socklen_t +_EOF + + +cat >>confdefs.h <<_EOF +#define CARES_SIZEOF_ARES_SOCKLEN_T $cares_sizeof_ares_socklen_t +_EOF + + + + + ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in_addr_t equivalent" >&5 +$as_echo_n "checking for in_addr_t equivalent... " >&6; } +if ${curl_cv_in_addr_t_equiv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_in_addr_t_equiv="unknown" + for t in "unsigned long" int size_t unsigned long; do + if test "$curl_cv_in_addr_t_equiv" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +int main (void) +{ + + $t data = inet_addr ("1.2.3.4"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + curl_cv_in_addr_t_equiv="$t" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_in_addr_t_equiv" >&5 +$as_echo "$curl_cv_in_addr_t_equiv" >&6; } + case "$curl_cv_in_addr_t_equiv" in + unknown) + as_fn_error $? "Cannot find a type to use in place of in_addr_t" "$LINENO" 5 + ;; + *) + +cat >>confdefs.h <<_ACEOF +#define in_addr_t $curl_cv_in_addr_t_equiv +_ACEOF + + ;; + esac + +fi + + + + + ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +" +if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : + +$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h + +fi + + + + + for ac_header in signal.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" +if test "x$ac_cv_header_signal_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNAL_H 1 +_ACEOF + +fi + +done + + ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" " +#ifdef HAVE_SIGNAL_H +#include +#endif + +" +if test "x$ac_cv_type_sig_atomic_t" = xyes; then : + + +$as_echo "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h + + +fi + + case "$ac_cv_type_sig_atomic_t" in + yes) + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sig_atomic_t is already defined as volatile" >&5 +$as_echo_n "checking if sig_atomic_t is already defined as volatile... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SIGNAL_H +#include +#endif + +int main (void) +{ + + static volatile sig_atomic_t dummy = 0; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_sig_atomic_t_volatile="no" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ac_cv_sig_atomic_t_volatile="yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then + +$as_echo "#define HAVE_SIG_ATOMIC_T_VOLATILE 1" >>confdefs.h + + fi + ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if ${ac_cv_type_signal+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +int main (void) +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recv" >&5 +$as_echo_n "checking for recv... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + recv(0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_recv="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_recv="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_recv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for recv" >&5 +$as_echo_n "checking types of args and return type for recv... " >&6; } +if ${curl_cv_func_recv_args+:} false; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_recv_args="unknown" + for recv_retv in 'int' 'ssize_t'; do + for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recv_arg2 in 'char *' 'void *'; do + for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recv_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_recv_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVCALLCONV +#endif + extern $recv_retv RECVCALLCONV + recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); + +int main (void) +{ + + $recv_arg1 s=0; + $recv_arg2 buf=0; + $recv_arg3 len=0; + $recv_arg4 flags=0; + $recv_retv res = recv(s, buf, len, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_recv_args" >&5 +$as_echo "$curl_cv_func_recv_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_recv_args" = "unknown"; then + as_fn_error $? "Cannot find proper types to use for recv args" "$LINENO" 5 + else + recv_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'` + IFS=$recv_prev_IFS + shift + # + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG2 $2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_RETV $5 +_ACEOF + + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECV 1 +_ACEOF + + ac_cv_func_recv="yes" + fi + else + as_fn_error $? "Unable to link function recv" "$LINENO" 5 + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recvfrom" >&5 +$as_echo_n "checking for recvfrom... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + recvfrom(0, 0, 0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_recvfrom="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_recvfrom="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_recvfrom" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for recvfrom" >&5 +$as_echo_n "checking types of args and return type for recvfrom... " >&6; } +if ${curl_cv_func_recvfrom_args+:} false; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_recvfrom_args="unknown" + for recvfrom_retv in 'int' 'ssize_t'; do + for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recvfrom_arg2 in 'char *' 'void *'; do + for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recvfrom_arg4 in 'int' 'unsigned int'; do + for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do + for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVFROMCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVFROMCALLCONV +#endif + extern $recvfrom_retv RECVFROMCALLCONV + recvfrom($recvfrom_arg1, $recvfrom_arg2, + $recvfrom_arg3, $recvfrom_arg4, + $recvfrom_arg5, $recvfrom_arg6); + +int main (void) +{ + + $recvfrom_arg1 s=0; + $recvfrom_arg2 buf=0; + $recvfrom_arg3 len=0; + $recvfrom_arg4 flags=0; + $recvfrom_arg5 addr=0; + $recvfrom_arg6 addrlen=0; + $recvfrom_retv res=0; + res = recvfrom(s, buf, len, flags, addr, addrlen); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_recvfrom_args" >&5 +$as_echo "$curl_cv_func_recvfrom_args" >&6; } # AC-CACHE-CHECK + # Nearly last minute change for this release starts here + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECVFROM 1 +_ACEOF + + ac_cv_func_recvfrom="yes" + # Nearly last minute change for this release ends here + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for recvfrom args" >&5 +$as_echo "$as_me: WARNING: Cannot find proper types to use for recvfrom args" >&2;} + else + recvfrom_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` + IFS=$recvfrom_prev_IFS + shift + # + recvfrom_ptrt_arg2=$2 + recvfrom_qual_ptrt_arg5=$5 + recvfrom_ptrt_arg6=$6 + # + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_RETV $7 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$recvfrom_qual_ptrt_arg5" in + const*) + recvfrom_qual_arg5=const + recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'` + ;; + *) + recvfrom_qual_arg5= + recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5 + ;; + esac + # + recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'` + recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'` + recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'` + # + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG2 $recvfrom_type_arg2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_QUAL_ARG5 $recvfrom_qual_arg5 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG5 $recvfrom_type_arg5 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG6 $recvfrom_type_arg6 +_ACEOF + + # + if test "$recvfrom_type_arg2" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG2_IS_VOID 1 +_ACEOF + + fi + if test "$recvfrom_type_arg5" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG5_IS_VOID 1 +_ACEOF + + fi + if test "$recvfrom_type_arg6" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG6_IS_VOID 1 +_ACEOF + + fi + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECVFROM 1 +_ACEOF + + ac_cv_func_recvfrom="yes" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to link function recvfrom" >&5 +$as_echo "$as_me: WARNING: Unable to link function recvfrom" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your system will be vulnerable to some forms of DNS cache poisoning" >&5 +$as_echo "$as_me: WARNING: Your system will be vulnerable to some forms of DNS cache poisoning" >&2;} + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for send" >&5 +$as_echo_n "checking for send... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + send(0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_send="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_send="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_send" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for send" >&5 +$as_echo_n "checking types of args and return type for send... " >&6; } +if ${curl_cv_func_send_args+:} false; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_send_args="unknown" + for send_retv in 'int' 'ssize_t'; do + for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do + for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for send_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_send_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define SENDCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define SENDCALLCONV +#endif + extern $send_retv SENDCALLCONV + send($send_arg1, $send_arg2, $send_arg3, $send_arg4); + +int main (void) +{ + + $send_arg1 s=0; + $send_arg3 len=0; + $send_arg4 flags=0; + $send_retv res = send(s, 0, len, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_send_args" >&5 +$as_echo "$curl_cv_func_send_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_send_args" = "unknown"; then + as_fn_error $? "Cannot find proper types to use for send args" "$LINENO" 5 + else + send_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'` + IFS=$send_prev_IFS + shift + # + send_qual_type_arg2=$2 + # + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_RETV $5 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$send_qual_type_arg2" in + const*) + send_qual_arg2=const + send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` + ;; + *) + send_qual_arg2= + send_type_arg2=$send_qual_type_arg2 + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define SEND_QUAL_ARG2 $send_qual_arg2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG2 $send_type_arg2 +_ACEOF + + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_SEND 1 +_ACEOF + + ac_cv_func_send="yes" + fi + else + as_fn_error $? "Unable to link function send" "$LINENO" 5 + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 +$as_echo_n "checking for MSG_NOSIGNAL... " >&6; } +if ${ac_cv_msg_nosignal+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + int flag=MSG_NOSIGNAL; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_msg_nosignal="yes" + +else + + ac_cv_msg_nosignal="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_nosignal" >&5 +$as_echo "$ac_cv_msg_nosignal" >&6; } + case "$ac_cv_msg_nosignal" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_MSG_NOSIGNAL 1 +_ACEOF + + ;; + esac + + + +cares_includes_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SOCKET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_socket +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_closesocket="unknown" + tst_proto_closesocket="unknown" + tst_compi_closesocket="unknown" + tst_allow_closesocket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket can be linked" >&5 +$as_echo_n "checking if closesocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_socket + +int main (void) +{ + + if(0 != closesocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_closesocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is prototyped" >&5 +$as_echo_n "checking if closesocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "closesocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_closesocket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is compilable" >&5 +$as_echo_n "checking if closesocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_socket + +int main (void) +{ + + if(0 != closesocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_closesocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket usage allowed" >&5 +$as_echo_n "checking if closesocket usage allowed... " >&6; } + if test "x$cares_disallow_closesocket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_closesocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_closesocket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket might be used" >&5 +$as_echo_n "checking if closesocket might be used... " >&6; } + if test "$tst_links_closesocket" = "yes" && + test "$tst_proto_closesocket" = "yes" && + test "$tst_compi_closesocket" = "yes" && + test "$tst_allow_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOSESOCKET 1 +_ACEOF + + ac_cv_func_closesocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_closesocket="no" + fi + + + # + tst_links_closesocket_camel="unknown" + tst_proto_closesocket_camel="unknown" + tst_compi_closesocket_camel="unknown" + tst_allow_closesocket_camel="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket can be linked" >&5 +$as_echo_n "checking if CloseSocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_sys_socket + +int main (void) +{ + + if(0 != CloseSocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_closesocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is prototyped" >&5 +$as_echo_n "checking if CloseSocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_sys_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "CloseSocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_closesocket_camel="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is compilable" >&5 +$as_echo_n "checking if CloseSocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_sys_socket + +int main (void) +{ + + if(0 != CloseSocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_closesocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket usage allowed" >&5 +$as_echo_n "checking if CloseSocket usage allowed... " >&6; } + if test "x$cares_disallow_closesocket_camel" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_closesocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_closesocket_camel="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket might be used" >&5 +$as_echo_n "checking if CloseSocket might be used... " >&6; } + if test "$tst_links_closesocket_camel" = "yes" && + test "$tst_proto_closesocket_camel" = "yes" && + test "$tst_compi_closesocket_camel" = "yes" && + test "$tst_allow_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOSESOCKET_CAMEL 1 +_ACEOF + + ac_cv_func_closesocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_closesocket_camel="no" + fi + + + # + tst_links_connect="unknown" + tst_proto_connect="unknown" + tst_compi_connect="unknown" + tst_allow_connect="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect can be linked" >&5 +$as_echo_n "checking if connect can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_connect="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is prototyped" >&5 +$as_echo_n "checking if connect is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "connect" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_connect="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is compilable" >&5 +$as_echo_n "checking if connect is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_connect="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect usage allowed" >&5 +$as_echo_n "checking if connect usage allowed... " >&6; } + if test "x$cares_disallow_connect" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_connect="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_connect="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect might be used" >&5 +$as_echo_n "checking if connect might be used... " >&6; } + if test "$tst_links_connect" = "yes" && + test "$tst_proto_connect" = "yes" && + test "$tst_compi_connect" = "yes" && + test "$tst_allow_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CONNECT 1 +_ACEOF + + ac_cv_func_connect="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_connect="no" + fi + + +cares_includes_fcntl="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_FCNTL_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h fcntl.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_fcntl +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_fcntl="unknown" + tst_proto_fcntl="unknown" + tst_compi_fcntl="unknown" + tst_allow_fcntl="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl can be linked" >&5 +$as_echo_n "checking if fcntl can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define fcntl innocuous_fcntl +#ifdef __STDC__ +# include +#else +# include +#endif +#undef fcntl +#ifdef __cplusplus +extern "C" +#endif +char fcntl (); +#if defined __stub_fcntl || defined __stub___fcntl +choke me +#endif + +int main (void) +{ +return fcntl (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_fcntl="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is prototyped" >&5 +$as_echo_n "checking if fcntl is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_fcntl + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fcntl" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_fcntl="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is compilable" >&5 +$as_echo_n "checking if fcntl is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_fcntl + +int main (void) +{ + + if(0 != fcntl(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fcntl="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl usage allowed" >&5 +$as_echo_n "checking if fcntl usage allowed... " >&6; } + if test "x$cares_disallow_fcntl" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fcntl="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fcntl="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl might be used" >&5 +$as_echo_n "checking if fcntl might be used... " >&6; } + if test "$tst_links_fcntl" = "yes" && + test "$tst_proto_fcntl" = "yes" && + test "$tst_compi_fcntl" = "yes" && + test "$tst_allow_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FCNTL 1 +_ACEOF + + ac_cv_func_fcntl="yes" + + # + tst_compi_fcntl_o_nonblock="unknown" + tst_allow_fcntl_o_nonblock="unknown" + # + case $host_os in + sunos4* | aix3* | beos*) + cares_disallow_fcntl_o_nonblock="yes" + ;; + esac + # + if test "$ac_cv_func_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK is compilable" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_fcntl + +int main (void) +{ + + int flags = 0; + if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fcntl_o_nonblock="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fcntl_o_nonblock="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_fcntl_o_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK usage allowed" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK usage allowed... " >&6; } + if test "x$cares_disallow_fcntl_o_nonblock" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fcntl_o_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fcntl_o_nonblock="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK might be used" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK might be used... " >&6; } + if test "$tst_compi_fcntl_o_nonblock" = "yes" && + test "$tst_allow_fcntl_o_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FCNTL_O_NONBLOCK 1 +_ACEOF + + ac_cv_func_fcntl_o_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fcntl_o_nonblock="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fcntl="no" + fi + + +cares_includes_netdb="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_netdb +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_freeaddrinfo="unknown" + tst_proto_freeaddrinfo="unknown" + tst_compi_freeaddrinfo="unknown" + tst_allow_freeaddrinfo="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo can be linked" >&5 +$as_echo_n "checking if freeaddrinfo can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ + + freeaddrinfo(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_freeaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is prototyped" >&5 +$as_echo_n "checking if freeaddrinfo is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "freeaddrinfo" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_freeaddrinfo="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is compilable" >&5 +$as_echo_n "checking if freeaddrinfo is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ + + freeaddrinfo(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_freeaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo usage allowed" >&5 +$as_echo_n "checking if freeaddrinfo usage allowed... " >&6; } + if test "x$cares_disallow_freeaddrinfo" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_freeaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_freeaddrinfo="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo might be used" >&5 +$as_echo_n "checking if freeaddrinfo might be used... " >&6; } + if test "$tst_links_freeaddrinfo" = "yes" && + test "$tst_proto_freeaddrinfo" = "yes" && + test "$tst_compi_freeaddrinfo" = "yes" && + test "$tst_allow_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FREEADDRINFO 1 +_ACEOF + + ac_cv_func_freeaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_freeaddrinfo="no" + fi + + +cares_includes_stdlib="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h stdlib.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_stdlib +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +cares_includes_string="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h string.h strings.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_string +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_getaddrinfo="unknown" + tst_proto_getaddrinfo="unknown" + tst_compi_getaddrinfo="unknown" + tst_works_getaddrinfo="unknown" + tst_allow_getaddrinfo="unknown" + tst_tsafe_getaddrinfo="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo can be linked" >&5 +$as_echo_n "checking if getaddrinfo can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ + + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is prototyped" >&5 +$as_echo_n "checking if getaddrinfo is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getaddrinfo" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getaddrinfo="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is compilable" >&5 +$as_echo_n "checking if getaddrinfo is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ + + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo seems to work" >&5 +$as_echo_n "checking if getaddrinfo seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_stdlib + $cares_includes_string + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ + + struct addrinfo hints; + struct addrinfo *ai = 0; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo("127.0.0.1", 0, &hints, &ai); + if(error || !ai) + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_getaddrinfo="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo usage allowed" >&5 +$as_echo_n "checking if getaddrinfo usage allowed... " >&6; } + if test "x$cares_disallow_getaddrinfo" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getaddrinfo="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo might be used" >&5 +$as_echo_n "checking if getaddrinfo might be used... " >&6; } + if test "$tst_links_getaddrinfo" = "yes" && + test "$tst_proto_getaddrinfo" = "yes" && + test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_allow_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETADDRINFO 1 +_ACEOF + + ac_cv_func_getaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getaddrinfo="no" + ac_cv_func_getaddrinfo_threadsafe="no" + fi + # + if test "$ac_cv_func_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is threadsafe" >&5 +$as_echo_n "checking if getaddrinfo is threadsafe... " >&6; } + case $host_os in + aix[1234].* | aix5.[01].*) + tst_tsafe_getaddrinfo="no" + ;; + aix*) + tst_tsafe_getaddrinfo="yes" + ;; + darwin[12345].*) + tst_tsafe_getaddrinfo="no" + ;; + darwin*) + tst_tsafe_getaddrinfo="yes" + ;; + freebsd[1234].* | freebsd5.[1234]*) + tst_tsafe_getaddrinfo="no" + ;; + freebsd*) + tst_tsafe_getaddrinfo="yes" + ;; + hpux[123456789].* | hpux10.* | hpux11.0* | hpux11.10*) + tst_tsafe_getaddrinfo="no" + ;; + hpux*) + tst_tsafe_getaddrinfo="yes" + ;; + netbsd[123].*) + tst_tsafe_getaddrinfo="no" + ;; + netbsd*) + tst_tsafe_getaddrinfo="yes" + ;; + *bsd*) + tst_tsafe_getaddrinfo="no" + ;; + solaris2*) + tst_tsafe_getaddrinfo="yes" + ;; + esac + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_ws2tcpip + $cares_includes_sys_socket + $cares_includes_netdb + +int main (void) +{ +#ifdef h_errno + return 0; +#else + force compilation error +#endif +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_symbol_defined="yes" + +else + + tst_symbol_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tst_symbol_defined" = "yes"; then + curl_cv_have_def_h_errno=yes + + else + curl_cv_have_def_h_errno=no + + fi + + if test "$curl_cv_have_def_h_errno" = "no"; then + tst_tsafe_getaddrinfo="no" + fi + fi + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + tst_tsafe_getaddrinfo="yes" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_tsafe_getaddrinfo" >&5 +$as_echo "$tst_tsafe_getaddrinfo" >&6; } + if test "$tst_tsafe_getaddrinfo" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETADDRINFO_THREADSAFE 1 +_ACEOF + + ac_cv_func_getaddrinfo_threadsafe="yes" + else + ac_cv_func_getaddrinfo_threadsafe="no" + fi + fi + + + # + tst_links_getenv="unknown" + tst_proto_getenv="unknown" + tst_compi_getenv="unknown" + tst_allow_getenv="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getenv can be linked" >&5 +$as_echo_n "checking if getenv can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getenv innocuous_getenv +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getenv +#ifdef __cplusplus +extern "C" +#endif +char getenv (); +#if defined __stub_getenv || defined __stub___getenv +choke me +#endif + +int main (void) +{ +return getenv (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getenv="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getenv="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getenv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getenv is prototyped" >&5 +$as_echo_n "checking if getenv is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_stdlib + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getenv" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getenv="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getenv="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getenv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getenv is compilable" >&5 +$as_echo_n "checking if getenv is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stdlib + +int main (void) +{ + + if(0 != getenv(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getenv="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getenv="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_getenv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getenv usage allowed" >&5 +$as_echo_n "checking if getenv usage allowed... " >&6; } + if test "x$cares_disallow_getenv" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getenv="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getenv="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getenv might be used" >&5 +$as_echo_n "checking if getenv might be used... " >&6; } + if test "$tst_links_getenv" = "yes" && + test "$tst_proto_getenv" = "yes" && + test "$tst_compi_getenv" = "yes" && + test "$tst_allow_getenv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETENV 1 +_ACEOF + + ac_cv_func_getenv="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getenv="no" + fi + + + # + tst_links_gethostbyaddr="unknown" + tst_proto_gethostbyaddr="unknown" + tst_compi_gethostbyaddr="unknown" + tst_allow_gethostbyaddr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr can be linked" >&5 +$as_echo_n "checking if gethostbyaddr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is prototyped" >&5 +$as_echo_n "checking if gethostbyaddr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyaddr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is compilable" >&5 +$as_echo_n "checking if gethostbyaddr is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr usage allowed" >&5 +$as_echo_n "checking if gethostbyaddr usage allowed... " >&6; } + if test "x$cares_disallow_gethostbyaddr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyaddr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr might be used" >&5 +$as_echo_n "checking if gethostbyaddr might be used... " >&6; } + if test "$tst_links_gethostbyaddr" = "yes" && + test "$tst_proto_gethostbyaddr" = "yes" && + test "$tst_compi_gethostbyaddr" = "yes" && + test "$tst_allow_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYADDR 1 +_ACEOF + + ac_cv_func_gethostbyaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyaddr="no" + fi + + + # + tst_links_gethostbyname="unknown" + tst_proto_gethostbyname="unknown" + tst_compi_gethostbyname="unknown" + tst_allow_gethostbyname="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname can be linked" >&5 +$as_echo_n "checking if gethostbyname can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyname="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is prototyped" >&5 +$as_echo_n "checking if gethostbyname is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyname="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is compilable" >&5 +$as_echo_n "checking if gethostbyname is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyname="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname usage allowed" >&5 +$as_echo_n "checking if gethostbyname usage allowed... " >&6; } + if test "x$cares_disallow_gethostbyname" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyname="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname might be used" >&5 +$as_echo_n "checking if gethostbyname might be used... " >&6; } + if test "$tst_links_gethostbyname" = "yes" && + test "$tst_proto_gethostbyname" = "yes" && + test "$tst_compi_gethostbyname" = "yes" && + test "$tst_allow_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYNAME 1 +_ACEOF + + ac_cv_func_gethostbyname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyname="no" + fi + + +cares_includes_unistd="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_unistd +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_gethostname="unknown" + tst_proto_gethostname="unknown" + tst_compi_gethostname="unknown" + tst_allow_gethostname="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname can be linked" >&5 +$as_echo_n "checking if gethostname can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_unistd + +int main (void) +{ + + if(0 != gethostname(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostname="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is prototyped" >&5 +$as_echo_n "checking if gethostname is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_unistd + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostname" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostname="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is compilable" >&5 +$as_echo_n "checking if gethostname is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_unistd + +int main (void) +{ + + if(0 != gethostname(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostname="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname usage allowed" >&5 +$as_echo_n "checking if gethostname usage allowed... " >&6; } + if test "x$cares_disallow_gethostname" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostname="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname might be used" >&5 +$as_echo_n "checking if gethostname might be used... " >&6; } + if test "$tst_links_gethostname" = "yes" && + test "$tst_proto_gethostname" = "yes" && + test "$tst_compi_gethostname" = "yes" && + test "$tst_allow_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTNAME 1 +_ACEOF + + ac_cv_func_gethostname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostname="no" + fi + + + # + tst_links_getservbyport_r="unknown" + tst_proto_getservbyport_r="unknown" + tst_compi_getservbyport_r="unknown" + tst_allow_getservbyport_r="unknown" + tst_nargs_getservbyport_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r can be linked" >&5 +$as_echo_n "checking if getservbyport_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getservbyport_r innocuous_getservbyport_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getservbyport_r +#ifdef __cplusplus +extern "C" +#endif +char getservbyport_r (); +#if defined __stub_getservbyport_r || defined __stub___getservbyport_r +choke me +#endif + +int main (void) +{ +return getservbyport_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getservbyport_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is prototyped" >&5 +$as_echo_n "checking if getservbyport_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getservbyport_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getservbyport_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getservbyport_r" = "yes"; then + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 4 args." >&5 +$as_echo_n "checking if getservbyport_r takes 4 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="4" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 5 args." >&5 +$as_echo_n "checking if getservbyport_r takes 5 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="5" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 6 args." >&5 +$as_echo_n "checking if getservbyport_r takes 6 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="6" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is compilable" >&5 +$as_echo_n "checking if getservbyport_r is compilable... " >&6; } + if test "$tst_compi_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r usage allowed" >&5 +$as_echo_n "checking if getservbyport_r usage allowed... " >&6; } + if test "x$cares_disallow_getservbyport_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getservbyport_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getservbyport_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r might be used" >&5 +$as_echo_n "checking if getservbyport_r might be used... " >&6; } + if test "$tst_links_getservbyport_r" = "yes" && + test "$tst_proto_getservbyport_r" = "yes" && + test "$tst_compi_getservbyport_r" = "yes" && + test "$tst_allow_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETSERVBYPORT_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETSERVBYPORT_R_ARGS $tst_nargs_getservbyport_r +_ACEOF + + if test "$tst_nargs_getservbyport_r" -eq "4"; then + +$as_echo "#define GETSERVBYPORT_R_BUFSIZE sizeof(struct servent_data)" >>confdefs.h + + else + +$as_echo "#define GETSERVBYPORT_R_BUFSIZE 4096" >>confdefs.h + + fi + ac_cv_func_getservbyport_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getservbyport_r="no" + fi + + +cares_includes_arpa_inet="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/socket.h netinet/in.h arpa/inet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_arpa_inet +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_inet_net_pton="unknown" + tst_proto_inet_net_pton="unknown" + tst_compi_inet_net_pton="unknown" + tst_works_inet_net_pton="unknown" + tst_allow_inet_net_pton="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton can be linked" >&5 +$as_echo_n "checking if inet_net_pton can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_net_pton innocuous_inet_net_pton +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_net_pton +#ifdef __cplusplus +extern "C" +#endif +char inet_net_pton (); +#if defined __stub_inet_net_pton || defined __stub___inet_net_pton +choke me +#endif + +int main (void) +{ +return inet_net_pton (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_net_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_net_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_net_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton is prototyped" >&5 +$as_echo_n "checking if inet_net_pton is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_net_pton" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_net_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_net_pton="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_net_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton is compilable" >&5 +$as_echo_n "checking if inet_net_pton is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_arpa_inet + +int main (void) +{ + + if(0 != inet_net_pton(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_net_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_net_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_net_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton seems to work" >&5 +$as_echo_n "checking if inet_net_pton seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stdlib + $cares_includes_arpa_inet + $cares_includes_string + +int main (void) +{ + + unsigned char ipv6a[16+1]; + unsigned char ipv4a[4+1]; + const char *ipv6net1 = "fe80::214:4fff:fe0b:76c8"; + const char *ipv6net2 = "::fffe:7f00:1"; + const char *ipv6net3 = "7f20:1::/64"; + const char *ipv6net4 = "7f20:1::/2147483649"; + const char *ipv4net1 = "192.168.100.1"; + const char *ipv4net2 = "192.168.100/32"; + const char *ipv4net3 = "192.168.100.1/2147483649"; + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(32 != inet_net_pton(AF_INET, ipv4net1, ipv4a, 4)) + exit(1); /* fail */ + /* - */ + if( (ipv4a[0x00] != 0xc0) || + (ipv4a[0x01] != 0xa8) || + (ipv4a[0x02] != 0x64) || + (ipv4a[0x03] != 0x01) || + (ipv4a[0x04] != 0x01) ) + exit(1); /* fail */ + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(32 != inet_net_pton(AF_INET, ipv4net2, ipv4a, 4)) + exit(1); /* fail */ + /* - */ + if( (ipv4a[0x00] != 0xc0) || + (ipv4a[0x01] != 0xa8) || + (ipv4a[0x02] != 0x64) || + (ipv4a[0x03] != 0x00) || + (ipv4a[0x04] != 0x01) ) + exit(1); /* fail */ + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(-1 != inet_net_pton(AF_INET, ipv4net3, ipv4a, 4)) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(128 != inet_net_pton(AF_INET6, ipv6net1, ipv6a, 16)) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0x00] != 0xfe) || + (ipv6a[0x01] != 0x80) || + (ipv6a[0x08] != 0x02) || + (ipv6a[0x09] != 0x14) || + (ipv6a[0x0a] != 0x4f) || + (ipv6a[0x0b] != 0xff) || + (ipv6a[0x0c] != 0xfe) || + (ipv6a[0x0d] != 0x0b) || + (ipv6a[0x0e] != 0x76) || + (ipv6a[0x0f] != 0xc8) || + (ipv6a[0x10] != 0x01) ) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0x02] != 0x0) || + (ipv6a[0x03] != 0x0) || + (ipv6a[0x04] != 0x0) || + (ipv6a[0x05] != 0x0) || + (ipv6a[0x06] != 0x0) || + (ipv6a[0x07] != 0x0) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 0, sizeof(ipv6a)); + ipv6a[0x10] = 0x01; + if(128 != inet_net_pton(AF_INET6, ipv6net2, ipv6a, 16)) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0x0a] != 0xff) || + (ipv6a[0x0b] != 0xfe) || + (ipv6a[0x0c] != 0x7f) || + (ipv6a[0x0f] != 0x01) || + (ipv6a[0x10] != 0x01) ) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0x00] != 0x0) || + (ipv6a[0x01] != 0x0) || + (ipv6a[0x02] != 0x0) || + (ipv6a[0x03] != 0x0) || + (ipv6a[0x04] != 0x0) || + (ipv6a[0x05] != 0x0) || + (ipv6a[0x06] != 0x0) || + (ipv6a[0x07] != 0x0) || + (ipv6a[0x08] != 0x0) || + (ipv6a[0x09] != 0x0) || + (ipv6a[0x0d] != 0x0) || + (ipv6a[0x0e] != 0x0) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(64 != inet_net_pton(AF_INET6, ipv6net3, ipv6a, 16)) + exit(1); /* fail */ + if( (ipv6a[0x00] != 0x7f) || + (ipv6a[0x01] != 0x20) || + (ipv6a[0x03] != 0x01) || + (ipv6a[0x08] != 0x01) || + (ipv6a[0x09] != 0x01) || + (ipv6a[0x0a] != 0x01) || + (ipv6a[0x0b] != 0x01) || + (ipv6a[0x0c] != 0x01) || + (ipv6a[0x0d] != 0x01) || + (ipv6a[0x0e] != 0x01) || + (ipv6a[0x0f] != 0x01) || + (ipv6a[0x10] != 0x01) ) + exit(1); /* fail */ + if( (ipv6a[0x02] != 0x0) || + (ipv6a[0x04] != 0x0) || + (ipv6a[0x05] != 0x0) || + (ipv6a[0x06] != 0x0) || + (ipv6a[0x07] != 0x0) || + (ipv6a[0x07] != 0x0) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(-1 != inet_net_pton(AF_INET6, ipv6net4, ipv6a, 16)) + exit(1); /* fail */ + /* - */ + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_inet_net_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_inet_net_pton="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_inet_net_pton" = "yes" && + test "$tst_works_inet_net_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton usage allowed" >&5 +$as_echo_n "checking if inet_net_pton usage allowed... " >&6; } + if test "x$cares_disallow_inet_net_pton" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_net_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_net_pton="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_net_pton might be used" >&5 +$as_echo_n "checking if inet_net_pton might be used... " >&6; } + if test "$tst_links_inet_net_pton" = "yes" && + test "$tst_proto_inet_net_pton" = "yes" && + test "$tst_compi_inet_net_pton" = "yes" && + test "$tst_allow_inet_net_pton" = "yes" && + test "$tst_works_inet_net_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_NET_PTON 1 +_ACEOF + + ac_cv_func_inet_net_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_net_pton="no" + fi + + + # + tst_links_inet_ntop="unknown" + tst_proto_inet_ntop="unknown" + tst_compi_inet_ntop="unknown" + tst_works_inet_ntop="unknown" + tst_allow_inet_ntop="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop can be linked" >&5 +$as_echo_n "checking if inet_ntop can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_ntop innocuous_inet_ntop +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_ntop +#ifdef __cplusplus +extern "C" +#endif +char inet_ntop (); +#if defined __stub_inet_ntop || defined __stub___inet_ntop +choke me +#endif + +int main (void) +{ +return inet_ntop (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_ntop="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is prototyped" >&5 +$as_echo_n "checking if inet_ntop is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntop" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_ntop="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is compilable" >&5 +$as_echo_n "checking if inet_ntop is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_arpa_inet + +int main (void) +{ + + if(0 != inet_ntop(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_ntop="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop seems to work" >&5 +$as_echo_n "checking if inet_ntop seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stdlib + $cares_includes_arpa_inet + $cares_includes_string + +int main (void) +{ + + char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char ipv4res[sizeof "255.255.255.255"]; + unsigned char ipv6a[26]; + unsigned char ipv4a[5]; + char *ipv6ptr = 0; + char *ipv4ptr = 0; + /* - */ + ipv4res[0] = '\0'; + ipv4a[0] = 0xc0; + ipv4a[1] = 0xa8; + ipv4a[2] = 0x64; + ipv4a[3] = 0x01; + ipv4a[4] = 0x01; + /* - */ + ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); + if(!ipv4ptr) + exit(1); /* fail */ + if(ipv4ptr != ipv4res) + exit(1); /* fail */ + if(!ipv4ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv4res, "192.168.100.1", 13) != 0) + exit(1); /* fail */ + /* - */ + ipv6res[0] = '\0'; + memset(ipv6a, 0, sizeof(ipv6a)); + ipv6a[0] = 0xfe; + ipv6a[1] = 0x80; + ipv6a[8] = 0x02; + ipv6a[9] = 0x14; + ipv6a[10] = 0x4f; + ipv6a[11] = 0xff; + ipv6a[12] = 0xfe; + ipv6a[13] = 0x0b; + ipv6a[14] = 0x76; + ipv6a[15] = 0xc8; + ipv6a[25] = 0x01; + /* - */ + ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); + if(!ipv6ptr) + exit(1); /* fail */ + if(ipv6ptr != ipv6res) + exit(1); /* fail */ + if(!ipv6ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) + exit(1); /* fail */ + /* - */ + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_inet_ntop="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop usage allowed" >&5 +$as_echo_n "checking if inet_ntop usage allowed... " >&6; } + if test "x$cares_disallow_inet_ntop" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_ntop="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_ntop="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop might be used" >&5 +$as_echo_n "checking if inet_ntop might be used... " >&6; } + if test "$tst_links_inet_ntop" = "yes" && + test "$tst_proto_inet_ntop" = "yes" && + test "$tst_compi_inet_ntop" = "yes" && + test "$tst_allow_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_NTOP 1 +_ACEOF + + ac_cv_func_inet_ntop="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_ntop="no" + fi + + + # + tst_links_inet_pton="unknown" + tst_proto_inet_pton="unknown" + tst_compi_inet_pton="unknown" + tst_works_inet_pton="unknown" + tst_allow_inet_pton="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton can be linked" >&5 +$as_echo_n "checking if inet_pton can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_pton innocuous_inet_pton +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_pton +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +#if defined __stub_inet_pton || defined __stub___inet_pton +choke me +#endif + +int main (void) +{ +return inet_pton (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is prototyped" >&5 +$as_echo_n "checking if inet_pton is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_pton" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_pton="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is compilable" >&5 +$as_echo_n "checking if inet_pton is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_arpa_inet + +int main (void) +{ + + if(0 != inet_pton(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton seems to work" >&5 +$as_echo_n "checking if inet_pton seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stdlib + $cares_includes_arpa_inet + $cares_includes_string + +int main (void) +{ + + unsigned char ipv6a[16+1]; + unsigned char ipv4a[4+1]; + const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; + const char *ipv4src = "192.168.100.1"; + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) + exit(1); /* fail */ + /* - */ + if( (ipv4a[0] != 0xc0) || + (ipv4a[1] != 0xa8) || + (ipv4a[2] != 0x64) || + (ipv4a[3] != 0x01) || + (ipv4a[4] != 0x01) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0] != 0xfe) || + (ipv6a[1] != 0x80) || + (ipv6a[8] != 0x02) || + (ipv6a[9] != 0x14) || + (ipv6a[10] != 0x4f) || + (ipv6a[11] != 0xff) || + (ipv6a[12] != 0xfe) || + (ipv6a[13] != 0x0b) || + (ipv6a[14] != 0x76) || + (ipv6a[15] != 0xc8) || + (ipv6a[16] != 0x01) ) + exit(1); /* fail */ + /* - */ + if( (ipv6a[2] != 0x0) || + (ipv6a[3] != 0x0) || + (ipv6a[4] != 0x0) || + (ipv6a[5] != 0x0) || + (ipv6a[6] != 0x0) || + (ipv6a[7] != 0x0) ) + exit(1); /* fail */ + /* - */ + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_inet_pton="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton usage allowed" >&5 +$as_echo_n "checking if inet_pton usage allowed... " >&6; } + if test "x$cares_disallow_inet_pton" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_pton="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton might be used" >&5 +$as_echo_n "checking if inet_pton might be used... " >&6; } + if test "$tst_links_inet_pton" = "yes" && + test "$tst_proto_inet_pton" = "yes" && + test "$tst_compi_inet_pton" = "yes" && + test "$tst_allow_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_PTON 1 +_ACEOF + + ac_cv_func_inet_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_pton="no" + fi + + +cares_includes_stropts="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_stropts +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_ioctl="unknown" + tst_proto_ioctl="unknown" + tst_compi_ioctl="unknown" + tst_allow_ioctl="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl can be linked" >&5 +$as_echo_n "checking if ioctl can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define ioctl innocuous_ioctl +#ifdef __STDC__ +# include +#else +# include +#endif +#undef ioctl +#ifdef __cplusplus +extern "C" +#endif +char ioctl (); +#if defined __stub_ioctl || defined __stub___ioctl +choke me +#endif + +int main (void) +{ +return ioctl (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctl="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is prototyped" >&5 +$as_echo_n "checking if ioctl is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_stropts + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "ioctl" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctl="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is compilable" >&5 +$as_echo_n "checking if ioctl is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stropts + +int main (void) +{ + + if(0 != ioctl(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl usage allowed" >&5 +$as_echo_n "checking if ioctl usage allowed... " >&6; } + if test "x$cares_disallow_ioctl" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl might be used" >&5 +$as_echo_n "checking if ioctl might be used... " >&6; } + if test "$tst_links_ioctl" = "yes" && + test "$tst_proto_ioctl" = "yes" && + test "$tst_compi_ioctl" = "yes" && + test "$tst_allow_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL 1 +_ACEOF + + ac_cv_func_ioctl="yes" + + # + tst_compi_ioctl_fionbio="unknown" + tst_allow_ioctl_fionbio="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO is compilable" >&5 +$as_echo_n "checking if ioctl FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stropts + +int main (void) +{ + + int flags = 0; + if(0 != ioctl(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO usage allowed" >&5 +$as_echo_n "checking if ioctl FIONBIO usage allowed... " >&6; } + if test "x$cares_disallow_ioctl_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO might be used" >&5 +$as_echo_n "checking if ioctl FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctl_fionbio" = "yes" && + test "$tst_allow_ioctl_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctl_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl_fionbio="no" + fi + + + # + tst_compi_ioctl_siocgifaddr="unknown" + tst_allow_ioctl_siocgifaddr="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR is compilable" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stropts + #include + +int main (void) +{ + + struct ifreq ifr; + if(0 != ioctl(0, SIOCGIFADDR, &ifr)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl_siocgifaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl_siocgifaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR usage allowed" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR usage allowed... " >&6; } + if test "x$cares_disallow_ioctl_siocgifaddr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl_siocgifaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl_siocgifaddr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR might be used" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR might be used... " >&6; } + if test "$tst_compi_ioctl_siocgifaddr" = "yes" && + test "$tst_allow_ioctl_siocgifaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL_SIOCGIFADDR 1 +_ACEOF + + ac_cv_func_ioctl_siocgifaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl_siocgifaddr="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl="no" + fi + + + # + tst_links_ioctlsocket="unknown" + tst_proto_ioctlsocket="unknown" + tst_compi_ioctlsocket="unknown" + tst_allow_ioctlsocket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket can be linked" >&5 +$as_echo_n "checking if ioctlsocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + +int main (void) +{ + + if(0 != ioctlsocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctlsocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is prototyped" >&5 +$as_echo_n "checking if ioctlsocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "ioctlsocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctlsocket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is compilable" >&5 +$as_echo_n "checking if ioctlsocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + +int main (void) +{ + + if(0 != ioctlsocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket usage allowed" >&5 +$as_echo_n "checking if ioctlsocket usage allowed... " >&6; } + if test "x$cares_disallow_ioctlsocket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket might be used" >&5 +$as_echo_n "checking if ioctlsocket might be used... " >&6; } + if test "$tst_links_ioctlsocket" = "yes" && + test "$tst_proto_ioctlsocket" = "yes" && + test "$tst_compi_ioctlsocket" = "yes" && + test "$tst_allow_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET 1 +_ACEOF + + ac_cv_func_ioctlsocket="yes" + + # + tst_compi_ioctlsocket_fionbio="unknown" + tst_allow_ioctlsocket_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO is compilable" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + +int main (void) +{ + + int flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO usage allowed" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO usage allowed... " >&6; } + if test "x$cares_disallow_ioctlsocket_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO might be used" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctlsocket_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctlsocket_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_fionbio="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket="no" + fi + + + # + tst_links_ioctlsocket_camel="unknown" + tst_proto_ioctlsocket_camel="unknown" + tst_compi_ioctlsocket_camel="unknown" + tst_allow_ioctlsocket_camel="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket can be linked" >&5 +$as_echo_n "checking if IoctlSocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define IoctlSocket innocuous_IoctlSocket +#ifdef __STDC__ +# include +#else +# include +#endif +#undef IoctlSocket +#ifdef __cplusplus +extern "C" +#endif +char IoctlSocket (); +#if defined __stub_IoctlSocket || defined __stub___IoctlSocket +choke me +#endif + +int main (void) +{ +return IoctlSocket (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctlsocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is prototyped" >&5 +$as_echo_n "checking if IoctlSocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_stropts + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "IoctlSocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctlsocket_camel="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is compilable" >&5 +$as_echo_n "checking if IoctlSocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stropts + +int main (void) +{ + + if(0 != IoctlSocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket usage allowed" >&5 +$as_echo_n "checking if IoctlSocket usage allowed... " >&6; } + if test "x$cares_disallow_ioctlsocket_camel" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_camel="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket might be used" >&5 +$as_echo_n "checking if IoctlSocket might be used... " >&6; } + if test "$tst_links_ioctlsocket_camel" = "yes" && + test "$tst_proto_ioctlsocket_camel" = "yes" && + test "$tst_compi_ioctlsocket_camel" = "yes" && + test "$tst_allow_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_CAMEL 1 +_ACEOF + + ac_cv_func_ioctlsocket_camel="yes" + + # + tst_compi_ioctlsocket_camel_fionbio="unknown" + tst_allow_ioctlsocket_camel_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO is compilable" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stropts + +int main (void) +{ + + long flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_camel_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_camel_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO usage allowed" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO usage allowed... " >&6; } + if test "x$cares_disallow_ioctlsocket_camel_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_camel_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_camel_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO might be used" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctlsocket_camel_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_camel_fionbio="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_camel="no" + fi + + + # + tst_links_setsockopt="unknown" + tst_proto_setsockopt="unknown" + tst_compi_setsockopt="unknown" + tst_allow_setsockopt="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt can be linked" >&5 +$as_echo_n "checking if setsockopt can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_setsockopt="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is prototyped" >&5 +$as_echo_n "checking if setsockopt is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_sys_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "setsockopt" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_setsockopt="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is compilable" >&5 +$as_echo_n "checking if setsockopt is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_setsockopt="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt usage allowed" >&5 +$as_echo_n "checking if setsockopt usage allowed... " >&6; } + if test "x$cares_disallow_setsockopt" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_setsockopt="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_setsockopt="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt might be used" >&5 +$as_echo_n "checking if setsockopt might be used... " >&6; } + if test "$tst_links_setsockopt" = "yes" && + test "$tst_proto_setsockopt" = "yes" && + test "$tst_compi_setsockopt" = "yes" && + test "$tst_allow_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SETSOCKOPT 1 +_ACEOF + + ac_cv_func_setsockopt="yes" + + # + tst_compi_setsockopt_so_nonblock="unknown" + tst_allow_setsockopt_so_nonblock="unknown" + # + if test "$ac_cv_func_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK is compilable" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_setsockopt_so_nonblock="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_setsockopt_so_nonblock="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK usage allowed" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK usage allowed... " >&6; } + if test "x$cares_disallow_setsockopt_so_nonblock" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_setsockopt_so_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_setsockopt_so_nonblock="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK might be used" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK might be used... " >&6; } + if test "$tst_compi_setsockopt_so_nonblock" = "yes" && + test "$tst_allow_setsockopt_so_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SETSOCKOPT_SO_NONBLOCK 1 +_ACEOF + + ac_cv_func_setsockopt_so_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_setsockopt_so_nonblock="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_setsockopt="no" + fi + + + # + tst_links_socket="unknown" + tst_proto_socket="unknown" + tst_compi_socket="unknown" + tst_allow_socket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket can be linked" >&5 +$as_echo_n "checking if socket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +int main (void) +{ + + if(0 != socket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_socket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is prototyped" >&5 +$as_echo_n "checking if socket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "socket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_socket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is compilable" >&5 +$as_echo_n "checking if socket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_winsock2 + $cares_includes_sys_socket + $cares_includes_socket + +int main (void) +{ + + if(0 != socket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_socket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket usage allowed" >&5 +$as_echo_n "checking if socket usage allowed... " >&6; } + if test "x$cares_disallow_socket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_socket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_socket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket might be used" >&5 +$as_echo_n "checking if socket might be used... " >&6; } + if test "$tst_links_socket" = "yes" && + test "$tst_proto_socket" = "yes" && + test "$tst_compi_socket" = "yes" && + test "$tst_allow_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKET 1 +_ACEOF + + ac_cv_func_socket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_socket="no" + fi + + + # + tst_links_strcasecmp="unknown" + tst_proto_strcasecmp="unknown" + tst_compi_strcasecmp="unknown" + tst_allow_strcasecmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp can be linked" >&5 +$as_echo_n "checking if strcasecmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strcasecmp innocuous_strcasecmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strcasecmp +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +#if defined __stub_strcasecmp || defined __stub___strcasecmp +choke me +#endif + +int main (void) +{ +return strcasecmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strcasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is prototyped" >&5 +$as_echo_n "checking if strcasecmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strcasecmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strcasecmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is compilable" >&5 +$as_echo_n "checking if strcasecmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strcasecmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strcasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp usage allowed" >&5 +$as_echo_n "checking if strcasecmp usage allowed... " >&6; } + if test "x$cares_disallow_strcasecmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strcasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strcasecmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp might be used" >&5 +$as_echo_n "checking if strcasecmp might be used... " >&6; } + if test "$tst_links_strcasecmp" = "yes" && + test "$tst_proto_strcasecmp" = "yes" && + test "$tst_compi_strcasecmp" = "yes" && + test "$tst_allow_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRCASECMP 1 +_ACEOF + + ac_cv_func_strcasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strcasecmp="no" + fi + + + # + tst_links_strcmpi="unknown" + tst_proto_strcmpi="unknown" + tst_compi_strcmpi="unknown" + tst_allow_strcmpi="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi can be linked" >&5 +$as_echo_n "checking if strcmpi can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strcmpi innocuous_strcmpi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strcmpi +#ifdef __cplusplus +extern "C" +#endif +char strcmpi (); +#if defined __stub_strcmpi || defined __stub___strcmpi +choke me +#endif + +int main (void) +{ +return strcmpi (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strcmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is prototyped" >&5 +$as_echo_n "checking if strcmpi is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strcmpi" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strcmpi="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is compilable" >&5 +$as_echo_n "checking if strcmpi is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strcmpi(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strcmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi usage allowed" >&5 +$as_echo_n "checking if strcmpi usage allowed... " >&6; } + if test "x$cares_disallow_strcmpi" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strcmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strcmpi="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi might be used" >&5 +$as_echo_n "checking if strcmpi might be used... " >&6; } + if test "$tst_links_strcmpi" = "yes" && + test "$tst_proto_strcmpi" = "yes" && + test "$tst_compi_strcmpi" = "yes" && + test "$tst_allow_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRCMPI 1 +_ACEOF + + ac_cv_func_strcmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strcmpi="no" + fi + + + # + tst_links_strdup="unknown" + tst_proto_strdup="unknown" + tst_compi_strdup="unknown" + tst_allow_strdup="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup can be linked" >&5 +$as_echo_n "checking if strdup can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strdup innocuous_strdup +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strdup +#ifdef __cplusplus +extern "C" +#endif +char strdup (); +#if defined __stub_strdup || defined __stub___strdup +choke me +#endif + +int main (void) +{ +return strdup (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strdup="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is prototyped" >&5 +$as_echo_n "checking if strdup is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strdup" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strdup="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is compilable" >&5 +$as_echo_n "checking if strdup is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strdup(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strdup="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup usage allowed" >&5 +$as_echo_n "checking if strdup usage allowed... " >&6; } + if test "x$cares_disallow_strdup" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strdup="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strdup="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup might be used" >&5 +$as_echo_n "checking if strdup might be used... " >&6; } + if test "$tst_links_strdup" = "yes" && + test "$tst_proto_strdup" = "yes" && + test "$tst_compi_strdup" = "yes" && + test "$tst_allow_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRDUP 1 +_ACEOF + + ac_cv_func_strdup="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strdup="no" + fi + + + # + tst_links_stricmp="unknown" + tst_proto_stricmp="unknown" + tst_compi_stricmp="unknown" + tst_allow_stricmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp can be linked" >&5 +$as_echo_n "checking if stricmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define stricmp innocuous_stricmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef stricmp +#ifdef __cplusplus +extern "C" +#endif +char stricmp (); +#if defined __stub_stricmp || defined __stub___stricmp +choke me +#endif + +int main (void) +{ +return stricmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_stricmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is prototyped" >&5 +$as_echo_n "checking if stricmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "stricmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_stricmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is compilable" >&5 +$as_echo_n "checking if stricmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != stricmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_stricmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp usage allowed" >&5 +$as_echo_n "checking if stricmp usage allowed... " >&6; } + if test "x$cares_disallow_stricmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_stricmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_stricmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp might be used" >&5 +$as_echo_n "checking if stricmp might be used... " >&6; } + if test "$tst_links_stricmp" = "yes" && + test "$tst_proto_stricmp" = "yes" && + test "$tst_compi_stricmp" = "yes" && + test "$tst_allow_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRICMP 1 +_ACEOF + + ac_cv_func_stricmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_stricmp="no" + fi + + + # + tst_links_strncasecmp="unknown" + tst_proto_strncasecmp="unknown" + tst_compi_strncasecmp="unknown" + tst_allow_strncasecmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp can be linked" >&5 +$as_echo_n "checking if strncasecmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strncasecmp innocuous_strncasecmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strncasecmp +#ifdef __cplusplus +extern "C" +#endif +char strncasecmp (); +#if defined __stub_strncasecmp || defined __stub___strncasecmp +choke me +#endif + +int main (void) +{ +return strncasecmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strncasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is prototyped" >&5 +$as_echo_n "checking if strncasecmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strncasecmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strncasecmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is compilable" >&5 +$as_echo_n "checking if strncasecmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strncasecmp(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strncasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp usage allowed" >&5 +$as_echo_n "checking if strncasecmp usage allowed... " >&6; } + if test "x$cares_disallow_strncasecmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strncasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strncasecmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp might be used" >&5 +$as_echo_n "checking if strncasecmp might be used... " >&6; } + if test "$tst_links_strncasecmp" = "yes" && + test "$tst_proto_strncasecmp" = "yes" && + test "$tst_compi_strncasecmp" = "yes" && + test "$tst_allow_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNCASECMP 1 +_ACEOF + + ac_cv_func_strncasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strncasecmp="no" + fi + + + # + tst_links_strncmpi="unknown" + tst_proto_strncmpi="unknown" + tst_compi_strncmpi="unknown" + tst_allow_strncmpi="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi can be linked" >&5 +$as_echo_n "checking if strncmpi can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strncmpi innocuous_strncmpi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strncmpi +#ifdef __cplusplus +extern "C" +#endif +char strncmpi (); +#if defined __stub_strncmpi || defined __stub___strncmpi +choke me +#endif + +int main (void) +{ +return strncmpi (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strncmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is prototyped" >&5 +$as_echo_n "checking if strncmpi is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strncmpi" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strncmpi="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is compilable" >&5 +$as_echo_n "checking if strncmpi is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strncmpi(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strncmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi usage allowed" >&5 +$as_echo_n "checking if strncmpi usage allowed... " >&6; } + if test "x$cares_disallow_strncmpi" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strncmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strncmpi="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi might be used" >&5 +$as_echo_n "checking if strncmpi might be used... " >&6; } + if test "$tst_links_strncmpi" = "yes" && + test "$tst_proto_strncmpi" = "yes" && + test "$tst_compi_strncmpi" = "yes" && + test "$tst_allow_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNCMPI 1 +_ACEOF + + ac_cv_func_strncmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strncmpi="no" + fi + + + # + tst_links_strnicmp="unknown" + tst_proto_strnicmp="unknown" + tst_compi_strnicmp="unknown" + tst_allow_strnicmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp can be linked" >&5 +$as_echo_n "checking if strnicmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strnicmp innocuous_strnicmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strnicmp +#ifdef __cplusplus +extern "C" +#endif +char strnicmp (); +#if defined __stub_strnicmp || defined __stub___strnicmp +choke me +#endif + +int main (void) +{ +return strnicmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strnicmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is prototyped" >&5 +$as_echo_n "checking if strnicmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strnicmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strnicmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is compilable" >&5 +$as_echo_n "checking if strnicmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_string + +int main (void) +{ + + if(0 != strnicmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strnicmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp usage allowed" >&5 +$as_echo_n "checking if strnicmp usage allowed... " >&6; } + if test "x$cares_disallow_strnicmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strnicmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strnicmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp might be used" >&5 +$as_echo_n "checking if strnicmp might be used... " >&6; } + if test "$tst_links_strnicmp" = "yes" && + test "$tst_proto_strnicmp" = "yes" && + test "$tst_compi_strnicmp" = "yes" && + test "$tst_allow_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNICMP 1 +_ACEOF + + ac_cv_func_strnicmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strnicmp="no" + fi + + +cares_includes_sys_uio="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_UIO_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/uio.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$cares_includes_sys_uio +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_writev="unknown" + tst_proto_writev="unknown" + tst_compi_writev="unknown" + tst_allow_writev="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev can be linked" >&5 +$as_echo_n "checking if writev can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define writev innocuous_writev +#ifdef __STDC__ +# include +#else +# include +#endif +#undef writev +#ifdef __cplusplus +extern "C" +#endif +char writev (); +#if defined __stub_writev || defined __stub___writev +choke me +#endif + +int main (void) +{ +return writev (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_writev="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is prototyped" >&5 +$as_echo_n "checking if writev is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_sys_uio + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "writev" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_writev="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is compilable" >&5 +$as_echo_n "checking if writev is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_sys_uio + +int main (void) +{ + + if(0 != writev(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_writev="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev usage allowed" >&5 +$as_echo_n "checking if writev usage allowed... " >&6; } + if test "x$cares_disallow_writev" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_writev="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_writev="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev might be used" >&5 +$as_echo_n "checking if writev might be used... " >&6; } + if test "$tst_links_writev" = "yes" && + test "$tst_proto_writev" = "yes" && + test "$tst_compi_writev" = "yes" && + test "$tst_allow_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_WRITEV 1 +_ACEOF + + ac_cv_func_writev="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_writev="no" + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PF_INET6" >&5 +$as_echo_n "checking for PF_INET6... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + + + #ifdef PF_INET6 + VARIABLEWASDEFINED + #else + NJET + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "VARIABLEWASDEFINED" >/dev/null 2>&1; then : + ac_constant="yes" +else + ac_constant="no" + +fi +rm -f conftest* + + if test "$ac_constant" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_PF_INET6 1 +_ACEOF + + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AF_INET6" >&5 +$as_echo_n "checking for AF_INET6... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + + + #ifdef AF_INET6 + VARIABLEWASDEFINED + #else + NJET + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "VARIABLEWASDEFINED" >/dev/null 2>&1; then : + ac_constant="yes" +else + ac_constant="no" + +fi +rm -f conftest* + + if test "$ac_constant" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_AF_INET6 1 +_ACEOF + + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct in6_addr" >&5 +$as_echo_n "checking for struct in6_addr... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#endif + +int main (void) +{ + + struct in6_addr struct_instance; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_struct="yes" +else + ac_found="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$ac_struct" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN6_ADDR 1 +_ACEOF + + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_in6" >&5 +$as_echo_n "checking for struct sockaddr_in6... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#endif + +int main (void) +{ + + struct sockaddr_in6 struct_instance; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_struct="yes" +else + ac_found="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$ac_struct" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_IN6 1 +_ACEOF + ac_have_sockaddr_in6=yes + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + fi + + +ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#endif + +" +if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 +_ACEOF + + +fi + + +ac_fn_c_check_member "$LINENO" "struct addrinfo" "ai_flags" "ac_cv_member_struct_addrinfo_ai_flags" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#endif + + +" +if test "x$ac_cv_member_struct_addrinfo_ai_flags" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ADDRINFO 1 +_ACEOF + +fi + + + +for ac_func in bitncmp \ + gettimeofday \ + if_indextoname + +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + + +else + + func="$ac_func" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for $func" >&5 +$as_echo_n "checking deeper for $func... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + $func (); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + eval "ac_cv_func_$func=yes" + +cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$func" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | sed 's/^A-Z0-9_/_/g'` 1 +_ACEOF + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +done + + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of struct in6_addr" >&5 +$as_echo_n "checking size of struct in6_addr... " >&6; } +if ${ac_cv_sizeof_struct_in6_addr+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct in6_addr))" "ac_cv_sizeof_struct_in6_addr" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#endif + + +"; then : + +else + if test "$ac_cv_type_struct_in6_addr" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (struct in6_addr) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_struct_in6_addr=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_struct_in6_addr" >&5 +$as_echo "$ac_cv_sizeof_struct_in6_addr" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_STRUCT_IN6_ADDR $ac_cv_sizeof_struct_in6_addr +_ACEOF + + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of struct in_addr" >&5 +$as_echo_n "checking size of struct in_addr... " >&6; } +if ${ac_cv_sizeof_struct_in_addr+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct in_addr))" "ac_cv_sizeof_struct_in_addr" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#endif + + +"; then : + +else + if test "$ac_cv_type_struct_in_addr" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (struct in_addr) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_struct_in_addr=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_struct_in_addr" >&5 +$as_echo "$ac_cv_sizeof_struct_in_addr" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_STRUCT_IN_ADDR $ac_cv_sizeof_struct_in_addr +_ACEOF + + + + + + for ac_header in sys/types.h sys/socket.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo" >&5 +$as_echo_n "checking for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getnameinfo innocuous_getnameinfo +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getnameinfo +#ifdef __cplusplus +extern "C" +#endif +char getnameinfo (); +#if defined __stub_getnameinfo || defined __stub___getnameinfo +choke me +#endif + +int main (void) +{ +return getnameinfo (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_getnameinfo" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for getnameinfo" >&5 +$as_echo_n "checking deeper for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + getnameinfo(); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$curl_cv_getnameinfo" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper and deeper for getnameinfo" >&5 +$as_echo_n "checking deeper and deeper for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#endif + +int main (void) +{ + + getnameinfo(0, 0, 0, 0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$curl_cv_getnameinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for getnameinfo" >&5 +$as_echo_n "checking types of arguments for getnameinfo... " >&6; } +if ${curl_cv_func_getnameinfo_args+:} false; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_getnameinfo_args="unknown" + for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do + for gni_arg2 in 'socklen_t' 'size_t' 'int'; do + for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do + for gni_arg7 in 'int' 'unsigned int'; do + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#define GNICALLCONV WSAAPI +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#define GNICALLCONV +#endif + extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, + char *, $gni_arg46, + char *, $gni_arg46, + $gni_arg7); + +int main (void) +{ + + $gni_arg2 salen=0; + $gni_arg46 hostlen=0; + $gni_arg46 servlen=0; + $gni_arg7 flags=0; + int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_getnameinfo_args" >&5 +$as_echo "$curl_cv_func_getnameinfo_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for getnameinfo args" >&5 +$as_echo "$as_me: WARNING: Cannot find proper types to use for getnameinfo args" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_GETNAMEINFO will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_GETNAMEINFO will not be defined" >&2;} + else + gni_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` + IFS=$gni_prev_IFS + shift + # + gni_qual_type_arg1=$1 + # + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG2 $2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG46 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG7 $4 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$gni_qual_type_arg1" in + const*) + gni_qual_arg1=const + gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` + ;; + *) + gni_qual_arg1= + gni_type_arg1=$gni_qual_type_arg1 + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_QUAL_ARG1 $gni_qual_arg1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG1 $gni_type_arg1 +_ACEOF + + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETNAMEINFO 1 +_ACEOF + + ac_cv_func_getnameinfo="yes" + fi + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int main (void) +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + +$as_echo "#define ARES_BIG_ENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: couldn't figure out endianess, assuming little endian!" >&5 +$as_echo "$as_me: WARNING: couldn't figure out endianess, assuming little endian!" >&2;} + ;; + esac + + + +# Check whether --with-random was given. +if test "${with_random+set}" = set; then : + withval=$with_random; RANDOM_FILE="$withval" +else + + if test "$cross_compiling" = "no"; then + as_ac_File=`$as_echo "ac_cv_file_"/dev/urandom"" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/urandom\"" >&5 +$as_echo_n "checking for \"/dev/urandom\"... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r ""/dev/urandom""; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + RANDOM_FILE="/dev/urandom" +fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&5 +$as_echo "$as_me: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&2;} + fi + + + +fi + +if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then + + +cat >>confdefs.h <<_ACEOF +#define RANDOM_FILE "$RANDOM_FILE" +_ACEOF + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable non-blocking communications" >&5 +$as_echo_n "checking whether to enable non-blocking communications... " >&6; } + OPT_NONBLOCKING="default" + # Check whether --enable-nonblocking was given. +if test "${enable_nonblocking+set}" = set; then : + enableval=$enable_nonblocking; OPT_NONBLOCKING=$enableval +fi + + case "$OPT_NONBLOCKING" in + no) + want_nonblocking="no" + ;; + default) + want_nonblocking="yes" + ;; + *) + want_nonblocking="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_nonblocking" >&5 +$as_echo "$want_nonblocking" >&6; } + + + # + tst_method="unknown" + if test "$want_nonblocking" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to set a socket into non-blocking mode" >&5 +$as_echo_n "checking how to set a socket into non-blocking mode... " >&6; } + if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then + tst_method="fcntl O_NONBLOCK" + elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then + tst_method="ioctl FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then + tst_method="ioctlsocket FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then + tst_method="IoctlSocket FIONBIO" + elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then + tst_method="setsockopt SO_NONBLOCK" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_method" >&5 +$as_echo "$tst_method" >&6; } + if test "$tst_method" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine non-blocking socket method." >&5 +$as_echo "$as_me: WARNING: cannot determine non-blocking socket method." >&2;} + fi + fi + if test "$tst_method" = "unknown"; then + +cat >>confdefs.h <<_ACEOF +#define USE_BLOCKING_SOCKETS 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: non-blocking sockets disabled." >&5 +$as_echo "$as_me: WARNING: non-blocking sockets disabled." >&2;} + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether hiding of library internal symbols will actually happen" >&5 +$as_echo_n "checking whether hiding of library internal symbols will actually happen... " >&6; } + CFLAG_CARES_SYMBOL_HIDING="" + doing_symbol_hiding="no" + if test x"$ac_cv_native_windows" != "xyes" && + test "$want_symbol_hiding" = "yes" && + test "$supports_symbol_hiding" = "yes"; then + doing_symbol_hiding="yes" + CFLAG_CARES_SYMBOL_HIDING="$symbol_hiding_CFLAGS" + +cat >>confdefs.h <<_ACEOF +#define CARES_SYMBOL_SCOPE_EXTERN $symbol_hiding_EXTERN +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + if test x$doing_symbol_hiding = xyes; then + DOING_CARES_SYMBOL_HIDING_TRUE= + DOING_CARES_SYMBOL_HIDING_FALSE='#' +else + DOING_CARES_SYMBOL_HIDING_TRUE='#' + DOING_CARES_SYMBOL_HIDING_FALSE= +fi + + + + +CARES_PRIVATE_LIBS="$LIBS" + + +CARES_CFLAG_EXTRAS="" +if test X"$want_werror" = Xyes; then + CARES_CFLAG_EXTRAS="-Werror" +fi + + + +squeeze CFLAGS +squeeze CPPFLAGS +squeeze DEFS +squeeze LDFLAGS +squeeze LIBS + +squeeze CARES_PRIVATE_LIBS + +ac_config_files="$ac_config_files Makefile libcares.pc" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_CPPFLAG_CARES_BUILDING_LIBRARY_TRUE}" && test -z "${USE_CPPFLAG_CARES_BUILDING_LIBRARY_FALSE}"; then + as_fn_error $? "conditional \"USE_CPPFLAG_CARES_BUILDING_LIBRARY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_CPPFLAG_CARES_STATICLIB_TRUE}" && test -z "${USE_CPPFLAG_CARES_STATICLIB_FALSE}"; then + as_fn_error $? "conditional \"USE_CPPFLAG_CARES_STATICLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${NO_UNDEFINED_TRUE}" && test -z "${NO_UNDEFINED_FALSE}"; then + as_fn_error $? "conditional \"NO_UNDEFINED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CURLDEBUG_TRUE}" && test -z "${CURLDEBUG_FALSE}"; then + as_fn_error $? "conditional \"CURLDEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DOING_NATIVE_WINDOWS_TRUE}" && test -z "${DOING_NATIVE_WINDOWS_FALSE}"; then + as_fn_error $? "conditional \"DOING_NATIVE_WINDOWS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${DOING_CARES_SYMBOL_HIDING_TRUE}" && test -z "${DOING_CARES_SYMBOL_HIDING_FALSE}"; then + as_fn_error $? "conditional \"DOING_CARES_SYMBOL_HIDING\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by c-ares $as_me -, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +c-ares config.status - +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in AS \ +DLLTOOL \ +OBJDUMP \ +SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "ares_config.h") CONFIG_HEADERS="$CONFIG_HEADERS ares_config.h" ;; + "ares_build.h") CONFIG_HEADERS="$CONFIG_HEADERS ares_build.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "libcares.pc") CONFIG_FILES="$CONFIG_FILES libcares.pc" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Assembler program. +AS=$lt_AS + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Object dumper program. +OBJDUMP=$lt_OBJDUMP + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff -Nru python-gevent-0.13.7/c-ares/config-win32.h python-gevent-1.0/c-ares/config-win32.h --- python-gevent-0.13.7/c-ares/config-win32.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/config-win32.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,385 @@ +#ifndef HEADER_CARES_CONFIG_WIN32_H +#define HEADER_CARES_CONFIG_WIN32_H + +/* Copyright (C) 2004 - 2011 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* ================================================================ */ +/* c-ares/config-win32.h - Hand crafted config file for Windows */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__POCC__) +#define HAVE_GETOPT_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_PROCESS_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__POCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WINSOCK2_H 1 +#endif + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WS2TCPIP_H 1 +#endif + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you have the getenv function. */ +#define HAVE_GETENV 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +#define HAVE_STRNICMP 1 + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Specifics for the Watt-32 tcp/ip stack. */ +#ifdef WATT32 + #define SOCKET int + #define NS_INADDRSZ 4 + #define HAVE_ARPA_NAMESER_H 1 + #define HAVE_ARPA_INET_H 1 + #define HAVE_NETDB_H 1 + #define HAVE_NETINET_IN_H 1 + #define HAVE_SYS_SOCKET_H 1 + #define HAVE_NETINET_TCP_H 1 + #define HAVE_AF_INET6 1 + #define HAVE_PF_INET6 1 + #define HAVE_STRUCT_IN6_ADDR 1 + #define HAVE_STRUCT_SOCKADDR_IN6 1 + #undef HAVE_WINSOCK_H + #undef HAVE_WINSOCK2_H + #undef HAVE_WS2TCPIP_H +#endif + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define if in_addr_t is not an available 'typedefed' type. */ +#define in_addr_t unsigned long + +/* Define to the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define if ssize_t is not an available 'typedefed' type. */ +#ifndef _SSIZE_T_DEFINED +# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ + defined(__POCC__) || \ + defined(__MINGW32__) +# elif defined(_WIN64) +# define _SSIZE_T_DEFINED +# define ssize_t __int64 +# else +# define _SSIZE_T_DEFINED +# define ssize_t int +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* Define to the size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* Define to the size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define to the size of `size_t', as computed by sizeof. */ +#if defined(_WIN64) +# define SIZEOF_SIZE_T 8 +#else +# define SIZEOF_SIZE_T 4 +#endif + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define if you have struct addrinfo. */ +#define HAVE_STRUCT_ADDRINFO 1 + +/* Define if you have struct sockaddr_storage. */ +#if !defined(__SALFORDC__) && !defined(__BORLANDC__) +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define if you have struct timeval. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Define to avoid VS2005 complaining about portable C functions. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# define _CRT_SECURE_NO_DEPRECATE 1 +# define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows + 2000 as a supported build target. VS2008 default installations provide + an embedded Windows SDK v6.0A along with the claim that Windows 2000 is + a valid build target for VS2008. Popular belief is that binaries built + with VS2008 using Windows SDK versions 6.X and Windows 2000 as a build + target are functional. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_MIN_TARGET 0x0500 +#endif + +/* When no build target is specified VS2008 default build target is Windows + Vista, which leaves out even Winsows XP. If no build target has been given + for VS2008 we will target the minimum Officially supported build target, + which happens to be Windows XP. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_DEF_TARGET 0x0501 +#endif + +/* VS2008 default target settings and minimum build target check. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2008_DEF_TARGET +# endif +# ifndef WINVER +# define WINVER VS2008_DEF_TARGET +# endif +# if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET) +# error VS2008 does not support Windows build targets prior to Windows 2000 +# endif +#endif + +/* When no build target is specified Pelles C 5.00 and later default build + target is Windows Vista. We override default target to be Windows 2000. */ +#if defined(__POCC__) && (__POCC__ >= 500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef WINVER +# define WINVER 0x0500 +# endif +#endif + +/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is + quite convoluted, compiler dependent and even build target dependent. */ +#if defined(HAVE_WS2TCPIP_H) +# if defined(__POCC__) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETNAMEINFO 1 +# endif +#endif + +#if defined(__POCC__) +# ifndef _MSC_VER +# error Microsoft extensions /Ze compiler option is required +# endif +# ifndef __POCC__OLDNAMES +# error Compatibility names /Go compiler option is required +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* IPV6 COMPATIBILITY */ +/* ---------------------------------------------------------------- */ + +/* Define if you have address family AF_INET6. */ +#ifdef HAVE_WINSOCK2_H +#define HAVE_AF_INET6 1 +#endif + +/* Define if you have protocol family PF_INET6. */ +#ifdef HAVE_WINSOCK2_H +#define HAVE_PF_INET6 1 +#endif + +/* Define if you have struct in6_addr. */ +#ifdef HAVE_WS2TCPIP_H +#define HAVE_STRUCT_IN6_ADDR 1 +#endif + +/* Define if you have struct sockaddr_in6. */ +#ifdef HAVE_WS2TCPIP_H +#define HAVE_STRUCT_SOCKADDR_IN6 1 +#endif + +/* Define if you have sockaddr_in6 with scopeid. */ +#ifdef HAVE_WS2TCPIP_H +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 +#endif + +/* ---------------------------------------------------------------- */ +/* Win CE */ +/* ---------------------------------------------------------------- */ + +/* FIXME: A proper config-win32ce.h should be created to hold these */ + +/* + * System error codes for Windows CE + */ + +#if defined(_WIN32_WCE) && !defined(HAVE_ERRNO_H) +# define ENOENT ERROR_FILE_NOT_FOUND +# define ESRCH ERROR_PATH_NOT_FOUND +# define ENOMEM ERROR_NOT_ENOUGH_MEMORY +# define ENOSPC ERROR_INVALID_PARAMETER +#endif + +#endif /* HEADER_CARES_CONFIG_WIN32_H */ diff -Nru python-gevent-0.13.7/c-ares/get_ver.awk python-gevent-1.0/c-ares/get_ver.awk --- python-gevent-0.13.7/c-ares/get_ver.awk 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/get_ver.awk 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,27 @@ +# *************************************************************************** +# * Project: c-ares +# * +# *************************************************************************** +# awk script which fetches c-ares version number and string from input +# file and writes them to STDOUT. Here you can get an awk version for Win32: +# http://www.gknw.net/development/prgtools/awk-20100523.zip +# +BEGIN { + while ((getline < ARGV[1]) > 0) { + sub("\r", "") # make MSYS gawk work with CRLF header input. + if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) + copyright_string = substr($0, 25, length($0)-25) + else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) + version_string = substr($3, 2, length($3)-2) + else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) + version_major = $3 + else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) + version_minor = $3 + else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) + version_patch = $3 + } + print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch + print "LIBCARES_VERSION_STR = " version_string + print "LIBCARES_COPYRIGHT_STR = " copyright_string +} + diff -Nru python-gevent-0.13.7/c-ares/gitinfo python-gevent-1.0/c-ares/gitinfo --- python-gevent-0.13.7/c-ares/gitinfo 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/gitinfo 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1 @@ +cares-1_9_1-12-g805c736 diff -Nru python-gevent-0.13.7/c-ares/inet_net_pton.c python-gevent-1.0/c-ares/inet_net_pton.c --- python-gevent-0.13.7/c-ares/inet_net_pton.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/inet_net_pton.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,451 @@ + +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include +#include + +#include "ares.h" +#include "ares_ipv6.h" +#include "ares_nowarn.h" +#include "inet_net_pton.h" + + +const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; + + +#ifndef HAVE_INET_NET_PTON + +/* + * static int + * inet_net_pton_ipv4(src, dst, size) + * convert IPv4 network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not an IPv4 network specification. + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0b11110000 in its fourth octet. + * note: + * On Windows we store the error in the thread errno, not + * in the winsock error code. This is to avoid loosing the + * actual last winsock error. So use macro ERRNO to fetch the + * errno this funtion sets when returning (-1), not SOCKERRNO. + * author: + * Paul Vixie (ISC), June 1996 + */ +static int +inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) +{ + static const char xdigits[] = "0123456789abcdef"; + static const char digits[] = "0123456789"; + int n, ch, tmp = 0, dirty, bits; + const unsigned char *odst = dst; + + ch = *src++; + if (ch == '0' && (src[0] == 'x' || src[0] == 'X') + && ISASCII(src[1]) + && ISXDIGIT(src[1])) { + /* Hexadecimal: Eat nybble string. */ + if (!size) + goto emsgsize; + dirty = 0; + src++; /* skip x or X. */ + while ((ch = *src++) != '\0' && ISASCII(ch) && ISXDIGIT(ch)) { + if (ISUPPER(ch)) + ch = tolower(ch); + n = aresx_sztosi(strchr(xdigits, ch) - xdigits); + if (dirty == 0) + tmp = n; + else + tmp = (tmp << 4) | n; + if (++dirty == 2) { + if (!size--) + goto emsgsize; + *dst++ = (unsigned char) tmp; + dirty = 0; + } + } + if (dirty) { /* Odd trailing nybble? */ + if (!size--) + goto emsgsize; + *dst++ = (unsigned char) (tmp << 4); + } + } else if (ISASCII(ch) && ISDIGIT(ch)) { + /* Decimal: eat dotted digit string. */ + for (;;) { + tmp = 0; + do { + n = aresx_sztosi(strchr(digits, ch) - digits); + tmp *= 10; + tmp += n; + if (tmp > 255) + goto enoent; + } while ((ch = *src++) != '\0' && + ISASCII(ch) && ISDIGIT(ch)); + if (!size--) + goto emsgsize; + *dst++ = (unsigned char) tmp; + if (ch == '\0' || ch == '/') + break; + if (ch != '.') + goto enoent; + ch = *src++; + if (!ISASCII(ch) || !ISDIGIT(ch)) + goto enoent; + } + } else + goto enoent; + + bits = -1; + if (ch == '/' && ISASCII(src[0]) && + ISDIGIT(src[0]) && dst > odst) { + /* CIDR width specifier. Nothing can follow it. */ + ch = *src++; /* Skip over the /. */ + bits = 0; + do { + n = aresx_sztosi(strchr(digits, ch) - digits); + bits *= 10; + bits += n; + if (bits > 32) + goto enoent; + } while ((ch = *src++) != '\0' && ISASCII(ch) && ISDIGIT(ch)); + if (ch != '\0') + goto enoent; + } + + /* Firey death and destruction unless we prefetched EOS. */ + if (ch != '\0') + goto enoent; + + /* If nothing was written to the destination, we found no address. */ + if (dst == odst) + goto enoent; + /* If no CIDR spec was given, infer width from net class. */ + if (bits == -1) { + if (*odst >= 240) /* Class E */ + bits = 32; + else if (*odst >= 224) /* Class D */ + bits = 8; + else if (*odst >= 192) /* Class C */ + bits = 24; + else if (*odst >= 128) /* Class B */ + bits = 16; + else /* Class A */ + bits = 8; + /* If imputed mask is narrower than specified octets, widen. */ + if (bits < ((dst - odst) * 8)) + bits = aresx_sztosi(dst - odst) * 8; + /* + * If there are no additional bits specified for a class D + * address adjust bits to 4. + */ + if (bits == 8 && *odst == 224) + bits = 4; + } + /* Extend network to cover the actual mask. */ + while (bits > ((dst - odst) * 8)) { + if (!size--) + goto emsgsize; + *dst++ = '\0'; + } + return (bits); + + enoent: + SET_ERRNO(ENOENT); + return (-1); + + emsgsize: + SET_ERRNO(EMSGSIZE); + return (-1); +} + +static int +getbits(const char *src, int *bitsp) +{ + static const char digits[] = "0123456789"; + int n; + int val; + char ch; + + val = 0; + n = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + pch = strchr(digits, ch); + if (pch != NULL) { + if (n++ != 0 && val == 0) /* no leading zeros */ + return (0); + val *= 10; + val += aresx_sztosi(pch - digits); + if (val > 128) /* range */ + return (0); + continue; + } + return (0); + } + if (n == 0) + return (0); + *bitsp = val; + return (1); +} + +static int +getv4(const char *src, unsigned char *dst, int *bitsp) +{ + static const char digits[] = "0123456789"; + unsigned char *odst = dst; + int n; + unsigned int val; + char ch; + + val = 0; + n = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + pch = strchr(digits, ch); + if (pch != NULL) { + if (n++ != 0 && val == 0) /* no leading zeros */ + return (0); + val *= 10; + val += aresx_sztoui(pch - digits); + if (val > 255) /* range */ + return (0); + continue; + } + if (ch == '.' || ch == '/') { + if (dst - odst > 3) /* too many octets? */ + return (0); + *dst++ = (unsigned char)val; + if (ch == '/') + return (getbits(src, bitsp)); + val = 0; + n = 0; + continue; + } + return (0); + } + if (n == 0) + return (0); + if (dst - odst > 3) /* too many octets? */ + return (0); + *dst = (unsigned char)val; + return 1; +} + +static int +inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + unsigned int val; + int digits; + int bits; + size_t bytes; + int words; + int ipv4; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + goto enoent; + curtok = src; + saw_xdigit = 0; + val = 0; + digits = 0; + bits = -1; + ipv4 = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= aresx_sztoui(pch - xdigits); + if (++digits > 4) + goto enoent; + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + goto enoent; + colonp = tp; + continue; + } else if (*src == '\0') + goto enoent; + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (unsigned char)((val >> 8) & 0xff); + *tp++ = (unsigned char)(val & 0xff); + saw_xdigit = 0; + digits = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + getv4(curtok, tp, &bits) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + ipv4 = 1; + break; /* '\0' was seen by inet_pton4(). */ + } + if (ch == '/' && getbits(src, &bits) > 0) + break; + goto enoent; + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + goto enoent; + *tp++ = (unsigned char)((val >> 8) & 0xff); + *tp++ = (unsigned char)(val & 0xff); + } + if (bits == -1) + bits = 128; + + words = (bits + 15) / 16; + if (words < 2) + words = 2; + if (ipv4) + words = 8; + endp = tmp + 2 * words; + + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const ssize_t n = tp - colonp; + ssize_t i; + + if (tp == endp) + goto enoent; + for (i = 1; i <= n; i++) { + *(endp - i) = *(colonp + n - i); + *(colonp + n - i) = 0; + } + tp = endp; + } + if (tp != endp) + goto enoent; + + bytes = (bits + 7) / 8; + if (bytes > size) + goto emsgsize; + memcpy(dst, tmp, bytes); + return (bits); + + enoent: + SET_ERRNO(ENOENT); + return (-1); + + emsgsize: + SET_ERRNO(EMSGSIZE); + return (-1); +} + +/* + * int + * inet_net_pton(af, src, dst, size) + * convert network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not a valid network specification. + * note: + * On Windows we store the error in the thread errno, not + * in the winsock error code. This is to avoid loosing the + * actual last winsock error. So use macro ERRNO to fetch the + * errno this funtion sets when returning (-1), not SOCKERRNO. + * author: + * Paul Vixie (ISC), June 1996 + */ +int +ares_inet_net_pton(int af, const char *src, void *dst, size_t size) +{ + switch (af) { + case AF_INET: + return (inet_net_pton_ipv4(src, dst, size)); + case AF_INET6: + return (inet_net_pton_ipv6(src, dst, size)); + default: + SET_ERRNO(EAFNOSUPPORT); + return (-1); + } +} + +#endif /* HAVE_INET_NET_PTON */ + +#ifndef HAVE_INET_PTON +int ares_inet_pton(int af, const char *src, void *dst) +{ + int result; + size_t size; + + if (af == AF_INET) + size = sizeof(struct in_addr); + else if (af == AF_INET6) + size = sizeof(struct ares_in6_addr); + else + { + SET_ERRNO(EAFNOSUPPORT); + return -1; + } + result = ares_inet_net_pton(af, src, dst, size); + if (result == -1 && ERRNO == ENOENT) + return 0; + return (result > -1 ? 1 : -1); +} +#endif diff -Nru python-gevent-0.13.7/c-ares/inet_net_pton.h python-gevent-1.0/c-ares/inet_net_pton.h --- python-gevent-0.13.7/c-ares/inet_net_pton.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/inet_net_pton.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,31 @@ +#ifndef HEADER_CARES_INET_NET_PTON_H +#define HEADER_CARES_INET_NET_PTON_H + +/* Copyright (C) 2005-2010 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifdef HAVE_INET_PTON +#define ares_inet_pton(x,y,z) inet_pton(x,y,z) +#else +int ares_inet_pton(int af, const char *src, void *dst); +#endif + +#ifdef HAVE_INET_NET_PTON +#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z) +#else +int ares_inet_net_pton(int af, const char *src, void *dst, size_t size); +#endif + +#endif /* HEADER_CARES_INET_NET_PTON_H */ diff -Nru python-gevent-0.13.7/c-ares/inet_ntop.c python-gevent-1.0/c-ares/inet_ntop.c --- python-gevent-0.13.7/c-ares/inet_ntop.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/inet_ntop.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ares_setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#else +# include "nameser.h" +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +#include +#include +#include +#include + +#include "ares.h" +#include "ares_ipv6.h" +#include "inet_ntop.h" + + +#ifndef HAVE_INET_NTOP + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size); +static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * note: + * On Windows we store the error in the thread errno, not + * in the winsock error code. This is to avoid loosing the + * actual last winsock error. So use macro ERRNO to fetch the + * errno this funtion sets when returning NULL, not SOCKERRNO. + * author: + * Paul Vixie, 1996. + */ +const char * +ares_inet_ntop(int af, const void *src, char *dst, size_t size) +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + SET_ERRNO(EAFNOSUPPORT); + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a unsigned char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(const unsigned char *src, char *dst, size_t size) +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof("255.255.255.255")]; + + if ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size) { + SET_ERRNO(ENOSPC); + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(const unsigned char *src, char *dst, size_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char *tp; + struct { int base, len; } best, cur; + unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof(words)); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + best.len = 0; + cur.base = -1; + cur.len = 0; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && (best.len == 6 || + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += sprintf(tp, "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + SET_ERRNO(ENOSPC); + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} +#endif diff -Nru python-gevent-0.13.7/c-ares/inet_ntop.h python-gevent-1.0/c-ares/inet_ntop.h --- python-gevent-0.13.7/c-ares/inet_ntop.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/inet_ntop.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef __ARES_INET_NTOP_H +#define __ARES_INET_NTOP_H + + +/* Copyright (C) 2005 by Dominick Meglio + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifdef HAVE_INET_NTOP +#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z) +#else +const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size); +#endif + +#endif /* __ARES_INET_NTOP_H */ diff -Nru python-gevent-0.13.7/c-ares/install-sh python-gevent-1.0/c-ares/install-sh --- python-gevent-0.13.7/c-ares/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/install-sh 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,250 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -Nru python-gevent-0.13.7/c-ares/missing python-gevent-1.0/c-ares/missing --- python-gevent-0.13.7/c-ares/missing 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/missing 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,331 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.13; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru python-gevent-0.13.7/c-ares/nameser.h python-gevent-1.0/c-ares/nameser.h --- python-gevent-0.13.7/c-ares/nameser.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/nameser.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,203 @@ + +#ifndef ARES_NAMESER_H +#define ARES_NAMESER_H + +/* header file provided by liren@vivisimo.com */ + +#ifndef HAVE_ARPA_NAMESER_H + +#define NS_PACKETSZ 512 /* maximum packet size */ +#define NS_MAXDNAME 256 /* maximum domain name */ +#define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#define NS_MAXLABEL 63 +#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define NS_INT16SZ 2 +#define NS_INADDRSZ 4 +#define NS_IN6ADDRSZ 16 +#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ + +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_apl = 42, /* Address prefix list (RFC3123) */ + ns_t_ds = 43, /* Delegation Signer (RFC4034) */ + ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ + ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ + ns_t_nsec = 47, /* Next Secure (RFC4034) */ + ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ + ns_t_tkey = 249, /* Transaction key */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ + ns_t_max = 65536 +} ns_type; + +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are TSIG extended errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +#endif /* HAVE_ARPA_NAMESER_H */ + +#ifndef HAVE_ARPA_NAMESER_COMPAT_H + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define QUERY ns_o_query + +#define SERVFAIL ns_r_servfail +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#undef NOERROR /* it seems this is already defined in winerror.h */ +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define NXDOMAIN ns_r_nxdomain + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_DS ns_t_ds +#define T_SSHFP ns_t_sshfp +#define T_RRSIG ns_t_rrsig +#define T_NSEC ns_t_nsec +#define T_DNSKEY ns_t_dnskey +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ + +#endif /* ARES_NAMESER_H */ diff -Nru python-gevent-0.13.7/c-ares/README python-gevent-1.0/c-ares/README --- python-gevent-0.13.7/c-ares/README 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/README 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,60 @@ +c-ares +====== + +This is c-ares, an asynchronous resolver library. It is intended for +applications which need to perform DNS queries without blocking, or need to +perform multiple DNS queries in parallel. The primary examples of such +applications are servers which communicate with multiple clients and programs +with graphical user interfaces. + +The full source code is available in the 'c-ares' release archives, and in a +git repository: http://github.com/bagder/c-ares + +If you find bugs, correct flaws, have questions or have comments in general in +regard to c-ares (or by all means the original ares too), get in touch with us +on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares + +c-ares is of course distributed under the same MIT-style license as the +original ares. + +You'll find all c-ares details and news here: + + http://c-ares.haxx.se/ + + +NOTES FOR C-ARES HACKERS + +The following notes apply to c-ares version 1.7.0 and later. + +* The distributed ares_build.h file is only intended to be used on systems + which can not run the also distributed configure script. + +* The distributed ares_build.h file is generated as a copy of ares_build.h.dist + when the c-ares source code distribution archive file is originally created. + +* If you check out from git on a non-configure platform, you must run the + appropriate buildconf* script to set up ares_build.h and other local files + before being able of compiling the library. + +* On systems capable of running the configure script, the configure process + will overwrite the distributed ares_build.h file with one that is suitable + and specific to the library being configured and built, this new file is + generated from the ares_build.h.in template file. + +* If you intend to distribute an already compiled c-ares library you _MUST_ + also distribute along with it the generated ares_build.h which has been + used to compile it. Otherwise the library will be of no use for the users of + the library that you have built. It is _your_ responsibility to provide this + file. No one at the c-ares project can know how you have built the library. + +* File ares_build.h includes platform and configuration dependent info, + and must not be modified by anyone. Configure script generates it for you. + +* We cannot assume anything else but very basic compiler features being + present. While c-ares requires an ANSI C compiler to build, some of the + earlier ANSI compilers clearly can't deal with some preprocessor operators. + +* Newlines must remain unix-style for older compilers' sake. + +* Comments must be written in the old-style /* unnested C-fashion */ + diff -Nru python-gevent-0.13.7/c-ares/README.cares python-gevent-1.0/c-ares/README.cares --- python-gevent-0.13.7/c-ares/README.cares 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/README.cares 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,13 @@ +c-ares +====== + +This package is based on ares 1.1.1 (written by Greg Hudson). I decided to +fork and release a separate project since the ares author didn't want the +improvements that were vital for our use of it. + +This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use +within the curl project (hence the letter C) and it makes a nice pun. Also, +c-ares is not API compatible with ares: a new name makes that more obvious to +the public. + +The original libares was distributed at athena-dist.mit.edu:pub/ATHENA/ares. diff -Nru python-gevent-0.13.7/c-ares/RELEASE-NOTES python-gevent-1.0/c-ares/RELEASE-NOTES --- python-gevent-0.13.7/c-ares/RELEASE-NOTES 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/RELEASE-NOTES 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,11 @@ +c-ares version 1.9.1 + +Fixed: + + o include the ares_parse_soa_reply.* files in the tarball + +Thanks go to these friendly people for their efforts and contributions: + + Eugeny Gladkih + +Have fun! diff -Nru python-gevent-0.13.7/c-ares/setup_once.h python-gevent-1.0/c-ares/setup_once.h --- python-gevent-0.13.7/c-ares/setup_once.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/setup_once.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,512 @@ +#ifndef __SETUP_ONCE_H +#define __SETUP_ONCE_H + + +/* Copyright (C) 2004 - 2012 by Daniel Stenberg et al + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + +/******************************************************************** + * NOTICE * + * ======== * + * * + * Content of header files lib/setup_once.h and ares/setup_once.h * + * must be kept in sync. Modify the other one if you change this. * + * * + ********************************************************************/ + + +/* + * Inclusion of common header files. + */ + +#include +#include +#include +#include +#include + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef NEED_MALLOC_H +#include +#endif + +#ifdef NEED_MEMORY_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +#ifdef WIN32 +#include +#include +#endif + +#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T) +#include +#endif + + +/* + * Definition of timeval struct for platforms that don't have it. + */ + +#ifndef HAVE_STRUCT_TIMEVAL +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + + +/* + * If we have the MSG_NOSIGNAL define, make sure we use + * it as the fourth argument of function send() + */ + +#ifdef HAVE_MSG_NOSIGNAL +#define SEND_4TH_ARG MSG_NOSIGNAL +#else +#define SEND_4TH_ARG 0 +#endif + + +#if defined(__minix) +/* Minix doesn't support recv on TCP sockets */ +#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z)) + +#elif defined(HAVE_RECV) +/* + * The definitions for the return type and arguments types + * of functions recv() and send() belong and come from the + * configuration file. Do not define them in any other place. + * + * HAVE_RECV is defined if you have a function named recv() + * which is used to read incoming data from sockets. If your + * function has another name then don't define HAVE_RECV. + * + * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2, + * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also + * be defined. + * + * HAVE_SEND is defined if you have a function named send() + * which is used to write outgoing data on a connected socket. + * If yours has another name then don't define HAVE_SEND. + * + * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2, + * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and + * SEND_TYPE_RETV must also be defined. + */ + +#if !defined(RECV_TYPE_ARG1) || \ + !defined(RECV_TYPE_ARG2) || \ + !defined(RECV_TYPE_ARG3) || \ + !defined(RECV_TYPE_ARG4) || \ + !defined(RECV_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recv + /* */ +#else +#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z), \ + (RECV_TYPE_ARG4)(0)) +#endif +#else /* HAVE_RECV */ +#ifndef sread + /* */ + Error Missing_definition_of_macro_sread + /* */ +#endif +#endif /* HAVE_RECV */ + + +#if defined(__minix) +/* Minix doesn't support send on TCP sockets */ +#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z)) + +#elif defined(HAVE_SEND) +#if !defined(SEND_TYPE_ARG1) || \ + !defined(SEND_QUAL_ARG2) || \ + !defined(SEND_TYPE_ARG2) || \ + !defined(SEND_TYPE_ARG3) || \ + !defined(SEND_TYPE_ARG4) || \ + !defined(SEND_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_send + /* */ +#else +#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z), \ + (SEND_TYPE_ARG4)(SEND_4TH_ARG)) +#endif +#else /* HAVE_SEND */ +#ifndef swrite + /* */ + Error Missing_definition_of_macro_swrite + /* */ +#endif +#endif /* HAVE_SEND */ + + +#if 0 +#if defined(HAVE_RECVFROM) +/* + * Currently recvfrom is only used on udp sockets. + */ +#if !defined(RECVFROM_TYPE_ARG1) || \ + !defined(RECVFROM_TYPE_ARG2) || \ + !defined(RECVFROM_TYPE_ARG3) || \ + !defined(RECVFROM_TYPE_ARG4) || \ + !defined(RECVFROM_TYPE_ARG5) || \ + !defined(RECVFROM_TYPE_ARG6) || \ + !defined(RECVFROM_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recvfrom + /* */ +#else +#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ + (RECVFROM_TYPE_ARG2 *)(b), \ + (RECVFROM_TYPE_ARG3) (bl), \ + (RECVFROM_TYPE_ARG4) (0), \ + (RECVFROM_TYPE_ARG5 *)(f), \ + (RECVFROM_TYPE_ARG6 *)(fl)) +#endif +#else /* HAVE_RECVFROM */ +#ifndef sreadfrom + /* */ + Error Missing_definition_of_macro_sreadfrom + /* */ +#endif +#endif /* HAVE_RECVFROM */ + + +#ifdef RECVFROM_TYPE_ARG6_IS_VOID +# define RECVFROM_ARG6_T int +#else +# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6 +#endif +#endif /* if 0 */ + + +/* + * Function-like macro definition used to close a socket. + */ + +#if defined(HAVE_CLOSESOCKET) +# define sclose(x) closesocket((x)) +#elif defined(HAVE_CLOSESOCKET_CAMEL) +# define sclose(x) CloseSocket((x)) +#else +# define sclose(x) close((x)) +#endif + + +/* + * Uppercase macro versions of ANSI/ISO is*() functions/macros which + * avoid negative number inputs with argument byte codes > 127. + */ + +#define ISSPACE(x) (isspace((int) ((unsigned char)x))) +#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) +#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) +#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) +#define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) +#define ISALPHA(x) (isalpha((int) ((unsigned char)x))) +#define ISPRINT(x) (isprint((int) ((unsigned char)x))) +#define ISUPPER(x) (isupper((int) ((unsigned char)x))) +#define ISLOWER(x) (islower((int) ((unsigned char)x))) +#define ISASCII(x) (isascii((int) ((unsigned char)x))) + +#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \ + (((unsigned char)x) == '\t')) + +#define TOLOWER(x) (tolower((int) ((unsigned char)x))) + + +/* + * 'bool' exists on platforms with , i.e. C99 platforms. + * On non-C99 platforms there's no bool, so define an enum for that. + * On C99 platforms 'false' and 'true' also exist. Enum uses a + * global namespace though, so use bool_false and bool_true. + */ + +#ifndef HAVE_BOOL_T + typedef enum { + bool_false = 0, + bool_true = 1 + } bool; + +/* + * Use a define to let 'true' and 'false' use those enums. There + * are currently no use of true and false in libcurl proper, but + * there are some in the examples. This will cater for any later + * code happening to use true and false. + */ +# define false bool_false +# define true bool_true +# define HAVE_BOOL_T +#endif + + +/* + * Redefine TRUE and FALSE too, to catch current use. With this + * change, 'bool found = 1' will give a warning on MIPSPro, but + * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, + * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. + */ + +#ifndef TRUE +#define TRUE true +#endif +#ifndef FALSE +#define FALSE false +#endif + + +/* + * Macro WHILE_FALSE may be used to build single-iteration do-while loops, + * avoiding compiler warnings. Mostly intended for other macro definitions. + */ + +#define WHILE_FALSE while(0) + +#if defined(_MSC_VER) && !defined(__POCC__) +# undef WHILE_FALSE +# if (_MSC_VER < 1500) +# define WHILE_FALSE while(1, 0) +# else +# define WHILE_FALSE \ +__pragma(warning(push)) \ +__pragma(warning(disable:4127)) \ +while(0) \ +__pragma(warning(pop)) +# endif +#endif + + +/* + * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. + */ + +#ifndef HAVE_SIG_ATOMIC_T +typedef int sig_atomic_t; +#define HAVE_SIG_ATOMIC_T +#endif + + +/* + * Convenience SIG_ATOMIC_T definition + */ + +#ifdef HAVE_SIG_ATOMIC_T_VOLATILE +#define SIG_ATOMIC_T static sig_atomic_t +#else +#define SIG_ATOMIC_T static volatile sig_atomic_t +#endif + + +/* + * Default return type for signal handlers. + */ + +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif + + +/* + * Macro used to include code only in debug builds. + */ + +#ifdef DEBUGBUILD +#define DEBUGF(x) x +#else +#define DEBUGF(x) do { } WHILE_FALSE +#endif + + +/* + * Macro used to include assertion code only in debug builds. + */ + +#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) +#define DEBUGASSERT(x) assert(x) +#else +#define DEBUGASSERT(x) do { } WHILE_FALSE +#endif + + +/* + * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno + * (or equivalent) on this platform to hide platform details to code using it. + */ + +#ifdef USE_WINSOCK +#define SOCKERRNO ((int)WSAGetLastError()) +#define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) +#else +#define SOCKERRNO (errno) +#define SET_SOCKERRNO(x) (errno = (x)) +#endif + + +/* + * Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno + * (or equivalent) on this platform to hide platform details to code using it. + */ + +#if defined(WIN32) && !defined(WATT32) +#define ERRNO ((int)GetLastError()) +#define SET_ERRNO(x) (SetLastError((DWORD)(x))) +#else +#define ERRNO (errno) +#define SET_ERRNO(x) (errno = (x)) +#endif + + +/* + * Portable error number symbolic names defined to Winsock error codes. + */ + +#ifdef USE_WINSOCK +#undef EBADF /* override definition in errno.h */ +#define EBADF WSAEBADF +#undef EINTR /* override definition in errno.h */ +#define EINTR WSAEINTR +#undef EINVAL /* override definition in errno.h */ +#define EINVAL WSAEINVAL +#undef EWOULDBLOCK /* override definition in errno.h */ +#define EWOULDBLOCK WSAEWOULDBLOCK +#undef EINPROGRESS /* override definition in errno.h */ +#define EINPROGRESS WSAEINPROGRESS +#undef EALREADY /* override definition in errno.h */ +#define EALREADY WSAEALREADY +#undef ENOTSOCK /* override definition in errno.h */ +#define ENOTSOCK WSAENOTSOCK +#undef EDESTADDRREQ /* override definition in errno.h */ +#define EDESTADDRREQ WSAEDESTADDRREQ +#undef EMSGSIZE /* override definition in errno.h */ +#define EMSGSIZE WSAEMSGSIZE +#undef EPROTOTYPE /* override definition in errno.h */ +#define EPROTOTYPE WSAEPROTOTYPE +#undef ENOPROTOOPT /* override definition in errno.h */ +#define ENOPROTOOPT WSAENOPROTOOPT +#undef EPROTONOSUPPORT /* override definition in errno.h */ +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#undef EOPNOTSUPP /* override definition in errno.h */ +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#undef EAFNOSUPPORT /* override definition in errno.h */ +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EADDRINUSE /* override definition in errno.h */ +#define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL /* override definition in errno.h */ +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef ENETDOWN /* override definition in errno.h */ +#define ENETDOWN WSAENETDOWN +#undef ENETUNREACH /* override definition in errno.h */ +#define ENETUNREACH WSAENETUNREACH +#undef ENETRESET /* override definition in errno.h */ +#define ENETRESET WSAENETRESET +#undef ECONNABORTED /* override definition in errno.h */ +#define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET /* override definition in errno.h */ +#define ECONNRESET WSAECONNRESET +#undef ENOBUFS /* override definition in errno.h */ +#define ENOBUFS WSAENOBUFS +#undef EISCONN /* override definition in errno.h */ +#define EISCONN WSAEISCONN +#undef ENOTCONN /* override definition in errno.h */ +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#undef ETIMEDOUT /* override definition in errno.h */ +#define ETIMEDOUT WSAETIMEDOUT +#undef ECONNREFUSED /* override definition in errno.h */ +#define ECONNREFUSED WSAECONNREFUSED +#undef ELOOP /* override definition in errno.h */ +#define ELOOP WSAELOOP +#ifndef ENAMETOOLONG /* possible previous definition in errno.h */ +#define ENAMETOOLONG WSAENAMETOOLONG +#endif +#define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH /* override definition in errno.h */ +#define EHOSTUNREACH WSAEHOSTUNREACH +#ifndef ENOTEMPTY /* possible previous definition in errno.h */ +#define ENOTEMPTY WSAENOTEMPTY +#endif +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE +#endif + + +/* + * Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid() + */ + +#if defined(__VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#define getpwuid __32_getpwuid +#endif + + +/* + * Macro argv_item_t hides platform details to code using it. + */ + +#ifdef __VMS +#define argv_item_t __char_ptr32 +#else +#define argv_item_t char * +#endif + + +/* + * We use this ZERO_NULL to avoid picky compiler warnings, + * when assigning a NULL pointer to a function pointer var. + */ + +#define ZERO_NULL 0 + + +#endif /* __SETUP_ONCE_H */ diff -Nru python-gevent-0.13.7/c-ares/TODO python-gevent-1.0/c-ares/TODO --- python-gevent-0.13.7/c-ares/TODO 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/TODO 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,23 @@ +TODO +==== + +ares_reinit() + +- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much + like the res_init() resolver function offers + +ares_gethostbyname + +- When built to support IPv6, it needs to also support PF_UNSPEC or similar, + so that an application can ask for any protocol and then c-ares would return + all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. + +ares_process + +- Upon next ABI breakage ares_process() should be changed to return 'int' + and return ARES_ENOTINITIALIZED if ares_library_init() has not been called. + +ares_process_fd + +- Upon next ABI breakage ares_process_fd() should be changed to return + 'int' and return ARES_ENOTINITIALIZED if library has not been initialized. diff -Nru python-gevent-0.13.7/c-ares/windows_port.c python-gevent-1.0/c-ares/windows_port.c --- python-gevent-0.13.7/c-ares/windows_port.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/c-ares/windows_port.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,22 @@ +#include "ares_setup.h" + + +/* only do the following on windows + */ +#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS) + +#ifdef __WATCOMC__ +/* + * Watcom needs a DllMain() in order to initialise the clib startup code. + */ +BOOL +WINAPI DllMain (HINSTANCE hnd, DWORD reason, LPVOID reserved) +{ + (void) hnd; + (void) reason; + (void) reserved; + return (TRUE); +} +#endif + +#endif /* WIN32 builds only */ diff -Nru python-gevent-0.13.7/changelog.rst python-gevent-1.0/changelog.rst --- python-gevent-0.13.7/changelog.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/changelog.rst 2013-11-26 16:25:45.000000000 +0000 @@ -4,6 +4,450 @@ .. currentmodule:: gevent +Release 1.0 (Nov 26, 2013) +-------------------------- + +- pywsgi: Pass copy of error list instead of direct reference. Thanks to Jonathan Kamens, Matt Iversen. +- Ignore the autogenerated doc/gevent.*.rst files. Patch by Matthias Urlichs. +- Fix cythonpp.py on Windows. Patch by Jeryn Mathew. +- Remove gevent.run (use gevent.wait). + + +Release 1.0rc3 (Sep 14, 2013) +----------------------------- + +- Fix #251: crash in gevent.core when accessing destroyed loop. +- Fix #235: Replace self._threadpool.close() with self._threadpool.kill() in hub.py. Patch by Jan-Philip Gehrcke. +- Remove unused timeout from select.py (#254). Patch by Saúl Ibarra Corretgé. +- Rename Greenlet.link()'s argument to 'callback' (closes #244). +- Fix parallel build (#193). Patch by Yichao Yu. +- Fix #263: potential UnboundLocalError: 'length' in gevent.pywsgi. +- Simplify psycopg2_pool.py (#239). Patch by Alex Gaynor. +- pywsgi: allow Content-Length in GET requests (#264). Patch by 陈小玉. +- documentation fixes (#281) [philipaconrad]. +- Fix old documentation about default blocking behavior of kill, killall (#306). Patch by Daniel Farina. +- Fix #6: patch sys after thread. Patch by Anton Patrushev. +- subprocess: fix check_output on Py2.6 and older (#265). Thanks to Marc Sibson for test. +- Fix #302: "python -m gevent.monkey" now sets __file__ properly. +- pywsgi: fix logging when bound on unix socket (#295). Thanks to Chris Meyers, Eugene Pankov. +- pywsgi: readout request data to prevent ECONNRESET +- Fix #303: 'requestline' AttributeError in pywsgi. Thanks to Neil Chintomby. +- Fix #79: Properly handle HTTP versions. Patch by Luca Wehrstedt. +- Fix #216: propagate errors raised by Pool.map/imap + + +Release 1.0rc2 (Dec 10, 2012) +----------------------------- + +- Fixed #210: callbacks were not run for non-default loop (bug introduced in 1.0rc1). +- patch_all() no longer patches subprocess unless `subprocess=True` is passed. +- Fixed AttributeError in hub.Waiter. +- Fixed #181: make hidden imports visible to freezing tools like py2exe. Patch by Ralf Schmitt. +- Fixed #202: periodically yield when running callbacks (sleep(0) cannot block the event loop now). +- Fixed #204: os.tp_read/tp_write did not propogate errors to the caller. +- Fixed #217: do not set SO_REUSEADDR on Windows. +- Fixed bug in --module argument for gevent.monkey. Patch by Örjan Persson. +- Remove warning from threadpool.py about mixing fork() and threads. +- Cleaned up hub.py from code that was needed to support older greenlets. Patch by Saúl Ibarra Corretgé. +- Allow for explicit default loop creation via `get_hub(default=True)`. Patch by Jan-Philip Gehrcke. + + +Release 1.0rc1 (Oct 30, 2012) +----------------------------- + +- Fixed hub.switch() not to touch stacktrace when switching. greenlet restores the exception information correctly since version 0.3.2. gevent now requires greenlet >= 0.3.2 +- Added gevent.wait() and gevent.iwait(). This is like gevent.joinall() but supports more objects, including Greenlet, Event, Semaphore, Popen. Without arguments it waits for the event loop to finish (previously gevent.run() did that). gevent.run will be removed before final release and gevent.joinall() might be deprecated. +- Reimplemented loop.run_callback with a list and a single prepare watcher; this fixes the order of spawns and improves performance a little. +- Fixes Semaphore/Lock not to init hub in `__init__`, so that it's possible to have module-global locks without initializing the hub. This fixes monkey.patch_all() not to init the hub. +- New implementation of callbacks that executes them in the order they were added. core.loop.callback is removed. +- Fixed 2.5 compatibility. +- Fixed crash on Windows when request 'prev' and 'attr' attributes of 'stat' watcher. The attribute access still fails, but now with an exception. +- Added known_failures.txt that lists all the tests that fail. It can be used by testrunner.py via expected option. It's used when running the test suite in travis. +- Fixed socket, ssl and fileobject to not mask EBADF error - it is now propogated to the caller. Previously EBADF was converted to empty read/write. Thanks to Vitaly Kruglikov +- Removed gevent.event.waitall() +- Renamed FileObjectThreadPool -> FileObjectThread +- Greenlet: Fixed #143: greenlet links are now executed in the order they were added +- Synchronize access to FileObjectThread with Semaphore +- EINVAL is not longer handled in fileobject. + +monkey: + +- Fixed #178: disable monkey patch os.read/os.write +- Fixed monkey.patch_thread() to patch threading._DummyThread to avoid leak in threading._active. Original patch by Wil Tan. +- added Event=False argument to patch_all() and patch_thread +- added patch_sys() which patches stdin, stdout, stderr with FileObjectThread wrappers. Experimental / buggy. +- monkey patching everything no longer initializes the hub/event loop. + +socket: + +- create_connection: do not lookup IPv6 address if IPv6 is unsupported. Patch by Ralf Schmitt. + +pywsgi: + +- Fixed #86: bytearray is now supported. Original patch by Aaron Westendorf. +- Fixed #116: Multiline HTTP headers are now handled properly. Patch by Ralf Schmitt. + +subprocess: + +- Fixed Windows compatibility. The wait() method now also supports 'timeout' argument on Windows. +- Popen: Added rawlink() method, which makes Popen objects supported by gevent.wait(). Updated examples/processes.py +- Fixed #148: read from errpipe_read in small chunks, to avoid trigger EINVAL issue on Mac OS X. Patch by Vitaly Kruglikov +- Do os._exit() in "finally" section to avoid executing unrelated code. Patch by Vitaly Kruglikov. + +resolver_ares: + +- improve getaddrinfo: For string ports (e.g. "http") resolver_ares/getaddrinfo previously only checked either getservbyname(port, "tcp") or getservbyname(port, "udp"), but never both. It now checks both of them. +- gevent.ares.channel now accepts strings as arguments +- upgraded c-ares to cares-1_9_1-12-g805c736 +- it is now possible to configure resolver_ares directly with environ, like GEVENTARES_SERVERS + +os: + +- Renamed threadpool_read/write to tp_read/write. +- Removed posix_read, posix_write. +- Added nb_read, nb_write, make_nonblocking. + +hub: + +- The system error is now raised immediatelly in main greenlet in all cases. +- Dropped support for old greenlet versions (need >= 0.3.2 now) + +core: + +- allow 'callback' property of watcher to be set to None. "del w.callback" no longer works. +- added missing 'noinotify' flag + +Misc: + +- gevent.thread: allocate_lock is now an alias for LockType/Semaphore. That way it does not fail when being used as class member. +- Updated greentest.py to start timeouts with `ref=False`. +- pool: remove unused get_values() function +- setup.py now recognizes GEVENTSETUP_EV_VERIFY env var which sets EV_VERIFY macro when compiling +- Added a few micro benchmarks +- stdlib tests that we care about are now included in greentest/2.x directories, so we don't depend on them being installed system-wide +- updated util/makedist.py +- the testrunner was completely rewritten. + + +Release 1.0b4 (Sep 6, 2012) +--------------------------- + +- Added gevent.os module with 'read' and 'write' functions. Patch by Geert Jansen. +- Moved gevent.hub.fork to gevent.os module (it is still available as gevent.fork). +- Fixed issue #148: Made fileobject handle EINVAL, which is randomly raised by os.read/os.write on Mac OS X. Thanks to Mark Hingston. +- Fixed issue #150: gevent.fileobject.SocketAdapter.sendall() could needlessly wait for write event on the descriptor. Original patch by Mark Hingston. +- Fixed AttributeError in baseserver. In case of error, start() would call kill() which was renamed to close(). Thanks to Vitaly Kruglikov. + + +Release 1.0b3 (Jul 27, 2012) +---------------------------- + +- New gevent.subprocess module +- New gevent.fileobject module +- Fixed ThreadPool to discard references of the objects passed to it (function, arguments) asap. Previously they could be stored for unlimited time until the thread gets a new job. +- Fixed #138: gevent.pool.Pool().imap_unordered hangs with an empty iterator. Thanks to exproxus. +- Fixed #127: ssl.py could raise TypeError in certain cases. Thanks to Johan Mjones. +- Fixed socket.makefile() to keep the timeout setting of the socket instance. Thanks to Colin Marc. +- Added 'copy()' method to queues. +- The 'nochild' event loop config option is removed. The install_sigchld offer more flexible way of enabling child watchers. +- core: all watchers except for 'child' now accept new 'priority' keyword argument +- gevent.Timeout accepts new arguments: 'ref' and 'priority'. The default priority for Timeout is -1. +- Hub.wait() uses Waiter now instead of raw switching +- Updated libev to the latest CVS version +- Made pywsgi to raise an AssertionError if non-zero content-length is passed to start_response(204/304) or if non-empty body is attempted to be written for 304/204 response +- Removed pywsgi feature to capitalize the passed headers. +- Fixed util/cythonpp.py to work on python3.2 (#123). Patch by Alexandre Kandalintsev. +- Added 'closed' readonly property to socket. +- Added 'ref' read/write property to socket. +- setup.py now parses CARES_EMBED and LIBEV_EMBED parameters, in addition to EMBED. +- gevent.reinit() and gevent.fork() only reinit hub if it was created and do not create it themselves +- Fixed setup.py not to add libev and c-ares to include dirs in non-embed mode. Patch by Ralf Schmitt. +- Renamed util/make_dist.py to util/makedist.py +- testrunner.py now saves more information about the system; the stat printing functionality is moved to a separate util/stat.py script. + + +Release 1.0b2 (Apr 11, 2012) +---------------------------- + +Major and backward-incompatible changes: + +- Made the threadpool-based resolver the default. To enable the ares-based resolver, set GEVENT_RESOLVER=ares env var. +- Added support for child watchers (not available on Windows). + - Libev loop now reaps all children by default. + - If NOCHILD flag is passed to the loop, child watchers and child reaping are disabled. +- Renamed gevent.coros to gevent.lock. The gevent.coros is still available but deprecated. +- Added 'stat' watchers to loop. +- The setup.py now recognizes gevent_embed env var. When set to "no", bundled c-ares and libev are ignored. +- Added optional 'ref' argument to sleep(). When ref=false, the watchers created by sleep() do not hold gevent.run() from exiting. +- ThreadPool now calls Hub.handle_error for exceptions in worker threads. +- ThreadPool got new method: apply_e. +- Added new extension module gevent._util and moved gevent.core.set_exc_info function there. +- Added new extension module gevent._semaphore. It contains Semaphore class which is imported by gevent.lock as gevent.lock.Semaphore. Providing Semaphore in extension module ensures that trace function set with settrace will not be called during __exit__. Thanks to Ralf Schmitt. +- It is now possible to kill or pre-spawn threads in ThreadPool by setting its 'size' property. + +core: + +- Make sure the default loop cannot be destroyed more than once, thus crashing the process. +- Make Hub.destroy() method not to destroy the default loop, unless *destroy_loop* is *True*. Non-default loops are still destroyed by default. +- loop: Removed properties from loop: fdchangecnt, timercnt, asynccnt. +- loop: Added properties: sigfd, origflags, origflags_int +- loop: The EVFLAG_NOENV is now always passed to libev. Thus LIBEV_FLAGS env variable is no longer checked. Use GEVENT_BACKEND. + +Misc: + +- Check that the argument of link() is callable. Raise TypeError when it's not. +- Fixed TypeError in baseserver when parsing an address. +- Pool: made add() and discard() usable by external users. Thanks to Danil Eremeev. +- When specifying a class to import, it is now possible to use format path/package.module.name +- pywsgi: Made sure format_request() does not fail if 'status' attribute is not set yet +- pywsgi: Added REMOTE_PORT variable to the environment. + +Examples: + +- portforwarder.py now shows how to use gevent.run() to implement graceful shutdown of a server. +- psycopg2_pool.py: Changed execute() to return rowcount. +- psycopg2_pool.py: Added fetchall() and fetchiter() methods. + +Developer utilities: + +- When building, CYTHON env variable can be used to specify Cython executable to use. +- util/make_dist.py now recongizes --fast and --revert options. Previous --rsync option is removed. +- Added util/winvbox.py which automates building/testing/making binaries on Windows VM. +- Fixed typos in exception handling code in testrunner.py +- Fixed patching unittest.runner on Python2.7. This caused the details of test cases run lost. +- Made testrunner.py kill the whole process group after test is done. + + +Release 1.0b1 (Jan 10, 2012) +---------------------------- + +Backward-incompatible changes: + +- Removed "link to greenlet" feature of Greenlet. +- If greenlet module older than 0.3.2 is used, then greenlet.GreenletExit.__bases__ is monkey patched to derive from BaseException and not Exception. That way gevent.GreenletExit is always derived from BaseException, regardless of installed greenlet version. +- Some code supporting Python 2.4 has been removed. + +Release highlights: + +- Added thread pool: gevent.threadpool.ThreadPool. +- Added thread pool-based resolver. Enable with GEVENT_RESOLVER=thread. +- Added UDP server: gevent.server.DatagramServer +- A "configure" is now run on libev. This fixes a problem of 'kqueue' not being available on Mac OS X. +- Gevent recognizes some environment variables now: + - GEVENT_BACKEND allows passing argument to loop, e.g. "GEVENT_BACKEND=select" for force select backend + - GEVENT_RESOLVER allows choosing resolver class. + - GEVENT_THREADPOOL allows choosing thread pool class. +- Added new examples: portforwarder, psycopg2_pool.py, threadpool.py, udp_server.py +- Fixed non-embedding build. To build against system libev, remove or rename 'libev' directory. To build against system c-ares, remove or rename 'c-ares'. Thanks to Örjan Persson. + +misc: +- gevent.joinall() method now accepts optional 'count' keyword. +- gevent.fork() only calls reinit() in the child process now. +- gevent.run() now returns False when exiting because of timeout or event (previous None). +- Hub got a new method: destroy(). +- Hub got a new property: threadpool. + +ares.pyx: +- Fixed issue #104: made ares_host_result pickable. Thanks to Shaun Cutts. + +pywsgi: +- Removed unused deprecated 'wfile' property from WSGIHandler +- Fixed issue #92: raise IOError on truncated POST requests. +- Fixed issue #93: do not sent multiple "100 continue" responses + +core: +- Fixed issue #97: the timer watcher now calls ev_now_update() in start() and again() unless 'update' keyword is passed and set to False. +- add set_syserr_cb() function; it's used by gevent internally. +- gevent now installs syserr callback using libev's set_syserr_cb. This callback is called when libev encounters an error it cannot recover from. The default action is to print a message and abort. With the callback installed, a SystemError() is now raised in the main greenlet. +- renamed 'backend_fd' property to 'fileno()' method. (not available if you build gevent against system libev) +- added 'asynccnt' property (not available if you build gevent against system libev) +- made loop.__repr__ output a bit more compact +- the watchers check the arguments for validness now (previously invalid argument would crash libev). +- The 'async' watcher now has send() method; +- fixed time() function +- libev has been upgraded to latest CVS version. +- libev has been patched to use send()/recv() for evpipe on windows when libev_vfd.h is in effect + +resolver_ares: +- Slightly improved compatibility with stdlib's socket in some error cases. + +socket: +- Fixed close() method not to reference any globals +- Fixed issue #115: _dummy gets unexpected Timeout arg +- Removed _fileobject used for python 2.4 compatibility in socket.py +- Fixed issue #94: fallback to buffer if memoryview fails in _get_memory on python 2.7 + +monkey: +- Removed patch_httplib() +- Fixed issue #112: threading._sleep is not patched. Thanks to David LaBissoniere. +- Added get_unpatched() function. However, it is slightly broken at the moment. + +backdoor: +- make 'locals()' not spew out __builtin__.__dict__ in backdoor +- add optional banner argument to BackdoorServer + +servers: +- add server.DatagramServer; +- StreamServer: 'ssl_enabled' is now a read-only property +- servers no longer have 'kill' method; it has been renamed to 'close'. +- listeners can now be configured as strings, e.g. ':80' or 80 +- modify baseserver.BaseServer in such a way that makes it a good base class for both StreamServer and DatagramServer +- BaseServer no longer accepts 'backlog' parameter. It is now done by StreamServer. +- BaseServer implements start_accepting() and stop_accepting() methods +- BaseServer now implements "temporarily stop accepting" strategy +- BaseServer now has _do_read method which does everything except for actually calling accept()/recvfrom() +- pre_start() method is renamed to init_socket() +- renamed _stopped_event to _stop_event +- 'started' is now a read-only property (which actually reports state of _stop_event) +- post_stop() method is removed +- close() now sets _stop_event(), thus setting 'started' to False, thus causing serve_forever() to exit +- _tcp_listener() function is moved from baseserver.py to server.py +- added 'fatal_errors' class attribute which is a tuple of all errnos that should kill the server + +coros: +- Semaphore: add _start_notify() method +- Semaphore: avoid copying list of links; rawlink() no longer schedules notification + + + +Release 1.0a3 (Sep 15, 2011) +---------------------------- + +Added 'ref' property to all watchers. Settings it to False make watcher call ev_unref/ev_ref appropriately so that this watcher does not prevent loop.run()/hub.join()/run() from exiting. +Made resolver_ares.Resolver use 'ref' property for internal watcher. + +In all servers, method "kill" was renamed to "close". The old name is available as deprecated alias. + +Added a few properties to the loop: backend_fd, fdchangecnt, timercnt. + +Upgraded c-ares to 1.7.5+patch. + +Fixed getaddrinfo to return results in the order (::1, IPv4, IPv6). + +Fixed getaddrinfo() to handle integer of string type. Thanks to kconor. + +Fixed gethostbyname() to handle '' (empty string). + +Fixed getaddrinfo() to convert UnicodeEncodeError into error('Int or String expected'). + +Fixed getaddrinfo() to uses the lowest 16 bits of passed port integer similar to built-in _socket. + +Fixed getnameinfo() to call getaddrinfo() to process arguments similar to built-in _socket. + +Fixed gethostbyaddr() to use getaddrinfo() to process arguments. + +version_info is now a 5-tuple. + +Added handle_system_error() method to Hub (used internally). + +Fixed Hub's run() method to never exit. This prevent inappropriate switches into parent greenlet. + +Fixed Hub.join() to return True if Hub was already dead. + +Added 'event' argument to Hub.join(). + +Added `run()` function to gevent top level package. + +Fixed Greenlet.start() to exit silently if greenlet was already started rather than raising :exc:`AssertionError`. + +Fixed Greenlet.start() not to schedule another switch if greenlet is already dead. + +Fixed gevent.signal() to spawn Greenlet instead of raw greenlet. Also it'll switch into the new greenlet immediately instead of scheduling additional callback. + +Do monkey patch create_connection() as gevent's version works better with gevent.socket.socket than the standard create_connection. + +pywsgi: make sure we don't try to read more requests if socket operation failed with EPIPE + +pywsgi: if we failed to send the reply, change 'status' to socket error so that the logs mention the error. + + +Release 1.0a2 (Aug 2, 2011) +--------------------------- + +Fixed a bug in gevent.queue.Channel class. (Thanks to Alexey Borzenkov) + + +Release 1.0a1 (Aug 2, 2011) +--------------------------- + +Backward-incompatible changes: + +- Dropped support for Python 2.4. +- `Queue(0)` is now equivalent to an unbound queue and raises :exc:`DeprecationError`. Use :class:`gevent.queue.Channel` if you need a channel. +- Deprecated ability to pass a greenlet instance to :meth:`Greenlet.link`, :meth:`Greenlet.link_value` and :meth:`Greenlet.link_exception`. +- All of :mod:`gevent.core` has been rewritten and the interface is not compatible. +- :exc:`SystemExit` and :exc:`SystemError` now kill the whole process instead of printing a traceback. +- Removed deprecated :class:`util.lazy_property` property. +- Removed :mod:`gevent.dns` module. +- Removed deprecated gevent.sslold module +- Removed deprecated gevent.rawgreenlet module +- Removed deprecated name `GreenletSet` which used to be alias for :class:`Group`. + +Release highlights: + +- The :mod:`gevent.core` module now wraps libev's API and is not compatible with gevent 0.x. +- Added a concept of pluggable event loops. By default gevent.core.loop is used, which is a wrapper around libev. +- Added a concept of pluggable name resolvers. By default a resolver based on c-ares library is used. +- Added support for multiple OS threads, each new thread will get its own Hub instance with its own event loop. +- The release now includes and embeds the dependencies: libev and c-ares. +- The standard :mod:`signal` works now as expected. +- The unhandled errors are now handled uniformely by `Hub.handle_error` function. +- Added :class:`Channel` class to :mod:`gevent.queue` module. It is equivalent to `Queue(0)` in gevent 0.x, which is deprecated now. +- Added method :meth:`peek` to :class:`Queue` class. +- Added :func:`idle` function which blocks until the event loop is idle. +- Added a way to gracefully shutdown the application by waiting for all outstanding greenlets/servers/watchers: :meth:`Hub.join`. +- Added new :mod:`gevent.ares` C extension which wraps `c-ares` and provides asynchronous DNS resolver. +- Added new :mod:`gevent.resolver_ares` module provides synchronous API on top of :mod:`gevent.ares`. + +The :mod:`gevent.socket` module: + +- DNS functions now use c-ares library rather than libevent-dns. This fixes a number of problems with name resolving: + - Issue #2: DNS resolver no longer breaks after `fork()`. You still need to call :func:`gevent.fork` (`os.fork` is monkey + patched with it if `monkey.patch_all()` was called). + - DNS resolver no longer ignores `/etc/resolv.conf` and `/etc/hosts`. +- The following functions were added to socket module + - gethostbyname_ex + - getnameinfo + - gethostbyaddr + - getfqdn +- Removed undocumented bind_and_listen and tcp_listener + +The :class:`Hub` object: + +- Added :meth:`join` method which waits until the event loop exits or optional timeout expires. +- Added :meth:`wait` method which waits until a watcher has got an event. +- Added :meth:`handle_error` method which is called by all of gevent in case of unhandled exception. +- Added :meth:`print_exception` method which is called by `handle_error` to print the exception traceback. + +The :class:`Greenlet` objects: + +- Added `__nonzero__` implementation that returns `True` after greenlet was started until it's dead. + Previously greenlet was `False` after `start()` until it was first switched to. + +The mod:`gevent.pool` module: + +- It is now possible to add raw greenlets to the pool. +- The :meth:`map` and :meth:`imap` methods now start yielding the results as soon as possible. +- The :meth:`imap_unordered` no longer swallows an exception raised while iterating its argument. + +Miscellaneous: + +- `gevent.sleep()` no longer raises an exception, instead it does `sleep(0)`. +- Added method `clear` to internal `Waiter` class. +- Removed `wait` method from internal `Waiter` class. +- The :class:`WSGIServer` now sets `max_accept` to 1 if `wsgi.multiprocessing` is set to `True`. +- Added :func:`monkey.patch_module` function that monkey patches module using `__implements__` list provided by gevent module. + All of gevent modules that replace stdlib module now have `__implements__` attribute. + + +Release 0.13.8 (September 6, 2012) +---------------------------------- + +- Fixed issue #80: gevent.httplib failed with RequestFailed errors because timeout was reset to 1s. Patch by Tomasz Prus. +- core: fix compilation with the latest Cython: remove emit_ifdef/emit_else/emit_endif. +- Fixed issue #132: gevent.socket.gethostbyname() now does ascii encoding and uses gevent's resolver rather than calling built-in resolver. Patch by Alexey Borzenkov. + + Release 0.13.7 (April 12, 2012) ------------------------------- @@ -63,7 +507,7 @@ - Fixed leaking of traceback object when switching out of greenlet with ``sys.exc_info`` set. Leaking is prevented by not preserving traceback at all and only keeping the value of the exception. Thanks to **Ned Rockson**. - Fixed :meth:`ssl.SSLSocket.unwrap` to shutdown :class:`SSLSocket` properly, without raising ``SSLError(read operation timeout)``. - Fixed :exc:`TypeError` inside :class:`Hub` on Python 2.4. -- Made a number of internal improvements to :mod:`gevent.pywsgi` to make subclassing easier (driven by the needs of websocket_ package). +- Made a number of internal improvements to :mod:`gevent.pywsgi` to make subclassing easier. - Changed :class:`WSGIServer ` to explicitly close the socket after the last request. Patch by **Ralf Schmitt**. - Fixed :class:`pywsgi.WSGIHandler` not to add ``CONTENT_TYPE`` to the *environ* dict when there's no ``Content-Type`` header in the request. Previously a default ``text/plain`` was added in such case. - Added proper implementation of :meth:`imap_unordered ` to :class:`Pool` class. Unlike previous "dummy" implementation this one starts yielding the results as soon as they are ready. @@ -79,8 +523,6 @@ - Added ``build_exc --cython=`` option to ``setup.py``. Patch by **Ralf Schmitt**. - Updated :class:`local ` to raise :exc:`AttributeError` if ``__dict__`` attribute is set or deleted. -.. _websocket: http://bitbucket.org/denis/websocket - Release 0.13.1 (Sep 23, 2010) ----------------------------- @@ -536,7 +978,7 @@ and :meth:`__exit__ ` now, so it can be used as a context manager. :class:`event`'s :attr:`callback ` signature has changed from ``(event, fd, evtype)`` to ``(event, evtype)``. * Fixed :class:`Hub`'s mainloop to never return successfully as this will screw up main greenlet's ``switch()`` call. - Instead of returning it raises :class:`DispatchExit`. + Instead of returning it raises ``DispatchExit``. * Added :func:`reinit` function - wrapper for libevent's ``event_reinit``. This function is a must have at least for daemons, as it fixes ``epoll`` and some others eventloops to work after ``fork``. * Trying to use gevent in another thread will now raise an exception immediately, since it's not implemented. @@ -585,3 +1027,4 @@ * Use the interfaces and conventions from the standard Python library where possible. .. _eventlet: http://bitbucket.org/denis/eventlet + diff -Nru python-gevent-0.13.7/debian/changelog python-gevent-1.0/debian/changelog --- python-gevent-0.13.7/debian/changelog 2013-03-24 19:00:00.000000000 +0000 +++ python-gevent-1.0/debian/changelog 2014-03-20 07:33:09.000000000 +0000 @@ -1,3 +1,25 @@ +python-gevent (1.0-1ubuntu1) trusty; urgency=medium + + * Fix build failure on arm64. + + -- Matthias Klose Thu, 20 Mar 2014 08:32:47 +0100 + +python-gevent (1.0-1build1) trusty; urgency=medium + + * Rebuild to drop files installed into /usr/share/pyshared. + + -- Matthias Klose Sun, 23 Feb 2014 13:51:43 +0000 + +python-gevent (1.0-1) unstable; urgency=low + + * New upstream release (closes: #733600). + * Update Standards-Version to 3.9.5 . + + [ Bart Martens ] + * Update watch file. + + -- Laszlo Boszormenyi (GCS) Sat, 01 Feb 2014 20:58:30 +0100 + python-gevent (0.13.7-4) unstable; urgency=low * Last bits of -dbg package fix (closes: #703611). diff -Nru python-gevent-0.13.7/debian/compat python-gevent-1.0/debian/compat --- python-gevent-0.13.7/debian/compat 2011-05-17 14:45:37.000000000 +0000 +++ python-gevent-1.0/debian/compat 2014-02-01 21:09:14.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru python-gevent-0.13.7/debian/control python-gevent-1.0/debian/control --- python-gevent-0.13.7/debian/control 2013-03-22 10:17:08.000000000 +0000 +++ python-gevent-1.0/debian/control 2014-02-01 21:09:08.000000000 +0000 @@ -1,10 +1,10 @@ Source: python-gevent Priority: extra -Maintainer: Laszlo Boszormenyi (GCS) -Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 7.0.50), python-all-dev, libevent-dev (>= 1.4), - python-greenlet | python-codespeak-lib (<< 1.0), python-sphinx (>= 1.0.7+dfsg), - python-all-dbg -Standards-Version: 3.9.4 +Maintainer: Laszlo Boszormenyi (GCS) +Build-Depends: debhelper (>= 9), autotools-dev, python-all-dev, + libevent-dev (>= 1.4), python-greenlet | python-codespeak-lib (<< 1.0), + python-sphinx (>= 1.0.7+dfsg), python-all-dbg +Standards-Version: 3.9.5 Section: python Homepage: http://www.gevent.org/ diff -Nru python-gevent-0.13.7/debian/copyright python-gevent-1.0/debian/copyright --- python-gevent-0.13.7/debian/copyright 2013-03-21 00:05:36.000000000 +0000 +++ python-gevent-1.0/debian/copyright 2014-02-01 20:00:08.000000000 +0000 @@ -1,6 +1,6 @@ This work was packaged for Debian by: Örjan Persson on Sun, 04 Apr 2010 18:47:51 +0200 -Packaging taken over by Laszlo Boszormenyi (GCS) +Packaging taken over by Laszlo Boszormenyi (GCS) on Thu, 21 Mar 2013 00:39:38 +0100. It was downloaded from http://www.gevent.org/ @@ -35,7 +35,8 @@ The Debian packaging is: - Copyright (C) 2010 Örjan Persson + Copyright (C) 2010-2013 Örjan Persson + Copyright (C) 2013- Laszlo Boszormenyi (GCS) and is licensed under the GPL version 3, see `/usr/share/common-licenses/GPL-3'. diff -Nru python-gevent-0.13.7/debian/patches/fix-gcc-ftbfs.diff python-gevent-1.0/debian/patches/fix-gcc-ftbfs.diff --- python-gevent-0.13.7/debian/patches/fix-gcc-ftbfs.diff 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/debian/patches/fix-gcc-ftbfs.diff 2014-03-20 07:32:45.000000000 +0000 @@ -0,0 +1,17 @@ +Index: b/libev/ev.c +=================================================================== +--- a/libev/ev.c ++++ b/libev/ev.c +@@ -617,9 +617,11 @@ + #if ECB_GCC_VERSION(4,7) + /* see comment below (stdatomic.h) about the C11 memory model. */ + #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST) +- #elif defined __clang && __has_feature (cxx_atomic) ++ #elif defined __clang ++ #if __has_feature (cxx_atomic) + /* see comment below (stdatomic.h) about the C11 memory model. */ + #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST) ++ #endif + #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__ + #define ECB_MEMORY_FENCE __sync_synchronize () + #elif _MSC_VER >= 1400 /* VC++ 2005 */ diff -Nru python-gevent-0.13.7/debian/patches/offline-doc-cross-reference python-gevent-1.0/debian/patches/offline-doc-cross-reference --- python-gevent-0.13.7/debian/patches/offline-doc-cross-reference 2011-05-17 14:45:37.000000000 +0000 +++ python-gevent-1.0/debian/patches/offline-doc-cross-reference 2014-02-01 20:10:21.000000000 +0000 @@ -14,7 +14,7 @@ =================================================================== --- python-gevent.orig/doc/mysphinxext.py 2010-09-06 20:38:42.000000000 +0200 +++ python-gevent/doc/mysphinxext.py 2010-09-06 20:42:37.000000000 +0200 -@@ -49,7 +49,6 @@ +@@ -51,7 +51,6 @@ if i_aliasname.endswith(target): stripped_aliasname = i_aliasname[len(docname):] if stripped_aliasname: diff -Nru python-gevent-0.13.7/debian/patches/series python-gevent-1.0/debian/patches/series --- python-gevent-0.13.7/debian/patches/series 2013-03-22 09:34:06.000000000 +0000 +++ python-gevent-1.0/debian/patches/series 2014-03-20 07:26:23.000000000 +0000 @@ -1,3 +1,4 @@ -offline-doc-cross-reference -gevent-ipv6-dns-workaround.patch +#offline-doc-cross-reference +#gevent-ipv6-dns-workaround.patch use-local-intersphinx-inventory.patch +fix-gcc-ftbfs.diff diff -Nru python-gevent-0.13.7/debian/pyversions python-gevent-1.0/debian/pyversions --- python-gevent-0.13.7/debian/pyversions 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/debian/pyversions 2014-02-01 20:29:47.000000000 +0000 @@ -0,0 +1 @@ +2.5- diff -Nru python-gevent-0.13.7/debian/rules python-gevent-1.0/debian/rules --- python-gevent-0.13.7/debian/rules 2013-03-23 23:00:57.000000000 +0000 +++ python-gevent-1.0/debian/rules 2014-02-01 20:30:08.000000000 +0000 @@ -10,7 +10,7 @@ #include /usr/share/dpkg/buildflags.mk %: - dh $@ --with python2 + dh $@ --parallel --with autotools_dev,python2 override_dh_auto_build: dh_auto_build @@ -18,11 +18,10 @@ override_dh_auto_clean: dh_auto_clean - rm -f gevent/*.so + rm -f $(CURDIR)/gevent/*.so cd doc && make clean rm -f $(CURDIR)/doc/gevent.*.rst $(CURDIR)/doc/changelog.rst - rm -f $(CURDIR)/gevent.egg-info/PKG-INFO \ - $(CURDIR)/gevent.egg-info/SOURCES.txt + rm -rf $(CURDIR)/gevent.egg-info/ rm -f $(CURDIR)/greentest/testresults.sqlite3 override_dh_compress: @@ -40,4 +39,5 @@ override_dh_installdocs: dh_installdocs --link-doc=python-gevent -.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_compress override_dh_strip override_dh_installdocs +.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_compress \ + override_dh_strip override_dh_installdocs diff -Nru python-gevent-0.13.7/debian/watch python-gevent-1.0/debian/watch --- python-gevent-0.13.7/debian/watch 2013-03-21 00:39:33.000000000 +0000 +++ python-gevent-1.0/debian/watch 2014-02-01 20:15:44.000000000 +0000 @@ -1,4 +1,4 @@ version=3 -opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)\d*)$/$1~$2/,dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$// \ -https://github.com/SiteSupport/gevent/tags .*/v?(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) -# Bart Martens Wed, 06 Mar 2013 05:05:51 +0000 +opts=uversionmangle=s/(\d)[\.\-]?((?:rc|RC|pre)\.?\d+(?:-\d+)?)$/$1~$2/;s/^((?:\d+\.)*\d+)([ab]\d*)$/$1~$2/ \ +https://github.com/surfly/gevent/tags \ +.*/archive/(?:upstream/)?(?:v||version-|release-|X|R)(\d\S*)\.tar\.gz diff -Nru python-gevent-0.13.7/doc/conf.py python-gevent-1.0/doc/conf.py --- python-gevent-0.13.7/doc/conf.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/conf.py 2013-11-26 16:25:45.000000000 +0000 @@ -54,7 +54,7 @@ # General information about the project. project = u'gevent' -copyright = u'2009-2010, gevent contributors' +copyright = u'2009-2011, gevent contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -108,7 +108,8 @@ # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' +html_theme = 'mytheme' +html_theme_path = ['.'] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -190,8 +191,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'gevent.tex', u'gevent Documentation', - u'gevent contributors', 'manual'), + ('index', 'gevent.tex', u'gevent Documentation', + u'gevent contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff -Nru python-gevent-0.13.7/doc/contents.rst python-gevent-1.0/doc/contents.rst --- python-gevent-0.13.7/doc/contents.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/contents.rst 2013-11-26 16:25:45.000000000 +0000 @@ -5,6 +5,7 @@ intro reference + whatsnew_1_0 changelog * :ref:`genindex` diff -Nru python-gevent-0.13.7/doc/gevent.core.rst python-gevent-1.0/doc/gevent.core.rst --- python-gevent-0.13.7/doc/gevent.core.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/gevent.core.rst 2013-11-26 16:25:45.000000000 +0000 @@ -1,70 +1,39 @@ -:mod:`gevent.core` - Low-level wrappers around libevent -======================================================= +:mod:`gevent.core` - event loop based on libev +============================================== .. automodule:: gevent.core -events ------- - -.. autoclass:: event(evtype, handle, callback[, arg]) - :members: - :undoc-members: -.. autoclass:: read_event - :members: - :undoc-members: -.. autoclass:: write_event - :members: - :undoc-members: -.. autoclass:: timer - :members: - :undoc-members: -.. autoclass:: signal - :members: - :undoc-members: -.. autoclass:: active_event - :members: - :undoc-members: -event loop ----------- +This module is a wrapper around libev__ and follower the libev API pretty closely. Note, +that gevent creates an event loop transparently for the user and runs it in a dedicated +greenlet (called hub), so using this module is not necessary. In fact, if you do use it, +chances are that your program is not compatible across different gevent version (gevent.core in +0.x has a completely different interface and 2.x will probably have yet another interface). -.. autofunction:: init -.. autofunction:: dispatch -.. autofunction:: loop -.. autofunction:: get_version -.. autofunction:: get_method -.. autofunction:: get_header_version +On Windows, this wrapper will accept Windows handles rather than stdio file descriptors which libev requires. This is to simplify +interaction with the rest of the Python, since it requires Windows handles. +The current event loop can be obtained with ``gevent.get_hub().loop``. -evdns ------ -.. autofunction:: dns_init -.. autofunction:: dns_shutdown -.. autofunction:: dns_resolve_ipv4 -.. autofunction:: dns_resolve_ipv6 -.. autofunction:: dns_resolve_reverse -.. autofunction:: dns_resolve_reverse_ipv6 +__ http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod -evbuffer --------- +events +------ -.. autoclass:: buffer +.. autoclass:: loop(flags=None, default=True) :members: :undoc-members: -evhttp ------- +misc functions +-------------- -.. autoclass:: http_request - :members: - :undoc-members: -.. autoclass:: http_connection - :members: - :undoc-members: -.. autoclass:: http - :members: - :undoc-members: +.. autofunction:: get_version +.. autofunction:: get_header_version +.. autofunction:: supported_backends +.. autofunction:: recommended_backends +.. autofunction:: embeddable_backends +.. autofunction:: time diff -Nru python-gevent-0.13.7/doc/gevent.hub.rst python-gevent-1.0/doc/gevent.hub.rst --- python-gevent-0.13.7/doc/gevent.hub.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/gevent.hub.rst 2013-11-26 16:25:45.000000000 +0000 @@ -7,8 +7,6 @@ :members: :undoc-members: -.. autoexception:: DispatchExit - .. autofunction:: get_hub .. autoclass:: Waiter diff -Nru python-gevent-0.13.7/doc/gevent.rst python-gevent-1.0/doc/gevent.rst --- python-gevent-0.13.7/doc/gevent.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/gevent.rst 2013-11-26 16:25:45.000000000 +0000 @@ -9,7 +9,7 @@ Greenlet objects ---------------- -:class:`Greenlet` is a light-weight cooperatively-scheduled execution unit. +:class:`Greenlet` is a light-weight cooperatively-scheduled execution unit. To start a new greenlet, pass the target function and its arguments to :class:`Greenlet` constructor and call :meth:`start`: @@ -37,10 +37,10 @@ .. automethod:: Greenlet.start_later .. automethod:: Greenlet.join .. automethod:: Greenlet.get -.. automethod:: Greenlet.kill(exception=GreenletExit, block=False, timeout=None) -.. automethod:: Greenlet.link(receiver=None) -.. automethod:: Greenlet.link_value(receiver=None) -.. automethod:: Greenlet.link_exception(receiver=None) +.. automethod:: Greenlet.kill(exception=GreenletExit, block=True, timeout=None) +.. automethod:: Greenlet.link(callback) +.. automethod:: Greenlet.link_value(callback) +.. automethod:: Greenlet.link_exception(callback) .. automethod:: Greenlet.unlink @@ -53,7 +53,7 @@ .. exception:: GreenletExit A special exception that kills the greenlet silently. - + When a greenlet raises :exc:`GreenletExit` or a subclass, the traceback is not printed and the greenlet is considered :meth:`successful `. The exception instance is available under :attr:`value ` @@ -79,21 +79,6 @@ As this returns a raw greenlet, it does not have all the useful methods that :class:`gevent.Greenlet` has and should only be used as an optimization. -.. function:: spawn_link(function, *args, **kwargs) - spawn_link_value(function, *args, **kwargs) - spawn_link_exception(function, *args, **kwargs) - - This are the shortcuts for:: - - g = spawn(function, *args, **kwargs) - g.link() # or g.link_value() or g.link_exception() - - As :meth:`Greenlet.link` without argument links to the current greenlet, a :class:`gevent.greenlet.LinkedExited` - exception will be raised if the newly spawned greenlet exits. It is not meant as a way of inter-greenlet communication - but more of a way to assert that a background greenlet is running at least as long as the current greenlet. - - See :meth:`Greenlet.link`, :meth:`Greenlet.link_value` and :meth:`Greenlet.link_exception` for details. - Useful general functions ------------------------ @@ -104,7 +89,7 @@ .. autofunction:: kill(greenlet, exception=GreenletExit) -.. autofunction:: killall(greenlets, exception=GreenletExit, block=False, timeout=None) +.. autofunction:: killall(greenlets, exception=GreenletExit, block=True, timeout=None) .. autofunction:: joinall @@ -112,8 +97,6 @@ .. autofunction:: fork -.. autofunction:: shutdown - .. autofunction:: reinit @@ -126,3 +109,10 @@ .. autofunction:: with_timeout + +Waiting +------- + +.. autofunction:: wait + +.. autofunction:: iwait diff -Nru python-gevent-0.13.7/doc/intro.rst python-gevent-1.0/doc/intro.rst --- python-gevent-0.13.7/doc/intro.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/intro.rst 2013-11-26 16:25:45.000000000 +0000 @@ -1,29 +1,27 @@ Introduction ============ -gevent is a Python networking library that uses greenlet_ to provide a synchronous API on top of libevent_ event loop. +gevent is a coroutine-based Python networking library. Features include: -* Fast event loop based on libevent (epoll on Linux, kqueue on FreeBSD). +* Fast event loop based on libev (epoll on Linux, kqueue on FreeBSD). * Lightweight execution units based on greenlet. * API that re-uses concepts from the Python standard library (e.g. :class:`Event`, :class:`Queue`). * Cooperative :mod:`socket` and :mod:`ssl` modules. * Ability to use standard library and 3rd party modules written for standard blocking sockets (:mod:`gevent.monkey`). -* DNS queries performed through libevent-dns. -* Fast WSGI server based on libevent-http. - -.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html -.. _libevent: http://monkey.org/~provos/libevent/ +* DNS queries performed through threadpool (default) or through c-ares (enabled via GEVENT_RESOLVER=ares env var). +* TCP/UDP/HTTP servers +* Subprocess support (through :mod:`gevent.subprocess`) +* Thread pools Installation ------------ -gevent runs on Python 2.4 and newer and requires +gevent runs on Python 2.5 and newer and requires -* greenlet__ which can be installed with ``easy_install greenlet``. -* libevent_ 1.4.x +* greenlet__ which can be installed with ``pip install greenlet``. For ssl to work on Python older than 2.6, ssl_ package is required. @@ -48,7 +46,7 @@ no longer than 2 seconds though. The results are then collected by checking :attr:`gevent.Greenlet.value` property. The :func:`gevent.socket.gethostbyname` function has the same interface as the standard :func:`socket.gethostbyname` but it does not block -the whole interpreter and thus lets the other greenlets to proceed with their requests as well. +the whole interpreter and thus lets the other greenlets proceed with their requests unhindered. .. _monkey-patching: @@ -57,57 +55,62 @@ --------------- The example above used :mod:`gevent.socket` for socket operations. If the standard :mod:`socket` -module was used it would took it 3 times longer to complete because the DNS requests would +module was used the example would have taken 3 times longer to complete because the DNS requests would be sequential. Using the standard socket module inside greenlets makes gevent rather pointless, so what about module and packages that are built on top of :mod:`socket`? -That's what monkey patching for. The functions in :mod:`gevent.monkey` carefully +That's what monkey patching is for. The functions in :mod:`gevent.monkey` carefully replace functions and classes in the standard :mod:`socket` module with their cooperative counterparts. That way even the modules that are unaware of gevent can benefit from running -in multi-greenlet environment. +in a multi-greenlet environment. >>> from gevent import monkey; monkey.patch_socket() >>> import urllib2 # it's usable from multiple greenlets now See `examples/concurrent_download.py`__ -__ http://bitbucket.org/denis/gevent/src/tip/examples/concurrent_download.py#cl-4 - +__ https://github.com/surfly/gevent/blob/master/examples/concurrent_download.py#L1 Event loop ---------- -Unlike other network libraries and similar to eventlet, gevent starts +Unlike other network libraries, in similar fashion to eventlet, gevent starts the event loop implicitly in a dedicated greenlet. There's no ``reactor`` that -you must ``run()`` or ``dispatch()`` function to call. When a function from -gevent API wants to block, it obtains the :class:`Hub` instance - a greenlet +you must call a ``run()`` or ``dispatch()`` function on. When a function from +gevent's API wants to block, it obtains the :class:`Hub` instance - a greenlet that runs the event loop - and switches to it. If there's no :class:`Hub` instance yet, one is created on the fly. -The event loop provided by libevent uses the fastest polling mechanism available -on the system by default. It is possible to command libevent not to use a particular -polling mechanism by setting ``EVENT_NOXXX``` environment variable where ``XXX`` is the event loop -you want to disable. For example, on Linux setting ``EVENT_NOEPOLL=1`` would avoid the default -``epoll`` mechanism and use ``poll``. - -Libevent API is available under :mod:`gevent.core` module. Note, that the callbacks -supplied to libevent API are run in the :class:`Hub` greenlet and thus cannot use synchronous -gevent API. It is possible to use asynchronous API there, like :func:`spawn` and :meth:`Event.set`. +The event loop provided by libev uses the fastest polling mechanism +available on the system by default. It is possible to command libev to +use a particular polling mechanism by setting the ``LIBEV_FLAGS``` +environment variable. Possible values include ``LIBEV_FLAGS=1`` for +the select backend, ``LIBEV_FLAGS=2`` for the poll backend, +``LIBEV_FLAGS=4`` for the epoll backend and ``LIBEV_FLAGS=8`` for the +kqueue backend. Please read the `libev documentation`_ for more +information. + +.. _`libev documentation`: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS + +The Libev API is available under :mod:`gevent.core` module. Note, that +the callbacks supplied to the libev API are run in the :class:`Hub` +greenlet and thus cannot use the synchronous gevent API. It is possible to +use the asynchronous API there, like :func:`spawn` and :meth:`Event.set`. Cooperative multitasking ------------------------ -The greenlets all run in the same OS thread and scheduled cooperatively. This means that until -a particular greenlet gives up control, by calling a blocking function that will switch to the :class:`Hub`, other greenlets +The greenlets all run in the same OS thread and are scheduled cooperatively. This means that until +a particular greenlet gives up control, (by calling a blocking function that will switch to the :class:`Hub`), other greenlets won't get a chance to run. It is typically not an issue for an I/O bound app, but one should be aware -of this when doing something CPU intensive or calling blocking I/O functions that bypass libevent event loop. +of this when doing something CPU intensive, or when calling blocking I/O functions that bypass the libev event loop. -Synchronizing access to the objects shared across the greenlets is unnecessary in most cases, thus -:class:`Lock` and :class:`Semaphore` classes although present aren't used as often. Other abstractions +Synchronizing access to objects shared across the greenlets is unnecessary in most cases, thus +:class:`Lock` and :class:`Semaphore` classes, although present, aren't used very often. Other abstractions from threading and multiprocessing remain useful in the cooperative world: -- :class:`Event` allows to wake up a number of greenlets that are calling :meth:`Event.wait` method. +- :class:`Event` allows one to wake up a number of greenlets that are calling :meth:`Event.wait` method. - :class:`AsyncResult` is similar to :class:`Event` but allows passing a value or an exception to the waiters. - :class:`Queue` and :class:`JoinableQueue`. @@ -119,12 +122,11 @@ The greenlets are spawned by creating a :class:`Greenlet` instance and calling its :meth:`start ` method. (The :func:`spawn` function is a shortcut that does exactly that). The :meth:`start ` -method schedules an :class:`event ` that will switch to the greenlet created, as soon -as the current greenlet gives up control. If there is more than one active event, they will be executed -one by one, in an undefined order. +method schedules a switch to the greenlet that will happen as soon as the current greenlet gives up control. +If there is more than one active event, they will be executed one by one, in an undefined order. -If there was an error during execution it won't escape greenlet's boundaries. An unhandled error results -in a stacktrace being printed complemented by failed function signature and arguments: +If there is an error during execution it won't escape greenlet's boundaries. An unhandled error results +in a stacktrace being printed, complemented by the failed function's signature and arguments: >>> gevent.spawn(lambda : 1/0) >>> gevent.sleep(1) @@ -135,13 +137,13 @@ The traceback is asynchronously printed to ``sys.stderr`` when the greenlet dies. -:class:`Greenlet` instances has a number of useful methods: +:class:`Greenlet` instances have a number of useful methods: - :meth:`join ` -- waits until the greenlet exits; - :meth:`kill ` -- interrupts greenlet's execution; - :meth:`get ` -- returns the value returned by greenlet or re-raised the exception that killed it. -It is possible to customize the string printed after the traceback by subclassing :class:`Greenlet` class +It is possible to customize the string printed after the traceback by subclassing the :class:`Greenlet` class and redefining its ``__str__`` method. To subclass a :class:`Greenlet`, override its :meth:`_run` method and call ``Greenlet.__init__(self)`` in ``__init__``:: @@ -167,11 +169,11 @@ >>> g.dead True -The :exc:`GreenletExit` exception and its subclasses are handled differently then other exceptions. +The :exc:`GreenletExit` exception and its subclasses are handled differently than other exceptions. Raising :exc:`GreenletExit` is not considered an exceptional situation, so the traceback is not printed. -The :exc:`GreenletExit` is returned by :meth:`get ` as if it was returned by the greenlet, not raised. +The :exc:`GreenletExit` is returned by :meth:`get ` as if it were returned by the greenlet, not raised. -The :meth:`kill ` method can accept an exception to raise: +The :meth:`kill ` method can accept a custom exception to be raised: >>> g = MyNoopGreenlet.spawn(5) # spawn() creates a Greenlet and starts it >>> g.kill(Exception("A time to kill")) @@ -181,7 +183,7 @@ MyNoopGreenlet(5) failed with Exception The :meth:`kill ` can also accept a *timeout* argument specifying the number of seconds to wait for the greenlet to exit. -Note, that :meth:`kill ` cannot guarantee that the target greenlet will not ignore the exception and thus it's a good idea always to pass a timeout to :meth:`kill `. +Note, that :meth:`kill ` cannot guarantee that the target greenlet will not ignore the exception, thus it's a good idea always to pass a timeout to :meth:`kill `. Timeouts @@ -189,13 +191,13 @@ Many functions in the gevent API are synchronous, blocking the current greenlet until the operation is done. For example, :meth:`kill ` waits until the target greenlet is :attr:`dead` before returning [#f1]_. Many of those -functions can be made asynchronous by passing ``block=False`` argument. +functions can be made asynchronous by passing the argument ``block=False``. -Furthermore, many of the synchronous functions accept *timeout* argument, which specifies a limit on how long the function -could block (examples: :meth:`Event.wait`, :meth:`Greenlet.join`, :meth:`Greenlet.kill`, :meth:`AsyncResult.get` and many more). +Furthermore, many of the synchronous functions accept a *timeout* argument, which specifies a limit on how long the function +can block (examples: :meth:`Event.wait`, :meth:`Greenlet.join`, :meth:`Greenlet.kill`, :meth:`AsyncResult.get`, and many more). The :class:`socket ` and :class:`SSLObject ` instances can also have a timeout, -set by :meth:`settimeout ` method. +set by the :meth:`settimeout ` method. When these are not enough, the :class:`Timeout` class can be used to add timeouts to arbitrary sections of (yielding) code. @@ -203,12 +205,20 @@ Futher reading -------------- -To limit concurrency, use :class:`Pool` class (see `example: dns_mass_resolve.py`_). +To limit concurrency, use the :class:`Pool` class (see `example: dns_mass_resolve.py`_). Gevent comes with TCP/SSL/HTTP/WSGI servers. See :doc:`servers`. .. _`example: dns_mass_resolve.py`: http://bitbucket.org/denis/gevent/src/tip/examples/dns_mass_resolve.py#cl-17 + +External resources +------------------ + +`Gevent for working Python developer`__ is a comprehensive tutorial. + +__ http://sdiehl.github.io/gevent-tutorial/ + .. rubric:: Footnotes .. [#f1] This was not the case before 0.13.0, :meth:`kill ` method in 0.12.2 and older was asynchronous by default. diff -Nru python-gevent-0.13.7/doc/mytheme/changes/frameset.html python-gevent-1.0/doc/mytheme/changes/frameset.html --- python-gevent-0.13.7/doc/mytheme/changes/frameset.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/changes/frameset.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,11 @@ + + + + {% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} — {{ docstitle }}{% endtrans %} + + + + + + diff -Nru python-gevent-0.13.7/doc/mytheme/changes/rstsource.html python-gevent-1.0/doc/mytheme/changes/rstsource.html --- python-gevent-0.13.7/doc/mytheme/changes/rstsource.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/changes/rstsource.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,15 @@ + + + + {% trans filename=filename, docstitle=docstitle|e %}{{ filename }} — {{ docstitle }}{% endtrans %} + + + +
+      {{ text }}
+    
+ + diff -Nru python-gevent-0.13.7/doc/mytheme/changes/versionchanges.html python-gevent-1.0/doc/mytheme/changes/versionchanges.html --- python-gevent-0.13.7/doc/mytheme/changes/versionchanges.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/changes/versionchanges.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +{% macro entries(changes) %} +
    {% for entry, docname, lineno in changes %} +
  • {{ entry }}
  • +{% endfor %}
+{% endmacro -%} + + + + + + {% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} — {{ docstitle }}{% endtrans %} + + +
+
+

{% trans version=version|e %}Automatically generated list of changes in version {{ version }}{% endtrans %}

+

{{ _('Library changes') }}

+ {% for modname, changes in libchanges %} +

{{ modname }}

+ {{ entries(changes) }} + {% endfor %} +

{{ _('C API changes') }}

+ {{ entries(apichanges) }} +

{{ _('Other changes') }}

+ {% for (fn, title), changes in otherchanges %} +

{{ title }} ({{ fn }})

+ {{ entries(changes) }} + {% endfor %} +
+
+ + diff -Nru python-gevent-0.13.7/doc/mytheme/defindex.html python-gevent-1.0/doc/mytheme/defindex.html --- python-gevent-0.13.7/doc/mytheme/defindex.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/defindex.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,26 @@ +{% extends "layout.html" %} +{% set title = _('Overview') %} +{% block body %} +

{{ docstitle|e }}

+

+ Welcome! This is + {% block description %}the documentation for {{ project|e }} + {{ release|e }}{% if last_updated %}, last updated {{ last_updated|e }}{% endif %}{% endblock %}. +

+ {% block tables %} +

{{ _('Indices and tables:') }}

+ + +
+ + + + + +
+ {% endblock %} +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/domainindex.html python-gevent-1.0/doc/mytheme/domainindex.html --- python-gevent-0.13.7/doc/mytheme/domainindex.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/domainindex.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,57 @@ +{# + basic/domainindex.html + ~~~~~~~~~~~~~~~~~~~~~~ + + Template for domain indices (module index, ...). + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "layout.html" %} +{% set title = indextitle %} +{% block extrahead %} +{{ super() }} +{% if not embedded and collapse_index %} + +{% endif %} +{% endblock %} +{% block body %} + + {%- set curr_group = 0 %} + +

{{ indextitle }}

+ +
+ {%- for (letter, entries) in content %} + {{ letter }} + {%- if not loop.last %} | {% endif %} + {%- endfor %} +
+ + + {%- for letter, entries in content %} + + + {%- for (name, grouptype, page, anchor, extra, qualifier, description) + in entries %} + {%- if grouptype == 1 %}{% set curr_group = curr_group + 1 %}{% endif %} + + + + {%- endfor %} + {%- endfor %} +
 
+ {{ letter }}
{% if grouptype == 1 -%} + + {%- endif %}{% if grouptype == 2 %}   {% endif %} + {% if page %}{% endif -%} + {{ name|e }} + {%- if page %}{% endif %} + {%- if extra %} ({{ extra|e }}){% endif -%} + {% if qualifier %}{{ qualifier|e }}:{% endif %} + {{ description|e }}
+ +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/genindex.html python-gevent-1.0/doc/mytheme/genindex.html --- python-gevent-0.13.7/doc/mytheme/genindex.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/genindex.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,57 @@ +{% extends "layout.html" %} +{% set title = _('Index') %} +{% block body %} + +

{{ _('Index') }}

+ + {% for key, dummy in genindexentries -%} + {{ key }} {% if not loop.last %}| {% endif %} + {%- endfor %} + +
+ + {% for key, entries in genindexentries %} +

{{ key }}

+
+
+{%- set breakat = genindexcounts[loop.index0] // 2 %} +{%- set numcols = 1 %} +{%- set numitems = 0 %} +{% for entryname, (links, subitems) in entries %} +
{%- if links -%}{{ entryname|e }} + {%- for link in links[1:] %}, [{{ loop.index }}]{% endfor -%} + {%- else -%} +{{ entryname|e }} + {%- endif -%}
+ {%- if subitems %} +
+ {%- for subentryname, subentrylinks in subitems %} +
{{ subentryname|e }} + {%- for link in subentrylinks[1:] %}, [{{ loop.index }}]{% endfor -%} +
+ {%- endfor %} +
+ {%- endif -%} +{%- set numitems = numitems + 1 + (subitems|length) -%} +{%- if numcols < 2 and numitems > breakat -%} +{%- set numcols = numcols+1 -%} +
+{%- endif -%} +{%- endfor %} +
+{% endfor %} + +{% endblock %} + +{% block sidebarrel %} +{% if split_index %} +

{{ _('Index') }}

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

{{ _('Full index on one page') }}

+{% endif %} + {{ super() }} +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/genindex-single.html python-gevent-1.0/doc/mytheme/genindex-single.html --- python-gevent-0.13.7/doc/mytheme/genindex-single.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/genindex-single.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,46 @@ +{% extends "layout.html" %} +{% set title = _('Index') %} +{% block body %} + +

{% trans key=key %}Index – {{ key }}{% endtrans %}

+ +
+
+{%- set breakat = count // 2 %} +{%- set numcols = 1 %} +{%- set numitems = 0 %} +{% for entryname, (links, subitems) in entries %} +
{%- if links -%}{{ entryname|e }} + {%- for link in links[1:] %}, [{{ loop.index }}]{% endfor -%} + {%- else -%} +{{ entryname|e }} + {%- endif -%}
+ {%- if subitems %} +
+ {%- for subentryname, subentrylinks in subitems %} +
{{ subentryname|e }} + {%- for link in subentrylinks[1:] %}, [{{ loop.index }}]{% endfor -%} +
+ {%- endfor %} +
+ {%- endif -%} +{%- set numitems = numitems + 1 + (subitems|length) -%} +{%- if numcols < 2 and numitems > breakat -%} +{%- set numcols = numcols+1 -%} +
+{%- endif -%} +{%- endfor %} +
+ +{% endblock %} + +{% block sidebarrel %} +

Index

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

{{ _('Full index on one page') }}

+ {{ super() }} +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/genindex-split.html python-gevent-1.0/doc/mytheme/genindex-split.html --- python-gevent-0.13.7/doc/mytheme/genindex-split.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/genindex-split.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,30 @@ +{% extends "layout.html" %} +{% set title = _('Index') %} +{% block body %} + +

{{ _('Index') }}

+ +

{{ _('Index pages by letter') }}:

+ +

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

{{ _('Full index on one page') }} + ({{ _('can be huge') }})

+ +{% endblock %} + +{% block sidebarrel %} +{% if split_index %} +

Index

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

{{ _('Full index on one page') }}

+{% endif %} + {{ super() }} +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/layout.html python-gevent-1.0/doc/mytheme/layout.html --- python-gevent-0.13.7/doc/mytheme/layout.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/layout.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,263 @@ +{%- block doctype -%} + +{%- endblock %} +{%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %} +{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %} +{%- set url_root = pathto('', 1) %} +{%- if url_root == '#' %}{% set url_root = '' %}{% endif %} + +{%- macro relbar() %} + +{%- endmacro %} + +{%- macro sidebar() %} + {%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+
+ {%- block sidebarlogo %} + {%- if logo %} + + {%- endif %} + {%- endblock %} + {%- block sidebartoc %} + {%- if display_toc %} +

{{ _('Table Of Contents') }}

+ {{ toc }} + + {%- else %} +

{{ _('Navigation') }}

+ + + {%- endif %} + {%- endblock %} + {%- block sidebarrel %} +

Related pages

+ + {%- endblock %} + {%- block sidebarsourcelink %} + {%- if show_source and has_source and sourcename %} +

{{ _('This Page') }}

+ + {%- endif %} + {%- endblock %} + {%- if customsidebar %} + {% include customsidebar %} + {%- endif %} +{# + {%- block sidebarsearch %} + {%- if pagename != "search" %} + + + {%- endif %} + {%- endblock %} #} +
+
+ {%- endif %}{% endif %} +{%- endmacro %} + + + + + + {{ metatags }} + {%- if not embedded and docstitle %} + {%- set titlesuffix = " — "|safe + docstitle|e %} + {%- else %} + {%- set titlesuffix = "" %} + {%- endif %} + {{ title|striptags }}{{ titlesuffix }} + + + {%- if not embedded %} +{# + {%- for scriptfile in script_files %} + + {%- endfor %} + {%- if use_opensearch %} + + {%- endif %} #} + {%- if favicon %} + + {%- endif %} + {%- endif %} +{%- block linktags %} + {%- if hasdoc('about') %} + + {%- endif %} + {%- if hasdoc('genindex') %} + + {%- endif %} + {%- if hasdoc('search') %} + + {%- endif %} + {%- if hasdoc('copyright') %} + + {%- endif %} + + {%- if parents %} + + {%- endif %} + {%- if next %} + + {%- endif %} + {%- if prev %} + + {%- endif %} +{%- endblock %} +{%- block extrahead %} {% endblock %} + + + + +
+ + +
+ +
+ +
+{%- block document %} +
+{%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+{%- endif %}{% endif %} +
+ + + {% block body %} {% endblock %} + + {%- if next %} +

Next page: {{ next.title }}

+ {%- endif %} + +
+{%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+{%- endif %}{% endif %} +
+{%- endblock %} +
+
+ +
+
+ {%- block sidebar2 %}{{ sidebar() }}{% endblock %} +
+
+
 
+
+ + + +
+ + + + + diff -Nru python-gevent-0.13.7/doc/mytheme/modindex.html python-gevent-1.0/doc/mytheme/modindex.html --- python-gevent-0.13.7/doc/mytheme/modindex.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/modindex.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ +{% extends "layout.html" %} +{% set title = _('Global Module Index') %} +{% block extrahead %} +{{ super() }} +{% if not embedded and collapse_modindex %} + +{% endif %} +{% endblock %} +{% block body %} + +

{{ _('Global Module Index') }}

+ + {%- for letter in letters %} + {{ letter }} {% if not loop.last %}| {% endif %} + {%- endfor %} +
+ + + {%- for modname, collapse, cgroup, indent, fname, synops, pform, dep, stripped in modindexentries %} + {%- if not modname -%} + + + {%- else -%} + + + + {%- endif -%} + {% endfor %} +
 
{{ fname }}
{% if collapse -%} + + {%- endif %}{% if indent %}   {% endif %} + {% if fname %}{% endif -%} + {{ stripped|e }}{{ modname|e }} + {%- if fname %}{% endif %} + {%- if pform and pform[0] %} ({{ pform|join(', ') }}){% endif -%} + {% if dep %}{{ _('Deprecated')}}:{% endif %} + {{ synops|e }}
+ +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/page.html python-gevent-1.0/doc/mytheme/page.html --- python-gevent-0.13.7/doc/mytheme/page.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/page.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,4 @@ +{% extends "layout.html" %} +{% block body %} + {{ body }} +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/search.html python-gevent-1.0/doc/mytheme/search.html --- python-gevent-0.13.7/doc/mytheme/search.html 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/search.html 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,45 @@ +{% extends "layout.html" %} +{% set title = _('Search') %} +{% set script_files = script_files + ['_static/searchtools.js'] %} +{% block body %} +

{{ _('Search') }}

+
+ +

+ {% trans %}Please activate JavaScript to enable the search + functionality.{% endtrans %} +

+
+

+ {% trans %}From here you can search these documents. Enter your search + words into the box below and click "search". Note that the search + function will automatically search for all of the words. Pages + containing fewer words won't appear in the result list.{% endtrans %} +

+
+ + + +
+ {% if search_performed %} +

{{ _('Search Results') }}

+ {% if not search_results %} +

{{ _('Your search did not match any results.') }}

+ {% endif %} + {% endif %} +
+ {% if search_results %} +
    + {% for href, caption, context in search_results %} +
  • {{ caption }} +
    {{ context|e }}
    +
  • + {% endfor %} +
+ {% endif %} +
+{% endblock %} +{% block footer %} + {{ super() }} + +{% endblock %} diff -Nru python-gevent-0.13.7/doc/mytheme/static/basic.css_t python-gevent-1.0/doc/mytheme/static/basic.css_t --- python-gevent-0.13.7/doc/mytheme/static/basic.css_t 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/static/basic.css_t 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1708 @@ +/* +Template name: Simple Organization +Template URI: http://templates.arcsin.se/simple-organization-website-template/ +Release date: 2009-09-20 +Last updated: 2009-09-24 +Description: A simple and elegant template suitable for organizations. +Author: Viktor Persson +Author URI: http://arcsin.se/ + +This template is licensed under a Creative Commons Attribution 2.5 License: +http://templates.arcsin.se/license/ +*/ + + +/* + Reset +------------------------------------------------------------------- */ + +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, /*pre,*/ a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, textarea, input, select {margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline;} +table {border-collapse: collapse; border-spacing: 0;} +caption, th, td {text-align: left; font-weight: normal;} +table, td, th {vertical-align: middle;} +blockquote:before, blockquote:after, q:before, q:after {content: "";} +blockquote, q {quotes: "" "";} +a img {border: none;} +:focus {outline: 0;} + + +/* + General +------------------------------------------------------------------- */ + +html { + height: 100%; + padding-bottom: 1px; /* force scrollbars */ +} + +body { + background: #FFF; + color: #444; + font: normal 75% sans-serif; + line-height: 1.5; +} + + +/* + Typography +------------------------------------------------------------------- */ + +/* Headings */ + +h1,h2,h3,h4,h5,h6 { + color: #444; + font-weight: normal; + line-height: 1; + margin-bottom: 0.3em; +} +/*h4,h5,h6 {font-weight: bold;}*/ + +h1 {font-size: 2em;} +h2 {font-size: 2em;} +h3 {font-size: 1.5em;} +h4 {font-size: 1.25em;} +h5 {font-size: 1.1em;} +h6 {font-size: 1em;} + +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin: 0;} + +.document h1, .document h2, .document h3 { + /* label */ + border-left-style: solid; + border-left-width: 4px; + margin-bottom: 0.2em; + padding-left: 10px; + /* label-green */ + border-left-color: #B7D897; +} + +.document h1 {font-size: 2em; margin-bottom: 1em; } +.document h2 {font-size: 1.5em; margin-bottom: 1em; margin-top: 1em; } +.document h3 {font-size: 1.25em; margin-bottom: 1em; margin-top: 1em; } +.document h4 {font-size: 1.1em; margin-bottom: 1em; margin-top: 1em; } +.document h5 {font-size: 1em; margin-bottom: 1em; margin-top: 1em; } + +.title {color: #7c9a5e;} + +/* Links */ + +a:focus,a:hover {color: {{ theme_linkcolor }}; /*#039;*/} +a { + color: #456; + text-decoration: none; +} +a:hover {text-decoration: underline;} + +a.feed { + background: url('img/icon-feed.gif') no-repeat left center; + padding-left: 18px; +} +a.more { + color: #579; + font-weight: bold; +} +a.more:hover {color: #234;} + + +h2 a {color: #444; text-decoration: none;} +h3 a {color: #444; text-decoration: none;} + +h2 a:hover {color: #000; text-decoration: none;} +h3 a:hover {color: #000; text-decoration: none;} + + +a .regular {color: #444; } + +a.nobr { white-space: nowrap; } + + +/* Text elements */ + +p {margin-bottom: 1em; + margin-top: 1em; +} + +abbr, acronym {border-bottom: 1px dotted #666;} +address {margin-bottom: 1.5em;} +blockquote {margin: 1.5em;} +del, blockquote { color:#666; } +em, dfn, blockquote, address {font-style: italic;} +strong, dfn {font-weight: bold;} +sup, sub {line-height: 0;} + +/*pre { + margin: 1.5em 0; + white-space: pre; +} +pre,code,tt { + font: 1em monospace; + line-height: 1.5; +}*/ + + +/* Lists */ + +li ul, li ol {margin-left: 1.5em;} +ul, ol {margin: 1.5em 0 1.5em 1.5em;} + +/*ul {list-style-type: disc;}*/ +ol { + /*list-style-type: decimal;*/ + margin-left: 1.9em; +} + +dl {margin: 0 0 1.5em 0;} +dl dt {font-weight: bold;} +dd {margin-left: 1.5em;} + + +/* Special lists */ + +ul.plain-list li, ul.nice-list li, ul.tabbed li { + list-style: none; + margin-top: 0; +} + +ul.tabbed { + display: inline; + margin: 0; +} +ul.tabbed li {float: left;} + +ul.plain-list {margin: 0;} + +ul.nice-list {margin-left: 0;} +ul.nice-list li { + border-top: 1px solid #EEE; + list-style: none; + padding: 4px 0; +} +ul.nice-list li:first-child {border-top: none;} +ul.nice-list li .right {color: #999;} + + +/* Tables */ + +table {margin-bottom: 1.4em; width: 100%;} +th {font-weight: bold;} +thead th {background: #C3D9FF;} +th,td,caption {padding: 4px 10px 4px 5px;} +tr.even td {background: #F2F6FA;} +tfoot {font-style: italic;} +caption {background: #EEE;} + +table.data-table { + border: 1px solid #CCB; + margin-bottom: 2em; + width: 100%; +} +table.data-table th { + background: #F0F0F0; + border: 1px solid #DDD; + color: #555; + text-align: left; +} +table.data-table tr {border-bottom: 1px solid #DDD;} +table.data-table td, table th {padding: 10px;} +table.data-table td { + background: #F6F6F6; + border: 1px solid #DDD; +} +table.data-table tr.even td {background: #FCFCFC;} + + +/* Misc classes */ + +.small {font-size: 0.9em;} +.smaller {font-size: 0.8em;} +.smallest {font-size: 0.7em;} + +.large {font-size: 1.15em;} +.larger {font-size: 1.25em;} +.largest {font-size: 1.35em;} + +.hidden {display: none;} + +.quiet, .quiet a {color: #999;} +.loud, .loud a {color: #000;} +.highlight, .highlight a {background:#ff0;} + +.text-left {text-align: left;} +.text-right {text-align: right;} +.text-center {text-align: center;} +.text-separator {padding: 0 5px;} + +.error, .notice, .success { + border: 1px solid #DDD; + margin-bottom: 1em; + padding: 0.6em 0.8em; +} + +.error {background: #FBE3E4; color: #8A1F11; border-color: #FBC2C4;} +.error a {color: #8A1F11;} + +.notice {background: #FFF6BF; color: #514721; border-color: #FFD324;} +.notice a {color: #514721;} + +.success {background: #E6EFC2; color: #264409; border-color: #C6D880;} +.success a {color: #264409;} + + +/* Labels */ +h1.label { + border-left-style: solid; + border-left-width: 4px; + margin-bottom: 0.2em; + padding-left: 10px; +} + +h1.label-blue {border-left-color: #55AADA;} +h1.label-green {border-left-color: #B7D897;} +h1.label-orange {border-left-color: #FA8F6F;} + + +h2.label { + border-left-style: solid; + border-left-width: 4px; + margin-bottom: 0.2em; + padding-left: 10px; +} + +h2.label-blue {border-left-color: #55AADA;} +h2.label-green {border-left-color: #B7D897;} +h2.label-orange {border-left-color: #FA8F6F;} + +/* + Forms +------------------------------------------------------------------- */ + +label { + cursor: pointer; + font-weight: bold; +} +label.checkbox, label.radio {font-weight: normal;} +legend { + font-weight: bold; + font-size: 1.2em; +} +textarea {overflow: auto;} +input.text, textarea, select { + background: #FCFCFC; + border: 1px inset #AAA; + margin: 0.5em 0; + padding: 4px 5px; +} +input.text:focus, textarea:focus, select:focus {background: #FFFFF5;} + +input.button { + background: #DDD; + border: 1px outset #AAA; + padding: 4px 5px; +} +input.button:active {border-style: inset;} + + +/* Specific */ + +form .required {font-weight: bold;} + +.form-error {border-color: #F00;} +.form-row {padding: 5px 0;} +.form-row-submit { + border-top: 1px solid #DDD; + padding: 8px 0 10px 76px; + margin-top: 10px; +} +.legend { + background: #F0FAF0; + border: 1px solid #D6DFD6; + font-size: 1.5em; + margin: 0; + padding: 8px 14px; +} +.form-property, .form-value {float: left;} +.form-property { + padding-top: 8px; + text-align: right; + width: 60px; +} +.form-value {padding-left: 16px;} +.form-error {border-color: #F00;} + + + +/* + Alignment +------------------------------------------------------------------- */ + +/* General */ + +.center,.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + + +/* Images */ + +img.bordered,img.alignleft,img.alignright,img.aligncenter { + background-color: #FFF; + border: 1px solid #DDD; + padding: 3px; +} +img.alignleft, img.left {margin: 0 1.5em 1em 0;} +img.alignright, img.right {margin: 0 0 1em 1.5em;} + + +/* Floats */ + +.left,.alignleft {float: left;} +.right,.alignright {float: right;} + +.clear,.clearer {clear: both;} +.clearer { + display: block; + font-size: 0; + line-height: 0; + height: 0; +} + + +/* + Separators +------------------------------------------------------------------- */ + +.content-separator, .archive-separator { + background: #E5E5E5; + clear: both; + color: #FFE; + display: block; + font-size: 0; + line-height: 0; + height: 1px; +} +.content-separator {margin: 32px 0;} +.archive-separator {margin-bottom: 20px;} + + +/* + Posts +------------------------------------------------------------------- */ + +.post {margin-bottom: 20px;} + +.post img.left, .post img.right {margin-bottom: 0;} + +.post-date { + color: #777; + margin: 2px 0 10px; +} +.post-date a {color: #444;} + +.post-meta a {color: #345; } +.post-meta a:hover {color: #001;} + +/*.body {font-size: 133.33333%;}*/ +.body {font-size: 1.1em;} +.body a {color: {{ theme_linkcolor }}; /*#039;*/} +.body a:hover {color: {{ theme_linkcolor }}; /*#039;*/} + +.body img.left, .body img.right {margin-bottom: 1em;} + + +/* Archives */ +.archive-pagination { + color: #777; + padding: 10px 0; +} +.archive-pagination-top { + border-bottom: 2px solid #DDD; + margin-bottom: 24px; +} +.archive-pagination-bottom { + border-top: 2px solid #DDD; + margin-top: 24px; +} + +.archive-post-date { + background: #F5F5F5; + border-bottom: 1px solid #C5C5C5; + border-right: 1px solid #CFCFCF; + float: left; + margin-right: 12px; + padding: 2px 0 5px; + text-align: center; + width: 46px; +} +.archive-post-title .post-date {margin: 0;} +.archive-post-title {padding-top: 4px;} +.archive-post-day {font: normal 1.6em Georgia,serif;} + + +/* + Comments +------------------------------------------------------------------- */ + +/* +.comment-input-text textarea {width: 80%;} + +// Comment list + +.comment-list-wrapper { + background: #F6F6F6; + margin: 10px 0 0; + padding: 5px 12px 10px 7px; +} +.comment-list { + margin: 0; + padding: 0; +} +.comment-list li {list-style: none;} +.comment-list ul {margin-bottom: 0;} + +.comment-profile-wrapper { + text-align: center; + width: 105px; +} + +.comment-gravatar {margin-bottom: 3px;} + +.comment-content-wrapper { + float: right; + width: 481px; +} + +.comment-parent, .comment-single {margin-top: 15px;} + +.comment-list ul.children, #comments #respond ul { + border-left: 1px solid #CCC; + margin: 0 0 0 130px; +} +.comment-list ul.children ul.children {margin-left: 15px;} + +.comment-list ul.children li { + background: url('img/comment-reply.gif') no-repeat left top; + margin: 0; + padding: 10px 0 0 15px; +} + +.comment-body { + background: #FFF; + border: 1px solid #DDD; + padding: 10px 12px 0; +} +.comment-list ul.children .comment-body {background: #FCFCFC;} + +.comment-author {padding-top: 2px;} + +.comment-text p {margin-bottom: 0.8em;} + +.comment .post-date, .comment-author {font-size: 0.9em;} +.comment .post-date .right a {color: #BBB;} +.comment .post-date .right a:hover {color: #234;} + +.comment-arrow { + background: url('img/comment-arrow.gif') no-repeat left top; + display: block; + float: left; + height: 45px; + margin: 3px 0 -45px -41px; + position: absolute; + width: 29px; +} + +// Respond + +#respond li {list-style: none;} +#respond { + background: #F6F6F6; + padding: 10px 12px; +} +#respond ul {margin: 0;} +#respond .legend {margin-bottom: 10px;} + +#comments #respond {padding: 0;} +#comments #respond .legend { + border-bottom: 0; + margin-bottom: 0; +} +#comments #respond ul { + background: url('img/comment-reply.gif') no-repeat left top; + padding: 10px 0 0 15px; +} +#comments ul.children #respond ul { + margin-left: 30px; + padding: 0; +} + +#comments #respond .comment-profile-wrapper, #comments #respond .comment-arrow {display: none;} +#comments #respond .comment-body {background: #FFF;} +#comments #respond .comment-content-wrapper { + float: none; + width: 100%; +} + +*/ + +/* + Layout +------------------------------------------------------------------- */ + +/* Common */ +#top, #sub-nav {border-bottom: 1px solid #DDD;} + + +/* Wrapper */ +#site-wrapper { + margin: 0 auto; + width: 920px; +} + + +/* Header */ +#header {padding-top: 24px;} + +/* Top */ +#top {padding-bottom: 32px;} + + +/* Logo */ +#logo { border-right: 1px solid #DDD; + padding: 10px 40px 10px 0; + margin-right: 40px; +} +#logo img {} + +/* Splash */ +#splash {padding-top: 32px;} + + +/* Navigation */ +.navigation a { + color: #888; + text-decoration: none; +} +.navigation a:hover {color: #002;} +.navigation li.current-tab a {color: #222;} + +#main-nav li:first-child, #sub-nav li:first-child {margin-left: 0;} + +/* Main navigation */ +#main-nav {padding-top: 0px;} +#main-nav li {margin: 0 1.5em;} +#main-nav a { + font-size: 1.45em; + line-height: 2em; + padding-bottom: 2px; +} +#main-nav li.current-tab a {color: #333;} +#main-nav a:hover {color: #002;} +#main-nav li.current-tab a {border-bottom: 2px solid #94CC5F;} +#main-nav li.current-tab a:hover {color: #002;} + +#title {color: #7c9a5e; text-decoration: none} +#title:hover {text-decoration: none} + + +/* Subnav */ +#sub-nav { + border-bottom: 1px solid #DDD; + padding: 12px 0; +} +#sub-nav a { + font-size: 1.2em; + text-decoration: none; +} +#sub-nav li {margin: 0 1em;} +#sub-nav li.current-tab a {font-weight: bold;} + + +/* Main */ +.main {margin: 24px 0;} + +.main#main-two-columns {background: url('img/main-two-columns.gif') repeat-y right top;} +.main#main-two-columns-left {background: url('img/main-two-columns-left.gif') repeat-y left top;} +.main#main-two-columns #main-content, .main#main-two-columns-left #main-content {width: 620px;} + +/* Sidebar */ +#sidebar {width: 255px;} + + +/* Columns */ +.col3, .col3-mid {width: 31%;} +.col3-mid {margin-left: 3%;} + +.col3big { width: 65% } + +/* Sections */ +.section {margin-bottom: 24px;} +.section-title { + background-color: #F9F9F9; + border-top: 2px solid #DDD; + color: #7A7A7A; + font: bold 1.2em sans-serif; + margin-bottom: 16px; + padding: 7px 10px 6px; +} +.section-title a {color: #7A7A7A;} +.section-title a:hover {color: #444; text-decoration: none;} + +#sidebar .section-title {margin-bottom: 8px;} + + +/* Footer */ + +#footer { + border-top: 1px solid #DDD; + color: #777; + padding: 16px 0 4px; +} +#footer-left {width: 259px;} +#footer-right { + width: 659px; + text-align: right; +} +#footer p {margin-bottom: 0.4em;} +#footer .text-separator { + padding: 0 3px; + color: #BBB; +} +#footer a:hover {color: #000;} + +#footer a.quiet-link {text-decoration: none; color: #777} +#footer a.quiet-link:hover {text-decoration: underline; color: #000} + + + +/* + Misc overriding classes +------------------------------------------------------------------- */ + +/* Border */ + +.noborder {border: 0;} +.notborder {border-top: 0;} +.norborder {border-right: 0;} +.nobborder {border-bottom: 0;} +.nolborder {border-left: 0;} + +/* Margin */ + +.nomargin {margin: 0;} +.notmargin {margin-top: 0;} +.normargin {margin-right: 0;} +.nobmargin {margin-bottom: 0;} +.nolmargin {margin-left: 0;} + +/* Padding */ + +.nopadding {padding: 0;} +.notpadding {padding-top: 0;} +.norpadding {padding-right: 0;} +.nobpadding {padding-bottom: 0;} +.nolpadding {padding-left: 0;} + + +/* + IE Fixes (zzz) +------------------------------------------------------------------- */ + +* html .navigation, * html #footer, * html #splash, * html .comment ul {height: 0.01%;} +* html #footer-left {width: 500px;} +.navigation, #splash, .comment ul {min-height: 0.01%;} + + + + + + + +/* Sphinx stylesheet */ + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + + + +tt { + background-color: #ecf0f3; + padding: 0 1px 0 1px; + font-size: 110%; +} + +.warning tt { + background: #efc2c2 !important; +} + +.note tt { + background: #d6d6d6; +} + +dt:target, .highlight { + background-color: #fbe54e; +} + + + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: {{ theme_linkcolor }}; + text-decoration: none; +} + +/* +a:hover { + text-decoration: underline; +} +*/ + +a.headerlink { + color: {{ theme_headlinkcolor }}; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: {{ theme_headlinkcolor }}; + color: white; +} + + +/* -- general body styles --------------------------------------------------- */ + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.admonition p { + margin-bottom: 5px; +} + +div.admonition pre { + margin-bottom: 5px; +} + +div.admonition ul, div.admonition ol { + margin-bottom: 5px; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + + + +pre { + padding: 5px; + background-color: {{ theme_codebgcolor }}; + color: {{ theme_codetextcolor }}; + font-size: 120%; + line-height: 150%; + border: 1px solid #ac9; + border-left: none; + border-right: none; + /*font-family: {{ theme_bodyfont }};*/ +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlight { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 1.3em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.classifier { + font-style: oblique; +} + + + +ul ul { margin-top: 0em; margin-bottom: 0em; } + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + + + +/* + + +// +// Sphinx stylesheet -- basic theme +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// + +// -- main layout ----------------------------------------------------------- + +div.clearer { + clear: both; +} + +// -- relbar ---------------------------------------------------------------- + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +// -- sidebar --------------------------------------------------------------- + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +img { + border: 0; +} + +// -- search page ----------------------------------------------------------- + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +// -- index page ------------------------------------------------------------ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +// -- general index --------------------------------------------------------- + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +// -- general body styles --------------------------------------------------- + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.field-list ul { + padding-left: 1em; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +.align-left { + text-align: left; +} + +.align-center { + clear: both; + text-align: center; +} + +.align-right { + text-align: right; +} + +// -- sidebars -------------------------------------------------------------- + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +// -- topics ---------------------------------------------------------------- + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +// -- tables ---------------------------------------------------------------- + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 0; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.field-list td, table.field-list th { + border: 0 !important; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +// -- other body styles ----------------------------------------------------- + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlight { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 1.3em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.classifier { + font-style: oblique; +} + +// -- code displays --------------------------------------------------------- + +pre { + overflow: auto; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +// -- math display ---------------------------------------------------------- + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +// -- printout stylesheet --------------------------------------------------- + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } + +} + + +// default theme + + +body { + font-family: {{ theme_bodyfont }}; + font-size: 100%; + background-color: {{ theme_footerbgcolor }}; + color: #000; + margin: 0; + padding: 0; +} + +div.document { + background-color: {{ theme_sidebarbgcolor }}; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +div.body { + background-color: {{ theme_bgcolor }}; + color: {{ theme_textcolor }}; + padding: 0 20px 30px 20px; +} + +{%- if theme_rightsidebar|tobool %} +div.bodywrapper { + margin: 0 230px 0 0; +} +{%- endif %} + +div.footer { + color: {{ theme_footertextcolor }}; + width: 100%; + padding: 9px 0 9px 0; + text-align: center; + font-size: 75%; +} + +div.footer a { + color: {{ theme_footertextcolor }}; + text-decoration: underline; +} + +div.related { + background-color: {{ theme_relbarbgcolor }}; + line-height: 30px; + color: {{ theme_relbartextcolor }}; +} + +div.related a { + color: {{ theme_relbarlinkcolor }}; +} + +div.sphinxsidebar { + {%- if theme_stickysidebar|tobool %} + top: 30px; + bottom: 0; + margin: 0; + position: fixed; + overflow: auto; + height: auto; + {%- endif %} + {%- if theme_rightsidebar|tobool %} + float: right; + {%- if theme_stickysidebar|tobool %} + right: 0; + {%- endif %} + {%- endif %} +} + +{%- if theme_stickysidebar|tobool %} +// this is nice, but it it leads to hidden headings when jumping +// to an anchor +// +//div.related { +// position: fixed; +//} +// +//div.documentwrapper { +// margin-top: 30px; +//} + +{%- endif %} + +div.sphinxsidebar h3 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + font-size: 1.4em; + font-weight: normal; + margin: 0; + padding: 0; +} + +div.sphinxsidebar h3 a { + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar h4 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + font-size: 1.3em; + font-weight: normal; + margin: 5px 0 0 0; + padding: 0; +} + +div.sphinxsidebar p { + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar p.topless { + margin: 5px 10px 10px 10px; +} + +div.sphinxsidebar ul { + margin: 10px; + padding: 0; + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar a { + color: {{ theme_sidebarlinkcolor }}; +} + +div.sphinxsidebar input { + border: 1px solid {{ theme_sidebarlinkcolor }}; + font-family: sans-serif; + font-size: 1em; +} + +// -- body styles ----------------------------------------------------------- + +a { + color: {{ theme_linkcolor }}; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: {{ theme_headfont }}; + background-color: {{ theme_headbgcolor }}; + font-weight: normal; + color: {{ theme_headtextcolor }}; + border-bottom: 1px solid #ccc; + margin: 20px -20px 10px -20px; + padding: 3px 0 3px 10px; +} + +div.body h1 { margin-top: 0; font-size: 200%; } +div.body h2 { font-size: 160%; } +div.body h3 { font-size: 140%; } +div.body h4 { font-size: 120%; } +div.body h5 { font-size: 110%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: {{ theme_headlinkcolor }}; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: {{ theme_headlinkcolor }}; + color: white; +} + +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.admonition p { + margin-bottom: 5px; +} + +div.admonition pre { + margin-bottom: 5px; +} + +div.admonition ul, div.admonition ol { + margin-bottom: 5px; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre { + padding: 5px; + background-color: {{ theme_codebgcolor }}; + color: {{ theme_codetextcolor }}; + border: 1px solid #ac9; + border-left: none; + border-right: none; +} + +tt { + background-color: #ecf0f3; + padding: 0 1px 0 1px; + font-size: 0.95em; +} + +.warning tt { + background: #efc2c2; +} + +.note tt { + background: #d6d6d6; +} + + + +*/ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/file.png and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/file.png differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/img/main-two-columns.gif and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/img/main-two-columns.gif differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/minus.png and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/minus.png differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/omegle_48.png and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/omegle_48.png differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/plus.png and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/plus.png differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/spotify_logo.png and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/spotify_logo.png differ Binary files /tmp/NiVlb4LT3_/python-gevent-0.13.7/doc/mytheme/static/transparent.gif and /tmp/bQctr4fBiO/python-gevent-1.0/doc/mytheme/static/transparent.gif differ diff -Nru python-gevent-0.13.7/doc/mytheme/theme.conf python-gevent-1.0/doc/mytheme/theme.conf --- python-gevent-0.13.7/doc/mytheme/theme.conf 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/mytheme/theme.conf 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,29 @@ +[theme] +inherit = none +stylesheet = basic.css +pygments_style = sphinx + +[options] +nosidebar = false +rightsidebar = false +stickysidebar = false + +footerbgcolor = #11303d +footertextcolor = #ffffff +sidebarbgcolor = #1c4e63 +sidebartextcolor = #ffffff +sidebarlinkcolor = #98dbcc +relbarbgcolor = #133f52 +relbartextcolor = #ffffff +relbarlinkcolor = #ffffff +bgcolor = #ffffff +textcolor = #000000 +headbgcolor = #f2f2f2 +headtextcolor = #20435c +headlinkcolor = #c60f0f +linkcolor = #355f7c +codebgcolor = #eeffcc +codetextcolor = #333333 + +bodyfont = sans-serif +headfont = 'Trebuchet MS', sans-serif diff -Nru python-gevent-0.13.7/doc/networking.rst python-gevent-1.0/doc/networking.rst --- python-gevent-0.13.7/doc/networking.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/networking.rst 2013-11-26 16:25:45.000000000 +0000 @@ -5,7 +5,4 @@ gevent.socket gevent.ssl - gevent.sslold - gevent.dns gevent.select - diff -Nru python-gevent-0.13.7/doc/servers.rst python-gevent-1.0/doc/servers.rst --- python-gevent-0.13.7/doc/servers.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/servers.rst 2013-11-26 16:25:45.000000000 +0000 @@ -23,7 +23,7 @@ server = StreamServer(('127.0.0.1', 1234), handle, spawn=pool) server.serve_forever() -The :meth:`server_forever` method calls :meth:`start` and then waits until interrupted or until the server is stopped. +The :meth:`serve_forever` method calls :meth:`start` and then waits until interrupted or until the server is stopped. The difference between :class:`wsgi.WSGIServer ` and :class:`pywsgi.WSGIServer ` is that the first one is very fast as it uses libevent's http server implementation but it shares the issues that diff -Nru python-gevent-0.13.7/doc/success.rst python-gevent-1.0/doc/success.rst --- python-gevent-0.13.7/doc/success.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/success.rst 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,128 @@ +Success stories +=============== + +If you have a success story for Gevent, contact denis.bilenko@gmail.com or post to the `google group`_. + +.. _google group: http://groups.google.com/group/gevent/ + + +Omegle_ +------- + +I've been using gevent to power Omegle, my high-volume chat site, +since 2010. Omegle is used by nearly half a million people every day, +and it has as many as 20,000 users chatting at any given time. It +needs to needs to perform well and be extremely reliable, and gevent +makes that easy to do: gevent gives you power to do more creative +things, and it's fast enough that you can more easily write apps that +stand up to a lot of load. + +gevent is well-engineered, and its development has been maintaining an +active, dedicated pace for as long as I've been following it. Any time +I've had an issue with gevent that I couldn't solve on my own, the +friendly community has been extremely helpful and knowledgeable. I +really think gevent is the best library of its type for Python right +now, and I would recommend it to anyone who needs a good networking +library. + +-- Leif K-Brooks, Founder, Omegle.com_ + +.. _Omegle: http://omegle.com +.. _Omegle.com: http://omegle.com + + +Pediapress_ +----------- + +Pediapress_ powers Wikipedia_'s PDF rendering cluster. I've started using +gevent in 2009 after our NFS based job queue showed serious performance +problems on Wikipedia's PDF rendering cluster. I've replaced that with +a gevent based job queue server in a short time. gevent is managing the +generation of around 100000 PDF files daily and is serving them to wikipedia users. + +Recently I've refactored the component that fetches articles and +images from wikipedia to use gevent instead of twisted. The code is +much cleaner and much more manageable then before. + +-- Ralf Schmitt, Developer, Pediapress_ + +.. _Pediapress: http://pediapress.com/ +.. _Wikipedia: http://www.wikipedia.org/ + + +`ESN Social Software`_ +---------------------- + +Wanting to avoid the ravages of asynchronous programming we choose to base +our real-time web development framework Planet on gevent and Python. We’ve +found gevent to be stable, efficient, highly functional and still simplistic +enough for our needs and our customer’s requirements. + +-- Jonas Tärnström, Product Manager, `ESN Social Software`_ + +.. _ESN Social Software: http://esn.me + + +`Blue Shell Games`_ +------------------- + +At Blue Shell Games we use gevent to power the application servers that +connect more than a million daily players of our social casino games. +Recognizing that our game code is largely I/O bound — whether waiting on +a database, social networking data providers, or the clients themselves — we chose +gevent as our asynchronous networking framework. Not only does gevent offer +the best performance of any of the Python async networking packages, its +threading model makes multithreaded application servers far easier to write +than traditional kernel threading-based approaches. As our applications add +more real-time multiplayer features, gevent is ready to handle these kinds +of problems with ease. + +-- David Young, CTO, Co-Founder, `Blue Shell Games`_ + +.. _Blue Shell Games: http://www.blueshellgames.com/ + + +TellApart_ +---------- + +At TellApart, we have been using gevent since 2010 as the underpinnings of +our frontend servers. It enables us to serve millions of requests every hour +through only a handful of servers, while achieving the strict latency +constraints of Real-Time Bidding ad exchanges. Since then, we've expanded +our use of gevent throughout our stack. Combined with tools such as closures +and generators, gevent makes complicated queuing, distribution, and +streaming workloads dramatically easier to implement. Our open-source event +aggregation service, Taba, couldn't have been built without it. + +See also: `Gevent at TellApart`_ + +-- Kevin Ballard, Software Engineer, TellApart_ + +.. _TellApart: http://tellapart.com +.. _Gevent at TellApart: http://tellapart.com/gevent-at-tellapart + + +Disqus +------ + +See: `Making Disqus Realtime`_ + +.. _`Making Disqus Realtime`: https://ep2012.europython.eu/conference/talks/making-disqus-realtime + + +Pinterest +--------- + +Pinterest is one of the biggest players of gevents. We started using gevent in +2011 to query our mysql shards concurrently. It served us well so far. We run +all our WSGI containers using gevent. We are in the process of making all our +service calls gevented. We use a gevented based thrift server which proved to +be way more efficient than the normal python version. I think there is a cost +upfront to make your code greenlet safe but we saw pretty huge win later. +If you are looking to scale out on python gevent is your best friend. + +-- Yash Nelapati, Engineer, Pinterest_ + +.. _Pinterest: http://pinterest.com/ + +TBA: Spotify, Twilio diff -Nru python-gevent-0.13.7/doc/synchronization.rst python-gevent-1.0/doc/synchronization.rst --- python-gevent-0.13.7/doc/synchronization.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/doc/synchronization.rst 2013-11-26 16:25:45.000000000 +0000 @@ -5,5 +5,5 @@ gevent.event gevent.queue - gevent.coros + gevent.lock diff -Nru python-gevent-0.13.7/doc/whatsnew_1_0.rst python-gevent-1.0/doc/whatsnew_1_0.rst --- python-gevent-0.13.7/doc/whatsnew_1_0.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/doc/whatsnew_1_0.rst 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,129 @@ +What's new gevent 1.0 +--------------------- + +The detailed information is available in changelog. Below is the summary of all changes since 0.13.8. + +Gevent 1.0 supports Python 2.5 - 2.7. The version of greenlet required is 0.3.2. The source distribution +now includes the dependencies (libev and c-ares) and has not dependencies other than greenlet. + + +New core +~~~~~~~~ + +New event loop is used libev instead of libevent (see http://blog.gevent.org/2011/04/28/libev-and-libevent/ for motivation). + +The new :mod:`gevent.core` has been rewritten to wrap libev's API. (On Windows, the :mod:`gevent.core` accepts Windows handles +rather than stdio file descriptors.). + +The signal handlers set with the standard signal module are no longer blocked by the event loop. + +The event loops are now pluggable. The GEVENT_LOOP enviroment variable can specify the alternative class to use (the default is ``gevent.core.loop``). + +The error handling is now done by Hub.handle_error(). + +The system errors that usually kill the process (SystemError, SystemExit, KeyboardInterrupt) are now re-raised in the main greenlet. +Thus ``sys.exit()`` when run inside a greenlet is no longer trapped and kills the process as expected. + + +New dns resolver +~~~~~~~~~~~~~~~~ + +Two new DNS resolvers: threadpool-based one (enabled by default) and c-ares based one. That threadpool-based resolver was added mostly for Windows and Mac OS X platforms where c-ares might behave differently w.r.t system configuration. On Linux, however, the c-ares based resolver is probably a better choice. To enable c-ares resolver set GEVENT_RESOLVER=ares environment variable. + +This fixes some major issues with DNS on 0.13.x, namely: + +- Issue #2: DNS resolver no longer breaks after ``fork()``. You still need to call :func:`gevent.fork` (``os.fork`` is monkey patched with it if ``monkey.patch_all()`` was called). +- DNS resolver no longer ignores ``/etc/resolv.conf`` and ``/etc/hosts``. + +The following functions were added to socket module: + +- gethostbyname_ex +- getnameinfo +- gethostbyaddr +- getfqdn + +It is possible to implement your own DNS resolver and make gevent use it. The GEVENT_RESOLVER variable can point to alternative implementation using the format: ``package.module.class``. The default is ``gevent.resolver_thread.Resolver``. The alternative "ares" resolver is an alias for ``gevent.resolver_ares.Resolver``. + + +New API +~~~~~~~ + +- :func:`gevent.wait` and :func:`gevent.iwait` +- UDP server: gevent.server.DatagramServer +- Subprocess support + + New :mod:`gevent.subprocess` implements the interface of the standard subprocess module in a cooperative way. + It is possible to monkey patch the standard subprocess module with ``patch_all(subprocess=True)`` (not done by default). + +- Thread pool + + **Warning:** this feature is experimental and should be used with care. + + The :mod:`gevent.threadpool` module provides the usual pool methods (apply, map, imap, etc) but runs passed functions + in a real OS thread. + + There's a default threadpool, available as ``gevent.get_hub().threadpool``. + + +Breaking changes +~~~~~~~~~~~~~~~~ + +Removed features +^^^^^^^^^^^^^^^^ + +- gevent.dns module (wrapper around libevent-dns) +- gevent.http module (wrapper around libevent-http) +- ``util.lazy_property`` property. +- deprecated gevent.sslold module +- deprecated gevent.rawgreenlet module +- deprecated name ``GreenletSet`` which used to be alias for :class:`Group`. +- link to greenlet feature of Greenlet +- undocumented bind_and_listen and tcp_listener + +Renamed gevent.coros to gevent.lock. The gevent.coros is still available but deprecated. + + +API changes +^^^^^^^^^^^ + +In all servers, method "kill" was renamed to "close". The old name is available as deprecated alias. + +- ``Queue(0)`` is now equivalent to an unbound queue and raises :exc:`DeprecationError`. Use :class:`gevent.queue.Channel` if you need a channel. + +The :class:`Greenlet` objects: + +- Added ``__nonzero__`` implementation that returns `True` after greenlet was started until it's dead. This overrides + greenlet's __nonzero__ which returned `False` after `start()` until it was first switched to. + + +Bugfixes +~~~~~~~~ + +- Issue #302: "python -m gevent.monkey" now sets __file__ properly. +- Issue #143: greenlet links are now executed in the order they were added +- Fixed monkey.patch_thread() to patch threading._DummyThread to avoid leak in threading._active. +- gevent.thread: allocate_lock is now an alias for LockType/Semaphore. That way it does not fail when being used as class member. +- It is now possible to add raw greenlets to the pool. +- The :meth:`map` and :meth:`imap` methods now start yielding the results as soon as possible. +- The :meth:`imap_unordered` no longer swallows an exception raised while iterating its argument. +- `gevent.sleep()` no longer raises an exception, instead it does `sleep(0)`. +- The :class:`WSGIServer` now sets `max_accept` to 1 if `wsgi.multiprocessing` is set to `True`. +- Added :func:`monkey.patch_module` function that monkey patches module using `__implements__` list provided by gevent module. + All of gevent modules that replace stdlib module now have `__implements__` attribute. + + +pywsgi: + +- Fix logging when bound on unix socket (#295). +- readout request data to prevent ECONNRESET +- Fix #79: Properly handle HTTP versions. +- Fix #86: bytearray is now supported. +- Fix #92: raise IOError on truncated POST requests. +- Fix #93: do not sent multiple "100 continue" responses +- Fix #116: Multiline HTTP headers are now handled properly. +- Fix #216: propagate errors raised by Pool.map/imap +- Fix #303: 'requestline' AttributeError in pywsgi. +- Raise an AssertionError if non-zero content-length is passed to start_response(204/304) or if non-empty body is attempted to be written for 304/204 response +- Made sure format_request() does not fail if 'status' attribute is not set yet +- Added REMOTE_PORT variable to the environment. +- Removed unused deprecated 'wfile' property from WSGIHandler diff -Nru python-gevent-0.13.7/examples/concurrent_download.py python-gevent-1.0/examples/concurrent_download.py --- python-gevent-0.13.7/examples/concurrent_download.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/concurrent_download.py 2013-11-26 16:25:45.000000000 +0000 @@ -15,10 +15,10 @@ def print_head(url): - print 'Starting %s' % url + print ('Starting %s' % url) data = urllib2.urlopen(url).read() - print '%s: %s bytes: %r' % (url, len(data), data[:50]) + print ('%s: %s bytes: %r' % (url, len(data), data[:50])) jobs = [gevent.spawn(print_head, url) for url in urls] -gevent.joinall(jobs) +gevent.wait(jobs) diff -Nru python-gevent-0.13.7/examples/dns_mass_resolve.py python-gevent-1.0/examples/dns_mass_resolve.py --- python-gevent-0.13.7/examples/dns_mass_resolve.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/dns_mass_resolve.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,12 +1,16 @@ #!/usr/bin/python """Resolve hostnames concurrently, exit after 2 seconds. -Note, that gevent.socket.gethostname uses libevent-dns under the hood -and yields the control to other greenlets until the result is ready. -This script splits the job between a number of greenlets to get the -results faster. +Under the hood, this might use an asynchronous resolver based on +c-ares (the default) or thread-pool-based resolver. + +You can choose between resolvers using GEVENT_RESOLVER environment +variable. To enable threading resolver: + + GEVENT_RESOLVER=thread python dns_mass_resolve.py """ from __future__ import with_statement +import sys import gevent from gevent import socket from gevent.pool import Pool @@ -22,9 +26,10 @@ try: try: ip = socket.gethostbyname(url) - print '%s = %s' % (url, ip) - except socket.gaierror, ex: - print '%s failed with %s' % (url, ex) + print ('%s = %s' % (url, ip)) + except socket.gaierror: + ex = sys.exc_info()[1] + print ('%s failed with %s' % (url, ex)) finally: finished += 1 @@ -33,4 +38,4 @@ pool.spawn(job, '%s.com' % x) pool.join() -print 'finished within 2 seconds: %s/%s' % (finished, N) +print ('finished within 2 seconds: %s/%s' % (finished, N)) diff -Nru python-gevent-0.13.7/examples/echoserver.py python-gevent-1.0/examples/echoserver.py --- python-gevent-0.13.7/examples/echoserver.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/echoserver.py 2013-11-26 16:25:45.000000000 +0000 @@ -11,22 +11,21 @@ # this handler will be run for each incoming connection in a dedicated greenlet def echo(socket, address): - print 'New connection from %s:%s' % address + print ('New connection from %s:%s' % address) + socket.sendall('Welcome to the echo server! Type quit to exit.\r\n') # using a makefile because we want to use readline() fileobj = socket.makefile() - fileobj.write('Welcome to the echo server! Type quit to exit.\r\n') - fileobj.flush() while True: line = fileobj.readline() if not line: - print "client disconnected" + print ("client disconnected") break if line.strip().lower() == 'quit': - print "client quit" + print ("client quit") break fileobj.write(line) fileobj.flush() - print "echoed", repr(line) + print ("echoed %r" % line) if __name__ == '__main__': @@ -34,5 +33,5 @@ server = StreamServer(('0.0.0.0', 6000), echo) # to start the server asynchronously, use its start() method; # we use blocking serve_forever() here because we have no other jobs - print 'Starting echo server on port 6000' + print ('Starting echo server on port 6000') server.serve_forever() diff -Nru python-gevent-0.13.7/examples/geventsendfile.py python-gevent-1.0/examples/geventsendfile.py --- python-gevent-0.13.7/examples/geventsendfile.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/geventsendfile.py 2013-11-26 16:25:45.000000000 +0000 @@ -2,6 +2,7 @@ [1] http://pypi.python.org/pypi/py-sendfile/ """ +from sys import exc_info from errno import EAGAIN from sendfile import sendfile as original_sendfile from gevent.socket import wait_write @@ -14,7 +15,8 @@ _offset, sent = original_sendfile(out_fd, in_fd, offset + total_sent, count - total_sent) #print '%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count) total_sent += sent - except OSError, ex: + except OSError: + ex = exc_info()[1] if ex[0] == EAGAIN: wait_write(out_fd) else: diff -Nru python-gevent-0.13.7/examples/httpserver.py python-gevent-1.0/examples/httpserver.py --- python-gevent-0.13.7/examples/httpserver.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/httpserver.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -#!/usr/bin/python -"""HTTP server example. - -Uses libevent API directly and thus may be dangerous. -WSGI interface is a safer choice, see examples/wsgiserver.py. -""" -from gevent import http - - -def callback(request): - print request - if request.uri == '/': - request.add_output_header('Content-Type', 'text/html') - request.send_reply(200, "OK", 'hello world') - else: - request.add_output_header('Content-Type', 'text/html') - request.send_reply(404, "Not Found", "

Not Found

") - -print 'Serving on 8088...' -http.HTTPServer(('0.0.0.0', 8088), callback).serve_forever() diff -Nru python-gevent-0.13.7/examples/portforwarder.py python-gevent-1.0/examples/portforwarder.py --- python-gevent-0.13.7/examples/portforwarder.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/portforwarder.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,90 @@ +"""Port forwarder with graceful exit. + +Run the example as + + python portforwarder.py :8080 gevent.org:80 + +Then direct your browser to http://localhost:8080 or do "telnet localhost 8080". + +When the portforwarder receives TERM or INT signal (type Ctrl-C), +it closes the listening socket and waits for all existing +connections to finish. The existing connections will remain unaffected. +The program will exit once the last connection has been closed. +""" +import sys +import signal +import gevent +from gevent.server import StreamServer +from gevent.socket import create_connection, gethostbyname + + +class PortForwarder(StreamServer): + + def __init__(self, listener, dest, **kwargs): + StreamServer.__init__(self, listener, **kwargs) + self.dest = dest + + def handle(self, source, address): + log('%s:%s accepted', *address[:2]) + try: + dest = create_connection(self.dest) + except IOError, ex: + log('%s:%s failed to connect to %s:%s: %s', address[0], address[1], self.dest[0], self.dest[1], ex) + return + gevent.spawn(forward, source, dest) + gevent.spawn(forward, dest, source) + # XXX only one spawn() is needed + + def close(self): + if self.closed: + sys.exit('Multiple exit signals received - aborting.') + else: + log('Closing listener socket') + StreamServer.close(self) + + +def forward(source, dest): + source_address = '%s:%s' % source.getpeername()[:2] + dest_address = '%s:%s' % dest.getpeername()[:2] + try: + while True: + data = source.recv(1024) + log('%s->%s: %r', source_address, dest_address, data) + if not data: + break + dest.sendall(data) + finally: + source.close() + dest.close() + + +def parse_address(address): + try: + hostname, port = address.rsplit(':', 1) + port = int(port) + except ValueError: + sys.exit('Expected HOST:PORT: %r' % address) + return gethostbyname(hostname), port + + +def main(): + args = sys.argv[1:] + if len(args) != 2: + sys.exit('Usage: %s source-address destination-address' % __file__) + source = args[0] + dest = parse_address(args[1]) + server = PortForwarder(source, dest) + log('Starting port forwarder %s:%s -> %s:%s', *(server.address[:2] + dest)) + gevent.signal(signal.SIGTERM, server.close) + gevent.signal(signal.SIGINT, server.close) + server.start() + gevent.wait() + + +def log(message, *args): + message = message % args + sys.stderr.write(message + '\n') + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/examples/processes.py python-gevent-1.0/examples/processes.py --- python-gevent-0.13.7/examples/processes.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/processes.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,73 +1,20 @@ #!/usr/bin/env python -"""An example on how to communicate with a subprocess. - -Written by Marcus Cavanaugh. -See http://groups.google.com/group/gevent/browse_thread/thread/7fca7230db0509f6 -where it was first posted. -""" - import gevent -from gevent import socket - -import subprocess -import errno -import sys -import os -import fcntl - - -def popen_communicate(args, data=''): - """Communicate with the process non-blockingly.""" - p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - fcntl.fcntl(p.stdin, fcntl.F_SETFL, os.O_NONBLOCK) # make the file nonblocking - fcntl.fcntl(p.stdout, fcntl.F_SETFL, os.O_NONBLOCK) # make the file nonblocking - - bytes_total = len(data) - bytes_written = 0 - while bytes_written < bytes_total: - try: - # p.stdin.write() doesn't return anything, so use os.write. - bytes_written += os.write(p.stdin.fileno(), data[bytes_written:]) - except IOError, ex: - if ex[0] != errno.EAGAIN: - raise - sys.exc_clear() - socket.wait_write(p.stdin.fileno()) - - p.stdin.close() - - chunks = [] - - while True: - try: - chunk = p.stdout.read(4096) - if not chunk: - break - chunks.append(chunk) - except IOError, ex: - if ex[0] != errno.EAGAIN: - raise - sys.exc_clear() - socket.wait_read(p.stdout.fileno()) - - p.stdout.close() - return ''.join(chunks) - - -if __name__ == '__main__': - # run 2 jobs in parallel - job1 = gevent.spawn(popen_communicate, 'finger') - job2 = gevent.spawn(popen_communicate, 'netstat') +from gevent import subprocess - # wait for them to complete. stop waiting after 2 seconds - gevent.joinall([job1, job2], timeout=2) - # print the results (if available) - if job1.ready(): - print 'finger: %s bytes: %s' % (len(job1.value), repr(job1.value)[:50]) - else: - print 'finger: job is still running' - if job2.ready(): - print 'netstat: %s bytes: %s' % (len(job2.value), repr(job2.value)[:50]) - else: - print 'netstat: job is still running' +# run 2 jobs in parallel +p1 = subprocess.Popen(['uname'], stdout=subprocess.PIPE) +p2 = subprocess.Popen(['ls'], stdout=subprocess.PIPE) + +gevent.wait([p1, p2], timeout=2) + +# print the results (if available) +if p1.poll() is not None: + print ('uname: %r' % p1.stdout.read()) +else: + print ('uname: job is still running') +if p2.poll() is not None: + print ('ls: %r' % p2.stdout.read()) +else: + print ('ls: job is still running') diff -Nru python-gevent-0.13.7/examples/psycopg2_pool.py python-gevent-1.0/examples/psycopg2_pool.py --- python-gevent-0.13.7/examples/psycopg2_pool.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/psycopg2_pool.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,150 @@ +from __future__ import with_statement +import sys +import contextlib + +import gevent +from gevent.queue import Queue +from gevent.socket import wait_read, wait_write +from psycopg2 import extensions, OperationalError, connect + + +def gevent_wait_callback(conn, timeout=None): + """A wait callback useful to allow gevent to work with Psycopg.""" + while 1: + state = conn.poll() + if state == extensions.POLL_OK: + break + elif state == extensions.POLL_READ: + wait_read(conn.fileno(), timeout=timeout) + elif state == extensions.POLL_WRITE: + wait_write(conn.fileno(), timeout=timeout) + else: + raise OperationalError( + "Bad result from poll: %r" % state) + + +extensions.set_wait_callback(gevent_wait_callback) + + +class DatabaseConnectionPool(object): + + def __init__(self, maxsize=100): + if not isinstance(maxsize, (int, long)): + raise TypeError('Expected integer, got %r' % (maxsize, )) + self.maxsize = maxsize + self.pool = Queue() + self.size = 0 + + def get(self): + pool = self.pool + if self.size >= self.maxsize or pool.qsize(): + return pool.get() + else: + self.size += 1 + try: + new_item = self.create_connection() + except: + self.size -= 1 + raise + return new_item + + def put(self, item): + self.pool.put(item) + + def closeall(self): + while not self.pool.empty(): + conn = self.pool.get_nowait() + try: + conn.close() + except Exception: + pass + + @contextlib.contextmanager + def connection(self, isolation_level=None): + conn = self.get() + try: + if isolation_level is not None: + if conn.isolation_level == isolation_level: + isolation_level = None + else: + conn.set_isolation_level(isolation_level) + yield conn + except: + if conn.closed: + conn = None + self.closeall() + else: + conn = self._rollback(conn) + raise + else: + if conn.closed: + raise OperationalError("Cannot commit because connection was closed: %r" % (conn, )) + conn.commit() + finally: + if conn is not None and not conn.closed: + if isolation_level is not None: + conn.set_isolation_level(isolation_level) + self.put(conn) + + @contextlib.contextmanager + def cursor(self, *args, **kwargs): + isolation_level = kwargs.pop('isolation_level', None) + with self.connection(isolation_level) as conn: + yield conn.cursor(*args, **kwargs) + + def _rollback(self, conn): + try: + conn.rollback() + except: + gevent.get_hub().handle_error(conn, *sys.exc_info()) + return + return conn + + def execute(self, *args, **kwargs): + with self.cursor(**kwargs) as cursor: + cursor.execute(*args) + return cursor.rowcount + + def fetchone(self, *args, **kwargs): + with self.cursor(**kwargs) as cursor: + cursor.execute(*args) + return cursor.fetchone() + + def fetchall(self, *args, **kwargs): + with self.cursor(**kwargs) as cursor: + cursor.execute(*args) + return cursor.fetchall() + + def fetchiter(self, *args, **kwargs): + with self.cursor(**kwargs) as cursor: + cursor.execute(*args) + while True: + items = cursor.fetchmany() + if not items: + break + for item in items: + yield item + + +class PostgresConnectionPool(DatabaseConnectionPool): + + def __init__(self, *args, **kwargs): + self.connect = kwargs.pop('connect', connect) + maxsize = kwargs.pop('maxsize', None) + self.args = args + self.kwargs = kwargs + DatabaseConnectionPool.__init__(self, maxsize) + + def create_connection(self): + return self.connect(*self.args, **self.kwargs) + + +if __name__ == '__main__': + import time + pool = PostgresConnectionPool("dbname=postgres", maxsize=3) + start = time.time() + for _ in xrange(4): + gevent.spawn(pool.execute, 'select pg_sleep(1);') + gevent.wait() + delay = time.time() - start + print 'Running "select pg_sleep(1);" 4 times with 3 connections. Should take about 2 seconds: %.2fs' % delay diff -Nru python-gevent-0.13.7/examples/threadpool.py python-gevent-1.0/examples/threadpool.py --- python-gevent-0.13.7/examples/threadpool.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/threadpool.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,12 @@ +import time +import gevent +from gevent.threadpool import ThreadPool + + +pool = ThreadPool(3) +start = time.time() +for _ in xrange(4): + pool.spawn(time.sleep, 1) +gevent.wait() +delay = time.time() - start +print 'Running "time.sleep(1)" 4 times with 3 threads. Should take about 2 seconds: %.3fs' % delay diff -Nru python-gevent-0.13.7/examples/udp_client.py python-gevent-1.0/examples/udp_client.py --- python-gevent-0.13.7/examples/udp_client.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/udp_client.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,20 @@ +# Copyright (c) 2012 Denis Bilenko. See LICENSE for details. +"""Send a datagram to localhost:9000 and receive a datagram back. + +Usage: python udp_client.py MESSAGE + +Make sure you're running a UDP server on port 9000 (see udp_server.py). + +There's nothing gevent-specific here. +""" +import sys +from gevent import socket + +address = ('localhost', 9000) +message = ' '.join(sys.argv[1:]) +sock = socket.socket(type=socket.SOCK_DGRAM) +sock.connect(address) +print 'Sending %s bytes to %s:%s' % ((len(message), ) + address) +sock.send(message) +data, address = sock.recvfrom(8192) +print '%s:%s: got %r' % (address + (data, )) diff -Nru python-gevent-0.13.7/examples/udp_server.py python-gevent-1.0/examples/udp_server.py --- python-gevent-0.13.7/examples/udp_server.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/udp_server.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,20 @@ +# Copyright (c) 2012 Denis Bilenko. See LICENSE for details. +"""A simple UDP server. + +For every message received, it sends a reply back. + +You can use udp_client.py to send a message. +""" +from gevent.server import DatagramServer + + +class EchoServer(DatagramServer): + + def handle(self, data, address): + print '%s: got %r' % (address[0], data) + self.socket.sendto('Received %s bytes' % len(data), address) + + +if __name__ == '__main__': + print 'Receiving datagrams on :9000' + EchoServer(':9000').serve_forever() diff -Nru python-gevent-0.13.7/examples/unixsocket_client.py python-gevent-1.0/examples/unixsocket_client.py --- python-gevent-0.13.7/examples/unixsocket_client.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/unixsocket_client.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,9 @@ +import socket + +s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +s.connect("./unixsocket_server.py.sock") +s.send('GET / HTTP/1.0\r\n\r\n') +data = s.recv(1024) +print 'received %s bytes' % len(data) +print data +s.close() diff -Nru python-gevent-0.13.7/examples/unixsocket_server.py python-gevent-1.0/examples/unixsocket_server.py --- python-gevent-0.13.7/examples/unixsocket_server.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/unixsocket_server.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,18 @@ +import os +from gevent.pywsgi import WSGIServer +from gevent import socket + + +def application(environ, start_response): + start_response('200 OK', []) + return [] + + +if __name__ == '__main__': + listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sockname = './' + os.path.basename(__file__) + '.sock' + if os.path.exists(sockname): + os.remove(sockname) + listener.bind(sockname) + listener.listen(1) + WSGIServer(listener, application).serve_forever() diff -Nru python-gevent-0.13.7/examples/webchat/application.py python-gevent-1.0/examples/webchat/application.py --- python-gevent-0.13.7/examples/webchat/application.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/webchat/application.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,20 @@ +#!/usr/bin/python +from gevent import monkey; monkey.patch_all() +import os +import traceback +from django.core.handlers.wsgi import WSGIHandler +from django.core.signals import got_request_exception +from django.core.management import call_command + +os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings' + + +def exception_printer(sender, **kwargs): + traceback.print_exc() + + +got_request_exception.connect(exception_printer) + +call_command('syncdb') + +application = WSGIHandler() diff -Nru python-gevent-0.13.7/examples/webchat/manage.py python-gevent-1.0/examples/webchat/manage.py --- python-gevent-0.13.7/examples/webchat/manage.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/webchat/manage.py 2013-11-26 16:25:45.000000000 +0000 @@ -4,8 +4,11 @@ import settings # Assumed to be in the same directory. except ImportError: import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) + sys.stderr.write("""Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things. +You'll have to run django-admin.py, passing it your settings module. +(If the file settings.py does indeed exist, it's causing an ImportError somehow.) +""" % __file__) + raise if __name__ == "__main__": execute_manager(settings) diff -Nru python-gevent-0.13.7/examples/webchat/run.py python-gevent-1.0/examples/webchat/run.py --- python-gevent-0.13.7/examples/webchat/run.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/webchat/run.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#!/usr/bin/python -from gevent import monkey; monkey.patch_all() -from gevent.wsgi import WSGIServer -import sys -import os -import traceback -from django.core.handlers.wsgi import WSGIHandler -from django.core.management import call_command -from django.core.signals import got_request_exception - -sys.path.append('..') -os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings' - - -def exception_printer(sender, **kwargs): - traceback.print_exc() - - -got_request_exception.connect(exception_printer) - -call_command('syncdb') -print 'Serving on 8088...' -WSGIServer(('', 8088), WSGIHandler()).serve_forever() diff -Nru python-gevent-0.13.7/examples/webchat/run_standalone.py python-gevent-1.0/examples/webchat/run_standalone.py --- python-gevent-0.13.7/examples/webchat/run_standalone.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/webchat/run_standalone.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,5 @@ +#!/usr/bin/python +from gevent.wsgi import WSGIServer +from application import application +print 'Serving on 8000...' +WSGIServer(('', 8000), application).serve_forever() diff -Nru python-gevent-0.13.7/examples/webchat/run_uwsgi python-gevent-1.0/examples/webchat/run_uwsgi --- python-gevent-0.13.7/examples/webchat/run_uwsgi 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/examples/webchat/run_uwsgi 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/sh +# see http://projects.unbit.it/uwsgi and http://projects.unbit.it/uwsgi/wiki/Gevent +exec uwsgi --loop gevent --http-socket :8000 --module application --async 1000 diff -Nru python-gevent-0.13.7/examples/webchat/urls.py python-gevent-1.0/examples/webchat/urls.py --- python-gevent-0.13.7/examples/webchat/urls.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/webchat/urls.py 2013-11-26 16:25:45.000000000 +0000 @@ -7,7 +7,6 @@ ('^a/message/updates$', 'message_updates')) urlpatterns += patterns('django.views.static', - (r'^%s(?P.*)$' % settings.MEDIA_URL.lstrip('/'), - 'serve', { - 'document_root': settings.MEDIA_ROOT, - 'show_indexes': True })) + (r'^%s(?P.*)$' % settings.MEDIA_URL.lstrip('/'), 'serve', + {'document_root': settings.MEDIA_ROOT, + 'show_indexes': True})) diff -Nru python-gevent-0.13.7/examples/webproxy.py python-gevent-1.0/examples/webproxy.py --- python-gevent-0.13.7/examples/webproxy.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/webproxy.py 2013-11-26 16:25:45.000000000 +0000 @@ -11,7 +11,6 @@ """ from gevent import monkey; monkey.patch_all() -from gevent import wsgi import sys import re import traceback @@ -20,7 +19,7 @@ from cgi import escape from urllib import unquote -PORT = 8088 +LISTEN = ":8088" def application(env, start_response): @@ -52,13 +51,14 @@ try: try: response = urllib2.urlopen(path) - except urllib2.HTTPError, ex: - response = ex - print '%s: %s %s' % (path, response.code, response.msg) + except urllib2.HTTPError: + response = sys.exc_info()[1] + print ('%s: %s %s' % (path, response.code, response.msg)) headers = [(k, v) for (k, v) in response.headers.items() if k not in drop_headers] scheme, netloc, path, params, query, fragment = urlparse(path) host = (scheme or 'http') + '://' + netloc - except Exception, ex: + except Exception: + ex = sys.exc_info()[1] sys.stderr.write('error while reading %s:\n' % path) traceback.print_exc() tb = traceback.format_exc() @@ -122,5 +122,6 @@ """ if __name__ == '__main__': - print 'Serving on %s...' % PORT - wsgi.WSGIServer(('', PORT), application).serve_forever() + from gevent.pywsgi import WSGIServer + print 'Serving on %s...' % LISTEN + WSGIServer(LISTEN, application).serve_forever() diff -Nru python-gevent-0.13.7/examples/webpy.py python-gevent-1.0/examples/webpy.py --- python-gevent-0.13.7/examples/webpy.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/webpy.py 2013-11-26 16:25:45.000000000 +0000 @@ -2,8 +2,8 @@ """A web.py application powered by gevent""" from gevent import monkey; monkey.patch_all() -from gevent.wsgi import WSGIServer -import gevent +from gevent.pywsgi import WSGIServer +import time import web urls = ("/", "index", @@ -12,19 +12,20 @@ class index: def GET(self): - return 'Hello, world!
/long' + return 'Hello, world!
/long' class long_polling: - # Since gevent.wsgi executes each incoming connection in a separate greenlet + # Since gevent's WSGIServer executes each incoming connection in a separate greenlet # long running requests such as this one don't block one another; # and thanks to "monkey.patch_all()" statement at the top, thread-local storage used by web.ctx # becomes greenlet-local storage thus making requests isolated as they should be. def GET(self): - print 'handling GET context id = %s' % (id(web.ctx._getd()), ) - gevent.sleep(10) # possible to block the request indefinitely, without harming others + print 'GET /long' + time.sleep(10) # possible to block the request indefinitely, without harming others return 'Hello, 10 seconds later' + if __name__ == "__main__": application = web.application(urls, globals()).wsgifunc() print 'Serving on 8088...' diff -Nru python-gevent-0.13.7/examples/wsgiserver.py python-gevent-1.0/examples/wsgiserver.py --- python-gevent-0.13.7/examples/wsgiserver.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/examples/wsgiserver.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,10 +1,9 @@ #!/usr/bin/python """WSGI server example""" +from gevent.pywsgi import WSGIServer -from gevent import wsgi - -def hello_world(env, start_response): +def application(env, start_response): if env['PATH_INFO'] == '/': start_response('200 OK', [('Content-Type', 'text/html')]) return ["hello world"] @@ -12,5 +11,7 @@ start_response('404 Not Found', [('Content-Type', 'text/html')]) return ['

Not Found

'] -print 'Serving on 8088...' -wsgi.WSGIServer(('', 8088), hello_world).serve_forever() + +if __name__ == '__main__': + print 'Serving on 8088...' + WSGIServer(('', 8088), application).serve_forever() diff -Nru python-gevent-0.13.7/fetch_libevent.py python-gevent-1.0/fetch_libevent.py --- python-gevent-0.13.7/fetch_libevent.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/fetch_libevent.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -#! /usr/bin/env python - -"""download and extract the libevent source archive -""" - -import sys -import os -import urllib -import tarfile -import StringIO -import tempfile -import shutil -import copy - -try: - from hashlib import md5 -except ImportError: - from md5 import md5 - - -# python 2.4's tarfile doesn't have extractall. -def extractall(self, path="."): - for tarinfo in self: - if tarinfo.isdir(): - # Extract directories with a safe mode. - tarinfo = copy.copy(tarinfo) - tarinfo.mode = 0700 - self.extract(tarinfo, path) - - -def download_and_extract(url, digest): - assert url.endswith(".tar.gz"), "can only download .tar.gz files" - dst = os.path.abspath("libevent-src") - - if os.path.exists(dst): - sys.exit("Error: path %s already exists" % dst) - - tmpdir = tempfile.mkdtemp(prefix="tmp-libevent-src", dir=".") - try: - dirname = os.path.join(tmpdir, url.split("/")[-1][:-len(".tar.gz")]) - print "downloading libevent source from %s" % url - tgz = urllib.urlopen(url).read() - if md5(tgz).hexdigest() != digest: - sys.exit("Error: wrong md5 sum") - - print "extracting to %s" % dst - tf = tarfile.open("libevent-src.tar.gz", - fileobj=StringIO.StringIO(tgz), - mode='r:gz') - extractall(tf, tmpdir) - os.rename(dirname, dst) - print "setup.py will now build libevent and link with it statically" - finally: - shutil.rmtree(tmpdir) - -if __name__ == '__main__': - os.chdir(os.path.dirname(os.path.abspath(__file__))) - download_and_extract( - "http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz", - "a00e037e4d3f9e4fe9893e8a2d27918c") diff -Nru python-gevent-0.13.7/gevent/ares.pyx python-gevent-1.0/gevent/ares.pyx --- python-gevent-0.13.7/gevent/ares.pyx 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/ares.pyx 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,437 @@ +# Copyright (c) 2011-2012 Denis Bilenko. See LICENSE for details. +cimport cares +import sys +from python cimport * +from _socket import gaierror + + +__all__ = ['channel'] + + +TIMEOUT = 1 + +DEF EV_READ = 1 +DEF EV_WRITE = 2 + + +cdef extern from "dnshelper.c": + int AF_INET + int AF_INET6 + + struct hostent: + char* h_name + int h_addrtype + + struct sockaddr_t "sockaddr": + pass + + struct ares_channeldata: + pass + + object parse_h_aliases(hostent*) + object parse_h_addr_list(hostent*) + void* create_object_from_hostent(void*) + + # this imports _socket lazily + object PyBytes_FromString(char*) + int PyTuple_Check(object) + int PyArg_ParseTuple(object, char*, ...) except 0 + struct sockaddr_in6: + pass + int gevent_make_sockaddr(char* hostp, int port, int flowinfo, int scope_id, sockaddr_in6* sa6) + + void* malloc(int) + void free(void*) + void memset(void*, int, int) + + +ARES_SUCCESS = cares.ARES_SUCCESS +ARES_ENODATA = cares.ARES_ENODATA +ARES_EFORMERR = cares.ARES_EFORMERR +ARES_ESERVFAIL = cares.ARES_ESERVFAIL +ARES_ENOTFOUND = cares.ARES_ENOTFOUND +ARES_ENOTIMP = cares.ARES_ENOTIMP +ARES_EREFUSED = cares.ARES_EREFUSED +ARES_EBADQUERY = cares.ARES_EBADQUERY +ARES_EBADNAME = cares.ARES_EBADNAME +ARES_EBADFAMILY = cares.ARES_EBADFAMILY +ARES_EBADRESP = cares.ARES_EBADRESP +ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED +ARES_ETIMEOUT = cares.ARES_ETIMEOUT +ARES_EOF = cares.ARES_EOF +ARES_EFILE = cares.ARES_EFILE +ARES_ENOMEM = cares.ARES_ENOMEM +ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION +ARES_EBADSTR = cares.ARES_EBADSTR +ARES_EBADFLAGS = cares.ARES_EBADFLAGS +ARES_ENONAME = cares.ARES_ENONAME +ARES_EBADHINTS = cares.ARES_EBADHINTS +ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED +ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI +ARES_EADDRGETNETWORKPARAMS = cares.ARES_EADDRGETNETWORKPARAMS +ARES_ECANCELLED = cares.ARES_ECANCELLED + +ARES_FLAG_USEVC = cares.ARES_FLAG_USEVC +ARES_FLAG_PRIMARY = cares.ARES_FLAG_PRIMARY +ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC +ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE +ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN +ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH +ARES_FLAG_NOALIASES = cares.ARES_FLAG_NOALIASES +ARES_FLAG_NOCHECKRESP = cares.ARES_FLAG_NOCHECKRESP + + +_ares_errors = dict([ + (cares.ARES_SUCCESS, 'ARES_SUCCESS'), + (cares.ARES_ENODATA, 'ARES_ENODATA'), + (cares.ARES_EFORMERR, 'ARES_EFORMERR'), + (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), + (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), + (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), + (cares.ARES_EREFUSED, 'ARES_EREFUSED'), + (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), + (cares.ARES_EBADNAME, 'ARES_EBADNAME'), + (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), + (cares.ARES_EBADRESP, 'ARES_EBADRESP'), + (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), + (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), + (cares.ARES_EOF, 'ARES_EOF'), + (cares.ARES_EFILE, 'ARES_EFILE'), + (cares.ARES_ENOMEM, 'ARES_ENOMEM'), + (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), + (cares.ARES_EBADSTR, 'ARES_EBADSTR'), + (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), + (cares.ARES_ENONAME, 'ARES_ENONAME'), + (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), + (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), + (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), + (cares.ARES_EADDRGETNETWORKPARAMS, 'ARES_EADDRGETNETWORKPARAMS'), + (cares.ARES_ECANCELLED, 'ARES_ECANCELLED')]) + + +# maps c-ares flag to _socket module flag +_cares_flag_map = None + + +cdef _prepare_cares_flag_map(): + global _cares_flag_map + import _socket + _cares_flag_map = [ + (getattr(_socket, 'NI_NUMERICHOST', 1), cares.ARES_NI_NUMERICHOST), + (getattr(_socket, 'NI_NUMERICSERV', 2), cares.ARES_NI_NUMERICSERV), + (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), + (getattr(_socket, 'NI_NAMEREQD', 8), cares.ARES_NI_NAMEREQD), + (getattr(_socket, 'NI_DGRAM', 16), cares.ARES_NI_DGRAM)] + + +cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): + if _cares_flag_map is None: + _prepare_cares_flag_map() + for socket_flag, cares_flag in _cares_flag_map: + if socket_flag & flags: + default |= cares_flag + flags &= ~socket_flag + if not flags: + return default + raise gaierror(-1, "Bad value for ai_flags: 0x%x" % flags) + + +cpdef strerror(code): + return '%s: %s' % (_ares_errors.get(code) or code, cares.ares_strerror(code)) + + +class InvalidIP(ValueError): + pass + + +cdef void gevent_sock_state_callback(void *data, int s, int read, int write): + if not data: + return + cdef channel ch = data + ch._sock_state_callback(s, read, write) + + +cdef class result: + cdef public object value + cdef public object exception + + def __init__(self, object value=None, object exception=None): + self.value = value + self.exception = exception + + def __repr__(self): + if self.exception is None: + return '%s(%r)' % (self.__class__.__name__, self.value) + elif self.value is None: + return '%s(exception=%r)' % (self.__class__.__name__, self.exception) + else: + return '%s(value=%r, exception=%r)' % (self.__class__.__name__, self.value, self.exception) + # add repr_recursive precaution + + def successful(self): + return self.exception is None + + def get(self): + if self.exception is not None: + raise self.exception + return self.value + + +class ares_host_result(tuple): + + def __new__(cls, family, iterable): + cdef object self = tuple.__new__(cls, iterable) + self.family = family + return self + + def __getnewargs__(self): + return (self.family, tuple(self)) + + +cdef void gevent_ares_host_callback(void *arg, int status, int timeouts, hostent* host): + cdef channel channel + cdef object callback + channel, callback = arg + Py_DECREF(arg) + cdef object host_result + try: + if status or not host: + callback(result(None, gaierror(status, strerror(status)))) + else: + try: + host_result = ares_host_result(host.h_addrtype, (host.h_name, parse_h_aliases(host), parse_h_addr_list(host))) + except: + callback(result(None, sys.exc_info()[1])) + else: + callback(result(host_result)) + except: + channel.loop.handle_error(callback, *sys.exc_info()) + + +cdef void gevent_ares_nameinfo_callback(void *arg, int status, int timeouts, char *c_node, char *c_service): + cdef channel channel + cdef object callback + channel, callback = arg + Py_DECREF(arg) + cdef object node + cdef object service + try: + if status: + callback(result(None, gaierror(status, strerror(status)))) + else: + if c_node: + node = PyBytes_FromString(c_node) + else: + node = None + if c_service: + service = PyBytes_FromString(c_service) + else: + service = None + callback(result((node, service))) + except: + channel.loop.handle_error(callback, *sys.exc_info()) + + +cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresChannel_Type]: + + cdef public object loop + cdef ares_channeldata* channel + cdef public dict _watchers + cdef public object _timer + + def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, + udp_port=None, tcp_port=None, servers=None): + cdef ares_channeldata* channel = NULL + cdef cares.ares_options options + memset(&options, 0, sizeof(cares.ares_options)) + cdef int optmask = cares.ARES_OPT_SOCK_STATE_CB + options.sock_state_cb = gevent_sock_state_callback + options.sock_state_cb_data = self + if flags is not None: + options.flags = int(flags) + optmask |= cares.ARES_OPT_FLAGS + if timeout is not None: + options.timeout = int(float(timeout) * 1000) + optmask |= cares.ARES_OPT_TIMEOUTMS + if tries is not None: + options.tries = int(tries) + optmask |= cares.ARES_OPT_TRIES + if ndots is not None: + options.ndots = int(ndots) + optmask |= cares.ARES_OPT_NDOTS + if udp_port is not None: + options.udp_port = int(udp_port) + optmask |= cares.ARES_OPT_UDP_PORT + if tcp_port is not None: + options.tcp_port = int(tcp_port) + optmask |= cares.ARES_OPT_TCP_PORT + cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? + if result: + raise gaierror(result, strerror(result)) + result = cares.ares_init_options(&channel, &options, optmask) + if result: + raise gaierror(result, strerror(result)) + self._timer = loop.timer(TIMEOUT, TIMEOUT) + self._watchers = {} + self.channel = channel + try: + if servers is not None: + self.set_servers(servers) + self.loop = loop + except: + self.destroy() + raise + + def __repr__(self): + args = (self.__class__.__name__, id(self), self._timer, len(self._watchers)) + return '<%s at 0x%x _timer=%r _watchers[%s]>' % args + + def destroy(self): + if self.channel: + # XXX ares_library_cleanup? + cares.ares_destroy(self.channel) + self.channel = NULL + self._watchers.clear() + self._timer.stop() + self.loop = None + + def __dealloc__(self): + if self.channel: + # XXX ares_library_cleanup? + cares.ares_destroy(self.channel) + self.channel = NULL + + def set_servers(self, servers=None): + if not self.channel: + raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + if not servers: + servers = [] + if isinstance(servers, basestring): + servers = servers.split(',') + cdef int length = len(servers) + cdef int result, index + cdef char* string + cdef cares.ares_addr_node* c_servers + if length <= 0: + result = cares.ares_set_servers(self.channel, NULL) + else: + c_servers = malloc(sizeof(cares.ares_addr_node) * length) + if not c_servers: + raise MemoryError + try: + index = 0 + for server in servers: + string = server + if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: + c_servers[index].family = AF_INET + elif cares.ares_inet_pton(AF_INET6, string, &c_servers[index].addr) > 0: + c_servers[index].family = AF_INET6 + else: + raise InvalidIP(repr(string)) + c_servers[index].next = &c_servers[index] + 1 + index += 1 + if index >= length: + break + c_servers[length - 1].next = NULL + index = cares.ares_set_servers(self.channel, c_servers) + if index: + raise ValueError(strerror(index)) + finally: + free(c_servers) + + # this crashes c-ares + #def cancel(self): + # cares.ares_cancel(self.channel) + + cdef _sock_state_callback(self, int socket, int read, int write): + if not self.channel: + return + cdef object watcher = self._watchers.get(socket) + cdef int events = 0 + if read: + events |= EV_READ + if write: + events |= EV_WRITE + if watcher is None: + if not events: + return + watcher = self.loop.io(socket, events) + self._watchers[socket] = watcher + elif events: + if watcher.events == events: + return + watcher.stop() + watcher.events = events + else: + watcher.stop() + self._watchers.pop(socket, None) + if not self._watchers: + self._timer.stop() + return + watcher.start(self._process_fd, watcher, pass_events=True) + self._timer.again(self._on_timer) + + def _on_timer(self): + cares.ares_process_fd(self.channel, cares.ARES_SOCKET_BAD, cares.ARES_SOCKET_BAD) + + def _process_fd(self, int events, object watcher): + if not self.channel: + return + cdef int read_fd = watcher.fd + cdef int write_fd = read_fd + if not (events & EV_READ): + read_fd = cares.ARES_SOCKET_BAD + if not (events & EV_WRITE): + write_fd = cares.ARES_SOCKET_BAD + cares.ares_process_fd(self.channel, read_fd, write_fd) + + def gethostbyname(self, object callback, char* name, int family=AF_INET): + if not self.channel: + raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + # note that for file lookups still AF_INET can be returned for AF_INET6 request + cdef object arg = (self, callback) + Py_INCREF(arg) + cares.ares_gethostbyname(self.channel, name, family, gevent_ares_host_callback, arg) + + def gethostbyaddr(self, object callback, char* addr): + if not self.channel: + raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + # will guess the family + cdef char addr_packed[16] + cdef int family + cdef int length + if cares.ares_inet_pton(AF_INET, addr, addr_packed) > 0: + family = AF_INET + length = 4 + elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: + family = AF_INET6 + length = 16 + else: + raise InvalidIP(repr(addr)) + cdef object arg = (self, callback) + Py_INCREF(arg) + cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) + + cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): + if not self.channel: + raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + cdef char* hostp = NULL + cdef int port = 0 + cdef int flowinfo = 0 + cdef int scope_id = 0 + cdef sockaddr_in6 sa6 + if not PyTuple_Check(sockaddr): + raise TypeError('expected a tuple, got %r' % (sockaddr, )) + PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) + if port < 0 or port > 65535: + raise gaierror(-8, 'Invalid value for port: %r' % port) + cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) + if length <= 0: + raise InvalidIP(repr(hostp)) + cdef object arg = (self, callback) + Py_INCREF(arg) + cdef sockaddr_t* x = &sa6 + cares.ares_getnameinfo(self.channel, x, length, flags, gevent_ares_nameinfo_callback, arg) + + def getnameinfo(self, object callback, tuple sockaddr, int flags): + return self._getnameinfo(callback, sockaddr, _convert_cares_flags(flags)) diff -Nru python-gevent-0.13.7/gevent/backdoor.py python-gevent-1.0/gevent/backdoor.py --- python-gevent-0.13.7/gevent/backdoor.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/backdoor.py 2013-11-26 16:25:45.000000000 +0000 @@ -4,6 +4,7 @@ # Copyright (c) 2007, Linden Research, Inc. # Copyright (c) 2008, Donovan Preston # Copyright (c) 2009-2010, Denis Bilenko +# Copyright (c) 2011, gevent contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,10 +45,11 @@ class SocketConsole(Greenlet): - def __init__(self, locals, conn): + def __init__(self, locals, conn, banner=None): Greenlet.__init__(self) self.locals = locals self.desc = _fileobject(conn) + self.banner = banner def finalize(self): self.desc = None @@ -64,7 +66,13 @@ try: try: console = InteractiveConsole(self.locals) - console.interact() + # __builtins__ may either be the __builtin__ module or + # __builtin__.__dict__ in the latter case typing + # locals() at the backdoor prompt spews out lots of + # useless stuff + import __builtin__ + console.locals["__builtins__"] = __builtin__ + console.interact(banner=self.banner) except SystemExit: # raised by quit() sys.exc_clear() finally: @@ -74,13 +82,14 @@ class BackdoorServer(StreamServer): - def __init__(self, listener, locals=None, **server_args): + def __init__(self, listener, locals=None, banner=None, **server_args): StreamServer.__init__(self, listener, spawn=None, **server_args) self.locals = locals + self.banner = banner # QQQ passing pool instance as 'spawn' is not possible; should it be fixed? def handle(self, conn, address): - SocketConsole.spawn(self.locals, conn) + SocketConsole.spawn(self.locals, conn, banner=self.banner) class _fileobject(socket._fileobject): @@ -100,6 +109,6 @@ if __name__ == '__main__': if not sys.argv[1:]: - print 'USAGE: %s PORT' % sys.argv[0] + print ('USAGE: %s PORT' % sys.argv[0]) else: BackdoorServer(('127.0.0.1', int(sys.argv[1]))).serve_forever() diff -Nru python-gevent-0.13.7/gevent/baseserver.py python-gevent-1.0/gevent/baseserver.py --- python-gevent-0.13.7/gevent/baseserver.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/baseserver.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,8 +1,11 @@ """Base class for implementing servers""" -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +import sys +import _socket +import errno from gevent.greenlet import Greenlet, getfuncname from gevent.event import Event -import _socket +from gevent.hub import string_types, integer_types, get_hub __all__ = ['BaseServer'] @@ -12,53 +15,69 @@ """An abstract base class that implements some common functionality for the servers in gevent. *listener* can either be an address that the server should bind on or a :class:`gevent.socket.socket` - instance that is already bound and put into listening mode. In the former case, *backlog* argument specifies the - length of the backlog queue. If not provided, the default (256) is used. + instance that is already bound (and put into listening mode in case of TCP socket). *spawn*, if provided, is called to create a new greenlet to run the handler. By default, :func:`gevent.spawn` is used. Possible values for *spawn*: - * a :class:`gevent.pool.Pool` instance -- *handle* will be executed using :meth:`Pool.spawn` method only if the - pool is not full. While it is full, all the connection are dropped; - * :func:`gevent.spawn_raw` -- *handle* will be executed in a raw greenlet which have a little less overhead then - :class:`gevent.Greenlet` instances spawned by default; - * ``None`` -- *handle* will be executed right away, in the :class:`Hub` greenlet. *handle* cannot use any blocking - functions as it means switching to the :class:`Hub`. + * a :class:`gevent.pool.Pool` instance -- *handle* will be executed + using :meth:`Pool.spawn` method only if the pool is not full. + While it is full, all the connection are dropped; + * :func:`gevent.spawn_raw` -- *handle* will be executed in a raw + greenlet which have a little less overhead then :class:`gevent.Greenlet` instances spawned by default; + * ``None`` -- *handle* will be executed right away, in the :class:`Hub` greenlet. + *handle* cannot use any blocking functions as it means switching to the :class:`Hub`. * an integer -- a shortcut for ``gevent.pool.Pool(integer)`` """ + # the number of seconds to sleep in case there was an error in accept() call + # for consecutive errors the delay will double until it reaches max_delay + # when accept() finally succeeds the delay will be reset to min_delay again + min_delay = 0.01 + max_delay = 1 + + # Sets the maximum number of consecutive accepts that a process may perform on + # a single wake up. High values give higher priority to high connection rates, + # while lower values give higher priority to already established connections. + # Default is 100. Note, that in case of multiple working processes on the same + # listening value, it should be set to a lower value. (pywsgi.WSGIServer sets it + # to 1 when environ["wsgi.multiprocess"] is true) + max_accept = 100 _spawn = Greenlet.spawn - # the default backlog to use if none was provided in __init__ - backlog = 256 - - reuse_addr = 1 - # the default timeout that we wait for the client connections to close in stop() stop_timeout = 1 - def __init__(self, listener, handle=None, backlog=None, spawn='default'): - self._stopped_event = Event() - self.set_listener(listener, backlog=backlog) - self.set_spawn(spawn) - self.set_handle(handle) - self.started = None + fatal_errors = (errno.EBADF, errno.EINVAL, errno.ENOTSOCK) + + def __init__(self, listener, handle=None, spawn='default'): + self._stop_event = Event() + self._stop_event.set() + self._watcher = None + self._timer = None + self.pool = None + try: + self.set_listener(listener) + self.set_spawn(spawn) + self.set_handle(handle) + self.delay = self.min_delay + self.loop = get_hub().loop + if self.max_accept < 1: + raise ValueError('max_accept must be positive int: %r' % (self.max_accept, )) + except: + self.close() + raise - def set_listener(self, listener, backlog=None): + def set_listener(self, listener): if hasattr(listener, 'accept'): if hasattr(listener, 'do_handshake'): raise TypeError('Expected a regular socket, not SSLSocket: %r' % (listener, )) - if backlog is not None: - raise TypeError('backlog must be None when a socket instance is passed') + self.family = listener.family self.address = listener.getsockname() self.socket = listener else: - if not isinstance(listener, tuple): - raise TypeError('Expected a socket instance or an address (tuple of 2 elements): %r' % (listener, )) - if backlog is not None: - self.backlog = backlog - self.address = listener + self.family, self.address = parse_address(listener) def set_spawn(self, spawn): if spawn == 'default': @@ -76,10 +95,76 @@ self._spawn = spawn if hasattr(self.pool, 'full'): self.full = self.pool.full + if self.pool is not None: + self.pool._semaphore.rawlink(self._start_accepting_if_started) def set_handle(self, handle): if handle is not None: self.handle = handle + if hasattr(self, 'handle'): + self._handle = self.handle + else: + raise TypeError("'handle' must be provided") + + def _start_accepting_if_started(self, _event=None): + if self.started: + self.start_accepting() + + def start_accepting(self): + if self._watcher is None: + # just stop watcher without creating a new one? + self._watcher = self.loop.io(self.socket.fileno(), 1) + self._watcher.start(self._do_read) + + def stop_accepting(self): + if self._watcher is not None: + self._watcher.stop() + self._watcher = None + if self._timer is not None: + self._timer.stop() + self._timer = None + + def do_handle(self, *args): + spawn = self._spawn + if spawn is None: + self._handle(*args) + else: + spawn(self._handle, *args) + + def _do_read(self): + for _ in xrange(self.max_accept): + if self.full(): + self.stop_accepting() + return + try: + args = self.do_read() + self.delay = self.min_delay + if not args: + return + except: + self.loop.handle_error(self, *sys.exc_info()) + ex = sys.exc_info()[1] + if self.is_fatal_error(ex): + self.close() + sys.stderr.write('ERROR: %s failed with %s\n' % (self, str(ex) or repr(ex))) + return + if self.delay >= 0: + self.stop_accepting() + self._timer = self.loop.timer(self.delay) + self._timer.start(self._start_accepting_if_started) + self.delay = min(self.max_delay, self.delay * 2) + break + else: + try: + self.do_handle(*args) + except: + self.loop.handle_error((args[1:], self), *sys.exc_info()) + if self.delay >= 0: + self.stop_accepting() + self._timer = self.loop.timer(self.delay) + self._timer.start(self._start_accepting_if_started) + self.delay = min(self.max_delay, self.delay * 2) + break def full(self): return False @@ -94,7 +179,8 @@ if hasattr(self, 'socket'): try: fileno = self.socket.fileno() - except Exception, ex: + except Exception: + ex = sys.exc_info()[1] fileno = str(ex) result = 'fileno=%s ' % fileno else: @@ -104,7 +190,8 @@ result += 'address=%s:%s' % self.address else: result += 'address=%s' % (self.address, ) - except Exception, ex: + except Exception: + ex = sys.exc_info()[1] result += str(ex) or '' try: handle = getfuncname(self.__dict__['handle']) @@ -126,34 +213,35 @@ if isinstance(self.address, tuple): return self.address[1] - def pre_start(self): + def init_socket(self): """If the user initialized the server with an address rather than socket, then this function will create a socket, bind it and put it into listening mode. It is not supposed to be called by the user, it is called by :meth:`start` before starting the accept loop.""" - if not hasattr(self, 'socket'): - self.socket = _tcp_listener(self.address, backlog=self.backlog, reuse_addr=self.reuse_addr) - self.address = self.socket.getsockname() - self._stopped_event.clear() + pass + + @property + def started(self): + return not self._stop_event.is_set() def start(self): """Start accepting the connections. - If an address was provided in the constructor, then also create a socket, bind it and put it into the listening mode. + If an address was provided in the constructor, then also create a socket, + bind it and put it into the listening mode. """ - assert not self.started, '%s already started' % self.__class__.__name__ - self.pre_start() - self.started = True + self.init_socket() + self._stop_event.clear() try: self.start_accepting() except: - self.kill() + self.close() raise - def kill(self): + def close(self): """Close the listener socket and stop accepting.""" - self.started = False + self._stop_event.set() try: self.stop_accepting() finally: @@ -161,8 +249,18 @@ self.socket.close() except Exception: pass - self.__dict__.pop('socket', None) - self.__dict__.pop('handle', None) + finally: + self.__dict__.pop('socket', None) + self.__dict__.pop('handle', None) + self.__dict__.pop('_handle', None) + self.__dict__.pop('_spawn', None) + self.__dict__.pop('full', None) + if self.pool is not None: + self.pool._semaphore.unlink(self._start_accepting_if_started) + + @property + def closed(self): + return not hasattr(self, 'socket') def stop(self, timeout=None): """Stop accepting the connections and close the listening socket. @@ -170,16 +268,12 @@ If the server uses a pool to spawn the requests, then :meth:`stop` also waits for all the handlers to exit. If there are still handlers executing after *timeout* has expired (default 1 second), then the currently running handlers in the pool are killed.""" - self.kill() + self.close() if timeout is None: timeout = self.stop_timeout if self.pool: self.pool.join(timeout=timeout) self.pool.kill(block=True, timeout=1) - self.post_stop() - - def post_stop(self): - self._stopped_event.set() def serve_forever(self, stop_timeout=None): """Start the server if it hasn't been already started and wait until it's stopped.""" @@ -187,28 +281,43 @@ if not self.started: self.start() try: - self._stopped_event.wait() - except: - self.stop(timeout=stop_timeout) - raise + self._stop_event.wait() + finally: + Greenlet.spawn(self.stop, timeout=stop_timeout).join() + def is_fatal_error(self, ex): + return isinstance(ex, _socket.error) and ex[0] in self.fatal_errors -def _tcp_listener(address, backlog=50, reuse_addr=None): - """A shortcut to create a TCP socket, bind it and put it into listening state. - The difference from :meth:`gevent.socket.tcp_listener` is that this function returns - an unwrapped :class:`_socket.socket` instance. - """ - sock = _socket.socket() - if reuse_addr is not None: - sock.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, reuse_addr) +def _extract_family(host): + if host.startswith('[') and host.endswith(']'): + host = host[1:-1] + return _socket.AF_INET6, host + return _socket.AF_INET, host + + +def _parse_address(address): + if isinstance(address, tuple): + if ':' in address[0]: + return _socket.AF_INET6, address + return _socket.AF_INET, address + elif isinstance(address, string_types): + if ':' in address: + host, port = address.rsplit(':', 1) + family, host = _extract_family(host) + if host == '*': + host = '' + return family, (host, int(port)) + else: + return _socket.AF_INET, ('', int(address)) + elif isinstance(address, integer_types): + return _socket.AF_INET, ('', int(address)) + else: + raise TypeError('Expected tuple or string, got %s' % type(address)) + + +def parse_address(address): try: - sock.bind(address) - except _socket.error, ex: - strerror = getattr(ex, 'strerror', None) - if strerror is not None: - ex.strerror = strerror + ': ' + repr(address) - raise - sock.listen(backlog) - sock.setblocking(0) - return sock + return _parse_address(address) + except ValueError: + raise ValueError('Failed to parse address %r: %s' % (address, sys.exc_info()[1])) diff -Nru python-gevent-0.13.7/gevent/callbacks.c python-gevent-1.0/gevent/callbacks.c --- python-gevent-0.13.7/gevent/callbacks.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/callbacks.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,221 @@ +/* Copyright (c) 2011-2012 Denis Bilenko. See LICENSE for details. */ +#ifdef Py_PYTHON_H + +static void gevent_handle_error(struct PyGeventLoopObject* loop, PyObject* context) { + PyThreadState *tstate; + PyObject *type, *value, *traceback, *result; + tstate = PyThreadState_GET(); + type = tstate->curexc_type; + if (!type) + return; + value = tstate->curexc_value; + traceback = tstate->curexc_traceback; + if (!value) value = Py_None; + if (!traceback) traceback = Py_None; + + Py_INCREF(type); + Py_INCREF(value); + Py_INCREF(traceback); + + PyErr_Clear(); + + result = ((struct __pyx_vtabstruct_6gevent_4core_loop *)loop->__pyx_vtab)->handle_error(loop, context, type, value, traceback, 0); + + if (result) { + Py_DECREF(result); + } + else { + PyErr_Print(); + PyErr_Clear(); + } + + Py_DECREF(type); + Py_DECREF(value); + Py_DECREF(traceback); +} + + +static CYTHON_INLINE void gevent_check_signals(struct PyGeventLoopObject* loop) { + if (!ev_is_default_loop(loop->_ptr)) { + /* only reporting signals on the default loop */ + return; + } + PyErr_CheckSignals(); + if (PyErr_Occurred()) gevent_handle_error(loop, Py_None); +} + +#define GET_OBJECT(PY_TYPE, EV_PTR, MEMBER) \ + ((struct PY_TYPE *)(((char *)EV_PTR) - offsetof(struct PY_TYPE, MEMBER))) + + +#ifdef WITH_THREAD +#define GIL_DECLARE PyGILState_STATE ___save +#define GIL_ENSURE ___save = PyGILState_Ensure(); +#define GIL_RELEASE PyGILState_Release(___save); +#else +#define GIL_DECLARE +#define GIL_ENSURE +#define GIL_RELEASE +#endif + + +static void gevent_stop(PyObject* watcher, struct PyGeventLoopObject* loop) { + PyObject *result, *method; + int error; + error = 1; + method = PyObject_GetAttrString(watcher, "stop"); + if (method) { + result = PyObject_Call(method, __pyx_empty_tuple, NULL); + if (result) { + Py_DECREF(result); + error = 0; + } + Py_DECREF(method); + } + if (error) { + gevent_handle_error(loop, watcher); + } +} + + +static void gevent_callback(struct PyGeventLoopObject* loop, PyObject* callback, PyObject* args, PyObject* watcher, void *c_watcher, int revents) { + GIL_DECLARE; + PyObject *result, *py_events; + long length; + py_events = 0; + GIL_ENSURE; + Py_INCREF(loop); + Py_INCREF(callback); + Py_INCREF(args); + Py_INCREF(watcher); + gevent_check_signals(loop); + if (args == Py_None) { + args = __pyx_empty_tuple; + } + length = PyTuple_Size(args); + if (length < 0) { + gevent_handle_error(loop, watcher); + goto end; + } + if (length > 0 && PyTuple_GET_ITEM(args, 0) == GEVENT_CORE_EVENTS) { + py_events = PyInt_FromLong(revents); + if (!py_events) { + gevent_handle_error(loop, watcher); + goto end; + } + PyTuple_SET_ITEM(args, 0, py_events); + } + else { + py_events = NULL; + } + result = PyObject_Call(callback, args, NULL); + if (result) { + Py_DECREF(result); + } + else { + gevent_handle_error(loop, watcher); + if (revents & (EV_READ|EV_WRITE)) { + /* io watcher: not stopping it may cause the failing callback to be called repeatedly */ + gevent_stop(watcher, loop); + goto end; + } + } + if (!ev_is_active(c_watcher)) { + /* Watcher was stopped, maybe by libev. Let's call stop() to clean up + * 'callback' and 'args' properties, do Py_DECREF() and ev_ref() if necessary. + * BTW, we don't need to check for EV_ERROR, because libev stops the watcher in that case. */ + gevent_stop(watcher, loop); + } +end: + if (py_events) { + Py_DECREF(py_events); + PyTuple_SET_ITEM(args, 0, GEVENT_CORE_EVENTS); + } + Py_DECREF(watcher); + Py_DECREF(args); + Py_DECREF(callback); + Py_DECREF(loop); + GIL_RELEASE; +} + + +static void gevent_call(struct PyGeventLoopObject* loop, struct PyGeventCallbackObject* cb) { + /* no need for GIL here because it is only called from run_callbacks which already has GIL */ + PyObject *result, *callback, *args; + if (!loop || !cb) + return; + callback = cb->callback; + args = cb->args; + if (!callback || !args) + return; + if (callback == Py_None || args == Py_None) + return; + Py_INCREF(loop); + Py_INCREF(callback); + Py_INCREF(args); + + Py_INCREF(Py_None); + Py_DECREF(cb->callback); + cb->callback = Py_None; + + result = PyObject_Call(callback, args, NULL); + if (result) { + Py_DECREF(result); + } + else { + gevent_handle_error(loop, (PyObject*)cb); + } + + Py_INCREF(Py_None); + Py_DECREF(cb->args); + cb->args = Py_None; + + Py_DECREF(callback); + Py_DECREF(args); + Py_DECREF(loop); +} + + +#undef DEFINE_CALLBACK +#define DEFINE_CALLBACK(WATCHER_LC, WATCHER_TYPE) \ + static void gevent_callback_##WATCHER_LC(struct ev_loop *_loop, void *c_watcher, int revents) { \ + struct PyGevent##WATCHER_TYPE##Object* watcher = GET_OBJECT(PyGevent##WATCHER_TYPE##Object, c_watcher, _watcher); \ + gevent_callback(watcher->loop, watcher->_callback, watcher->args, (PyObject*)watcher, c_watcher, revents); \ + } + + +DEFINE_CALLBACKS + + +static void gevent_run_callbacks(struct ev_loop *_loop, void *watcher, int revents) { + struct PyGeventLoopObject* loop; + PyObject *result; + GIL_DECLARE; + GIL_ENSURE; + loop = GET_OBJECT(PyGeventLoopObject, watcher, _prepare); + Py_INCREF(loop); + gevent_check_signals(loop); + result = ((struct __pyx_vtabstruct_6gevent_4core_loop *)loop->__pyx_vtab)->_run_callbacks(loop); + if (result) { + Py_DECREF(result); + } + else { + PyErr_Print(); + PyErr_Clear(); + } + Py_DECREF(loop); + GIL_RELEASE; +} + +#if defined(_WIN32) + +static void gevent_periodic_signal_check(struct ev_loop *_loop, void *watcher, int revents) { + GIL_DECLARE; + GIL_ENSURE; + gevent_check_signals(GET_OBJECT(PyGeventLoopObject, watcher, _periodic_signal_checker)); + GIL_RELEASE; +} + +#endif /* _WIN32 */ + +#endif /* Py_PYTHON_H */ diff -Nru python-gevent-0.13.7/gevent/callbacks.h python-gevent-1.0/gevent/callbacks.h --- python-gevent-0.13.7/gevent/callbacks.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/callbacks.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ +#define DEFINE_CALLBACK(WATCHER_LC, WATCHER_TYPE) \ + static void gevent_callback_##WATCHER_LC(struct ev_loop *, void *, int); + + +#define DEFINE_CALLBACKS0 \ + DEFINE_CALLBACK(io, IO); \ + DEFINE_CALLBACK(timer, Timer); \ + DEFINE_CALLBACK(signal, Signal); \ + DEFINE_CALLBACK(idle, Idle); \ + DEFINE_CALLBACK(prepare, Prepare); \ + DEFINE_CALLBACK(fork, Fork); \ + DEFINE_CALLBACK(async, Async); \ + DEFINE_CALLBACK(stat, Stat); + + +#ifndef _WIN32 + +#define DEFINE_CALLBACKS \ + DEFINE_CALLBACKS0 \ + DEFINE_CALLBACK(child, Child) + +#else + +#define DEFINE_CALLBACKS DEFINE_CALLBACKS0 + +#endif + + +DEFINE_CALLBACKS + + +static void gevent_run_callbacks(struct ev_loop *, void *, int); +struct PyGeventLoopObject; +static void gevent_handle_error(struct PyGeventLoopObject* loop, PyObject* context); +struct PyGeventCallbackObject; +static void gevent_call(struct PyGeventLoopObject* loop, struct PyGeventCallbackObject* cb); + +#if defined(_WIN32) +static void gevent_periodic_signal_check(struct ev_loop *, void *, int); +#endif + +static void gevent_noop(struct ev_loop *_loop, void *watcher, int revents) { } diff -Nru python-gevent-0.13.7/gevent/cares_ntop.h python-gevent-1.0/gevent/cares_ntop.h --- python-gevent-0.13.7/gevent/cares_ntop.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/cares_ntop.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,7 @@ +#ifdef CARES_EMBED +#include "ares_setup.h" +#include "inet_ntop.h" +#else +#include +#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z) +#endif diff -Nru python-gevent-0.13.7/gevent/cares_pton.h python-gevent-1.0/gevent/cares_pton.h --- python-gevent-0.13.7/gevent/cares_pton.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/cares_pton.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,8 @@ +#ifdef CARES_EMBED +#include "ares_setup.h" +#include "inet_net_pton.h" +#else +#include +#define ares_inet_pton(x,y,z) inet_pton(x,y,z) +#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z) +#endif diff -Nru python-gevent-0.13.7/gevent/cares.pxd python-gevent-1.0/gevent/cares.pxd --- python-gevent-0.13.7/gevent/cares.pxd 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/cares.pxd 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,109 @@ +cdef extern from "ares.h": + struct ares_options: + int flags + void* sock_state_cb + void* sock_state_cb_data + int timeout + int tries + int ndots + unsigned short udp_port + unsigned short tcp_port + char **domains + int ndomains + char* lookups + + int ARES_OPT_FLAGS + int ARES_OPT_SOCK_STATE_CB + int ARES_OPT_TIMEOUTMS + int ARES_OPT_TRIES + int ARES_OPT_NDOTS + int ARES_OPT_TCP_PORT + int ARES_OPT_UDP_PORT + int ARES_OPT_SERVERS + int ARES_OPT_DOMAINS + int ARES_OPT_LOOKUPS + + int ARES_FLAG_USEVC + int ARES_FLAG_PRIMARY + int ARES_FLAG_IGNTC + int ARES_FLAG_NORECURSE + int ARES_FLAG_STAYOPEN + int ARES_FLAG_NOSEARCH + int ARES_FLAG_NOALIASES + int ARES_FLAG_NOCHECKRESP + + int ARES_LIB_INIT_ALL + int ARES_SOCKET_BAD + + int ARES_SUCCESS + int ARES_ENODATA + int ARES_EFORMERR + int ARES_ESERVFAIL + int ARES_ENOTFOUND + int ARES_ENOTIMP + int ARES_EREFUSED + int ARES_EBADQUERY + int ARES_EBADNAME + int ARES_EBADFAMILY + int ARES_EBADRESP + int ARES_ECONNREFUSED + int ARES_ETIMEOUT + int ARES_EOF + int ARES_EFILE + int ARES_ENOMEM + int ARES_EDESTRUCTION + int ARES_EBADSTR + int ARES_EBADFLAGS + int ARES_ENONAME + int ARES_EBADHINTS + int ARES_ENOTINITIALIZED + int ARES_ELOADIPHLPAPI + int ARES_EADDRGETNETWORKPARAMS + int ARES_ECANCELLED + + int ARES_NI_NOFQDN + int ARES_NI_NUMERICHOST + int ARES_NI_NAMEREQD + int ARES_NI_NUMERICSERV + int ARES_NI_DGRAM + int ARES_NI_TCP + int ARES_NI_UDP + int ARES_NI_SCTP + int ARES_NI_DCCP + int ARES_NI_NUMERICSCOPE + int ARES_NI_LOOKUPHOST + int ARES_NI_LOOKUPSERVICE + + + int ares_library_init(int flags) + void ares_library_cleanup() + int ares_init_options(void *channelptr, ares_options *options, int) + int ares_init(void *channelptr) + void ares_destroy(void *channelptr) + void ares_gethostbyname(void* channel, char *name, int family, void* callback, void *arg) + void ares_gethostbyaddr(void* channel, void *addr, int addrlen, int family, void* callback, void *arg) + void ares_process_fd(void* channel, int read_fd, int write_fd) + char* ares_strerror(int code) + void ares_cancel(void* channel) + void ares_getnameinfo(void* channel, void* sa, int salen, int flags, void* callback, void *arg) + + struct in_addr: + pass + + struct ares_in6_addr: + pass + + struct addr_union: + in_addr addr4 + ares_in6_addr addr6 + + struct ares_addr_node: + ares_addr_node *next + int family + addr_union addr + + int ares_set_servers(void* channel, ares_addr_node *servers) + + +cdef extern from "cares_pton.h": + int ares_inet_pton(int af, char *src, void *dst) diff -Nru python-gevent-0.13.7/gevent/core.c python-gevent-1.0/gevent/core.c --- python-gevent-0.13.7/gevent/core.c 2012-04-11 22:26:24.000000000 +0000 +++ python-gevent-1.0/gevent/core.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,21922 +0,0 @@ -/* Generated by Cython 0.14.1 on Mon May 2 20:02:59 2011 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#else - -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) -#endif - -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) - #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) - #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) - #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - #define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - #define PyType_Modified(t) - - typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; - } Py_buffer; - - #define PyBUF_SIMPLE 0 - #define PyBUF_WRITABLE 0x0001 - #define PyBUF_FORMAT 0x0004 - #define PyBUF_ND 0x0008 - #define PyBUF_STRIDES (0x0010 | PyBUF_ND) - #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) - #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) - #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) - #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#endif - -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#endif - -#if PY_MAJOR_VERSION >= 3 - #define Py_TPFLAGS_CHECKTYPES 0 - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif - -#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) - #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) - #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) -#else - #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) - #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) -#else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) -#endif - -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE_API__gevent__core -#include "sys/types.h" -#include "frameobject.h" -#include "libevent.h" -#include "string.h" -#include "errno.h" - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "core.pyx", - "evhttp.pxi", - "evbuffer.pxi", - "evdns.pxi", -}; - -/* Type declarations */ - -typedef void (*__pyx_t_6gevent_4core_event_handler)(int, short, void *); - -typedef void *__pyx_t_6gevent_4core_event_base; - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":144 - * - * - * cdef class http_request_base: # <<<<<<<<<<<<<< - * """Wrapper around libevent's :class:`evhttp_request` structure.""" - * - */ - -struct __pyx_obj_6gevent_4core_http_request_base { - PyObject_HEAD - PyObject *__weakref__; - struct evhttp_request *__pyx___obj; - PyObject *_input_buffer; - PyObject *_output_buffer; -}; - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":466 - * - * - * cdef class http_request_client(http_request_base): # <<<<<<<<<<<<<< - * """Wrapper around libevent's :class:`evhttp_request` structure.""" - * - */ - -struct __pyx_obj_6gevent_4core_http_request_client { - struct __pyx_obj_6gevent_4core_http_request_base __pyx_base; - struct __pyx_vtabstruct_6gevent_4core_http_request_client *__pyx_vtab; - int _owned; - PyObject *callback; - int _incref; -}; - -/* "gevent/core.pyx":145 - * - * - * cdef class event: # <<<<<<<<<<<<<< - * """Create a new event object with a user callback. - * - */ - -struct __pyx_obj_6gevent_4core_event { - PyObject_HEAD - struct __pyx_vtabstruct_6gevent_4core_event *__pyx_vtab; - struct event ev; - PyObject *callback; - PyObject *arg; - int _incref; -}; - -/* "gevent/core.pyx":370 - * - * - * cdef class active_event(event): # <<<<<<<<<<<<<< - * """An event that is scheduled to run in the current loop iteration""" - * - */ - -struct __pyx_obj_6gevent_4core_active_event { - struct __pyx_obj_6gevent_4core_event __pyx_base; -}; - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":395 - * - * - * cdef class http_request(http_request_base): # <<<<<<<<<<<<<< - * """Wrapper around libevent's :class:`evhttp_request` structure.""" - * - */ - -struct __pyx_obj_6gevent_4core_http_request { - struct __pyx_obj_6gevent_4core_http_request_base __pyx_base; - PyObject *default_response_headers; -}; - -/* "gevent/core.pyx":300 - * - * - * cdef class read_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_READ""" - * - */ - -struct __pyx_obj_6gevent_4core_read_event { - struct __pyx_obj_6gevent_4core_event __pyx_base; -}; - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":505 - * - * - * cdef class http_connection: # <<<<<<<<<<<<<< - * - * cdef evhttp_connection* __obj - */ - -struct __pyx_obj_6gevent_4core_http_connection { - PyObject_HEAD - struct evhttp_connection *__pyx___obj; - int _owned; -}; - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":20 - * - * - * cdef class buffer: # <<<<<<<<<<<<<< - * """file-like wrapper for libevent's :class:`evbuffer` structure. - * - */ - -struct __pyx_obj_6gevent_4core_buffer { - PyObject_HEAD - struct evbuffer *__pyx___obj; -}; - -/* "gevent/core.pyx":360 - * - * - * cdef class signal(event): # <<<<<<<<<<<<<< - * """Create a new persistent signal event""" - * - */ - -struct __pyx_obj_6gevent_4core_signal { - struct __pyx_obj_6gevent_4core_event __pyx_base; -}; - -/* "gevent/core.pyx":350 - * - * - * cdef class timer(event): # <<<<<<<<<<<<<< - * """Create a new scheduled timer""" - * - */ - -struct __pyx_obj_6gevent_4core_timer { - struct __pyx_obj_6gevent_4core_event __pyx_base; -}; - -/* "gevent/core.pyx":311 - * - * - * cdef class write_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_WRITE""" - * - */ - -struct __pyx_obj_6gevent_4core_write_event { - struct __pyx_obj_6gevent_4core_event __pyx_base; -}; - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":658 - * - * - * cdef class http: # <<<<<<<<<<<<<< - * cdef evhttp* __obj - * cdef public object handle - */ - -struct __pyx_obj_6gevent_4core_http { - PyObject_HEAD - struct evhttp *__pyx___obj; - PyObject *handle; - PyObject *default_response_headers; - PyObject *_requests; -}; - - -/* "gevent/core.pyx":145 - * - * - * cdef class event: # <<<<<<<<<<<<<< - * """Create a new event object with a user callback. - * - */ - -struct __pyx_vtabstruct_6gevent_4core_event { - PyObject *(*_addref)(struct __pyx_obj_6gevent_4core_event *); - PyObject *(*_delref)(struct __pyx_obj_6gevent_4core_event *); -}; -static struct __pyx_vtabstruct_6gevent_4core_event *__pyx_vtabptr_6gevent_4core_event; - - -/* "gevent/core.pyx":300 - * - * - * cdef class read_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_READ""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_read_event { - struct __pyx_vtabstruct_6gevent_4core_event __pyx_base; -}; -static struct __pyx_vtabstruct_6gevent_4core_read_event *__pyx_vtabptr_6gevent_4core_read_event; - - -/* "gevent/core.pyx":370 - * - * - * cdef class active_event(event): # <<<<<<<<<<<<<< - * """An event that is scheduled to run in the current loop iteration""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_active_event { - struct __pyx_vtabstruct_6gevent_4core_event __pyx_base; -}; -static struct __pyx_vtabstruct_6gevent_4core_active_event *__pyx_vtabptr_6gevent_4core_active_event; - - -/* "gevent/core.pyx":311 - * - * - * cdef class write_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_WRITE""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_write_event { - struct __pyx_vtabstruct_6gevent_4core_event __pyx_base; -}; -static struct __pyx_vtabstruct_6gevent_4core_write_event *__pyx_vtabptr_6gevent_4core_write_event; - - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":466 - * - * - * cdef class http_request_client(http_request_base): # <<<<<<<<<<<<<< - * """Wrapper around libevent's :class:`evhttp_request` structure.""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_http_request_client { - PyObject *(*_addref)(struct __pyx_obj_6gevent_4core_http_request_client *); - PyObject *(*_delref)(struct __pyx_obj_6gevent_4core_http_request_client *); -}; -static struct __pyx_vtabstruct_6gevent_4core_http_request_client *__pyx_vtabptr_6gevent_4core_http_request_client; - - -/* "gevent/core.pyx":350 - * - * - * cdef class timer(event): # <<<<<<<<<<<<<< - * """Create a new scheduled timer""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_timer { - struct __pyx_vtabstruct_6gevent_4core_event __pyx_base; -}; -static struct __pyx_vtabstruct_6gevent_4core_timer *__pyx_vtabptr_6gevent_4core_timer; - - -/* "gevent/core.pyx":360 - * - * - * cdef class signal(event): # <<<<<<<<<<<<<< - * """Create a new persistent signal event""" - * - */ - -struct __pyx_vtabstruct_6gevent_4core_signal { - struct __pyx_vtabstruct_6gevent_4core_event __pyx_base; -}; -static struct __pyx_vtabstruct_6gevent_4core_signal *__pyx_vtabptr_6gevent_4core_signal; - -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif - -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) -#else - #define __Pyx_RefNannySetupContext(name) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, - const char* function_name, int kw_allowed); /*proto*/ - -static PyObject* __Pyx_PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*); /*proto*/ - -static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; /* this is just to have an accurate signature */ - } - else { - PyObject *r, *m; - m = __Pyx_GetAttrString(L, "append"); - if (!m) return NULL; - r = PyObject_CallFunctionObjArgs(m, x, NULL); - Py_DECREF(m); - return r; - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) - return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); - } -} - -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ - -static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname); /*proto*/ - -#define __pyx_binding_PyCFunctionType_USED 1 - -typedef struct { - PyCFunctionObject func; -} __pyx_binding_PyCFunctionType_object; - -static PyTypeObject __pyx_binding_PyCFunctionType_type; -static PyTypeObject *__pyx_binding_PyCFunctionType = NULL; - -static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */ -#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL) - -static int __pyx_binding_PyCFunctionType_init(void); /* proto */ - -#include "descrobject.h" -static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/ - -#ifndef __PYX_FORCE_INIT_THREADS - #if PY_VERSION_HEX < 0x02040200 - #define __PYX_FORCE_INIT_THREADS 1 - #else - #define __PYX_FORCE_INIT_THREADS 0 - #endif -#endif - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_ev_uint16_t(ev_uint16_t); - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from gevent.core */ - -static PyTypeObject *__pyx_ptype_6gevent_4core_event = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_read_event = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_write_event = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_timer = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_signal = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_active_event = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_buffer = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_http_request_base = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_http_request = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_http_request_client = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_http_connection = 0; -static PyTypeObject *__pyx_ptype_6gevent_4core_http = 0; -static void __pyx_f_6gevent_4core___event_handler(int, short, void *); /*proto*/ -static void __pyx_f_6gevent_4core___simple_handler(int, short, void *); /*proto*/ -static void __pyx_f_6gevent_4core___evdns_callback(int, char, int, int, void *, void *); /*proto*/ -static void __pyx_f_6gevent_4core__http_request_cb_handler(struct evhttp_request *, void *); /*proto*/ -static void __pyx_f_6gevent_4core__http_cb_handler(struct evhttp_request *, void *); /*proto*/ -static void __pyx_f_6gevent_4core__http_closecb_handler(struct evhttp_connection *, void *); /*proto*/ -static void __pyx_f_6gevent_4core__http_cb_reply_error(struct evhttp_request *, void *); /*proto*/ -static void __pyx_f_6gevent_4core_report_internal_error(struct evhttp_request *); /*proto*/ -#define __Pyx_MODULE_NAME "gevent.core" -static int __pyx_module_is_main_gevent__core = 0; - -/* Implementation of gevent.core */ -static PyObject *__pyx_builtin_UserWarning; -static PyObject *__pyx_builtin_AttributeError; -static PyObject *__pyx_builtin_hex; -static PyObject *__pyx_builtin_DeprecationWarning; -static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_NotImplementedError; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_Exception; -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_TypeError; -static char __pyx_k_1[] = "Failed to execute callback for %s\n\n"; -static char __pyx_k_2[] = "|"; -static char __pyx_k_3[] = "Negative timeouts are deprecated. Use None to disable timeout."; -static char __pyx_k_4[] = "event_add(fileno=%s) returned %s"; -static char __pyx_k_5[] = " pending"; -static char __pyx_k_6[] = ""; -static char __pyx_k_7[] = " %s"; -static char __pyx_k_8[] = "<%s at %s%s fd=%s%s flags=%s cb=%s arg=%s>"; -static char __pyx_k_9[] = "\n"; -static char __pyx_k_10[] = " "; -static char __pyx_k_11[] = "%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s"; -static char __pyx_k_16[] = "evdns_resolve_ipv4(%r, %r) returned %s"; -static char __pyx_k_17[] = "evdns_resolve_ip6(%r, %r) returned %s"; -static char __pyx_k_18[] = "evdns_resolve_reverse(%r, %r) returned %s"; -static char __pyx_k_19[] = "evdns_resolve_reverse_ipv6(%r, %r) returned %s"; -static char __pyx_k_20[] = "evbuffer_drain(0x%x, %s) returned %s\n"; -static char __pyx_k_21[] = "evbuffer_add() returned %s"; -static char __pyx_k_22[] = "\"%s %s HTTP/%s.%s\" %s:%s"; -static char __pyx_k_23[] = " response=%s"; -static char __pyx_k_24[] = " input=%s"; -static char __pyx_k_25[] = " output=%s"; -static char __pyx_k_26[] = ""; -static char __pyx_k_27[] = "<%s %s>"; -static char __pyx_k_28[] = "<%s _obj=0x%x %s>"; -static char __pyx_k_29[] = "Internal error in evhttp_add_header"; -static char __pyx_k_32[] = "default_response_headers"; -static char __pyx_k_34[] = "_add_default_response_headers"; -static char __pyx_k_35[] = "Expected str or buffer: %r"; -static char __pyx_k_36[] = "evhttp_request_new() failed"; -static char __pyx_k_38[] = "HttpConnectionDeleted"; -static char __pyx_k_39[] = "<%s _obj=0x%x%s>"; -static char __pyx_k_40[] = "Internal error in evhttp\n"; -static char __pyx_k_42[] = "Failed to execute callback for evhttp request.\n"; -static char __pyx_k_44[] = "%s: Failed to handle request: %s\n\n"; -static char __pyx_k_45[] = "Content-type"; -static char __pyx_k_46[] = "text/plain"; -static char __pyx_k_47[] = "Content-length"; -static char __pyx_k_48[] = "Internal Server Error"; -static char __pyx_k_49[] = "127.0.0.1"; -static char __pyx_k_50[] = "evhttp_bind_socket(%r, %r) returned %r"; -static char __pyx_k_51[] = "evhttp_accept_socket(%r) returned %r"; -static char __pyx_k_52[] = "Return True if the event is still scheduled to run."; -static char __pyx_k_53[] = "Wrappers around libevent API.\n\nThis module provides a mechanism to execute a function when a\nspecific event on a file handle, file descriptor, or signal occurs,\nor after a given time has passed. It also provides wrappers around\nstructures and functions from libevent-dns and libevent-http.\n\nThis module does not work with the greenlets. A callback passed\nto a method from this module will be executed in the event loop,\nwhich is running in the :class:`Hub ` greenlet.\nTherefore it must not use any synchronous gevent API,\nthat is, the functions that switch to the Hub. It's OK to call asynchronous\nstuff like :func:`gevent.spawn`, :meth:`Event.set `.\n\nThe code is based on pyevent_.\n\n.. _pyevent: http://code.google.com/p/pyevent/\n"; -static char __pyx_k_54[] = "Dug Song "; -static char __pyx_k_55[] = "Martin Murray "; -static char __pyx_k_57[] = "Copyright (c) 2004 Dug Song"; -static char __pyx_k_58[] = "Copyright (c) 2003 Martin Murray"; -static char __pyx_k_60[] = "http://monkey.org/~dugsong/pyevent/"; -static char __pyx_k_61[] = "0.4+"; -static char __pyx_k_62[] = "gevent.core"; -static char __pyx_k_63[] = "Create a new scheduled event with evtype=EV_READ|EV_WRITE"; -static char __pyx_k_64[] = "dns_resolve_reverse_ipv6"; -static char __pyx_k_65[] = "DNS_ERR_SERVERFAILED"; -static char __pyx_k_66[] = "1.3.99-trunk"; -static char __pyx_k_67[] = "libevent version mismatch: system version is %r but this gevent is compiled against %r"; -static char __pyx_k_68[] = "Raised when an attribute is accessed of http_request instance whose _obj is 0"; -static char __pyx_k_69[] = "Raised when an attribute is accessed of http_connection instance whose _obj is 0"; -static char __pyx_k__21[] = "21"; -static char __pyx_k__ev[] = "ev"; -static char __pyx_k__fd[] = "fd"; -static char __pyx_k__id[] = "id"; -static char __pyx_k__BSD[] = "BSD"; -static char __pyx_k__GET[] = "GET"; -static char __pyx_k__PUT[] = "PUT"; -static char __pyx_k__add[] = "add"; -static char __pyx_k__arg[] = "arg"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__get[] = "get"; -static char __pyx_k__hex[] = "hex"; -static char __pyx_k__key[] = "key"; -static char __pyx_k__msg[] = "msg"; -static char __pyx_k__new[] = "new"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__pop[] = "pop"; -static char __pyx_k__req[] = "req"; -static char __pyx_k__sys[] = "sys"; -static char __pyx_k__uri[] = "uri"; -static char __pyx_k__HEAD[] = "HEAD"; -static char __pyx_k__INIT[] = "INIT"; -static char __pyx_k__POST[] = "POST"; -static char __pyx_k__READ[] = "READ"; -static char __pyx_k___obj[] = "_obj"; -static char __pyx_k__code[] = "code"; -static char __pyx_k__hint[] = "hint"; -static char __pyx_k__http[] = "http"; -static char __pyx_k__init[] = "init"; -static char __pyx_k__join[] = "join"; -static char __pyx_k__keys[] = "keys"; -static char __pyx_k__kind[] = "kind"; -static char __pyx_k__loop[] = "loop"; -static char __pyx_k__name[] = "name"; -static char __pyx_k__peer[] = "peer"; -static char __pyx_k__port[] = "port"; -static char __pyx_k__self[] = "self"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__type[] = "type"; -static char __pyx_k__warn[] = "warn"; -static char __pyx_k__PATCH[] = "PATCH"; -static char __pyx_k__TRACE[] = "TRACE"; -static char __pyx_k__WRITE[] = "WRITE"; -static char __pyx_k____obj[] = "__obj"; -static char __pyx_k__close[] = "close"; -static char __pyx_k__ev_fd[] = "ev_fd"; -static char __pyx_k__evcon[] = "evcon"; -static char __pyx_k__event[] = "event"; -static char __pyx_k__flags[] = "flags"; -static char __pyx_k__lower[] = "lower"; -static char __pyx_k__major[] = "major"; -static char __pyx_k__minor[] = "minor"; -static char __pyx_k__owned[] = "owned"; -static char __pyx_k__timer[] = "timer"; -static char __pyx_k__value[] = "value"; -static char __pyx_k__write[] = "write"; -static char __pyx_k__ACTIVE[] = "ACTIVE"; -static char __pyx_k__DELETE[] = "DELETE"; -static char __pyx_k__SIGNAL[] = "SIGNAL"; -static char __pyx_k___owned[] = "_owned"; -static char __pyx_k__append[] = "append"; -static char __pyx_k__buffer[] = "buffer"; -static char __pyx_k__cancel[] = "cancel"; -static char __pyx_k__detach[] = "detach"; -static char __pyx_k__evtype[] = "evtype"; -static char __pyx_k__handle[] = "handle"; -static char __pyx_k__indent[] = "indent"; -static char __pyx_k__pprint[] = "pprint"; -static char __pyx_k__reason[] = "reason"; -static char __pyx_k__reinit[] = "reinit"; -static char __pyx_k__signal[] = "signal"; -static char __pyx_k__stderr[] = "stderr"; -static char __pyx_k__tv_sec[] = "tv_sec"; -static char __pyx_k__CONNECT[] = "CONNECT"; -static char __pyx_k__DNS_PTR[] = "DNS_PTR"; -static char __pyx_k__IOError[] = "IOError"; -static char __pyx_k__OPTIONS[] = "OPTIONS"; -static char __pyx_k__PERSIST[] = "PERSIST"; -static char __pyx_k__TIMEOUT[] = "TIMEOUT"; -static char __pyx_k____all__[] = "__all__"; -static char __pyx_k____url__[] = "__url__"; -static char __pyx_k___addref[] = "_addref"; -static char __pyx_k___delref[] = "_delref"; -static char __pyx_k___format[] = "_format"; -static char __pyx_k___incref[] = "_incref"; -static char __pyx_k__address[] = "address"; -static char __pyx_k__chunked[] = "chunked"; -static char __pyx_k__deleted[] = "deleted"; -static char __pyx_k__pending[] = "pending"; -static char __pyx_k__persist[] = "persist"; -static char __pyx_k__pformat[] = "pformat"; -static char __pyx_k__replace[] = "replace"; -static char __pyx_k__seconds[] = "seconds"; -static char __pyx_k__timeout[] = "timeout"; -static char __pyx_k__tv_usec[] = "tv_usec"; -static char __pyx_k__typestr[] = "typestr"; -static char __pyx_k__weakref[] = "weakref"; -static char __pyx_k__INSERTED[] = "INSERTED"; -static char __pyx_k__INTERNAL[] = "INTERNAL"; -static char __pyx_k____init__[] = "__init__"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____name__[] = "__name__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__callback[] = "callback"; -static char __pyx_k__dispatch[] = "dispatch"; -static char __pyx_k__dns_init[] = "dns_init"; -static char __pyx_k__ev_flags[] = "ev_flags"; -static char __pyx_k__exc_type[] = "exc_type"; -static char __pyx_k__nonblock[] = "nonblock"; -static char __pyx_k__readline[] = "readline"; -static char __pyx_k__warnings[] = "warnings"; -static char __pyx_k__Exception[] = "Exception"; -static char __pyx_k__TypeError[] = "TypeError"; -static char __pyx_k____class__[] = "__class__"; -static char __pyx_k___requests[] = "_requests"; -static char __pyx_k__ev_events[] = "ev_events"; -static char __pyx_k__exc_clear[] = "exc_clear"; -static char __pyx_k__exc_value[] = "exc_value"; -static char __pyx_k__flags_str[] = "flags_str"; -static char __pyx_k__packed_ip[] = "packed_ip"; -static char __pyx_k__print_exc[] = "print_exc"; -static char __pyx_k__signalnum[] = "signalnum"; -static char __pyx_k__traceback[] = "traceback"; -static char __pyx_k__Connection[] = "Connection"; -static char __pyx_k__DNS_IPv4_A[] = "DNS_IPv4_A"; -static char __pyx_k____author__[] = "__author__"; -static char __pyx_k__events_str[] = "events_str"; -static char __pyx_k__get_method[] = "get_method"; -static char __pyx_k__read_event[] = "read_event"; -static char __pyx_k__stacklevel[] = "stacklevel"; -static char __pyx_k__UserWarning[] = "UserWarning"; -static char __pyx_k____license__[] = "__license__"; -static char __pyx_k____version__[] = "__version__"; -static char __pyx_k__get_version[] = "get_version"; -static char __pyx_k__remote_host[] = "remote_host"; -static char __pyx_k__remote_port[] = "remote_port"; -static char __pyx_k__write_event[] = "write_event"; -static char __pyx_k__DNS_ERR_NONE[] = "DNS_ERR_NONE"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__active_event[] = "active_event"; -static char __pyx_k__dns_shutdown[] = "dns_shutdown"; -static char __pyx_k__http_request[] = "http_request"; -static char __pyx_k__input_buffer[] = "input_buffer"; -static char __pyx_k__set_exc_info[] = "set_exc_info"; -static char __pyx_k__DNS_IPv6_AAAA[] = "DNS_IPv6_AAAA"; -static char __pyx_k__ObjectDeleted[] = "ObjectDeleted"; -static char __pyx_k__StopIteration[] = "StopIteration"; -static char __pyx_k____copyright__[] = "__copyright__"; -static char __pyx_k___input_buffer[] = "_input_buffer"; -static char __pyx_k__exc_traceback[] = "exc_traceback"; -static char __pyx_k__fail_requests[] = "fail_requests"; -static char __pyx_k__input_headers[] = "input_headers"; -static char __pyx_k__output_buffer[] = "output_buffer"; -static char __pyx_k__response_code[] = "response_code"; -static char __pyx_k__AttributeError[] = "AttributeError"; -static char __pyx_k__DNS_ERR_FORMAT[] = "DNS_ERR_FORMAT"; -static char __pyx_k__EVHTTP_REQUEST[] = "EVHTTP_REQUEST"; -static char __pyx_k__EVHTTP_REQ_GET[] = "EVHTTP_REQ_GET"; -static char __pyx_k__EVHTTP_REQ_PUT[] = "EVHTTP_REQ_PUT"; -static char __pyx_k___output_buffer[] = "_output_buffer"; -static char __pyx_k__output_headers[] = "output_headers"; -static char __pyx_k__DNS_ERR_NOTIMPL[] = "DNS_ERR_NOTIMPL"; -static char __pyx_k__DNS_ERR_REFUSED[] = "DNS_ERR_REFUSED"; -static char __pyx_k__DNS_ERR_TIMEOUT[] = "DNS_ERR_TIMEOUT"; -static char __pyx_k__DNS_ERR_UNKNOWN[] = "DNS_ERR_UNKNOWN"; -static char __pyx_k__EVHTTP_REQ_HEAD[] = "EVHTTP_REQ_HEAD"; -static char __pyx_k__EVHTTP_REQ_POST[] = "EVHTTP_REQ_POST"; -static char __pyx_k__EVHTTP_RESPONSE[] = "EVHTTP_RESPONSE"; -static char __pyx_k__http_connection[] = "http_connection"; -static char __pyx_k__readwrite_event[] = "readwrite_event"; -static char __pyx_k__DNS_ERR_NOTEXIST[] = "DNS_ERR_NOTEXIST"; -static char __pyx_k__DNS_ERR_SHUTDOWN[] = "DNS_ERR_SHUTDOWN"; -static char __pyx_k__EVHTTP_REQ_PATCH[] = "EVHTTP_REQ_PATCH"; -static char __pyx_k__EVHTTP_REQ_TRACE[] = "EVHTTP_REQ_TRACE"; -static char __pyx_k__HTTP_method2name[] = "HTTP_method2name"; -static char __pyx_k__dns_resolve_ipv4[] = "dns_resolve_ipv4"; -static char __pyx_k__dns_resolve_ipv6[] = "dns_resolve_ipv6"; -static char __pyx_k__DNS_ERR_TRUNCATED[] = "DNS_ERR_TRUNCATED"; -static char __pyx_k__EVHTTP_REQ_DELETE[] = "EVHTTP_REQ_DELETE"; -static char __pyx_k__WeakKeyDictionary[] = "WeakKeyDictionary"; -static char __pyx_k__add_output_header[] = "add_output_header"; -static char __pyx_k__dns_err_to_string[] = "dns_err_to_string"; -static char __pyx_k__DeprecationWarning[] = "DeprecationWarning"; -static char __pyx_k__EVHTTP_REQ_CONNECT[] = "EVHTTP_REQ_CONNECT"; -static char __pyx_k__EVHTTP_REQ_OPTIONS[] = "EVHTTP_REQ_OPTIONS"; -static char __pyx_k__HttpRequestDeleted[] = "HttpRequestDeleted"; -static char __pyx_k__find_output_header[] = "find_output_header"; -static char __pyx_k__get_header_version[] = "get_header_version"; -static char __pyx_k__response_code_line[] = "response_code_line"; -static char __pyx_k__DNS_QUERY_NO_SEARCH[] = "DNS_QUERY_NO_SEARCH"; -static char __pyx_k__NotImplementedError[] = "NotImplementedError"; -static char __pyx_k__dns_resolve_reverse[] = "dns_resolve_reverse"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_s_10; -static PyObject *__pyx_kp_s_11; -static PyObject *__pyx_kp_s_16; -static PyObject *__pyx_kp_s_17; -static PyObject *__pyx_kp_s_18; -static PyObject *__pyx_kp_s_19; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_kp_s_20; -static PyObject *__pyx_kp_s_21; -static PyObject *__pyx_kp_s_22; -static PyObject *__pyx_kp_s_23; -static PyObject *__pyx_kp_s_24; -static PyObject *__pyx_kp_s_25; -static PyObject *__pyx_kp_s_26; -static PyObject *__pyx_kp_s_27; -static PyObject *__pyx_kp_s_28; -static PyObject *__pyx_kp_s_29; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_n_s_32; -static PyObject *__pyx_n_s_34; -static PyObject *__pyx_kp_s_35; -static PyObject *__pyx_kp_s_36; -static PyObject *__pyx_n_s_38; -static PyObject *__pyx_kp_s_39; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_40; -static PyObject *__pyx_kp_s_42; -static PyObject *__pyx_kp_s_44; -static PyObject *__pyx_kp_s_5; -static PyObject *__pyx_kp_s_50; -static PyObject *__pyx_kp_s_51; -static PyObject *__pyx_kp_s_54; -static PyObject *__pyx_kp_s_55; -static PyObject *__pyx_kp_s_57; -static PyObject *__pyx_kp_s_58; -static PyObject *__pyx_kp_s_6; -static PyObject *__pyx_kp_s_60; -static PyObject *__pyx_kp_s_61; -static PyObject *__pyx_n_s_62; -static PyObject *__pyx_kp_s_63; -static PyObject *__pyx_n_s_64; -static PyObject *__pyx_n_s_65; -static PyObject *__pyx_kp_s_66; -static PyObject *__pyx_kp_s_67; -static PyObject *__pyx_kp_s_68; -static PyObject *__pyx_kp_s_69; -static PyObject *__pyx_kp_s_7; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_s_9; -static PyObject *__pyx_n_s__ACTIVE; -static PyObject *__pyx_n_s__AttributeError; -static PyObject *__pyx_n_s__BSD; -static PyObject *__pyx_n_s__CONNECT; -static PyObject *__pyx_n_s__DELETE; -static PyObject *__pyx_n_s__DNS_ERR_FORMAT; -static PyObject *__pyx_n_s__DNS_ERR_NONE; -static PyObject *__pyx_n_s__DNS_ERR_NOTEXIST; -static PyObject *__pyx_n_s__DNS_ERR_NOTIMPL; -static PyObject *__pyx_n_s__DNS_ERR_REFUSED; -static PyObject *__pyx_n_s__DNS_ERR_SHUTDOWN; -static PyObject *__pyx_n_s__DNS_ERR_TIMEOUT; -static PyObject *__pyx_n_s__DNS_ERR_TRUNCATED; -static PyObject *__pyx_n_s__DNS_ERR_UNKNOWN; -static PyObject *__pyx_n_s__DNS_IPv4_A; -static PyObject *__pyx_n_s__DNS_IPv6_AAAA; -static PyObject *__pyx_n_s__DNS_PTR; -static PyObject *__pyx_n_s__DNS_QUERY_NO_SEARCH; -static PyObject *__pyx_n_s__DeprecationWarning; -static PyObject *__pyx_n_s__EVHTTP_REQUEST; -static PyObject *__pyx_n_s__EVHTTP_REQ_CONNECT; -static PyObject *__pyx_n_s__EVHTTP_REQ_DELETE; -static PyObject *__pyx_n_s__EVHTTP_REQ_GET; -static PyObject *__pyx_n_s__EVHTTP_REQ_HEAD; -static PyObject *__pyx_n_s__EVHTTP_REQ_OPTIONS; -static PyObject *__pyx_n_s__EVHTTP_REQ_PATCH; -static PyObject *__pyx_n_s__EVHTTP_REQ_POST; -static PyObject *__pyx_n_s__EVHTTP_REQ_PUT; -static PyObject *__pyx_n_s__EVHTTP_REQ_TRACE; -static PyObject *__pyx_n_s__EVHTTP_RESPONSE; -static PyObject *__pyx_n_s__Exception; -static PyObject *__pyx_n_s__GET; -static PyObject *__pyx_n_s__HEAD; -static PyObject *__pyx_n_s__HTTP_method2name; -static PyObject *__pyx_n_s__HttpRequestDeleted; -static PyObject *__pyx_n_s__INIT; -static PyObject *__pyx_n_s__INSERTED; -static PyObject *__pyx_n_s__INTERNAL; -static PyObject *__pyx_n_s__IOError; -static PyObject *__pyx_n_s__NotImplementedError; -static PyObject *__pyx_n_s__OPTIONS; -static PyObject *__pyx_n_s__ObjectDeleted; -static PyObject *__pyx_n_s__PATCH; -static PyObject *__pyx_n_s__PERSIST; -static PyObject *__pyx_n_s__POST; -static PyObject *__pyx_n_s__PUT; -static PyObject *__pyx_n_s__READ; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__SIGNAL; -static PyObject *__pyx_n_s__StopIteration; -static PyObject *__pyx_n_s__TIMEOUT; -static PyObject *__pyx_n_s__TRACE; -static PyObject *__pyx_n_s__TypeError; -static PyObject *__pyx_n_s__UserWarning; -static PyObject *__pyx_n_s__WRITE; -static PyObject *__pyx_n_s__WeakKeyDictionary; -static PyObject *__pyx_n_s____all__; -static PyObject *__pyx_n_s____author__; -static PyObject *__pyx_n_s____class__; -static PyObject *__pyx_n_s____copyright__; -static PyObject *__pyx_n_s____init__; -static PyObject *__pyx_n_s____license__; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____name__; -static PyObject *__pyx_n_s____obj; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s____url__; -static PyObject *__pyx_n_s____version__; -static PyObject *__pyx_n_s___addref; -static PyObject *__pyx_n_s___delref; -static PyObject *__pyx_n_s___format; -static PyObject *__pyx_n_s___incref; -static PyObject *__pyx_n_s___input_buffer; -static PyObject *__pyx_n_s___obj; -static PyObject *__pyx_n_s___output_buffer; -static PyObject *__pyx_n_s___owned; -static PyObject *__pyx_n_s___requests; -static PyObject *__pyx_n_s__active_event; -static PyObject *__pyx_n_s__add; -static PyObject *__pyx_n_s__add_output_header; -static PyObject *__pyx_n_s__address; -static PyObject *__pyx_n_s__append; -static PyObject *__pyx_n_s__arg; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__buffer; -static PyObject *__pyx_n_s__callback; -static PyObject *__pyx_n_s__cancel; -static PyObject *__pyx_n_s__chunked; -static PyObject *__pyx_n_s__code; -static PyObject *__pyx_n_s__deleted; -static PyObject *__pyx_n_s__detach; -static PyObject *__pyx_n_s__dispatch; -static PyObject *__pyx_n_s__dns_err_to_string; -static PyObject *__pyx_n_s__dns_init; -static PyObject *__pyx_n_s__dns_resolve_ipv4; -static PyObject *__pyx_n_s__dns_resolve_ipv6; -static PyObject *__pyx_n_s__dns_resolve_reverse; -static PyObject *__pyx_n_s__dns_shutdown; -static PyObject *__pyx_n_s__ev; -static PyObject *__pyx_n_s__ev_events; -static PyObject *__pyx_n_s__ev_fd; -static PyObject *__pyx_n_s__ev_flags; -static PyObject *__pyx_n_s__evcon; -static PyObject *__pyx_n_s__event; -static PyObject *__pyx_n_s__events_str; -static PyObject *__pyx_n_s__evtype; -static PyObject *__pyx_n_s__exc_clear; -static PyObject *__pyx_n_s__exc_traceback; -static PyObject *__pyx_n_s__exc_type; -static PyObject *__pyx_n_s__exc_value; -static PyObject *__pyx_n_s__fail_requests; -static PyObject *__pyx_n_s__fd; -static PyObject *__pyx_n_s__find_output_header; -static PyObject *__pyx_n_s__flags; -static PyObject *__pyx_n_s__flags_str; -static PyObject *__pyx_n_s__get; -static PyObject *__pyx_n_s__get_header_version; -static PyObject *__pyx_n_s__get_method; -static PyObject *__pyx_n_s__get_version; -static PyObject *__pyx_n_s__handle; -static PyObject *__pyx_n_s__hex; -static PyObject *__pyx_n_s__hint; -static PyObject *__pyx_n_s__http; -static PyObject *__pyx_n_s__http_connection; -static PyObject *__pyx_n_s__http_request; -static PyObject *__pyx_n_s__id; -static PyObject *__pyx_n_s__indent; -static PyObject *__pyx_n_s__init; -static PyObject *__pyx_n_s__input_buffer; -static PyObject *__pyx_n_s__input_headers; -static PyObject *__pyx_n_s__join; -static PyObject *__pyx_n_s__key; -static PyObject *__pyx_n_s__keys; -static PyObject *__pyx_n_s__kind; -static PyObject *__pyx_n_s__loop; -static PyObject *__pyx_n_s__lower; -static PyObject *__pyx_n_s__major; -static PyObject *__pyx_n_s__minor; -static PyObject *__pyx_n_s__msg; -static PyObject *__pyx_n_s__name; -static PyObject *__pyx_n_s__new; -static PyObject *__pyx_n_s__nonblock; -static PyObject *__pyx_n_s__obj; -static PyObject *__pyx_n_s__output_buffer; -static PyObject *__pyx_n_s__output_headers; -static PyObject *__pyx_n_s__owned; -static PyObject *__pyx_n_s__packed_ip; -static PyObject *__pyx_n_s__peer; -static PyObject *__pyx_n_s__pending; -static PyObject *__pyx_n_s__persist; -static PyObject *__pyx_n_s__pformat; -static PyObject *__pyx_n_s__pop; -static PyObject *__pyx_n_s__port; -static PyObject *__pyx_n_s__pprint; -static PyObject *__pyx_n_s__print_exc; -static PyObject *__pyx_n_s__read_event; -static PyObject *__pyx_n_s__readline; -static PyObject *__pyx_n_s__readwrite_event; -static PyObject *__pyx_n_s__reason; -static PyObject *__pyx_n_s__reinit; -static PyObject *__pyx_n_s__remote_host; -static PyObject *__pyx_n_s__remote_port; -static PyObject *__pyx_n_s__replace; -static PyObject *__pyx_n_s__req; -static PyObject *__pyx_n_s__response_code; -static PyObject *__pyx_n_s__response_code_line; -static PyObject *__pyx_n_s__seconds; -static PyObject *__pyx_n_s__self; -static PyObject *__pyx_n_s__set_exc_info; -static PyObject *__pyx_n_s__signal; -static PyObject *__pyx_n_s__signalnum; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__stacklevel; -static PyObject *__pyx_n_s__stderr; -static PyObject *__pyx_n_s__sys; -static PyObject *__pyx_n_s__timeout; -static PyObject *__pyx_n_s__timer; -static PyObject *__pyx_n_s__traceback; -static PyObject *__pyx_n_s__tv_sec; -static PyObject *__pyx_n_s__tv_usec; -static PyObject *__pyx_n_s__type; -static PyObject *__pyx_n_s__typestr; -static PyObject *__pyx_n_s__uri; -static PyObject *__pyx_n_s__value; -static PyObject *__pyx_n_s__warn; -static PyObject *__pyx_n_s__warnings; -static PyObject *__pyx_n_s__weakref; -static PyObject *__pyx_n_s__write; -static PyObject *__pyx_n_s__write_event; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_8; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_16; -static PyObject *__pyx_int_32; -static PyObject *__pyx_int_64; -static PyObject *__pyx_int_65; -static PyObject *__pyx_int_66; -static PyObject *__pyx_int_67; -static PyObject *__pyx_int_68; -static PyObject *__pyx_int_128; -static PyObject *__pyx_int_256; -static PyObject *__pyx_k_12; -static PyObject *__pyx_k_13; -static PyObject *__pyx_k_14; -static PyObject *__pyx_k_15; -static PyObject *__pyx_k_33; -static PyObject *__pyx_k_tuple_30; -static PyObject *__pyx_k_tuple_31; -static PyObject *__pyx_k_tuple_37; -static PyObject *__pyx_k_tuple_41; -static PyObject *__pyx_k_tuple_43; -static PyObject *__pyx_k_tuple_56; -static PyObject *__pyx_k_tuple_59; - -/* "gevent/core.pyx":129 - * - * - * cdef void __event_handler(int fd, short evtype, void *arg) with gil: # <<<<<<<<<<<<<< - * cdef event self = arg - * try: - */ - -static void __pyx_f_6gevent_4core___event_handler(int __pyx_v_fd, short __pyx_v_evtype, void *__pyx_v_arg) { - struct __pyx_obj_6gevent_4core_event *__pyx_v_self = 0; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__event_handler"); - - /* "gevent/core.pyx":130 - * - * cdef void __event_handler(int fd, short evtype, void *arg) with gil: - * cdef event self = arg # <<<<<<<<<<<<<< - * try: - * self.callback(self, evtype) - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6gevent_4core_event *)__pyx_v_arg))); - __pyx_v_self = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_arg); - - /* "gevent/core.pyx":131 - * cdef void __event_handler(int fd, short evtype, void *arg) with gil: - * cdef event self = arg - * try: # <<<<<<<<<<<<<< - * self.callback(self, evtype) - * except: - */ - /*try:*/ { - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "gevent/core.pyx":132 - * cdef event self = arg - * try: - * self.callback(self, evtype) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_evtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_v_self->callback, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":133 - * try: - * self.callback(self, evtype) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * try: - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.__event_handler"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - - /* "gevent/core.pyx":134 - * self.callback(self, evtype) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "gevent/core.pyx":135 - * except: - * traceback.print_exc() - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "gevent/core.pyx":136 - * traceback.print_exc() - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__stderr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L23_try_end; - __pyx_L16_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "gevent/core.pyx":137 - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * sys.exc_clear() - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.__event_handler"); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - - /* "gevent/core.pyx":138 - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * sys.exc_clear() - * finally: - */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L17_exception_handled; - } - __pyx_L18_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L8_except_error; - __pyx_L17_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L23_try_end:; - } - - /* "gevent/core.pyx":139 - * except: - * traceback.print_exc() - * sys.exc_clear() # <<<<<<<<<<<<<< - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exc_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_exception_handled; - } - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L4; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L13_try_end:; - } - } - - /* "gevent/core.pyx":141 - * sys.exc_clear() - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): # <<<<<<<<<<<<<< - * self._delref() - * - */ - /*finally:*/ { - int __pyx_why; - PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; - int __pyx_exc_lineno; - __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; - __pyx_why = 0; goto __pyx_L5; - __pyx_L4: { - __pyx_why = 4; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); - __pyx_exc_lineno = __pyx_lineno; - goto __pyx_L5; - } - __pyx_L5:; - __pyx_t_9 = (!event_pending((&__pyx_v_self->ev), (((EV_READ | EV_WRITE) | EV_SIGNAL) | EV_TIMEOUT), NULL)); - if (__pyx_t_9) { - - /* "gevent/core.pyx":142 - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - * self._delref() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_4core_event *)__pyx_v_self->__pyx_vtab)->_delref(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L26_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L27; - } - __pyx_L27:; - goto __pyx_L28; - __pyx_L26_error:; - if (__pyx_why == 4) { - Py_XDECREF(__pyx_exc_type); - Py_XDECREF(__pyx_exc_value); - Py_XDECREF(__pyx_exc_tb); - } - goto __pyx_L1_error; - __pyx_L28:; - switch (__pyx_why) { - case 4: { - __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); - __pyx_lineno = __pyx_exc_lineno; - __pyx_exc_type = 0; - __pyx_exc_value = 0; - __pyx_exc_tb = 0; - goto __pyx_L1_error; - } - } - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_WriteUnraisable("gevent.core.__event_handler"); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_self); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "gevent/core.pyx":158 - * cdef int _incref # 1 if we already INCREFed this object once (because libevent references it) - * - * def __init__(self, short evtype, int handle, callback, arg=None): # <<<<<<<<<<<<<< - * self.callback = callback - * self.arg = arg - */ - -static int __pyx_pf_6gevent_4core_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - short __pyx_v_evtype; - int __pyx_v_handle; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_arg = 0; - void *__pyx_v_c_self; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evtype,&__pyx_n_s__handle,&__pyx_n_s__callback,&__pyx_n_s__arg,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - values[3] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evtype); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg); - if (value) { values[3] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_evtype = __Pyx_PyInt_AsShort(values[0]); if (unlikely((__pyx_v_evtype == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_handle = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - __pyx_v_arg = values[3]; - } else { - __pyx_v_arg = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: - __pyx_v_arg = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - __pyx_v_handle = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_evtype = __Pyx_PyInt_AsShort(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_evtype == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.event.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":159 - * - * def __init__(self, short evtype, int handle, callback, arg=None): - * self.callback = callback # <<<<<<<<<<<<<< - * self.arg = arg - * self._incref = 0 - */ - __Pyx_INCREF(__pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback = __pyx_v_callback; - - /* "gevent/core.pyx":160 - * def __init__(self, short evtype, int handle, callback, arg=None): - * self.callback = callback - * self.arg = arg # <<<<<<<<<<<<<< - * self._incref = 0 - * cdef void* c_self = self - */ - __Pyx_INCREF(__pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg = __pyx_v_arg; - - /* "gevent/core.pyx":161 - * self.callback = callback - * self.arg = arg - * self._incref = 0 # <<<<<<<<<<<<<< - * cdef void* c_self = self - * if evtype == 0 and not handle: - */ - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->_incref = 0; - - /* "gevent/core.pyx":162 - * self.arg = arg - * self._incref = 0 - * cdef void* c_self = self # <<<<<<<<<<<<<< - * if evtype == 0 and not handle: - * evtimer_set(&self.ev, __event_handler, c_self) - */ - __pyx_v_c_self = ((void *)__pyx_v_self); - - /* "gevent/core.pyx":163 - * self._incref = 0 - * cdef void* c_self = self - * if evtype == 0 and not handle: # <<<<<<<<<<<<<< - * evtimer_set(&self.ev, __event_handler, c_self) - * else: - */ - __pyx_t_1 = (__pyx_v_evtype == 0); - if (__pyx_t_1) { - __pyx_t_2 = (!__pyx_v_handle); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "gevent/core.pyx":164 - * cdef void* c_self = self - * if evtype == 0 and not handle: - * evtimer_set(&self.ev, __event_handler, c_self) # <<<<<<<<<<<<<< - * else: - * event_set(&self.ev, handle, evtype, __event_handler, c_self) - */ - evtimer_set((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), __pyx_f_6gevent_4core___event_handler, __pyx_v_c_self); - goto __pyx_L6; - } - /*else*/ { - - /* "gevent/core.pyx":166 - * evtimer_set(&self.ev, __event_handler, c_self) - * else: - * event_set(&self.ev, handle, evtype, __event_handler, c_self) # <<<<<<<<<<<<<< - * - * cdef _addref(self): - */ - event_set((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), __pyx_v_handle, __pyx_v_evtype, __pyx_f_6gevent_4core___event_handler, __pyx_v_c_self); - } - __pyx_L6:; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":168 - * event_set(&self.ev, handle, evtype, __event_handler, c_self) - * - * cdef _addref(self): # <<<<<<<<<<<<<< - * if self._incref <= 0: - * Py_INCREF(self) - */ - -static PyObject *__pyx_f_6gevent_4core_5event__addref(struct __pyx_obj_6gevent_4core_event *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("_addref"); - - /* "gevent/core.pyx":169 - * - * cdef _addref(self): - * if self._incref <= 0: # <<<<<<<<<<<<<< - * Py_INCREF(self) - * self._incref += 1 - */ - __pyx_t_1 = (__pyx_v_self->_incref <= 0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":170 - * cdef _addref(self): - * if self._incref <= 0: - * Py_INCREF(self) # <<<<<<<<<<<<<< - * self._incref += 1 - * - */ - Py_INCREF(((PyObject*)__pyx_v_self)); - - /* "gevent/core.pyx":171 - * if self._incref <= 0: - * Py_INCREF(self) - * self._incref += 1 # <<<<<<<<<<<<<< - * - * cdef _delref(self): - */ - __pyx_v_self->_incref = (__pyx_v_self->_incref + 1); - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":173 - * self._incref += 1 - * - * cdef _delref(self): # <<<<<<<<<<<<<< - * if self._incref > 0: - * Py_DECREF(self) - */ - -static PyObject *__pyx_f_6gevent_4core_5event__delref(struct __pyx_obj_6gevent_4core_event *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("_delref"); - - /* "gevent/core.pyx":174 - * - * cdef _delref(self): - * if self._incref > 0: # <<<<<<<<<<<<<< - * Py_DECREF(self) - * self._incref -= 1 - */ - __pyx_t_1 = (__pyx_v_self->_incref > 0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":175 - * cdef _delref(self): - * if self._incref > 0: - * Py_DECREF(self) # <<<<<<<<<<<<<< - * self._incref -= 1 - * - */ - Py_DECREF(((PyObject*)__pyx_v_self)); - - /* "gevent/core.pyx":176 - * if self._incref > 0: - * Py_DECREF(self) - * self._incref -= 1 # <<<<<<<<<<<<<< - * - * property pending: - */ - __pyx_v_self->_incref = (__pyx_v_self->_incref - 1); - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":181 - * """Return True if the event is still scheduled to run.""" - * - * def __get__(self): # <<<<<<<<<<<<<< - * return event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_7pending___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_7pending___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "gevent/core.pyx":182 - * - * def __get__(self): - * return event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL) # <<<<<<<<<<<<<< - * - * property fd: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(event_pending((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), (((EV_TIMEOUT | EV_SIGNAL) | EV_READ) | EV_WRITE), NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.event.pending.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":186 - * property fd: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self.ev.ev_fd - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_2fd___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_2fd___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "gevent/core.pyx":187 - * - * def __get__(self): - * return self.ev.ev_fd # <<<<<<<<<<<<<< - * - * property events: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev.ev_fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.event.fd.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":191 - * property events: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self.ev.ev_events - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_6events___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_6events___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "gevent/core.pyx":192 - * - * def __get__(self): - * return self.ev.ev_events # <<<<<<<<<<<<<< - * - * property events_str: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev.ev_events); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.event.events.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":196 - * property events_str: - * - * def __get__(self): # <<<<<<<<<<<<<< - * result = [] - * cdef int events = self.ev.ev_events - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_10events_str___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_10events_str___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_result; - int __pyx_v_events; - int __pyx_v_c_event; - PyObject *__pyx_v_event; - PyObject *__pyx_v_txt; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __Pyx_RefNannySetupContext("__get__"); - __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_event = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_txt = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":197 - * - * def __get__(self): - * result = [] # <<<<<<<<<<<<<< - * cdef int events = self.ev.ev_events - * cdef int c_event - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "gevent/core.pyx":198 - * def __get__(self): - * result = [] - * cdef int events = self.ev.ev_events # <<<<<<<<<<<<<< - * cdef int c_event - * for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), - */ - __pyx_v_events = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev.ev_events; - - /* "gevent/core.pyx":200 - * cdef int events = self.ev.ev_events - * cdef int c_event - * for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), # <<<<<<<<<<<<<< - * (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): - * c_event = event - */ - __pyx_t_1 = PyInt_FromLong(EV_TIMEOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__TIMEOUT)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__TIMEOUT)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TIMEOUT)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EV_READ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__READ)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__READ)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__READ)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EV_WRITE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__WRITE)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__WRITE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WRITE)); - __pyx_t_1 = 0; - - /* "gevent/core.pyx":201 - * cdef int c_event - * for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), - * (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): # <<<<<<<<<<<<<< - * c_event = event - * if events & c_event: - */ - __pyx_t_1 = PyInt_FromLong(EV_SIGNAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__SIGNAL)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__SIGNAL)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SIGNAL)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EV_PERSIST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__PERSIST)); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__PERSIST)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PERSIST)); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_2 = 0; __pyx_t_7 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - for (;;) { - - /* "gevent/core.pyx":200 - * cdef int events = self.ev.ev_events - * cdef int c_event - * for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), # <<<<<<<<<<<<<< - * (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): - * c_event = event - */ - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; - if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { - PyObject* tuple = __pyx_t_1; - __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_event); - __pyx_v_event = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_txt); - __pyx_v_txt = __pyx_t_5; - __pyx_t_5 = 0; - } else { - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_event); - __pyx_v_event = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_txt); - __pyx_v_txt = __pyx_t_5; - __pyx_t_5 = 0; - } - - /* "gevent/core.pyx":202 - * for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), - * (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): - * c_event = event # <<<<<<<<<<<<<< - * if events & c_event: - * result.append(txt) - */ - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_event); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c_event = __pyx_t_8; - - /* "gevent/core.pyx":203 - * (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): - * c_event = event - * if events & c_event: # <<<<<<<<<<<<<< - * result.append(txt) - * events = events & (~c_event) - */ - __pyx_t_8 = (__pyx_v_events & __pyx_v_c_event); - if (__pyx_t_8) { - - /* "gevent/core.pyx":204 - * c_event = event - * if events & c_event: - * result.append(txt) # <<<<<<<<<<<<<< - * events = events & (~c_event) - * if events: - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_v_txt); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":205 - * if events & c_event: - * result.append(txt) - * events = events & (~c_event) # <<<<<<<<<<<<<< - * if events: - * result.append(hex(events)) - */ - __pyx_v_events = (__pyx_v_events & (~__pyx_v_c_event)); - goto __pyx_L7; - } - __pyx_L7:; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "gevent/core.pyx":206 - * result.append(txt) - * events = events & (~c_event) - * if events: # <<<<<<<<<<<<<< - * result.append(hex(events)) - * return '|'.join(result) - */ - if (__pyx_v_events) { - - /* "gevent/core.pyx":207 - * events = events & (~c_event) - * if events: - * result.append(hex(events)) # <<<<<<<<<<<<<< - * return '|'.join(result) - * - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_hex, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "gevent/core.pyx":208 - * if events: - * result.append(hex(events)) - * return '|'.join(result) # <<<<<<<<<<<<<< - * - * property flags: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("gevent.core.event.events_str.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_result); - __Pyx_DECREF(__pyx_v_event); - __Pyx_DECREF(__pyx_v_txt); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":212 - * property flags: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self.ev.ev_flags - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_5flags___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_5flags___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "gevent/core.pyx":213 - * - * def __get__(self): - * return self.ev.ev_flags # <<<<<<<<<<<<<< - * - * property flags_str: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev.ev_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.event.flags.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":217 - * property flags_str: - * - * def __get__(self): # <<<<<<<<<<<<<< - * result = [] - * cdef int flags = self.ev.ev_flags - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_9flags_str___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_9flags_str___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_result; - int __pyx_v_flags; - int __pyx_v_c_flag; - PyObject *__pyx_v_flag; - PyObject *__pyx_v_txt; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - __Pyx_RefNannySetupContext("__get__"); - __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_flag = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_txt = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":218 - * - * def __get__(self): - * result = [] # <<<<<<<<<<<<<< - * cdef int flags = self.ev.ev_flags - * cdef int c_flag - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "gevent/core.pyx":219 - * def __get__(self): - * result = [] - * cdef int flags = self.ev.ev_flags # <<<<<<<<<<<<<< - * cdef int c_flag - * for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), - */ - __pyx_v_flags = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev.ev_flags; - - /* "gevent/core.pyx":221 - * cdef int flags = self.ev.ev_flags - * cdef int c_flag - * for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), # <<<<<<<<<<<<<< - * (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): - * c_flag = flag - */ - __pyx_t_1 = PyInt_FromLong(EVLIST_TIMEOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__TIMEOUT)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__TIMEOUT)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TIMEOUT)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EVLIST_INSERTED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__INSERTED)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__INSERTED)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INSERTED)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EVLIST_SIGNAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__SIGNAL)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__SIGNAL)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SIGNAL)); - __pyx_t_1 = 0; - - /* "gevent/core.pyx":222 - * cdef int c_flag - * for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), - * (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): # <<<<<<<<<<<<<< - * c_flag = flag - * if flags & c_flag: - */ - __pyx_t_1 = PyInt_FromLong(EVLIST_ACTIVE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__ACTIVE)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__ACTIVE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ACTIVE)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EVLIST_INTERNAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__INTERNAL)); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__INTERNAL)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INTERNAL)); - __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(EVLIST_INIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__INIT)); - PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_n_s__INIT)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INIT)); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_2 = 0; __pyx_t_8 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - for (;;) { - - /* "gevent/core.pyx":221 - * cdef int flags = self.ev.ev_flags - * cdef int c_flag - * for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), # <<<<<<<<<<<<<< - * (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): - * c_flag = flag - */ - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; - if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { - PyObject* tuple = __pyx_t_1; - __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_flag); - __pyx_v_flag = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_txt); - __pyx_v_txt = __pyx_t_6; - __pyx_t_6 = 0; - } else { - __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_flag); - __pyx_v_flag = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_txt); - __pyx_v_txt = __pyx_t_6; - __pyx_t_6 = 0; - } - - /* "gevent/core.pyx":223 - * for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), - * (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): - * c_flag = flag # <<<<<<<<<<<<<< - * if flags & c_flag: - * result.append(txt) - */ - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_flag); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c_flag = __pyx_t_9; - - /* "gevent/core.pyx":224 - * (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): - * c_flag = flag - * if flags & c_flag: # <<<<<<<<<<<<<< - * result.append(txt) - * flags = flags & (~c_flag) - */ - __pyx_t_9 = (__pyx_v_flags & __pyx_v_c_flag); - if (__pyx_t_9) { - - /* "gevent/core.pyx":225 - * c_flag = flag - * if flags & c_flag: - * result.append(txt) # <<<<<<<<<<<<<< - * flags = flags & (~c_flag) - * if flags: - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = PyList_Append(__pyx_v_result, __pyx_v_txt); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":226 - * if flags & c_flag: - * result.append(txt) - * flags = flags & (~c_flag) # <<<<<<<<<<<<<< - * if flags: - * result.append(hex(flags)) - */ - __pyx_v_flags = (__pyx_v_flags & (~__pyx_v_c_flag)); - goto __pyx_L7; - } - __pyx_L7:; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "gevent/core.pyx":227 - * result.append(txt) - * flags = flags & (~c_flag) - * if flags: # <<<<<<<<<<<<<< - * result.append(hex(flags)) - * return '|'.join(result) - */ - if (__pyx_v_flags) { - - /* "gevent/core.pyx":228 - * flags = flags & (~c_flag) - * if flags: - * result.append(hex(flags)) # <<<<<<<<<<<<<< - * return '|'.join(result) - * - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_hex, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_9 = PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "gevent/core.pyx":229 - * if flags: - * result.append(hex(flags)) - * return '|'.join(result) # <<<<<<<<<<<<<< - * - * def add(self, timeout=None): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("gevent.core.event.flags_str.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_result); - __Pyx_DECREF(__pyx_v_flag); - __Pyx_DECREF(__pyx_v_txt); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":231 - * return '|'.join(result) - * - * def add(self, timeout=None): # <<<<<<<<<<<<<< - * """Add event to be executed after an optional *timeout* - number of seconds - * after which the event will be executed.""" - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_1add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_5event_1add[] = "Add event to be executed after an optional *timeout* - number of seconds\n after which the event will be executed."; -static PyObject *__pyx_pf_6gevent_4core_5event_1add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_timeout = 0; - struct timeval __pyx_v_tv; - double __pyx_v_c_timeout; - int __pyx_v_result; - PyObject *__pyx_v_warnings; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - double __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__timeout,0}; - __Pyx_RefNannySetupContext("add"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_timeout = values[0]; - } else { - __pyx_v_timeout = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.event.add"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_warnings = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":237 - * cdef double c_timeout - * cdef int result - * if timeout is None: # <<<<<<<<<<<<<< - * result = event_add(&self.ev, NULL) - * else: - */ - __pyx_t_1 = (__pyx_v_timeout == Py_None); - if (__pyx_t_1) { - - /* "gevent/core.pyx":238 - * cdef int result - * if timeout is None: - * result = event_add(&self.ev, NULL) # <<<<<<<<<<<<<< - * else: - * c_timeout = timeout - */ - __pyx_v_result = event_add((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), NULL); - goto __pyx_L6; - } - /*else*/ { - - /* "gevent/core.pyx":240 - * result = event_add(&self.ev, NULL) - * else: - * c_timeout = timeout # <<<<<<<<<<<<<< - * if c_timeout < 0.0: - * #raise ValueError('Expected a non-negative number or None: %r' % (timeout, )) - */ - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_timeout); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c_timeout = __pyx_t_2; - - /* "gevent/core.pyx":241 - * else: - * c_timeout = timeout - * if c_timeout < 0.0: # <<<<<<<<<<<<<< - * #raise ValueError('Expected a non-negative number or None: %r' % (timeout, )) - * import warnings - */ - __pyx_t_1 = (__pyx_v_c_timeout < 0.0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":243 - * if c_timeout < 0.0: - * #raise ValueError('Expected a non-negative number or None: %r' % (timeout, )) - * import warnings # <<<<<<<<<<<<<< - * warnings.warn('Negative timeouts are deprecated. Use None to disable timeout.', DeprecationWarning, stacklevel=2) - * result = event_add(&self.ev, NULL) - */ - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_warnings); - __pyx_v_warnings = __pyx_t_3; - __pyx_t_3 = 0; - - /* "gevent/core.pyx":244 - * #raise ValueError('Expected a non-negative number or None: %r' % (timeout, )) - * import warnings - * warnings.warn('Negative timeouts are deprecated. Use None to disable timeout.', DeprecationWarning, stacklevel=2) # <<<<<<<<<<<<<< - * result = event_add(&self.ev, NULL) - * else: - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_warnings, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __Pyx_INCREF(__pyx_builtin_DeprecationWarning); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_builtin_DeprecationWarning); - __Pyx_GIVEREF(__pyx_builtin_DeprecationWarning); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__stacklevel), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "gevent/core.pyx":245 - * import warnings - * warnings.warn('Negative timeouts are deprecated. Use None to disable timeout.', DeprecationWarning, stacklevel=2) - * result = event_add(&self.ev, NULL) # <<<<<<<<<<<<<< - * else: - * tv.tv_sec = c_timeout - */ - __pyx_v_result = event_add((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), NULL); - goto __pyx_L7; - } - /*else*/ { - - /* "gevent/core.pyx":247 - * result = event_add(&self.ev, NULL) - * else: - * tv.tv_sec = c_timeout # <<<<<<<<<<<<<< - * tv.tv_usec = ((c_timeout - tv.tv_sec) * 1000000.0) - * result = event_add(&self.ev, &tv) - */ - __pyx_v_tv.tv_sec = ((long)__pyx_v_c_timeout); - - /* "gevent/core.pyx":248 - * else: - * tv.tv_sec = c_timeout - * tv.tv_usec = ((c_timeout - tv.tv_sec) * 1000000.0) # <<<<<<<<<<<<<< - * result = event_add(&self.ev, &tv) - * if result < 0: - */ - __pyx_v_tv.tv_usec = ((unsigned int)((__pyx_v_c_timeout - ((double)__pyx_v_tv.tv_sec)) * 1000000.0)); - - /* "gevent/core.pyx":249 - * tv.tv_sec = c_timeout - * tv.tv_usec = ((c_timeout - tv.tv_sec) * 1000000.0) - * result = event_add(&self.ev, &tv) # <<<<<<<<<<<<<< - * if result < 0: - * if errno: - */ - __pyx_v_result = event_add((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), (&__pyx_v_tv)); - } - __pyx_L7:; - } - __pyx_L6:; - - /* "gevent/core.pyx":250 - * tv.tv_usec = ((c_timeout - tv.tv_sec) * 1000000.0) - * result = event_add(&self.ev, &tv) - * if result < 0: # <<<<<<<<<<<<<< - * if errno: - * raise IOError(errno, strerror(errno)) - */ - __pyx_t_1 = (__pyx_v_result < 0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":251 - * result = event_add(&self.ev, &tv) - * if result < 0: - * if errno: # <<<<<<<<<<<<<< - * raise IOError(errno, strerror(errno)) - * else: - */ - if (errno) { - - /* "gevent/core.pyx":252 - * if result < 0: - * if errno: - * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<< - * else: - * raise IOError("event_add(fileno=%s) returned %s" % (self.fd, result)) - */ - __pyx_t_6 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; - } - /*else*/ { - - /* "gevent/core.pyx":254 - * raise IOError(errno, strerror(errno)) - * else: - * raise IOError("event_add(fileno=%s) returned %s" % (self.fd, result)) # <<<<<<<<<<<<<< - * self._addref() - * - */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L9:; - goto __pyx_L8; - } - __pyx_L8:; - - /* "gevent/core.pyx":255 - * else: - * raise IOError("event_add(fileno=%s) returned %s" % (self.fd, result)) - * self._addref() # <<<<<<<<<<<<<< - * - * def cancel(self): - */ - __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_4core_event *)((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->__pyx_vtab)->_addref(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.event.add"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_warnings); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":257 - * self._addref() - * - * def cancel(self): # <<<<<<<<<<<<<< - * """Remove event from the event queue.""" - * cdef int result - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_2cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_5event_2cancel[] = "Remove event from the event queue."; -static PyObject *__pyx_pf_6gevent_4core_5event_2cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - int __pyx_v_result; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("cancel"); - - /* "gevent/core.pyx":260 - * """Remove event from the event queue.""" - * cdef int result - * if event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL): # <<<<<<<<<<<<<< - * result = event_del(&self.ev) - * if result < 0: - */ - __pyx_t_1 = event_pending((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev), (((EV_TIMEOUT | EV_SIGNAL) | EV_READ) | EV_WRITE), NULL); - if (__pyx_t_1) { - - /* "gevent/core.pyx":261 - * cdef int result - * if event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL): - * result = event_del(&self.ev) # <<<<<<<<<<<<<< - * if result < 0: - * return result - */ - __pyx_v_result = event_del((&((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->ev)); - - /* "gevent/core.pyx":262 - * if event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL): - * result = event_del(&self.ev) - * if result < 0: # <<<<<<<<<<<<<< - * return result - * self._delref() - */ - __pyx_t_2 = (__pyx_v_result < 0); - if (__pyx_t_2) { - - /* "gevent/core.pyx":263 - * result = event_del(&self.ev) - * if result < 0: - * return result # <<<<<<<<<<<<<< - * self._delref() - * return result - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "gevent/core.pyx":264 - * if result < 0: - * return result - * self._delref() # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_4core_event *)((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->__pyx_vtab)->_delref(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "gevent/core.pyx":265 - * return result - * self._delref() - * return result # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.event.cancel"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":267 - * return result - * - * def __repr__(self): # <<<<<<<<<<<<<< - * if self.pending: - * pending = ' pending' - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_3__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_3__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_pending; - PyObject *__pyx_v_events_str; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("__repr__"); - __pyx_v_pending = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_events_str = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":268 - * - * def __repr__(self): - * if self.pending: # <<<<<<<<<<<<<< - * pending = ' pending' - * else: - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pending); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "gevent/core.pyx":269 - * def __repr__(self): - * if self.pending: - * pending = ' pending' # <<<<<<<<<<<<<< - * else: - * pending = '' - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); - __Pyx_DECREF(__pyx_v_pending); - __pyx_v_pending = ((PyObject *)__pyx_kp_s_5); - goto __pyx_L5; - } - /*else*/ { - - /* "gevent/core.pyx":271 - * pending = ' pending' - * else: - * pending = '' # <<<<<<<<<<<<<< - * if self.events_str: - * events_str = ' %s' % self.events_str - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_pending); - __pyx_v_pending = ((PyObject *)__pyx_kp_s_6); - } - __pyx_L5:; - - /* "gevent/core.pyx":272 - * else: - * pending = '' - * if self.events_str: # <<<<<<<<<<<<<< - * events_str = ' %s' % self.events_str - * else: - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__events_str); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "gevent/core.pyx":273 - * pending = '' - * if self.events_str: - * events_str = ' %s' % self.events_str # <<<<<<<<<<<<<< - * else: - * events_str = '' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__events_str); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_events_str); - __pyx_v_events_str = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "gevent/core.pyx":275 - * events_str = ' %s' % self.events_str - * else: - * events_str = '' # <<<<<<<<<<<<<< - * return '<%s at %s%s fd=%s%s flags=%s cb=%s arg=%s>' % \ - * (type(self).__name__, hex(id(self)), pending, self.fd, events_str, self.flags_str, self.callback, self.arg) - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_events_str); - __pyx_v_events_str = ((PyObject *)__pyx_kp_s_6); - } - __pyx_L6:; - - /* "gevent/core.pyx":276 - * else: - * events_str = '' - * return '<%s at %s%s fd=%s%s flags=%s cb=%s arg=%s>' % \ # <<<<<<<<<<<<<< - * (type(self).__name__, hex(id(self)), pending, self.fd, events_str, self.flags_str, self.callback, self.arg) - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "gevent/core.pyx":277 - * events_str = '' - * return '<%s at %s%s fd=%s%s flags=%s cb=%s arg=%s>' % \ - * (type(self).__name__, hex(id(self)), pending, self.fd, events_str, self.flags_str, self.callback, self.arg) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s____name__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - __pyx_t_4 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_hex, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flags_str); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_pending); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_pending); - __Pyx_GIVEREF(__pyx_v_pending); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_events_str); - PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_events_str); - __Pyx_GIVEREF(__pyx_v_events_str); - PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - PyTuple_SET_ITEM(__pyx_t_6, 6, ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_GIVEREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - PyTuple_SET_ITEM(__pyx_t_6, 7, ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __Pyx_GIVEREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.event.__repr__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_pending); - __Pyx_DECREF(__pyx_v_events_str); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":279 - * (type(self).__name__, hex(id(self)), pending, self.fd, events_str, self.flags_str, self.callback, self.arg) - * - * def __str__(self): # <<<<<<<<<<<<<< - * if self.pending: - * pending = ' pending' - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_4__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_4__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_pending; - PyObject *__pyx_v_events_str; - PyObject *__pyx_v_cb; - PyObject *__pyx_v_arg; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("__str__"); - __pyx_v_pending = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_events_str = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_cb = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_arg = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":280 - * - * def __str__(self): - * if self.pending: # <<<<<<<<<<<<<< - * pending = ' pending' - * else: - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pending); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "gevent/core.pyx":281 - * def __str__(self): - * if self.pending: - * pending = ' pending' # <<<<<<<<<<<<<< - * else: - * pending = '' - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); - __Pyx_DECREF(__pyx_v_pending); - __pyx_v_pending = ((PyObject *)__pyx_kp_s_5); - goto __pyx_L5; - } - /*else*/ { - - /* "gevent/core.pyx":283 - * pending = ' pending' - * else: - * pending = '' # <<<<<<<<<<<<<< - * if self.events_str: - * events_str = ' %s' % self.events_str - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_pending); - __pyx_v_pending = ((PyObject *)__pyx_kp_s_6); - } - __pyx_L5:; - - /* "gevent/core.pyx":284 - * else: - * pending = '' - * if self.events_str: # <<<<<<<<<<<<<< - * events_str = ' %s' % self.events_str - * else: - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__events_str); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "gevent/core.pyx":285 - * pending = '' - * if self.events_str: - * events_str = ' %s' % self.events_str # <<<<<<<<<<<<<< - * else: - * events_str = '' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__events_str); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_events_str); - __pyx_v_events_str = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "gevent/core.pyx":287 - * events_str = ' %s' % self.events_str - * else: - * events_str = '' # <<<<<<<<<<<<<< - * cb = str(self.callback).replace('\n', '\n' + ' ' * 8) - * arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_events_str); - __pyx_v_events_str = ((PyObject *)__pyx_kp_s_6); - } - __pyx_L6:; - - /* "gevent/core.pyx":288 - * else: - * events_str = '' - * cb = str(self.callback).replace('\n', '\n' + ' ' * 8) # <<<<<<<<<<<<<< - * arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) - * return '%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s' % \ - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_GIVEREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__replace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_10), __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_cb); - __pyx_v_cb = __pyx_t_4; - __pyx_t_4 = 0; - - /* "gevent/core.pyx":289 - * events_str = '' - * cb = str(self.callback).replace('\n', '\n' + ' ' * 8) - * arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) # <<<<<<<<<<<<<< - * return '%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s' % \ - * (type(self).__name__, pending, self.fd, events_str, self.flags_str, cb, arg) - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__pformat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __Pyx_GIVEREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__indent), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__replace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_10), __pyx_int_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_arg); - __pyx_v_arg = __pyx_t_1; - __pyx_t_1 = 0; - - /* "gevent/core.pyx":290 - * cb = str(self.callback).replace('\n', '\n' + ' ' * 8) - * arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) - * return '%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s' % \ # <<<<<<<<<<<<<< - * (type(self).__name__, pending, self.fd, events_str, self.flags_str, cb, arg) - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "gevent/core.pyx":291 - * arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) - * return '%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s' % \ - * (type(self).__name__, pending, self.fd, events_str, self.flags_str, cb, arg) # <<<<<<<<<<<<<< - * - * def __enter__(self): - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flags_str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_pending); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_pending); - __Pyx_GIVEREF(__pyx_v_pending); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_events_str); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_events_str); - __Pyx_GIVEREF(__pyx_v_events_str); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_cb); - PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_cb); - __Pyx_GIVEREF(__pyx_v_cb); - __Pyx_INCREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("gevent.core.event.__str__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_pending); - __Pyx_DECREF(__pyx_v_events_str); - __Pyx_DECREF(__pyx_v_cb); - __Pyx_DECREF(__pyx_v_arg); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":293 - * (type(self).__name__, pending, self.fd, events_str, self.flags_str, cb, arg) - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_5__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_5__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__enter__"); - - /* "gevent/core.pyx":294 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< - * - * def __exit__(self, *exit_args): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":296 - * return self - * - * def __exit__(self, *exit_args): # <<<<<<<<<<<<<< - * self.cancel() - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_6__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_6__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_exit_args = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__exit__"); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_exit_args = __pyx_args; - - /* "gevent/core.pyx":297 - * - * def __exit__(self, *exit_args): - * self.cancel() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cancel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.event.__exit__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_exit_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":154 - * """ - * cdef event_t ev - * cdef public object callback # <<<<<<<<<<<<<< - * cdef public object arg - * cdef int _incref # 1 if we already INCREFed this object once (because libevent references it) - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_8callback___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_8callback___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __pyx_r = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_5event_8callback_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_5event_8callback_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_5event_8callback_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_5event_8callback_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->callback = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":155 - * cdef event_t ev - * cdef public object callback - * cdef public object arg # <<<<<<<<<<<<<< - * cdef int _incref # 1 if we already INCREFed this object once (because libevent references it) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_5event_3arg___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_5event_3arg___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __pyx_r = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_5event_3arg_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_5event_3arg_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_5event_3arg_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_5event_3arg_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg); - ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)->arg = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":303 - * """Create a new scheduled event with evtype=EV_READ""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_READ - * if persist: - */ - -static int __pyx_pf_6gevent_4core_10read_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_10read_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_handle; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_timeout = 0; - PyObject *__pyx_v_arg = 0; - PyObject *__pyx_v_persist = 0; - short __pyx_v_evtype; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s__callback,&__pyx_n_s__timeout,&__pyx_n_s__arg,&__pyx_n_s__persist,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); - values[4] = __pyx_k_12; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__persist); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_handle = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[1]; - __pyx_v_timeout = values[2]; - __pyx_v_arg = values[3]; - __pyx_v_persist = values[4]; - } else { - __pyx_v_timeout = ((PyObject *)Py_None); - __pyx_v_arg = ((PyObject *)Py_None); - __pyx_v_persist = __pyx_k_12; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_persist = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_arg = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_handle = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.read_event.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":304 - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_READ # <<<<<<<<<<<<<< - * if persist: - * evtype = evtype | EV_PERSIST - */ - __pyx_v_evtype = EV_READ; - - /* "gevent/core.pyx":305 - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_READ - * if persist: # <<<<<<<<<<<<<< - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_persist); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - - /* "gevent/core.pyx":306 - * cdef short evtype = EV_READ - * if persist: - * evtype = evtype | EV_PERSIST # <<<<<<<<<<<<<< - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) - */ - __pyx_v_evtype = (__pyx_v_evtype | EV_PERSIST); - goto __pyx_L6; - } - __pyx_L6:; - - /* "gevent/core.pyx":307 - * if persist: - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) # <<<<<<<<<<<<<< - * self.add(timeout) - * - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_evtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_handle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_callback); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_INCREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "gevent/core.pyx":308 - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_timeout); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_timeout); - __Pyx_GIVEREF(__pyx_v_timeout); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("gevent.core.read_event.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":314 - * """Create a new scheduled event with evtype=EV_WRITE""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_WRITE - * if persist: - */ - -static int __pyx_pf_6gevent_4core_11write_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_11write_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_handle; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_timeout = 0; - PyObject *__pyx_v_arg = 0; - PyObject *__pyx_v_persist = 0; - short __pyx_v_evtype; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s__callback,&__pyx_n_s__timeout,&__pyx_n_s__arg,&__pyx_n_s__persist,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); - values[4] = __pyx_k_13; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__persist); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_handle = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[1]; - __pyx_v_timeout = values[2]; - __pyx_v_arg = values[3]; - __pyx_v_persist = values[4]; - } else { - __pyx_v_timeout = ((PyObject *)Py_None); - __pyx_v_arg = ((PyObject *)Py_None); - __pyx_v_persist = __pyx_k_13; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_persist = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_arg = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_handle = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.write_event.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":315 - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_WRITE # <<<<<<<<<<<<<< - * if persist: - * evtype = evtype | EV_PERSIST - */ - __pyx_v_evtype = EV_WRITE; - - /* "gevent/core.pyx":316 - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_WRITE - * if persist: # <<<<<<<<<<<<<< - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_persist); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - - /* "gevent/core.pyx":317 - * cdef short evtype = EV_WRITE - * if persist: - * evtype = evtype | EV_PERSIST # <<<<<<<<<<<<<< - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) - */ - __pyx_v_evtype = (__pyx_v_evtype | EV_PERSIST); - goto __pyx_L6; - } - __pyx_L6:; - - /* "gevent/core.pyx":318 - * if persist: - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) # <<<<<<<<<<<<<< - * self.add(timeout) - * - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_evtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_handle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_callback); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_INCREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "gevent/core.pyx":319 - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_timeout); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_timeout); - __Pyx_GIVEREF(__pyx_v_timeout); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("gevent.core.write_event.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":325 - * """Create a new scheduled event with evtype=EV_READ|EV_WRITE""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_READ|EV_WRITE - * if persist: - */ - -static PyObject *__pyx_pf_6gevent_4core_15readwrite_event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6gevent_4core_15readwrite_event___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_6gevent_4core_15readwrite_event___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6gevent_4core_15readwrite_event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - int __pyx_v_handle; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_timeout = 0; - PyObject *__pyx_v_arg = 0; - PyObject *__pyx_v_persist = 0; - short __pyx_v_evtype; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__handle,&__pyx_n_s__callback,&__pyx_n_s__timeout,&__pyx_n_s__arg,&__pyx_n_s__persist,0}; - __Pyx_RefNannySetupContext("__init__"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[6] = {0,0,0,0,0,0}; - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)Py_None); - values[5] = __pyx_k_14; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__persist); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_self = values[0]; - __pyx_v_handle = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - __pyx_v_timeout = values[3]; - __pyx_v_arg = values[4]; - __pyx_v_persist = values[5]; - } else { - __pyx_v_timeout = ((PyObject *)Py_None); - __pyx_v_arg = ((PyObject *)Py_None); - __pyx_v_persist = __pyx_k_14; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_persist = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: - __pyx_v_arg = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - __pyx_v_handle = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_handle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.readwrite_event.__init__"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":326 - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_READ|EV_WRITE # <<<<<<<<<<<<<< - * if persist: - * evtype = evtype | EV_PERSIST - */ - __pyx_v_evtype = (EV_READ | EV_WRITE); - - /* "gevent/core.pyx":327 - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - * cdef short evtype = EV_READ|EV_WRITE - * if persist: # <<<<<<<<<<<<<< - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_persist); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - - /* "gevent/core.pyx":328 - * cdef short evtype = EV_READ|EV_WRITE - * if persist: - * evtype = evtype | EV_PERSIST # <<<<<<<<<<<<<< - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) - */ - __pyx_v_evtype = (__pyx_v_evtype | EV_PERSIST); - goto __pyx_L6; - } - __pyx_L6:; - - /* "gevent/core.pyx":329 - * if persist: - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) # <<<<<<<<<<<<<< - * self.add(timeout) - * - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_evtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_handle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_callback); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_INCREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "gevent/core.pyx":330 - * evtype = evtype | EV_PERSIST - * event.__init__(self, evtype, handle, callback, arg) - * self.add(timeout) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_timeout); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_timeout); - __Pyx_GIVEREF(__pyx_v_timeout); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("gevent.core.readwrite_event.__init__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":333 - * - * - * cdef void __simple_handler(int fd, short evtype, void *arg) with gil: # <<<<<<<<<<<<<< - * cdef event self = arg - * try: - */ - -static void __pyx_f_6gevent_4core___simple_handler(int __pyx_v_fd, short __pyx_v_evtype, void *__pyx_v_arg) { - struct __pyx_obj_6gevent_4core_event *__pyx_v_self = 0; - PyObject *__pyx_v_args; - PyObject *__pyx_v_kwargs; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__simple_handler"); - __pyx_v_args = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_kwargs = Py_None; __Pyx_INCREF(Py_None); - - /* "gevent/core.pyx":334 - * - * cdef void __simple_handler(int fd, short evtype, void *arg) with gil: - * cdef event self = arg # <<<<<<<<<<<<<< - * try: - * args, kwargs = self.arg - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6gevent_4core_event *)__pyx_v_arg))); - __pyx_v_self = ((struct __pyx_obj_6gevent_4core_event *)__pyx_v_arg); - - /* "gevent/core.pyx":335 - * cdef void __simple_handler(int fd, short evtype, void *arg) with gil: - * cdef event self = arg - * try: # <<<<<<<<<<<<<< - * args, kwargs = self.arg - * self.callback(*args, **kwargs) - */ - /*try:*/ { - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "gevent/core.pyx":336 - * cdef event self = arg - * try: - * args, kwargs = self.arg # <<<<<<<<<<<<<< - * self.callback(*args, **kwargs) - * except: - */ - if (PyTuple_CheckExact(__pyx_v_self->arg) && likely(PyTuple_GET_SIZE(__pyx_v_self->arg) == 2)) { - PyObject* tuple = __pyx_v_self->arg; - __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_args); - __pyx_v_args = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_kwargs); - __pyx_v_kwargs = __pyx_t_2; - __pyx_t_2 = 0; - } else { - __pyx_t_3 = PyObject_GetIter(__pyx_v_self->arg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_3, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_EndUnpack(__pyx_t_3, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_args); - __pyx_v_args = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_kwargs); - __pyx_v_kwargs = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "gevent/core.pyx":337 - * try: - * args, kwargs = self.arg - * self.callback(*args, **kwargs) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_PyEval_CallObjectWithKeywords(__pyx_v_self->callback, ((PyObject *)__pyx_t_2), __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":338 - * args, kwargs = self.arg - * self.callback(*args, **kwargs) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * try: - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.__simple_handler"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - - /* "gevent/core.pyx":339 - * self.callback(*args, **kwargs) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "gevent/core.pyx":340 - * except: - * traceback.print_exc() - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "gevent/core.pyx":341 - * traceback.print_exc() - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__stderr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L23_try_end; - __pyx_L16_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "gevent/core.pyx":342 - * try: - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * sys.exc_clear() - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.__simple_handler"); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - - /* "gevent/core.pyx":343 - * sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * sys.exc_clear() - * finally: - */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L17_exception_handled; - } - __pyx_L18_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L8_except_error; - __pyx_L17_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L23_try_end:; - } - - /* "gevent/core.pyx":344 - * except: - * traceback.print_exc() - * sys.exc_clear() # <<<<<<<<<<<<<< - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exc_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_exception_handled; - } - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L4; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L13_try_end:; - } - } - - /* "gevent/core.pyx":346 - * sys.exc_clear() - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): # <<<<<<<<<<<<<< - * self._delref() - * - */ - /*finally:*/ { - int __pyx_why; - PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; - int __pyx_exc_lineno; - __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; - __pyx_why = 0; goto __pyx_L5; - __pyx_L4: { - __pyx_why = 4; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); - __pyx_exc_lineno = __pyx_lineno; - goto __pyx_L5; - } - __pyx_L5:; - __pyx_t_9 = (!event_pending((&__pyx_v_self->ev), (((EV_READ | EV_WRITE) | EV_SIGNAL) | EV_TIMEOUT), NULL)); - if (__pyx_t_9) { - - /* "gevent/core.pyx":347 - * finally: - * if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - * self._delref() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_4core_event *)__pyx_v_self->__pyx_vtab)->_delref(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L26_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L27; - } - __pyx_L27:; - goto __pyx_L28; - __pyx_L26_error:; - if (__pyx_why == 4) { - Py_XDECREF(__pyx_exc_type); - Py_XDECREF(__pyx_exc_value); - Py_XDECREF(__pyx_exc_tb); - } - goto __pyx_L1_error; - __pyx_L28:; - switch (__pyx_why) { - case 4: { - __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); - __pyx_lineno = __pyx_exc_lineno; - __pyx_exc_type = 0; - __pyx_exc_value = 0; - __pyx_exc_tb = 0; - goto __pyx_L1_error; - } - } - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_WriteUnraisable("gevent.core.__simple_handler"); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_self); - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "gevent/core.pyx":353 - * """Create a new scheduled timer""" - * - * def __init__(self, float seconds, callback, *args, **kwargs): # <<<<<<<<<<<<<< - * self.callback = callback - * self.arg = (args, kwargs) - */ - -static int __pyx_pf_6gevent_4core_5timer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_5timer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - float __pyx_v_seconds; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seconds,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("__init__"); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 2) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args); - - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); - return -1; - } - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - default: - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seconds); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_seconds = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_seconds == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_seconds = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_seconds == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_AddTraceback("gevent.core.timer.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":354 - * - * def __init__(self, float seconds, callback, *args, **kwargs): - * self.callback = callback # <<<<<<<<<<<<<< - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) - */ - __Pyx_INCREF(__pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.callback); - ((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.callback = __pyx_v_callback; - - /* "gevent/core.pyx":355 - * def __init__(self, float seconds, callback, *args, **kwargs): - * self.callback = callback - * self.arg = (args, kwargs) # <<<<<<<<<<<<<< - * evtimer_set(&self.ev, __simple_handler, self) - * self.add(seconds) - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_args)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_args)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); - __Pyx_INCREF(((PyObject *)__pyx_v_kwargs)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.arg); - ((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.arg = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "gevent/core.pyx":356 - * self.callback = callback - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) # <<<<<<<<<<<<<< - * self.add(seconds) - * - */ - evtimer_set((&((struct __pyx_obj_6gevent_4core_timer *)__pyx_v_self)->__pyx_base.ev), __pyx_f_6gevent_4core___simple_handler, ((void *)__pyx_v_self)); - - /* "gevent/core.pyx":357 - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) - * self.add(seconds) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_seconds); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.timer.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":363 - * """Create a new persistent signal event""" - * - * def __init__(self, int signalnum, callback, *args, **kwargs): # <<<<<<<<<<<<<< - * self.callback = callback - * self.arg = (args, kwargs) - */ - -static int __pyx_pf_6gevent_4core_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_signalnum; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signalnum,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("__init__"); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 2) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args); - - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); - return -1; - } - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - default: - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__signalnum); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_signalnum = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_signalnum == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_signalnum = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_signalnum == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_AddTraceback("gevent.core.signal.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":364 - * - * def __init__(self, int signalnum, callback, *args, **kwargs): - * self.callback = callback # <<<<<<<<<<<<<< - * self.arg = (args, kwargs) - * event_set(&self.ev, signalnum, EV_SIGNAL|EV_PERSIST, __simple_handler, self) - */ - __Pyx_INCREF(__pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.callback); - ((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.callback = __pyx_v_callback; - - /* "gevent/core.pyx":365 - * def __init__(self, int signalnum, callback, *args, **kwargs): - * self.callback = callback - * self.arg = (args, kwargs) # <<<<<<<<<<<<<< - * event_set(&self.ev, signalnum, EV_SIGNAL|EV_PERSIST, __simple_handler, self) - * self.add() - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_args)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_args)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); - __Pyx_INCREF(((PyObject *)__pyx_v_kwargs)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.arg); - ((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.arg = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "gevent/core.pyx":366 - * self.callback = callback - * self.arg = (args, kwargs) - * event_set(&self.ev, signalnum, EV_SIGNAL|EV_PERSIST, __simple_handler, self) # <<<<<<<<<<<<<< - * self.add() - * - */ - event_set((&((struct __pyx_obj_6gevent_4core_signal *)__pyx_v_self)->__pyx_base.ev), __pyx_v_signalnum, (EV_SIGNAL | EV_PERSIST), __pyx_f_6gevent_4core___simple_handler, ((void *)__pyx_v_self)); - - /* "gevent/core.pyx":367 - * self.arg = (args, kwargs) - * event_set(&self.ev, signalnum, EV_SIGNAL|EV_PERSIST, __simple_handler, self) - * self.add() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.signal.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":373 - * """An event that is scheduled to run in the current loop iteration""" - * - * def __init__(self, callback, *args, **kwargs): # <<<<<<<<<<<<<< - * self.callback = callback - * self.arg = (args, kwargs) - */ - -static int __pyx_pf_6gevent_4core_12active_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_12active_event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("__init__"); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args); - - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); - return -1; - } - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_callback = values[0]; - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 0); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_AddTraceback("gevent.core.active_event.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":374 - * - * def __init__(self, callback, *args, **kwargs): - * self.callback = callback # <<<<<<<<<<<<<< - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) - */ - __Pyx_INCREF(__pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.callback); - ((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.callback = __pyx_v_callback; - - /* "gevent/core.pyx":375 - * def __init__(self, callback, *args, **kwargs): - * self.callback = callback - * self.arg = (args, kwargs) # <<<<<<<<<<<<<< - * evtimer_set(&self.ev, __simple_handler, self) - * self._addref() - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_args)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_args)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); - __Pyx_INCREF(((PyObject *)__pyx_v_kwargs)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.arg); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.arg); - ((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.arg = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "gevent/core.pyx":376 - * self.callback = callback - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) # <<<<<<<<<<<<<< - * self._addref() - * event_active(&self.ev, EV_TIMEOUT, 1) - */ - evtimer_set((&((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.ev), __pyx_f_6gevent_4core___simple_handler, ((void *)__pyx_v_self)); - - /* "gevent/core.pyx":377 - * self.arg = (args, kwargs) - * evtimer_set(&self.ev, __simple_handler, self) - * self._addref() # <<<<<<<<<<<<<< - * event_active(&self.ev, EV_TIMEOUT, 1) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_4core_active_event *)((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._addref(((struct __pyx_obj_6gevent_4core_event *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":378 - * evtimer_set(&self.ev, __simple_handler, self) - * self._addref() - * event_active(&self.ev, EV_TIMEOUT, 1) # <<<<<<<<<<<<<< - * - * def add(self, timeout=None): - */ - event_active((&((struct __pyx_obj_6gevent_4core_active_event *)__pyx_v_self)->__pyx_base.ev), EV_TIMEOUT, 1); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.active_event.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":380 - * event_active(&self.ev, EV_TIMEOUT, 1) - * - * def add(self, timeout=None): # <<<<<<<<<<<<<< - * raise NotImplementedError - * - */ - -static PyObject *__pyx_pf_6gevent_4core_12active_event_1add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12active_event_1add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_timeout = 0; - PyObject *__pyx_r = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__timeout,0}; - __Pyx_RefNannySetupContext("add"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_timeout = values[0]; - } else { - __pyx_v_timeout = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.active_event.add"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":381 - * - * def add(self, timeout=None): - * raise NotImplementedError # <<<<<<<<<<<<<< - * - * - */ - __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("gevent.core.active_event.add"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":384 - * - * - * def init(): # <<<<<<<<<<<<<< - * """Initialize event queue.""" - * event_init() - */ - -static PyObject *__pyx_pf_6gevent_4core_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_init[] = "Initialize event queue."; -static PyMethodDef __pyx_mdef_6gevent_4core_init = {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_6gevent_4core_init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_init)}; -static PyObject *__pyx_pf_6gevent_4core_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("init"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":386 - * def init(): - * """Initialize event queue.""" - * event_init() # <<<<<<<<<<<<<< - * - * - */ - event_init(); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":389 - * - * - * def dispatch(): # <<<<<<<<<<<<<< - * """Dispatch all events on the event queue. - * Returns 0 on success, and 1 if no events are registered. - */ - -static PyObject *__pyx_pf_6gevent_4core_1dispatch(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_1dispatch[] = "Dispatch all events on the event queue.\n Returns 0 on success, and 1 if no events are registered.\n May raise IOError.\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_1dispatch = {__Pyx_NAMESTR("dispatch"), (PyCFunction)__pyx_pf_6gevent_4core_1dispatch, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_1dispatch)}; -static PyObject *__pyx_pf_6gevent_4core_1dispatch(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - int __pyx_v_ret; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("dispatch"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":395 - * """ - * cdef int ret - * with nogil: # <<<<<<<<<<<<<< - * ret = event_dispatch() - * if ret < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { - - /* "gevent/core.pyx":396 - * cdef int ret - * with nogil: - * ret = event_dispatch() # <<<<<<<<<<<<<< - * if ret < 0: - * raise IOError(errno, strerror(errno)) - */ - __pyx_v_ret = event_dispatch(); - } - - /* "gevent/core.pyx":395 - * """ - * cdef int ret - * with nogil: # <<<<<<<<<<<<<< - * ret = event_dispatch() - * if ret < 0: - */ - /*finally:*/ { - Py_BLOCK_THREADS - } - } - - /* "gevent/core.pyx":397 - * with nogil: - * ret = event_dispatch() - * if ret < 0: # <<<<<<<<<<<<<< - * raise IOError(errno, strerror(errno)) - * return ret - */ - __pyx_t_1 = (__pyx_v_ret < 0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":398 - * ret = event_dispatch() - * if ret < 0: - * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<< - * return ret - * - */ - __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; - } - __pyx_L8:; - - /* "gevent/core.pyx":399 - * if ret < 0: - * raise IOError(errno, strerror(errno)) - * return ret # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.dispatch"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":402 - * - * - * def loop(nonblock=False): # <<<<<<<<<<<<<< - * """Dispatch all pending events on queue in a single pass. - * Returns 0 on success, and 1 if no events are registered. - */ - -static PyObject *__pyx_pf_6gevent_4core_2loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_2loop[] = "Dispatch all pending events on queue in a single pass.\n Returns 0 on success, and 1 if no events are registered.\n May raise IOError.\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_2loop = {__Pyx_NAMESTR("loop"), (PyCFunction)__pyx_pf_6gevent_4core_2loop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_2loop)}; -static PyObject *__pyx_pf_6gevent_4core_2loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_nonblock = 0; - int __pyx_v_flags; - int __pyx_v_ret; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nonblock,0}; - __Pyx_RefNannySetupContext("loop"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - values[0] = __pyx_k_15; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonblock); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_nonblock = values[0]; - } else { - __pyx_v_nonblock = __pyx_k_15; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_nonblock = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loop", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.loop"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":408 - * """ - * cdef int flags, ret - * flags = EVLOOP_ONCE # <<<<<<<<<<<<<< - * if nonblock: - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - */ - __pyx_v_flags = EVLOOP_ONCE; - - /* "gevent/core.pyx":409 - * cdef int flags, ret - * flags = EVLOOP_ONCE - * if nonblock: # <<<<<<<<<<<<<< - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - * with nogil: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nonblock); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - - /* "gevent/core.pyx":410 - * flags = EVLOOP_ONCE - * if nonblock: - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK # <<<<<<<<<<<<<< - * with nogil: - * ret = event_loop(flags) - */ - __pyx_v_flags = (EVLOOP_ONCE | EVLOOP_NONBLOCK); - goto __pyx_L6; - } - __pyx_L6:; - - /* "gevent/core.pyx":411 - * if nonblock: - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - * with nogil: # <<<<<<<<<<<<<< - * ret = event_loop(flags) - * if ret < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { - - /* "gevent/core.pyx":412 - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - * with nogil: - * ret = event_loop(flags) # <<<<<<<<<<<<<< - * if ret < 0: - * raise IOError(errno, strerror(errno)) - */ - __pyx_v_ret = event_loop(__pyx_v_flags); - } - - /* "gevent/core.pyx":411 - * if nonblock: - * flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - * with nogil: # <<<<<<<<<<<<<< - * ret = event_loop(flags) - * if ret < 0: - */ - /*finally:*/ { - Py_BLOCK_THREADS - } - } - - /* "gevent/core.pyx":413 - * with nogil: - * ret = event_loop(flags) - * if ret < 0: # <<<<<<<<<<<<<< - * raise IOError(errno, strerror(errno)) - * return ret - */ - __pyx_t_1 = (__pyx_v_ret < 0); - if (__pyx_t_1) { - - /* "gevent/core.pyx":414 - * ret = event_loop(flags) - * if ret < 0: - * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<< - * return ret - * - */ - __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - - /* "gevent/core.pyx":415 - * if ret < 0: - * raise IOError(errno, strerror(errno)) - * return ret # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.loop"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":418 - * - * - * def get_version(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_get_version`""" - * return event_get_version() - */ - -static PyObject *__pyx_pf_6gevent_4core_3get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_3get_version[] = "Wrapper for :meth:`event_get_version`"; -static PyMethodDef __pyx_mdef_6gevent_4core_3get_version = {__Pyx_NAMESTR("get_version"), (PyCFunction)__pyx_pf_6gevent_4core_3get_version, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_3get_version)}; -static PyObject *__pyx_pf_6gevent_4core_3get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_version"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":420 - * def get_version(): - * """Wrapper for :meth:`event_get_version`""" - * return event_get_version() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(event_get_version()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.get_version"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":423 - * - * - * def get_method(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_get_method`""" - * return event_get_method() - */ - -static PyObject *__pyx_pf_6gevent_4core_4get_method(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_4get_method[] = "Wrapper for :meth:`event_get_method`"; -static PyMethodDef __pyx_mdef_6gevent_4core_4get_method = {__Pyx_NAMESTR("get_method"), (PyCFunction)__pyx_pf_6gevent_4core_4get_method, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_4get_method)}; -static PyObject *__pyx_pf_6gevent_4core_4get_method(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_method"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":425 - * def get_method(): - * """Wrapper for :meth:`event_get_method`""" - * return event_get_method() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(event_get_method()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.get_method"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":436 - * # _EVENT_VERSION is available since libevent 1.4.0-beta - * - * def get_header_version(): # <<<<<<<<<<<<<< - * """Return _EVENT_VERSION""" - * emit_ifdef() - */ - -static PyObject *__pyx_pf_6gevent_4core_5get_header_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_5get_header_version[] = "Return _EVENT_VERSION"; -static PyMethodDef __pyx_mdef_6gevent_4core_5get_header_version = {__Pyx_NAMESTR("get_header_version"), (PyCFunction)__pyx_pf_6gevent_4core_5get_header_version, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_5get_header_version)}; -static PyObject *__pyx_pf_6gevent_4core_5get_header_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_header_version"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":438 - * def get_header_version(): - * """Return _EVENT_VERSION""" - * emit_ifdef() # <<<<<<<<<<<<<< - * return _EVENT_VERSION - * emit_endif() - */ - #if defined(_EVENT_VERSION) //(); - - /* "gevent/core.pyx":439 - * """Return _EVENT_VERSION""" - * emit_ifdef() - * return _EVENT_VERSION # <<<<<<<<<<<<<< - * emit_endif() - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(_EVENT_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "gevent/core.pyx":440 - * emit_ifdef() - * return _EVENT_VERSION - * emit_endif() # <<<<<<<<<<<<<< - * - * # event_reinit is available since libevent 1.4.1-beta, - */ - #endif //(); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.get_header_version"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":447 - * # which will work in every version other than 1.4.0-beta - * - * def reinit(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_reinit`.""" - * emit_ifdef() - */ - -static PyObject *__pyx_pf_6gevent_4core_6reinit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_6reinit[] = "Wrapper for :meth:`event_reinit`."; -static PyMethodDef __pyx_mdef_6gevent_4core_6reinit = {__Pyx_NAMESTR("reinit"), (PyCFunction)__pyx_pf_6gevent_4core_6reinit, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_6reinit)}; -static PyObject *__pyx_pf_6gevent_4core_6reinit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reinit"); - __pyx_self = __pyx_self; - - /* "gevent/core.pyx":449 - * def reinit(): - * """Wrapper for :meth:`event_reinit`.""" - * emit_ifdef() # <<<<<<<<<<<<<< - * return event_reinit(current_base) - * emit_endif() - */ - #if defined(_EVENT_VERSION) //(); - - /* "gevent/core.pyx":450 - * """Wrapper for :meth:`event_reinit`.""" - * emit_ifdef() - * return event_reinit(current_base) # <<<<<<<<<<<<<< - * emit_endif() - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(event_reinit(current_base)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "gevent/core.pyx":451 - * emit_ifdef() - * return event_reinit(current_base) - * emit_endif() # <<<<<<<<<<<<<< - * - * include "evdns.pxi" - */ - #endif //(); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.reinit"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":40 - * - * - * def dns_init(): # <<<<<<<<<<<<<< - * """Initialize async DNS resolver.""" - * evdns_init() - */ - -static PyObject *__pyx_pf_6gevent_4core_7dns_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6gevent_4core_7dns_init[] = "Initialize async DNS resolver."; -static PyMethodDef __pyx_mdef_6gevent_4core_7dns_init = {__Pyx_NAMESTR("dns_init"), (PyCFunction)__pyx_pf_6gevent_4core_7dns_init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_7dns_init)}; -static PyObject *__pyx_pf_6gevent_4core_7dns_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("dns_init"); - __pyx_self = __pyx_self; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":42 - * def dns_init(): - * """Initialize async DNS resolver.""" - * evdns_init() # <<<<<<<<<<<<<< - * - * - */ - evdns_init(); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":45 - * - * - * def dns_shutdown(int fail_requests=0): # <<<<<<<<<<<<<< - * """Shutdown the async DNS resolver and terminate all active requests.""" - * evdns_shutdown(fail_requests) - */ - -static PyObject *__pyx_pf_6gevent_4core_8dns_shutdown(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_8dns_shutdown[] = "Shutdown the async DNS resolver and terminate all active requests."; -static PyMethodDef __pyx_mdef_6gevent_4core_8dns_shutdown = {__Pyx_NAMESTR("dns_shutdown"), (PyCFunction)__pyx_pf_6gevent_4core_8dns_shutdown, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_8dns_shutdown)}; -static PyObject *__pyx_pf_6gevent_4core_8dns_shutdown(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_fail_requests; - PyObject *__pyx_r = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fail_requests,0}; - __Pyx_RefNannySetupContext("dns_shutdown"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fail_requests); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dns_shutdown") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - if (values[0]) { - __pyx_v_fail_requests = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fail_requests == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_fail_requests = ((int)0); - } - } else { - __pyx_v_fail_requests = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_fail_requests = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_fail_requests == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dns_shutdown", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_shutdown"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":47 - * def dns_shutdown(int fail_requests=0): - * """Shutdown the async DNS resolver and terminate all active requests.""" - * evdns_shutdown(fail_requests) # <<<<<<<<<<<<<< - * - * - */ - evdns_shutdown(__pyx_v_fail_requests); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":50 - * - * - * def dns_err_to_string(int err): # <<<<<<<<<<<<<< - * cdef const_char_ptr result = evdns_err_to_string(err) - * if result: - */ - -static PyObject *__pyx_pf_6gevent_4core_9dns_err_to_string(PyObject *__pyx_self, PyObject *__pyx_arg_err); /*proto*/ -static PyMethodDef __pyx_mdef_6gevent_4core_9dns_err_to_string = {__Pyx_NAMESTR("dns_err_to_string"), (PyCFunction)__pyx_pf_6gevent_4core_9dns_err_to_string, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6gevent_4core_9dns_err_to_string(PyObject *__pyx_self, PyObject *__pyx_arg_err) { - int __pyx_v_err; - const char* __pyx_v_result; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("dns_err_to_string"); - __pyx_self = __pyx_self; - assert(__pyx_arg_err); { - __pyx_v_err = __Pyx_PyInt_AsInt(__pyx_arg_err); if (unlikely((__pyx_v_err == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_err_to_string"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":51 - * - * def dns_err_to_string(int err): - * cdef const_char_ptr result = evdns_err_to_string(err) # <<<<<<<<<<<<<< - * if result: - * return result - */ - __pyx_v_result = evdns_err_to_string(__pyx_v_err); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":52 - * def dns_err_to_string(int err): - * cdef const_char_ptr result = evdns_err_to_string(err) - * if result: # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_1 = (__pyx_v_result != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":53 - * cdef const_char_ptr result = evdns_err_to_string(err) - * if result: - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.dns_err_to_string"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":56 - * - * - * cdef void __evdns_callback(int code, char type, int count, int ttl, void *addrs, void *arg) with gil: # <<<<<<<<<<<<<< - * cdef int i - * cdef object callback = arg - */ - -static void __pyx_f_6gevent_4core___evdns_callback(int __pyx_v_code, char __pyx_v_type, int __pyx_v_count, int __pyx_v_ttl, void *__pyx_v_addrs, void *__pyx_v_arg) { - int __pyx_v_i; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_addr; - PyObject *__pyx_v_result; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__evdns_callback"); - __pyx_v_addr = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":58 - * cdef void __evdns_callback(int code, char type, int count, int ttl, void *addrs, void *arg) with gil: - * cdef int i - * cdef object callback = arg # <<<<<<<<<<<<<< - * Py_DECREF(callback) - * cdef object addr - */ - __Pyx_INCREF(((PyObject *)__pyx_v_arg)); - __pyx_v_callback = ((PyObject *)__pyx_v_arg); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":59 - * cdef int i - * cdef object callback = arg - * Py_DECREF(callback) # <<<<<<<<<<<<<< - * cdef object addr - * cdef object result - */ - Py_DECREF(((PyObject*)__pyx_v_callback)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":63 - * cdef object result - * - * if type == DNS_IPv4_A: # <<<<<<<<<<<<<< - * result = [] - * for i from 0 <= i < count: - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DNS_IPv4_A); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":64 - * - * if type == DNS_IPv4_A: - * result = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":65 - * if type == DNS_IPv4_A: - * result = [] - * for i from 0 <= i < count: # <<<<<<<<<<<<<< - * addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) - * result.append(addr) - */ - __pyx_t_5 = __pyx_v_count; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":66 - * result = [] - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) # <<<<<<<<<<<<<< - * result.append(addr) - * elif type == DNS_IPv6_AAAA: - */ - __pyx_t_3 = PyString_FromStringAndSize((&(((char *)__pyx_v_addrs)[(__pyx_v_i * 4)])), 4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_addr); - __pyx_v_addr = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":67 - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) - * result.append(addr) # <<<<<<<<<<<<<< - * elif type == DNS_IPv6_AAAA: - * result = [] - */ - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_v_addr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - goto __pyx_L3; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":68 - * addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) - * result.append(addr) - * elif type == DNS_IPv6_AAAA: # <<<<<<<<<<<<<< - * result = [] - * for i from 0 <= i < count: - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DNS_IPv6_AAAA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":69 - * result.append(addr) - * elif type == DNS_IPv6_AAAA: - * result = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":70 - * elif type == DNS_IPv6_AAAA: - * result = [] - * for i from 0 <= i < count: # <<<<<<<<<<<<<< - * addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) - * result.append(addr) - */ - __pyx_t_5 = __pyx_v_count; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":71 - * result = [] - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) # <<<<<<<<<<<<<< - * result.append(addr) - * elif type == DNS_PTR and count == 1: # only 1 PTR possible - */ - __pyx_t_1 = PyString_FromStringAndSize((&(((char *)__pyx_v_addrs)[(__pyx_v_i * 16)])), 16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_addr); - __pyx_v_addr = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":72 - * for i from 0 <= i < count: - * addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) - * result.append(addr) # <<<<<<<<<<<<<< - * elif type == DNS_PTR and count == 1: # only 1 PTR possible - * result = PyString_FromString((addrs)[0]) - */ - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - goto __pyx_L3; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":73 - * addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) - * result.append(addr) - * elif type == DNS_PTR and count == 1: # only 1 PTR possible # <<<<<<<<<<<<<< - * result = PyString_FromString((addrs)[0]) - * else: - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DNS_PTR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - __pyx_t_6 = (__pyx_v_count == 1); - __pyx_t_7 = __pyx_t_6; - } else { - __pyx_t_7 = __pyx_t_4; - } - if (__pyx_t_7) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":74 - * result.append(addr) - * elif type == DNS_PTR and count == 1: # only 1 PTR possible - * result = PyString_FromString((addrs)[0]) # <<<<<<<<<<<<<< - * else: - * result = None - */ - __pyx_t_3 = PyString_FromString((((char **)__pyx_v_addrs)[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":76 - * result = PyString_FromString((addrs)[0]) - * else: - * result = None # <<<<<<<<<<<<<< - * try: - * callback(code, type, ttl, result) - */ - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = Py_None; - } - __pyx_L3:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":77 - * else: - * result = None - * try: # <<<<<<<<<<<<<< - * callback(code, type, ttl, result) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":78 - * result = None - * try: - * callback(code, type, ttl, result) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_code); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L8_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L8_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong(__pyx_v_ttl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L8_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L8_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_result); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L8_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L15_try_end; - __pyx_L8_error:; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":79 - * try: - * callback(code, type, ttl, result) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * sys.exc_clear() - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.__evdns_callback"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_2); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":80 - * callback(code, type, ttl, result) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * sys.exc_clear() - * - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":81 - * except: - * traceback.print_exc() - * sys.exc_clear() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exc_clear); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L9_exception_handled; - } - __pyx_L10_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L9_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L15_try_end:; - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_WriteUnraisable("gevent.core.__evdns_callback"); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_callback); - __Pyx_DECREF(__pyx_v_addr); - __Pyx_DECREF(__pyx_v_result); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":84 - * - * - * def dns_resolve_ipv4(char *name, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup an A record for a given name. - * - */ - -static PyObject *__pyx_pf_6gevent_4core_10dns_resolve_ipv4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_10dns_resolve_ipv4[] = "Lookup an A record for a given name.\n\n - *name* -- DNS hostname\n - *flags* -- either 0 or DNS_QUERY_NO_SEARCH\n - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_10dns_resolve_ipv4 = {__Pyx_NAMESTR("dns_resolve_ipv4"), (PyCFunction)__pyx_pf_6gevent_4core_10dns_resolve_ipv4, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_10dns_resolve_ipv4)}; -static PyObject *__pyx_pf_6gevent_4core_10dns_resolve_ipv4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_name; - int __pyx_v_flags; - PyObject *__pyx_v_callback = 0; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__flags,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("dns_resolve_ipv4"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv4", 1, 3, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv4", 1, 3, 3, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dns_resolve_ipv4") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_name = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_name = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_resolve_ipv4"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":91 - * - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - * """ - * cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, callback) # <<<<<<<<<<<<<< - * if result: - * raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, )) - */ - __pyx_v_result = evdns_resolve_ipv4(__pyx_v_name, __pyx_v_flags, __pyx_f_6gevent_4core___evdns_callback, ((void *)__pyx_v_callback)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":92 - * """ - * cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, callback) - * if result: # <<<<<<<<<<<<<< - * raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, )) - * Py_INCREF(callback) - */ - if (__pyx_v_result) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":93 - * cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, callback) - * if result: - * raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, )) # <<<<<<<<<<<<<< - * Py_INCREF(callback) - * - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":94 - * if result: - * raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, )) - * Py_INCREF(callback) # <<<<<<<<<<<<<< - * - * - */ - Py_INCREF(((PyObject*)__pyx_v_callback)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.dns_resolve_ipv4"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":97 - * - * - * def dns_resolve_ipv6(char *name, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup an AAAA record for a given name. - * - */ - -static PyObject *__pyx_pf_6gevent_4core_11dns_resolve_ipv6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_11dns_resolve_ipv6[] = "Lookup an AAAA record for a given name.\n\n - *name* -- DNS hostname\n - *flags* -- either 0 or DNS_QUERY_NO_SEARCH\n - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_11dns_resolve_ipv6 = {__Pyx_NAMESTR("dns_resolve_ipv6"), (PyCFunction)__pyx_pf_6gevent_4core_11dns_resolve_ipv6, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_11dns_resolve_ipv6)}; -static PyObject *__pyx_pf_6gevent_4core_11dns_resolve_ipv6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_name; - int __pyx_v_flags; - PyObject *__pyx_v_callback = 0; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__flags,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("dns_resolve_ipv6"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv6", 1, 3, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv6", 1, 3, 3, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dns_resolve_ipv6") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_name = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_name = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dns_resolve_ipv6", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_resolve_ipv6"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":104 - * - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - * """ - * cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, callback) # <<<<<<<<<<<<<< - * if result: - * raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, )) - */ - __pyx_v_result = evdns_resolve_ipv6(__pyx_v_name, __pyx_v_flags, __pyx_f_6gevent_4core___evdns_callback, ((void *)__pyx_v_callback)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":105 - * """ - * cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, callback) - * if result: # <<<<<<<<<<<<<< - * raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, )) - * Py_INCREF(callback) - */ - if (__pyx_v_result) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":106 - * cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, callback) - * if result: - * raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, )) # <<<<<<<<<<<<<< - * Py_INCREF(callback) - * - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":107 - * if result: - * raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, )) - * Py_INCREF(callback) # <<<<<<<<<<<<<< - * - * - */ - Py_INCREF(((PyObject*)__pyx_v_callback)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.dns_resolve_ipv6"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":110 - * - * - * def dns_resolve_reverse(char* packed_ip, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup a PTR record for a given IPv4 address. - * - */ - -static PyObject *__pyx_pf_6gevent_4core_12dns_resolve_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_12dns_resolve_reverse[] = "Lookup a PTR record for a given IPv4 address.\n\n - *packed_ip* -- IPv4 address (as 4-byte binary string)\n - *flags* -- either 0 or DNS_QUERY_NO_SEARCH\n - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_12dns_resolve_reverse = {__Pyx_NAMESTR("dns_resolve_reverse"), (PyCFunction)__pyx_pf_6gevent_4core_12dns_resolve_reverse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_12dns_resolve_reverse)}; -static PyObject *__pyx_pf_6gevent_4core_12dns_resolve_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_packed_ip; - int __pyx_v_flags; - PyObject *__pyx_v_callback = 0; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__packed_ip,&__pyx_n_s__flags,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("dns_resolve_reverse"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__packed_ip); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse", 1, 3, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse", 1, 3, 3, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dns_resolve_reverse") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_packed_ip = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_packed_ip) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_packed_ip = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_packed_ip) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_resolve_reverse"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":117 - * - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - * """ - * cdef int result = evdns_resolve_reverse(packed_ip, flags, __evdns_callback, callback) # <<<<<<<<<<<<<< - * if result: - * raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, )) - */ - __pyx_v_result = evdns_resolve_reverse(((void *)__pyx_v_packed_ip), __pyx_v_flags, __pyx_f_6gevent_4core___evdns_callback, ((void *)__pyx_v_callback)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":118 - * """ - * cdef int result = evdns_resolve_reverse(packed_ip, flags, __evdns_callback, callback) - * if result: # <<<<<<<<<<<<<< - * raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, )) - * Py_INCREF(callback) - */ - if (__pyx_v_result) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":119 - * cdef int result = evdns_resolve_reverse(packed_ip, flags, __evdns_callback, callback) - * if result: - * raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, )) # <<<<<<<<<<<<<< - * Py_INCREF(callback) - * - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_packed_ip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":120 - * if result: - * raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, )) - * Py_INCREF(callback) # <<<<<<<<<<<<<< - * - * - */ - Py_INCREF(((PyObject*)__pyx_v_callback)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.dns_resolve_reverse"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":123 - * - * - * def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup a PTR record for a given IPv6 address. - * - */ - -static PyObject *__pyx_pf_6gevent_4core_13dns_resolve_reverse_ipv6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_13dns_resolve_reverse_ipv6[] = "Lookup a PTR record for a given IPv6 address.\n\n - *packed_ip* -- IPv6 address (as 16-byte binary string)\n - *flags* -- either 0 or DNS_QUERY_NO_SEARCH\n - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype\n "; -static PyMethodDef __pyx_mdef_6gevent_4core_13dns_resolve_reverse_ipv6 = {__Pyx_NAMESTR("dns_resolve_reverse_ipv6"), (PyCFunction)__pyx_pf_6gevent_4core_13dns_resolve_reverse_ipv6, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_13dns_resolve_reverse_ipv6)}; -static PyObject *__pyx_pf_6gevent_4core_13dns_resolve_reverse_ipv6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_packed_ip; - int __pyx_v_flags; - PyObject *__pyx_v_callback = 0; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__packed_ip,&__pyx_n_s__flags,&__pyx_n_s__callback,0}; - __Pyx_RefNannySetupContext("dns_resolve_reverse_ipv6"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__packed_ip); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse_ipv6", 1, 3, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse_ipv6", 1, 3, 3, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dns_resolve_reverse_ipv6") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_packed_ip = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_packed_ip) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_packed_ip = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_packed_ip) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dns_resolve_reverse_ipv6", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.dns_resolve_reverse_ipv6"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":130 - * - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - * """ - * cdef int result = evdns_resolve_reverse_ipv6(packed_ip, flags, __evdns_callback, callback) # <<<<<<<<<<<<<< - * if result: - * raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) - */ - __pyx_v_result = evdns_resolve_reverse_ipv6(((void *)__pyx_v_packed_ip), __pyx_v_flags, __pyx_f_6gevent_4core___evdns_callback, ((void *)__pyx_v_callback)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":131 - * """ - * cdef int result = evdns_resolve_reverse_ipv6(packed_ip, flags, __evdns_callback, callback) - * if result: # <<<<<<<<<<<<<< - * raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) - * Py_INCREF(callback) - */ - if (__pyx_v_result) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":132 - * cdef int result = evdns_resolve_reverse_ipv6(packed_ip, flags, __evdns_callback, callback) - * if result: - * raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) # <<<<<<<<<<<<<< - * Py_INCREF(callback) - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_packed_ip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":133 - * if result: - * raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) - * Py_INCREF(callback) # <<<<<<<<<<<<<< - */ - Py_INCREF(((PyObject*)__pyx_v_callback)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.dns_resolve_reverse_ipv6"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":27 - * cdef evbuffer* __obj - * - * def __init__(self, size_t _obj): # <<<<<<<<<<<<<< - * self.__obj = _obj - * - */ - -static int __pyx_pf_6gevent_4core_6buffer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_6buffer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - size_t __pyx_v__obj; - int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___obj,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___obj); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v__obj = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v__obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v__obj = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v__obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.buffer.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":28 - * - * def __init__(self, size_t _obj): - * self.__obj = _obj # <<<<<<<<<<<<<< - * - * property _obj: - */ - ((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj = ((struct evbuffer *)__pyx_v__obj); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":32 - * property _obj: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.__obj) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_4_obj___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_4_obj___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":33 - * - * def __get__(self): - * return (self.__obj) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.buffer._obj.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":35 - * return (self.__obj) - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.__obj: - * return evbuffer_get_length(self.__obj) - */ - -static Py_ssize_t __pyx_pf_6gevent_4core_6buffer_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_6gevent_4core_6buffer_1__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":36 - * - * def __len__(self): - * if self.__obj: # <<<<<<<<<<<<<< - * return evbuffer_get_length(self.__obj) - * else: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":37 - * def __len__(self): - * if self.__obj: - * return evbuffer_get_length(self.__obj) # <<<<<<<<<<<<<< - * else: - * return 0 - */ - __pyx_r = evbuffer_get_length(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj); - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":39 - * return evbuffer_get_length(self.__obj) - * else: - * return 0 # <<<<<<<<<<<<<< - * - * def __nonzero__(self): - */ - __pyx_r = 0; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":41 - * return 0 - * - * def __nonzero__(self): # <<<<<<<<<<<<<< - * if self.__obj: - * return evbuffer_get_length(self.__obj) - */ - -static int __pyx_pf_6gevent_4core_6buffer_2__nonzero__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_6buffer_2__nonzero__(PyObject *__pyx_v_self) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__nonzero__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":42 - * - * def __nonzero__(self): - * if self.__obj: # <<<<<<<<<<<<<< - * return evbuffer_get_length(self.__obj) - * - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":43 - * def __nonzero__(self): - * if self.__obj: - * return evbuffer_get_length(self.__obj) # <<<<<<<<<<<<<< - * - * def detach(self): - */ - __pyx_r = evbuffer_get_length(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj); - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":45 - * return evbuffer_get_length(self.__obj) - * - * def detach(self): # <<<<<<<<<<<<<< - * self.__obj = NULL - * - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_3detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_3detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("detach"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":46 - * - * def detach(self): - * self.__obj = NULL # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - ((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj = NULL; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":48 - * self.__obj = NULL - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_4__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_4__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__iter__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":49 - * - * def __iter__(self): - * return self # <<<<<<<<<<<<<< - * - * def __next__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":51 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * line = self.readline() - * if not line: - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_5__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_5__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_line; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("__next__"); - __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":52 - * - * def __next__(self): - * line = self.readline() # <<<<<<<<<<<<<< - * if not line: - * raise StopIteration - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__readline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_line); - __pyx_v_line = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":53 - * def __next__(self): - * line = self.readline() - * if not line: # <<<<<<<<<<<<<< - * raise StopIteration - * return line - */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = (!__pyx_t_3); - if (__pyx_t_4) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":54 - * line = self.readline() - * if not line: - * raise StopIteration # <<<<<<<<<<<<<< - * return line - * - */ - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":55 - * if not line: - * raise StopIteration - * return line # <<<<<<<<<<<<<< - * - * def read(self, long size=-1): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_line); - __pyx_r = __pyx_v_line; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.buffer.__next__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_line); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":57 - * return line - * - * def read(self, long size=-1): # <<<<<<<<<<<<<< - * """Drain the first *size* bytes from the buffer (or what's left if there are less than *size* bytes). - * - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_6read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6gevent_4core_6buffer_6read[] = "Drain the first *size* bytes from the buffer (or what's left if there are less than *size* bytes).\n\n If *size* is negative, drain the whole buffer.\n "; -static PyObject *__pyx_pf_6gevent_4core_6buffer_6read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - long __pyx_v_size; - long __pyx_v_length; - char *__pyx_v_data; - PyObject *__pyx_v_result = 0; - int __pyx_v_res; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - long __pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; - __Pyx_RefNannySetupContext("read"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - if (values[0]) { - __pyx_v_size = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_size = ((long)-1); - } - } else { - __pyx_v_size = ((long)-1); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_size = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.buffer.read"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":62 - * If *size* is negative, drain the whole buffer. - * """ - * if not self.__obj: # <<<<<<<<<<<<<< - * return '' - * cdef long length = evbuffer_get_length(self.__obj) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":63 - * """ - * if not self.__obj: - * return '' # <<<<<<<<<<<<<< - * cdef long length = evbuffer_get_length(self.__obj) - * if size < 0: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __pyx_r = ((PyObject *)__pyx_kp_s_6); - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":64 - * if not self.__obj: - * return '' - * cdef long length = evbuffer_get_length(self.__obj) # <<<<<<<<<<<<<< - * if size < 0: - * size = length - */ - __pyx_v_length = evbuffer_get_length(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":65 - * return '' - * cdef long length = evbuffer_get_length(self.__obj) - * if size < 0: # <<<<<<<<<<<<<< - * size = length - * else: - */ - __pyx_t_1 = (__pyx_v_size < 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":66 - * cdef long length = evbuffer_get_length(self.__obj) - * if size < 0: - * size = length # <<<<<<<<<<<<<< - * else: - * size = min(size, length) - */ - __pyx_v_size = __pyx_v_length; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":68 - * size = length - * else: - * size = min(size, length) # <<<<<<<<<<<<<< - * if size <= 0: - * return '' - */ - __pyx_t_2 = __pyx_v_length; - __pyx_t_3 = __pyx_v_size; - if ((__pyx_t_2 < __pyx_t_3)) { - __pyx_t_4 = __pyx_t_2; - } else { - __pyx_t_4 = __pyx_t_3; - } - __pyx_v_size = __pyx_t_4; - } - __pyx_L7:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":69 - * else: - * size = min(size, length) - * if size <= 0: # <<<<<<<<<<<<<< - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, size) - */ - __pyx_t_1 = (__pyx_v_size <= 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":70 - * size = min(size, length) - * if size <= 0: - * return '' # <<<<<<<<<<<<<< - * cdef char* data = EVBUFFER_PULLUP(self.__obj, size) - * if not data: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __pyx_r = ((PyObject *)__pyx_kp_s_6); - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":71 - * if size <= 0: - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, size) # <<<<<<<<<<<<<< - * if not data: - * return '' - */ - __pyx_v_data = ((char *)EVBUFFER_PULLUP(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj, __pyx_v_size)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":72 - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, size) - * if not data: # <<<<<<<<<<<<<< - * return '' - * cdef object result = PyString_FromStringAndSize(data, size) - */ - __pyx_t_1 = (!(__pyx_v_data != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":73 - * cdef char* data = EVBUFFER_PULLUP(self.__obj, size) - * if not data: - * return '' # <<<<<<<<<<<<<< - * cdef object result = PyString_FromStringAndSize(data, size) - * cdef int res = EVBUFFER_DRAIN(self.__obj, size) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __pyx_r = ((PyObject *)__pyx_kp_s_6); - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":74 - * if not data: - * return '' - * cdef object result = PyString_FromStringAndSize(data, size) # <<<<<<<<<<<<<< - * cdef int res = EVBUFFER_DRAIN(self.__obj, size) - * if res: - */ - __pyx_t_5 = PyString_FromStringAndSize(__pyx_v_data, __pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_result = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":75 - * return '' - * cdef object result = PyString_FromStringAndSize(data, size) - * cdef int res = EVBUFFER_DRAIN(self.__obj, size) # <<<<<<<<<<<<<< - * if res: - * try: - */ - __pyx_v_res = EVBUFFER_DRAIN(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj, __pyx_v_size); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":76 - * cdef object result = PyString_FromStringAndSize(data, size) - * cdef int res = EVBUFFER_DRAIN(self.__obj, size) - * if res: # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) - */ - if (__pyx_v_res) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":77 - * cdef int res = EVBUFFER_DRAIN(self.__obj, size) - * if res: - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":78 - * if res: - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__stderr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___obj); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyInt_FromLong(__pyx_v_res); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L11_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L18_try_end; - __pyx_L11_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":79 - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * return result - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.buffer.read"); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":80 - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L12_exception_handled; - } - __pyx_L13_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L12_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L18_try_end:; - } - goto __pyx_L10; - } - __pyx_L10:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":81 - * except: - * traceback.print_exc() - * return result # <<<<<<<<<<<<<< - * - * def readline(self, size=None): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("gevent.core.buffer.read"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":83 - * return result - * - * def readline(self, size=None): # <<<<<<<<<<<<<< - * if not self.__obj: - * return '' - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_7readline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_7readline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_size = 0; - char *__pyx_v_data; - long __pyx_v_length; - char *__pyx_v_nl; - PyObject *__pyx_v_result = 0; - int __pyx_v_res; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; - __Pyx_RefNannySetupContext("readline"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "readline") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_size = values[0]; - } else { - __pyx_v_size = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("readline", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.buffer.readline"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":84 - * - * def readline(self, size=None): - * if not self.__obj: # <<<<<<<<<<<<<< - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":85 - * def readline(self, size=None): - * if not self.__obj: - * return '' # <<<<<<<<<<<<<< - * cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) - * if not data: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __pyx_r = ((PyObject *)__pyx_kp_s_6); - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":86 - * if not self.__obj: - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) # <<<<<<<<<<<<<< - * if not data: - * return '' - */ - __pyx_v_data = ((char *)EVBUFFER_PULLUP(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj, -1)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":87 - * return '' - * cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) - * if not data: # <<<<<<<<<<<<<< - * return '' - * - */ - __pyx_t_1 = (!(__pyx_v_data != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":88 - * cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) - * if not data: - * return '' # <<<<<<<<<<<<<< - * - * cdef long length = evbuffer_get_length(self.__obj) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __pyx_r = ((PyObject *)__pyx_kp_s_6); - goto __pyx_L0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":90 - * return '' - * - * cdef long length = evbuffer_get_length(self.__obj) # <<<<<<<<<<<<<< - * cdef char *nl = memchr(data, 10, length) # search for "\n" - * - */ - __pyx_v_length = evbuffer_get_length(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":91 - * - * cdef long length = evbuffer_get_length(self.__obj) - * cdef char *nl = memchr(data, 10, length) # search for "\n" # <<<<<<<<<<<<<< - * - * if nl: - */ - __pyx_v_nl = ((char *)memchr(((void *)__pyx_v_data), 10, __pyx_v_length)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":93 - * cdef char *nl = memchr(data, 10, length) # search for "\n" - * - * if nl: # <<<<<<<<<<<<<< - * length = nl - data + 1 - * - */ - __pyx_t_1 = (__pyx_v_nl != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":94 - * - * if nl: - * length = nl - data + 1 # <<<<<<<<<<<<<< - * - * cdef object result = PyString_FromStringAndSize(data, length) - */ - __pyx_v_length = ((__pyx_v_nl - __pyx_v_data) + 1); - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":96 - * length = nl - data + 1 - * - * cdef object result = PyString_FromStringAndSize(data, length) # <<<<<<<<<<<<<< - * cdef int res = EVBUFFER_DRAIN(self.__obj, length) - * if res: - */ - __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_data, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":97 - * - * cdef object result = PyString_FromStringAndSize(data, length) - * cdef int res = EVBUFFER_DRAIN(self.__obj, length) # <<<<<<<<<<<<<< - * if res: - * try: - */ - __pyx_v_res = EVBUFFER_DRAIN(((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj, __pyx_v_length); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":98 - * cdef object result = PyString_FromStringAndSize(data, length) - * cdef int res = EVBUFFER_DRAIN(self.__obj, length) - * if res: # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) - */ - if (__pyx_v_res) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":99 - * cdef int res = EVBUFFER_DRAIN(self.__obj, length) - * if res: - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":100 - * if res: - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyInt_FromLong(__pyx_v_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L17_try_end; - __pyx_L10_error:; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":101 - * try: - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * return result - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core.buffer.readline"); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_2); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":102 - * sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L11_exception_handled; - } - __pyx_L12_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L11_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L17_try_end:; - } - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":103 - * except: - * traceback.print_exc() - * return result # <<<<<<<<<<<<<< - * - * def readlines(self, hint=-1): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.buffer.readline"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":105 - * return result - * - * def readlines(self, hint=-1): # <<<<<<<<<<<<<< - * return list(self) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_8readlines(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_8readlines(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_hint = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hint,0}; - __Pyx_RefNannySetupContext("readlines"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - values[0] = ((PyObject *)__pyx_int_neg_1); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hint); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "readlines") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_hint = values[0]; - } else { - __pyx_v_hint = ((PyObject *)__pyx_int_neg_1); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_hint = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("readlines", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.buffer.readlines"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":106 - * - * def readlines(self, hint=-1): - * return list(self) # <<<<<<<<<<<<<< - * - * def write(self, bytes data): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.buffer.readlines"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":108 - * return list(self) - * - * def write(self, bytes data): # <<<<<<<<<<<<<< - * cdef int result = evbuffer_add(self.__obj, data, len(data)) - * if result < 0: - */ - -static PyObject *__pyx_pf_6gevent_4core_6buffer_9write(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_6buffer_9write(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { - int __pyx_v_result; - PyObject *__pyx_r = NULL; - struct evbuffer *__pyx_t_1; - char *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("write"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":109 - * - * def write(self, bytes data): - * cdef int result = evbuffer_add(self.__obj, data, len(data)) # <<<<<<<<<<<<<< - * if result < 0: - * raise IOError("evbuffer_add() returned %s" % result) - */ - __pyx_t_1 = ((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_self)->__pyx___obj; - __pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_data)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyObject *)__pyx_v_data); - __Pyx_INCREF(__pyx_t_3); - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = evbuffer_add(__pyx_t_1, __pyx_t_2, __pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":110 - * def write(self, bytes data): - * cdef int result = evbuffer_add(self.__obj, data, len(data)) - * if result < 0: # <<<<<<<<<<<<<< - * raise IOError("evbuffer_add() returned %s" % result) - * return result - */ - __pyx_t_5 = (__pyx_v_result < 0); - if (__pyx_t_5) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":111 - * cdef int result = evbuffer_add(self.__obj, data, len(data)) - * if result < 0: - * raise IOError("evbuffer_add() returned %s" % result) # <<<<<<<<<<<<<< - * return result - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":112 - * if result < 0: - * raise IOError("evbuffer_add() returned %s" % result) - * return result # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.buffer.write"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":155 - * cdef public object _output_buffer - * - * def __init__(self, size_t obj): # <<<<<<<<<<<<<< - * self.__obj = obj - * - */ - -static int __pyx_pf_6gevent_4core_17http_request_base___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - size_t __pyx_v_obj; - int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_obj = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_obj = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":156 - * - * def __init__(self, size_t obj): - * self.__obj = obj # <<<<<<<<<<<<<< - * - * property _obj: - */ - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj = ((struct evhttp_request *)__pyx_v_obj); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":160 - * property _obj: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.__obj) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4_obj___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4_obj___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":161 - * - * def __get__(self): - * return (self.__obj) # <<<<<<<<<<<<<< - * - * def __nonzero__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.http_request_base._obj.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":163 - * return (self.__obj) - * - * def __nonzero__(self): # <<<<<<<<<<<<<< - * if self.__obj: - * return True - */ - -static int __pyx_pf_6gevent_4core_17http_request_base_1__nonzero__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base_1__nonzero__(PyObject *__pyx_v_self) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__nonzero__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":164 - * - * def __nonzero__(self): - * if self.__obj: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":165 - * def __nonzero__(self): - * if self.__obj: - * return True # <<<<<<<<<<<<<< - * else: - * return False - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":167 - * return True - * else: - * return False # <<<<<<<<<<<<<< - * - * def detach(self): - */ - __pyx_r = 0; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":169 - * return False - * - * def detach(self): # <<<<<<<<<<<<<< - * self.__obj = NULL - * if self._input_buffer is not None: - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_2detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_2detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("detach"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":170 - * - * def detach(self): - * self.__obj = NULL # <<<<<<<<<<<<<< - * if self._input_buffer is not None: - * self._input_buffer.detach() - */ - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj = NULL; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":171 - * def detach(self): - * self.__obj = NULL - * if self._input_buffer is not None: # <<<<<<<<<<<<<< - * self._input_buffer.detach() - * if self._output_buffer is not None: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer != Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":172 - * self.__obj = NULL - * if self._input_buffer is not None: - * self._input_buffer.detach() # <<<<<<<<<<<<<< - * if self._output_buffer is not None: - * self._output_buffer.detach() - */ - __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer, __pyx_n_s__detach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":173 - * if self._input_buffer is not None: - * self._input_buffer.detach() - * if self._output_buffer is not None: # <<<<<<<<<<<<<< - * self._output_buffer.detach() - * - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer != Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":174 - * self._input_buffer.detach() - * if self._output_buffer is not None: - * self._output_buffer.detach() # <<<<<<<<<<<<<< - * - * def _format(self): - */ - __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer, __pyx_n_s__detach); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.detach"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":176 - * self._output_buffer.detach() - * - * def _format(self): # <<<<<<<<<<<<<< - * args = (self.typestr, self.uri, self.major, self.minor, - * self.remote_host, self.remote_port) - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_3_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_3_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_args; - PyObject *__pyx_v_res; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - __Pyx_RefNannySetupContext("_format"); - __pyx_v_args = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_res = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":177 - * - * def _format(self): - * args = (self.typestr, self.uri, self.major, self.minor, # <<<<<<<<<<<<<< - * self.remote_host, self.remote_port) - * res = '"%s %s HTTP/%s.%s" %s:%s' % args - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__typestr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__major); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__minor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":178 - * def _format(self): - * args = (self.typestr, self.uri, self.major, self.minor, - * self.remote_host, self.remote_port) # <<<<<<<<<<<<<< - * res = '"%s %s HTTP/%s.%s" %s:%s' % args - * if self.response_code: - */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__remote_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__remote_port); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_args)); - __pyx_v_args = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":179 - * args = (self.typestr, self.uri, self.major, self.minor, - * self.remote_host, self.remote_port) - * res = '"%s %s HTTP/%s.%s" %s:%s' % args # <<<<<<<<<<<<<< - * if self.response_code: - * res += ' response=%s' % self.response_code - */ - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_DECREF(__pyx_v_res); - __pyx_v_res = ((PyObject *)__pyx_t_7); - __pyx_t_7 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":180 - * self.remote_host, self.remote_port) - * res = '"%s %s HTTP/%s.%s" %s:%s' % args - * if self.response_code: # <<<<<<<<<<<<<< - * res += ' response=%s' % self.response_code - * if self.input_buffer: - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__response_code); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_8) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":181 - * res = '"%s %s HTTP/%s.%s" %s:%s' % args - * if self.response_code: - * res += ' response=%s' % self.response_code # <<<<<<<<<<<<<< - * if self.input_buffer: - * res += ' input=%s' % len(self.input_buffer) - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__response_code); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_res, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_res); - __pyx_v_res = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":182 - * if self.response_code: - * res += ' response=%s' % self.response_code - * if self.input_buffer: # <<<<<<<<<<<<<< - * res += ' input=%s' % len(self.input_buffer) - * if self.output_buffer: - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__input_buffer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_8) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":183 - * res += ' response=%s' % self.response_code - * if self.input_buffer: - * res += ' input=%s' % len(self.input_buffer) # <<<<<<<<<<<<<< - * if self.output_buffer: - * res += ' output=%s' % len(self.output_buffer) - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__input_buffer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_res, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_res); - __pyx_v_res = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":184 - * if self.input_buffer: - * res += ' input=%s' % len(self.input_buffer) - * if self.output_buffer: # <<<<<<<<<<<<<< - * res += ' output=%s' % len(self.output_buffer) - * return res - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__output_buffer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_8) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":185 - * res += ' input=%s' % len(self.input_buffer) - * if self.output_buffer: - * res += ' output=%s' % len(self.output_buffer) # <<<<<<<<<<<<<< - * return res - * - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__output_buffer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_res, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_res); - __pyx_v_res = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":186 - * if self.output_buffer: - * res += ' output=%s' % len(self.output_buffer) - * return res # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_res); - __pyx_r = __pyx_v_res; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("gevent.core.http_request_base._format"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_DECREF(__pyx_v_res); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":188 - * return res - * - * def __str__(self): # <<<<<<<<<<<<<< - * try: - * info = self._format() - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_info; - PyObject *__pyx_v_ex; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("__str__"); - __pyx_v_info = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_ex = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":189 - * - * def __str__(self): - * try: # <<<<<<<<<<<<<< - * info = self._format() - * except HttpRequestDeleted: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":190 - * def __str__(self): - * try: - * info = self._format() # <<<<<<<<<<<<<< - * except HttpRequestDeleted: - * info = 'deleted' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = __pyx_t_2; - __pyx_t_2 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L12_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":191 - * try: - * info = self._format() - * except HttpRequestDeleted: # <<<<<<<<<<<<<< - * info = 'deleted' - * except Exception, ex: - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_ExceptionMatches(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - __Pyx_AddTraceback("gevent.core.http_request_base.__str__"); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":192 - * info = self._format() - * except HttpRequestDeleted: - * info = 'deleted' # <<<<<<<<<<<<<< - * except Exception, ex: - * info = str(ex) or repr(ex) or '' - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s__deleted)); - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = ((PyObject *)__pyx_n_s__deleted); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6_exception_handled; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":193 - * except HttpRequestDeleted: - * info = 'deleted' - * except Exception, ex: # <<<<<<<<<<<<<< - * info = str(ex) or repr(ex) or '' - * return '<%s %s>' % (self.__class__.__name__, info) - */ - __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception); - if (__pyx_t_3) { - __Pyx_AddTraceback("gevent.core.http_request_base.__str__"); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = __pyx_t_1; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":194 - * info = 'deleted' - * except Exception, ex: - * info = str(ex) or repr(ex) or '' # <<<<<<<<<<<<<< - * return '<%s %s>' % (self.__class__.__name__, info) - * - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - if (!__pyx_t_7) { - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_5 = PyObject_Repr(__pyx_v_ex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - if (!__pyx_t_7) { - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_26)); - __pyx_t_8 = __pyx_kp_s_26; - } else { - __pyx_t_8 = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_t_5 = __pyx_t_8; - __pyx_t_8 = 0; - } else { - __pyx_t_5 = __pyx_t_6; - __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L6_exception_handled; - } - __pyx_L7_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L6_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L12_try_end:; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":195 - * except Exception, ex: - * info = str(ex) or repr(ex) or '' - * return '<%s %s>' % (self.__class__.__name__, info) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_info); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_info); - __Pyx_GIVEREF(__pyx_v_info); - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("gevent.core.http_request_base.__str__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_info); - __Pyx_DECREF(__pyx_v_ex); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":197 - * return '<%s %s>' % (self.__class__.__name__, info) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * try: - * info = ' ' + self._format() - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_info; - PyObject *__pyx_v_ex; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("__repr__"); - __pyx_v_info = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_ex = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":198 - * - * def __repr__(self): - * try: # <<<<<<<<<<<<<< - * info = ' ' + self._format() - * except HttpRequestDeleted: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":199 - * def __repr__(self): - * try: - * info = ' ' + self._format() # <<<<<<<<<<<<<< - * except HttpRequestDeleted: - * info = '' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_10), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = __pyx_t_1; - __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L12_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":200 - * try: - * info = ' ' + self._format() - * except HttpRequestDeleted: # <<<<<<<<<<<<<< - * info = '' - * except Exception, ex: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyErr_ExceptionMatches(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - __Pyx_AddTraceback("gevent.core.http_request_base.__repr__"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":201 - * info = ' ' + self._format() - * except HttpRequestDeleted: - * info = '' # <<<<<<<<<<<<<< - * except Exception, ex: - * info = ' ' + (str(ex) or repr(ex) or '') - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = ((PyObject *)__pyx_kp_s_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6_exception_handled; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":202 - * except HttpRequestDeleted: - * info = '' - * except Exception, ex: # <<<<<<<<<<<<<< - * info = ' ' + (str(ex) or repr(ex) or '') - * return '<%s _obj=0x%x %s>' % (self.__class__.__name__, self._obj, info) - */ - __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception); - if (__pyx_t_3) { - __Pyx_AddTraceback("gevent.core.http_request_base.__repr__"); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = __pyx_t_2; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":203 - * info = '' - * except Exception, ex: - * info = ' ' + (str(ex) or repr(ex) or '') # <<<<<<<<<<<<<< - * return '<%s _obj=0x%x %s>' % (self.__class__.__name__, self._obj, info) - * - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - if (!__pyx_t_7) { - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_5 = PyObject_Repr(__pyx_v_ex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - if (!__pyx_t_7) { - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_26)); - __pyx_t_8 = __pyx_kp_s_26; - } else { - __pyx_t_8 = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_t_5 = __pyx_t_8; - __pyx_t_8 = 0; - } else { - __pyx_t_5 = __pyx_t_6; - __pyx_t_6 = 0; - } - __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_info); - __pyx_v_info = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L6_exception_handled; - } - __pyx_L7_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L6_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L12_try_end:; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":204 - * except Exception, ex: - * info = ' ' + (str(ex) or repr(ex) or '') - * return '<%s _obj=0x%x %s>' % (self.__class__.__name__, self._obj, info) # <<<<<<<<<<<<<< - * - * def get_input_headers(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___obj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_info); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_info); - __Pyx_GIVEREF(__pyx_v_info); - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("gevent.core.http_request_base.__repr__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_info); - __Pyx_DECREF(__pyx_v_ex); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":206 - * return '<%s _obj=0x%x %s>' % (self.__class__.__name__, self._obj, info) - * - * def get_input_headers(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_6get_input_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_6get_input_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - struct evkeyvalq *__pyx_v_headers; - struct evkeyval *__pyx_v_p; - char *__pyx_v_key; - char *__pyx_v_value; - PyObject *__pyx_v_result; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - __Pyx_RefNannySetupContext("get_input_headers"); - __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":207 - * - * def get_input_headers(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * cdef evkeyvalq* headers = self.__obj.input_headers - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":208 - * def get_input_headers(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * cdef evkeyvalq* headers = self.__obj.input_headers - * cdef evkeyval* p = TAILQ_FIRST(headers) - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":209 - * if not self.__obj: - * raise HttpRequestDeleted - * cdef evkeyvalq* headers = self.__obj.input_headers # <<<<<<<<<<<<<< - * cdef evkeyval* p = TAILQ_FIRST(headers) - * cdef char *key, *value - */ - __pyx_v_headers = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_headers; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":210 - * raise HttpRequestDeleted - * cdef evkeyvalq* headers = self.__obj.input_headers - * cdef evkeyval* p = TAILQ_FIRST(headers) # <<<<<<<<<<<<<< - * cdef char *key, *value - * result = [] - */ - __pyx_v_p = TAILQ_FIRST(__pyx_v_headers); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":212 - * cdef evkeyval* p = TAILQ_FIRST(headers) - * cdef char *key, *value - * result = [] # <<<<<<<<<<<<<< - * while p: - * key = p.key - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":213 - * cdef char *key, *value - * result = [] - * while p: # <<<<<<<<<<<<<< - * key = p.key - * value = p.value - */ - while (1) { - __pyx_t_1 = (__pyx_v_p != 0); - if (!__pyx_t_1) break; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":214 - * result = [] - * while p: - * key = p.key # <<<<<<<<<<<<<< - * value = p.value - * if key == NULL or value == NULL: - */ - __pyx_v_key = __pyx_v_p->key; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":215 - * while p: - * key = p.key - * value = p.value # <<<<<<<<<<<<<< - * if key == NULL or value == NULL: - * break - */ - __pyx_v_value = __pyx_v_p->value; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":216 - * key = p.key - * value = p.value - * if key == NULL or value == NULL: # <<<<<<<<<<<<<< - * break - * result.append((key.lower(), value)) - */ - __pyx_t_1 = (__pyx_v_key == NULL); - if (!__pyx_t_1) { - __pyx_t_3 = (__pyx_v_value == NULL); - __pyx_t_4 = __pyx_t_3; - } else { - __pyx_t_4 = __pyx_t_1; - } - if (__pyx_t_4) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":217 - * value = p.value - * if key == NULL or value == NULL: - * break # <<<<<<<<<<<<<< - * result.append((key.lower(), value)) - * p = TAILQ_GET_NEXT(p) - */ - goto __pyx_L7_break; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":218 - * if key == NULL or value == NULL: - * break - * result.append((key.lower(), value)) # <<<<<<<<<<<<<< - * p = TAILQ_GET_NEXT(p) - * return result - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyBytes_FromString(__pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__lower); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyBytes_FromString(__pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":219 - * break - * result.append((key.lower(), value)) - * p = TAILQ_GET_NEXT(p) # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_p = TAILQ_GET_NEXT(__pyx_v_p); - } - __pyx_L7_break:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":220 - * result.append((key.lower(), value)) - * p = TAILQ_GET_NEXT(p) - * return result # <<<<<<<<<<<<<< - * - * property connection: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.http_request_base.get_input_headers"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":224 - * property connection: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_10connection___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_10connection___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":225 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return http_connection(self.__obj.evcon) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":226 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return http_connection(self.__obj.evcon) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":227 - * if not self.__obj: - * raise HttpRequestDeleted - * return http_connection(self.__obj.evcon) # <<<<<<<<<<<<<< - * - * property remote_host: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->evcon)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_http_connection)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.connection.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":231 - * property remote_host: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remote_host___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remote_host___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":232 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * if self.__obj.remote_host: - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":233 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * if self.__obj.remote_host: - * return self.__obj.remote_host - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":234 - * if not self.__obj: - * raise HttpRequestDeleted - * if self.__obj.remote_host: # <<<<<<<<<<<<<< - * return self.__obj.remote_host - * - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->remote_host != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":235 - * raise HttpRequestDeleted - * if self.__obj.remote_host: - * return self.__obj.remote_host # <<<<<<<<<<<<<< - * - * property remote_port: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->remote_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.remote_host.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":239 - * property remote_port: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remote_port___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remote_port___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":240 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.remote_port - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":241 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.remote_port - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":242 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.remote_port # <<<<<<<<<<<<<< - * - * property remote: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->remote_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.remote_port.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":246 - * property remote: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.remote_host, self.remote_port) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_6remote___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_6remote___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":247 - * - * def __get__(self): - * return (self.remote_host, self.remote_port) # <<<<<<<<<<<<<< - * - * property kind: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__remote_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__remote_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.remote.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":251 - * property kind: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4kind___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4kind___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":252 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.kind - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":253 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.kind - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":254 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.kind # <<<<<<<<<<<<<< - * - * property type: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->kind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.kind.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":258 - * property type: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4type___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_4type___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":259 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.type - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":260 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.type - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":261 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.type # <<<<<<<<<<<<<< - * - * property typestr: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.type.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":265 - * property typestr: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7typestr___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7typestr___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":266 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return HTTP_method2name.get(self.__obj.type) or str(self.__obj.type) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":267 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return HTTP_method2name.get(self.__obj.type) or str(self.__obj.type) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":268 - * if not self.__obj: - * raise HttpRequestDeleted - * return HTTP_method2name.get(self.__obj.type) or str(self.__obj.type) # <<<<<<<<<<<<<< - * - * property uri: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HTTP_method2name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __pyx_t_3 = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.http_request_base.typestr.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":272 - * property uri: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_3uri___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_3uri___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":273 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * if self.__obj.uri: - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":274 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * if self.__obj.uri: - * return self.__obj.uri - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":275 - * if not self.__obj: - * raise HttpRequestDeleted - * if self.__obj.uri: # <<<<<<<<<<<<<< - * return self.__obj.uri - * - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->uri != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":276 - * raise HttpRequestDeleted - * if self.__obj.uri: - * return self.__obj.uri # <<<<<<<<<<<<<< - * - * property major: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.uri.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":280 - * property major: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5major___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5major___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":281 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.major - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":282 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.major - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":283 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.major # <<<<<<<<<<<<<< - * - * property minor: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->major); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.major.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":287 - * property minor: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5minor___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_5minor___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":288 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.minor - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":289 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.minor - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":290 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.minor # <<<<<<<<<<<<<< - * - * property version: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->minor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.minor.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":294 - * property version: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7version___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7version___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":295 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return (self.__obj.major, self.__obj.minor) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":296 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return (self.__obj.major, self.__obj.minor) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":297 - * if not self.__obj: - * raise HttpRequestDeleted - * return (self.__obj.major, self.__obj.minor) # <<<<<<<<<<<<<< - * - * property response_code: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->major); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->minor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.http_request_base.version.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":301 - * property response_code: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13response_code___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13response_code___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":302 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.response_code - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":303 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.response_code - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":304 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.response_code # <<<<<<<<<<<<<< - * - * property response_code_line: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->response_code); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.response_code.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":308 - * property response_code_line: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_18response_code_line___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_18response_code_line___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":309 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * if self.__obj.response_code_line: - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":310 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * if self.__obj.response_code_line: - * return self.__obj.response_code_line - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":311 - * if not self.__obj: - * raise HttpRequestDeleted - * if self.__obj.response_code_line: # <<<<<<<<<<<<<< - * return self.__obj.response_code_line - * - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->response_code_line != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":312 - * raise HttpRequestDeleted - * if self.__obj.response_code_line: - * return self.__obj.response_code_line # <<<<<<<<<<<<<< - * - * property response: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->response_code_line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.response_code_line.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":316 - * property response: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.response_code, self.response_code_line) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_8response___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_8response___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":317 - * - * def __get__(self): - * return (self.response_code, self.response_code_line) # <<<<<<<<<<<<<< - * - * property chunked: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__response_code); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__response_code_line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.response.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":321 - * property chunked: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7chunked___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7chunked___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":322 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return self.__obj.chunked - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":323 - * def __get__(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return self.__obj.chunked - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":324 - * if not self.__obj: - * raise HttpRequestDeleted - * return self.__obj.chunked # <<<<<<<<<<<<<< - * - * property input_buffer: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->chunked); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.chunked.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":328 - * property input_buffer: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if self._input_buffer is not None: - * return self._input_buffer - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_12input_buffer___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_12input_buffer___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":329 - * - * def __get__(self): - * if self._input_buffer is not None: # <<<<<<<<<<<<<< - * return self._input_buffer - * if not self.__obj: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer != Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":330 - * def __get__(self): - * if self._input_buffer is not None: - * return self._input_buffer # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":331 - * if self._input_buffer is not None: - * return self._input_buffer - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * self._input_buffer = buffer(self.__obj.input_buffer) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":332 - * return self._input_buffer - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * self._input_buffer = buffer(self.__obj.input_buffer) - * return self._input_buffer - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":333 - * if not self.__obj: - * raise HttpRequestDeleted - * self._input_buffer = buffer(self.__obj.input_buffer) # <<<<<<<<<<<<<< - * return self._input_buffer - * - */ - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_buffer)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_buffer)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":334 - * raise HttpRequestDeleted - * self._input_buffer = buffer(self.__obj.input_buffer) - * return self._input_buffer # <<<<<<<<<<<<<< - * - * property output_buffer: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.input_buffer.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":338 - * property output_buffer: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if self._output_buffer is not None: - * return self._output_buffer - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13output_buffer___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13output_buffer___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":339 - * - * def __get__(self): - * if self._output_buffer is not None: # <<<<<<<<<<<<<< - * return self._output_buffer - * if not self.__obj: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer != Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":340 - * def __get__(self): - * if self._output_buffer is not None: - * return self._output_buffer # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":341 - * if self._output_buffer is not None: - * return self._output_buffer - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * self._output_buffer = buffer(self.__obj.output_buffer) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":342 - * return self._output_buffer - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * self._output_buffer = buffer(self.__obj.output_buffer) - * return self._output_buffer - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":343 - * if not self.__obj: - * raise HttpRequestDeleted - * self._output_buffer = buffer(self.__obj.output_buffer) # <<<<<<<<<<<<<< - * return self._output_buffer - * - */ - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->output_buffer)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_buffer)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":344 - * raise HttpRequestDeleted - * self._output_buffer = buffer(self.__obj.output_buffer) - * return self._output_buffer # <<<<<<<<<<<<<< - * - * def find_input_header(self, char* key): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_base.output_buffer.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":346 - * return self._output_buffer - * - * def find_input_header(self, char* key): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7find_input_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_7find_input_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { - char *__pyx_v_key; - const char* __pyx_v_val; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("find_input_header"); - assert(__pyx_arg_key); { - __pyx_v_key = PyBytes_AsString(__pyx_arg_key); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.find_input_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":347 - * - * def find_input_header(self, char* key): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":348 - * def find_input_header(self, char* key): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) - * if val: - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":349 - * if not self.__obj: - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) # <<<<<<<<<<<<<< - * if val: - * return val - */ - __pyx_v_val = evhttp_find_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_headers, __pyx_v_key); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":350 - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) - * if val: # <<<<<<<<<<<<<< - * return val - * - */ - __pyx_t_1 = (__pyx_v_val != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":351 - * cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) - * if val: - * return val # <<<<<<<<<<<<<< - * - * def find_output_header(self, char* key): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.find_input_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":353 - * return val - * - * def find_output_header(self, char* key): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_8find_output_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_8find_output_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { - char *__pyx_v_key; - const char* __pyx_v_val; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("find_output_header"); - assert(__pyx_arg_key); { - __pyx_v_key = PyBytes_AsString(__pyx_arg_key); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.find_output_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":354 - * - * def find_output_header(self, char* key): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":355 - * def find_output_header(self, char* key): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) - * if val: - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":356 - * if not self.__obj: - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) # <<<<<<<<<<<<<< - * if val: - * return val - */ - __pyx_v_val = evhttp_find_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->output_headers, __pyx_v_key); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":357 - * raise HttpRequestDeleted - * cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) - * if val: # <<<<<<<<<<<<<< - * return val - * - */ - __pyx_t_1 = (__pyx_v_val != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":358 - * cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) - * if val: - * return val # <<<<<<<<<<<<<< - * - * def add_input_header(self, char* key, char* value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.find_output_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":360 - * return val - * - * def add_input_header(self, char* key, char* value): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_9add_input_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_9add_input_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_key; - char *__pyx_v_value; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0}; - __Pyx_RefNannySetupContext("add_input_header"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_input_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_input_header") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_key = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_value) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_key = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_value) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_input_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.add_input_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":361 - * - * def add_input_header(self, char* key, char* value): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.input_headers, key, value): - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":362 - * def add_input_header(self, char* key, char* value): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * if evhttp_add_header(self.__obj.input_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":363 - * if not self.__obj: - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.input_headers, key, value): # <<<<<<<<<<<<<< - * raise RuntimeError('Internal error in evhttp_add_header') - * - */ - __pyx_t_3 = evhttp_add_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_headers, __pyx_v_key, __pyx_v_value); - if (__pyx_t_3) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":364 - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.input_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') # <<<<<<<<<<<<<< - * - * def add_output_header(self, char* key, char* value): - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.add_input_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":366 - * raise RuntimeError('Internal error in evhttp_add_header') - * - * def add_output_header(self, char* key, char* value): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_10add_output_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_10add_output_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_key; - char *__pyx_v_value; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0}; - __Pyx_RefNannySetupContext("add_output_header"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_output_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_output_header") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_key = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_value) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_key = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_value) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_output_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.add_output_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":367 - * - * def add_output_header(self, char* key, char* value): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.output_headers, key, value): - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":368 - * def add_output_header(self, char* key, char* value): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * if evhttp_add_header(self.__obj.output_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":369 - * if not self.__obj: - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.output_headers, key, value): # <<<<<<<<<<<<<< - * raise RuntimeError('Internal error in evhttp_add_header') - * - */ - __pyx_t_3 = evhttp_add_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->output_headers, __pyx_v_key, __pyx_v_value); - if (__pyx_t_3) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":370 - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.output_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') # <<<<<<<<<<<<<< - * - * def remove_input_header(self, char* key): - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.add_output_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":372 - * raise RuntimeError('Internal error in evhttp_add_header') - * - * def remove_input_header(self, char* key): # <<<<<<<<<<<<<< - * """Return True if header was found and removed""" - * if not self.__obj: - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remove_input_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ -static char __pyx_doc_6gevent_4core_17http_request_base_11remove_input_header[] = "Return True if header was found and removed"; -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_11remove_input_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { - char *__pyx_v_key; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("remove_input_header"); - assert(__pyx_arg_key); { - __pyx_v_key = PyBytes_AsString(__pyx_arg_key); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.remove_input_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":374 - * def remove_input_header(self, char* key): - * """Return True if header was found and removed""" - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return True if 0 == evhttp_remove_header(self.__obj.input_headers, key) else False - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":375 - * """Return True if header was found and removed""" - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return True if 0 == evhttp_remove_header(self.__obj.input_headers, key) else False - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":376 - * if not self.__obj: - * raise HttpRequestDeleted - * return True if 0 == evhttp_remove_header(self.__obj.input_headers, key) else False # <<<<<<<<<<<<<< - * - * def remove_output_header(self, char* key): - */ - __Pyx_XDECREF(__pyx_r); - if ((0 == evhttp_remove_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_headers, __pyx_v_key))) { - __pyx_t_1 = 1; - } else { - __pyx_t_1 = 0; - } - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.remove_input_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":378 - * return True if 0 == evhttp_remove_header(self.__obj.input_headers, key) else False - * - * def remove_output_header(self, char* key): # <<<<<<<<<<<<<< - * """Return True if header was found and removed""" - * if not self.__obj: - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_12remove_output_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ -static char __pyx_doc_6gevent_4core_17http_request_base_12remove_output_header[] = "Return True if header was found and removed"; -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_12remove_output_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { - char *__pyx_v_key; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("remove_output_header"); - assert(__pyx_arg_key); { - __pyx_v_key = PyBytes_AsString(__pyx_arg_key); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_base.remove_output_header"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":380 - * def remove_output_header(self, char* key): - * """Return True if header was found and removed""" - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * return True if 0 == evhttp_remove_header(self.__obj.output_headers, key) else False - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":381 - * """Return True if header was found and removed""" - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * return True if 0 == evhttp_remove_header(self.__obj.output_headers, key) else False - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":382 - * if not self.__obj: - * raise HttpRequestDeleted - * return True if 0 == evhttp_remove_header(self.__obj.output_headers, key) else False # <<<<<<<<<<<<<< - * - * def clear_input_headers(self): - */ - __Pyx_XDECREF(__pyx_r); - if ((0 == evhttp_remove_header(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->output_headers, __pyx_v_key))) { - __pyx_t_1 = 1; - } else { - __pyx_t_1 = 0; - } - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.remove_output_header"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":384 - * return True if 0 == evhttp_remove_header(self.__obj.output_headers, key) else False - * - * def clear_input_headers(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13clear_input_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13clear_input_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("clear_input_headers"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":385 - * - * def clear_input_headers(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * evhttp_clear_headers(self.__obj.input_headers) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":386 - * def clear_input_headers(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * evhttp_clear_headers(self.__obj.input_headers) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":387 - * if not self.__obj: - * raise HttpRequestDeleted - * evhttp_clear_headers(self.__obj.input_headers) # <<<<<<<<<<<<<< - * - * def clear_output_headers(self): - */ - evhttp_clear_headers(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->input_headers); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.clear_input_headers"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":389 - * evhttp_clear_headers(self.__obj.input_headers) - * - * def clear_output_headers(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_14clear_output_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_14clear_output_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("clear_output_headers"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":390 - * - * def clear_output_headers(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * evhttp_clear_headers(self.__obj.output_headers) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":391 - * def clear_output_headers(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * evhttp_clear_headers(self.__obj.output_headers) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":392 - * if not self.__obj: - * raise HttpRequestDeleted - * evhttp_clear_headers(self.__obj.output_headers) # <<<<<<<<<<<<<< - * - * - */ - evhttp_clear_headers(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->__pyx___obj->output_headers); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_base.clear_output_headers"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":152 - * cdef object __weakref__ - * cdef evhttp_request* __obj - * cdef public object _input_buffer # <<<<<<<<<<<<<< - * cdef public object _output_buffer - * - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13_input_buffer___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_13_input_buffer___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_input_buffer = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":153 - * cdef evhttp_request* __obj - * cdef public object _input_buffer - * cdef public object _output_buffer # <<<<<<<<<<<<<< - * - * def __init__(self, size_t obj): - */ - -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_14_output_buffer___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_17http_request_base_14_output_buffer___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer); - ((struct __pyx_obj_6gevent_4core_http_request_base *)__pyx_v_self)->_output_buffer = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":403 - * cdef public object default_response_headers - * - * def __init__(self, size_t obj, object default_response_headers=[]): # <<<<<<<<<<<<<< - * http_request_base.__init__(self, obj) - * self.default_response_headers = default_response_headers - */ - -static int __pyx_pf_6gevent_4core_12http_request___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_12http_request___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - size_t __pyx_v_obj; - PyObject *__pyx_v_default_response_headers = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s_32,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - values[1] = __pyx_k_33; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_32); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_obj = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_default_response_headers = values[1]; - } else { - __pyx_v_default_response_headers = __pyx_k_33; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_default_response_headers = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_obj = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":404 - * - * def __init__(self, size_t obj, object default_response_headers=[]): - * http_request_base.__init__(self, obj) # <<<<<<<<<<<<<< - * self.default_response_headers = default_response_headers - * - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_http_request_base)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":405 - * def __init__(self, size_t obj, object default_response_headers=[]): - * http_request_base.__init__(self, obj) - * self.default_response_headers = default_response_headers # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __Pyx_INCREF(__pyx_v_default_response_headers); - __Pyx_GIVEREF(__pyx_v_default_response_headers); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers = __pyx_v_default_response_headers; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":407 - * self.default_response_headers = default_response_headers - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: - */ - -static void __pyx_pf_6gevent_4core_12http_request_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_6gevent_4core_12http_request_1__dealloc__(PyObject *__pyx_v_self) { - struct evhttp_request *__pyx_v_obj; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":408 - * - * def __dealloc__(self): - * cdef evhttp_request* obj = self.__obj # <<<<<<<<<<<<<< - * if obj != NULL: - * self.detach() - */ - __pyx_v_obj = ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":409 - * def __dealloc__(self): - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: # <<<<<<<<<<<<<< - * self.detach() - * report_internal_error(obj) - */ - __pyx_t_1 = (__pyx_v_obj != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":410 - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: - * self.detach() # <<<<<<<<<<<<<< - * report_internal_error(obj) - * - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":411 - * if obj != NULL: - * self.detach() - * report_internal_error(obj) # <<<<<<<<<<<<<< - * - * def _add_default_response_headers(self): - */ - __pyx_f_6gevent_4core_report_internal_error(__pyx_v_obj); - goto __pyx_L5; - } - __pyx_L5:; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.__dealloc__"); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":413 - * report_internal_error(obj) - * - * def _add_default_response_headers(self): # <<<<<<<<<<<<<< - * for key, value in self.default_response_headers: - * if not self.find_output_header(key): - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_2_add_default_response_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_2_add_default_response_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_key; - PyObject *__pyx_v_value; - PyObject *__pyx_r = NULL; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - __Pyx_RefNannySetupContext("_add_default_response_headers"); - __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":414 - * - * def _add_default_response_headers(self): - * for key, value in self.default_response_headers: # <<<<<<<<<<<<<< - * if not self.find_output_header(key): - * self.add_output_header(key, value) - */ - if (PyList_CheckExact(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers) || PyTuple_CheckExact(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers)) { - __pyx_t_1 = 0; __pyx_t_2 = ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers; __Pyx_INCREF(__pyx_t_2); - } else { - __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - } - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_2); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { - PyObject* tuple = __pyx_t_3; - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_t_5; - __pyx_t_5 = 0; - } else { - __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_t_5; - __pyx_t_5 = 0; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":415 - * def _add_default_response_headers(self): - * for key, value in self.default_response_headers: - * if not self.find_output_header(key): # <<<<<<<<<<<<<< - * self.add_output_header(key, value) - * - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__find_output_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = (!__pyx_t_7); - if (__pyx_t_8) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":416 - * for key, value in self.default_response_headers: - * if not self.find_output_header(key): - * self.add_output_header(key, value) # <<<<<<<<<<<<<< - * - * def send_reply(self, int code, char *reason, object buf): - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_output_header); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - __Pyx_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7; - } - __pyx_L7:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("gevent.core.http_request._add_default_response_headers"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_key); - __Pyx_DECREF(__pyx_v_value); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":418 - * self.add_output_header(key, value) - * - * def send_reply(self, int code, char *reason, object buf): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_3send_reply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_3send_reply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_code; - char *__pyx_v_reason; - PyObject *__pyx_v_buf = 0; - struct evbuffer *__pyx_v_c_buf; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - char *__pyx_t_5; - Py_ssize_t __pyx_t_6; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__code,&__pyx_n_s__reason,&__pyx_n_s__buf,0}; - __Pyx_RefNannySetupContext("send_reply"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__code); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reason); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("send_reply", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buf); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("send_reply", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_reply") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_code = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_buf = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_code = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_buf = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("send_reply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request.send_reply"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":419 - * - * def send_reply(self, int code, char *reason, object buf): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * cdef evbuffer* c_buf - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":420 - * def send_reply(self, int code, char *reason, object buf): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":422 - * raise HttpRequestDeleted - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): # <<<<<<<<<<<<<< - * self._add_default_response_headers() - * evhttp_send_reply(self.__obj, code, reason, (buf).__obj) - */ - __pyx_t_2 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_buffer)); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_2, __pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":423 - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): - * self._add_default_response_headers() # <<<<<<<<<<<<<< - * evhttp_send_reply(self.__obj, code, reason, (buf).__obj) - * elif isinstance(buf, str): - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_34); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":424 - * if isinstance(buf, buffer): - * self._add_default_response_headers() - * evhttp_send_reply(self.__obj, code, reason, (buf).__obj) # <<<<<<<<<<<<<< - * elif isinstance(buf, str): - * self._add_default_response_headers() - */ - evhttp_send_reply(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, __pyx_v_code, __pyx_v_reason, ((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_buf)->__pyx___obj); - goto __pyx_L7; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":425 - * self._add_default_response_headers() - * evhttp_send_reply(self.__obj, code, reason, (buf).__obj) - * elif isinstance(buf, str): # <<<<<<<<<<<<<< - * self._add_default_response_headers() - * c_buf = evbuffer_new() - */ - __pyx_t_2 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)((PyObject*)(&PyString_Type))); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_2, __pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":426 - * evhttp_send_reply(self.__obj, code, reason, (buf).__obj) - * elif isinstance(buf, str): - * self._add_default_response_headers() # <<<<<<<<<<<<<< - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_34); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":427 - * elif isinstance(buf, str): - * self._add_default_response_headers() - * c_buf = evbuffer_new() # <<<<<<<<<<<<<< - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply(self.__obj, code, reason, c_buf) - */ - __pyx_v_c_buf = evbuffer_new(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":428 - * self._add_default_response_headers() - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) # <<<<<<<<<<<<<< - * evhttp_send_reply(self.__obj, code, reason, c_buf) - * evbuffer_free(c_buf) - */ - __pyx_t_4 = PyBytes_AsString(__pyx_v_buf); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_t_4; - __pyx_t_2 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - evbuffer_add(__pyx_v_c_buf, __pyx_t_5, __pyx_t_6); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":429 - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply(self.__obj, code, reason, c_buf) # <<<<<<<<<<<<<< - * evbuffer_free(c_buf) - * else: - */ - evhttp_send_reply(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, __pyx_v_code, __pyx_v_reason, __pyx_v_c_buf); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":430 - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply(self.__obj, code, reason, c_buf) - * evbuffer_free(c_buf) # <<<<<<<<<<<<<< - * else: - * raise TypeError('Expected str or buffer: %r' % (buf, )) - */ - evbuffer_free(__pyx_v_c_buf); - goto __pyx_L7; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":432 - * evbuffer_free(c_buf) - * else: - * raise TypeError('Expected str or buffer: %r' % (buf, )) # <<<<<<<<<<<<<< - * - * def send_reply_start(self, int code, char *reason): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_v_buf); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_buf); - __Pyx_GIVEREF(__pyx_v_buf); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L7:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.send_reply"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":434 - * raise TypeError('Expected str or buffer: %r' % (buf, )) - * - * def send_reply_start(self, int code, char *reason): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_4send_reply_start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_4send_reply_start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_code; - char *__pyx_v_reason; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__code,&__pyx_n_s__reason,0}; - __Pyx_RefNannySetupContext("send_reply_start"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__code); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reason); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("send_reply_start", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_reply_start") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_code = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_code = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("send_reply_start", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request.send_reply_start"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":435 - * - * def send_reply_start(self, int code, char *reason): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * self._add_default_response_headers() - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":436 - * def send_reply_start(self, int code, char *reason): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * self._add_default_response_headers() - * evhttp_send_reply_start(self.__obj, code, reason) - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":437 - * if not self.__obj: - * raise HttpRequestDeleted - * self._add_default_response_headers() # <<<<<<<<<<<<<< - * evhttp_send_reply_start(self.__obj, code, reason) - * - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":438 - * raise HttpRequestDeleted - * self._add_default_response_headers() - * evhttp_send_reply_start(self.__obj, code, reason) # <<<<<<<<<<<<<< - * - * def send_reply_chunk(self, object buf): - */ - evhttp_send_reply_start(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, __pyx_v_code, __pyx_v_reason); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.send_reply_start"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":440 - * evhttp_send_reply_start(self.__obj, code, reason) - * - * def send_reply_chunk(self, object buf): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_5send_reply_chunk(PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_5send_reply_chunk(PyObject *__pyx_v_self, PyObject *__pyx_v_buf) { - struct evbuffer *__pyx_v_c_buf; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - char *__pyx_t_5; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("send_reply_chunk"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":441 - * - * def send_reply_chunk(self, object buf): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * cdef evbuffer* c_buf - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":442 - * def send_reply_chunk(self, object buf): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":444 - * raise HttpRequestDeleted - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): # <<<<<<<<<<<<<< - * evhttp_send_reply_chunk(self.__obj, (buf).__obj) - * elif isinstance(buf, str): - */ - __pyx_t_2 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_buffer)); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_2, __pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":445 - * cdef evbuffer* c_buf - * if isinstance(buf, buffer): - * evhttp_send_reply_chunk(self.__obj, (buf).__obj) # <<<<<<<<<<<<<< - * elif isinstance(buf, str): - * c_buf = evbuffer_new() - */ - evhttp_send_reply_chunk(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, ((struct __pyx_obj_6gevent_4core_buffer *)__pyx_v_buf)->__pyx___obj); - goto __pyx_L6; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":446 - * if isinstance(buf, buffer): - * evhttp_send_reply_chunk(self.__obj, (buf).__obj) - * elif isinstance(buf, str): # <<<<<<<<<<<<<< - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) - */ - __pyx_t_3 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_2 = ((PyObject *)((PyObject*)(&PyString_Type))); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_3, __pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":447 - * evhttp_send_reply_chunk(self.__obj, (buf).__obj) - * elif isinstance(buf, str): - * c_buf = evbuffer_new() # <<<<<<<<<<<<<< - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply_chunk(self.__obj, c_buf) - */ - __pyx_v_c_buf = evbuffer_new(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":448 - * elif isinstance(buf, str): - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) # <<<<<<<<<<<<<< - * evhttp_send_reply_chunk(self.__obj, c_buf) - * evbuffer_free(c_buf) - */ - __pyx_t_4 = PyBytes_AsString(__pyx_v_buf); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_t_4; - __pyx_t_2 = __pyx_v_buf; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - evbuffer_add(__pyx_v_c_buf, __pyx_t_5, __pyx_t_6); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":449 - * c_buf = evbuffer_new() - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply_chunk(self.__obj, c_buf) # <<<<<<<<<<<<<< - * evbuffer_free(c_buf) - * else: - */ - evhttp_send_reply_chunk(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, __pyx_v_c_buf); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":450 - * evbuffer_add(c_buf, buf, len(buf)) - * evhttp_send_reply_chunk(self.__obj, c_buf) - * evbuffer_free(c_buf) # <<<<<<<<<<<<<< - * else: - * raise TypeError('Expected str or buffer: %r' % (buf, )) - */ - evbuffer_free(__pyx_v_c_buf); - goto __pyx_L6; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":452 - * evbuffer_free(c_buf) - * else: - * raise TypeError('Expected str or buffer: %r' % (buf, )) # <<<<<<<<<<<<<< - * - * def send_reply_end(self): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_v_buf); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_buf); - __Pyx_GIVEREF(__pyx_v_buf); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.send_reply_chunk"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":454 - * raise TypeError('Expected str or buffer: %r' % (buf, )) - * - * def send_reply_end(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_6send_reply_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_6send_reply_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("send_reply_end"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":455 - * - * def send_reply_end(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * evhttp_send_reply_end(self.__obj) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":456 - * def send_reply_end(self): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * evhttp_send_reply_end(self.__obj) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":457 - * if not self.__obj: - * raise HttpRequestDeleted - * evhttp_send_reply_end(self.__obj) # <<<<<<<<<<<<<< - * - * def send_error(self, int code, char* reason): - */ - evhttp_send_reply_end(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request.send_reply_end"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":459 - * evhttp_send_reply_end(self.__obj) - * - * def send_error(self, int code, char* reason): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpRequestDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_7send_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_7send_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_code; - char *__pyx_v_reason; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__code,&__pyx_n_s__reason,0}; - __Pyx_RefNannySetupContext("send_error"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__code); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reason); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("send_error", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_error") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_code = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_code = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reason = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_reason) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("send_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request.send_error"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":460 - * - * def send_error(self, int code, char* reason): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpRequestDeleted - * self._add_default_response_headers() - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":461 - * def send_error(self, int code, char* reason): - * if not self.__obj: - * raise HttpRequestDeleted # <<<<<<<<<<<<<< - * self._add_default_response_headers() - * evhttp_send_error(self.__obj, code, reason) - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HttpRequestDeleted); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":462 - * if not self.__obj: - * raise HttpRequestDeleted - * self._add_default_response_headers() # <<<<<<<<<<<<<< - * evhttp_send_error(self.__obj, code, reason) - * - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":463 - * raise HttpRequestDeleted - * self._add_default_response_headers() - * evhttp_send_error(self.__obj, code, reason) # <<<<<<<<<<<<<< - * - * - */ - evhttp_send_error(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->__pyx_base.__pyx___obj, __pyx_v_code, __pyx_v_reason); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request.send_error"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":401 - * # prefer gevent.http and gevent.wsgi which should be safe - * - * cdef public object default_response_headers # <<<<<<<<<<<<<< - * - * def __init__(self, size_t obj, object default_response_headers=[]): - */ - -static PyObject *__pyx_pf_6gevent_4core_12http_request_24default_response_headers___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_12http_request_24default_response_headers___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_12http_request_24default_response_headers_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_12http_request_24default_response_headers_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_12http_request_24default_response_headers_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_12http_request_24default_response_headers_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_v_self)->default_response_headers = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":473 - * cdef int _incref - * - * def __init__(self, object callback=None, size_t obj=0): # <<<<<<<<<<<<<< - * self._incref = 0 - * self.callback = callback - */ - -static int __pyx_pf_6gevent_4core_19http_request_client___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_19http_request_client___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_callback = 0; - size_t __pyx_v_obj; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__obj,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - values[0] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_callback = values[0]; - if (values[1]) { - __pyx_v_obj = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_obj = ((size_t)0); - } - } else { - __pyx_v_callback = ((PyObject *)Py_None); - __pyx_v_obj = ((size_t)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_obj = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_request_client.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":474 - * - * def __init__(self, object callback=None, size_t obj=0): - * self._incref = 0 # <<<<<<<<<<<<<< - * self.callback = callback - * if obj: - */ - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_incref = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":475 - * def __init__(self, object callback=None, size_t obj=0): - * self._incref = 0 - * self.callback = callback # <<<<<<<<<<<<<< - * if obj: - * self.__obj = obj - */ - __Pyx_INCREF(__pyx_v_callback); - __Pyx_GIVEREF(__pyx_v_callback); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback = __pyx_v_callback; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":476 - * self._incref = 0 - * self.callback = callback - * if obj: # <<<<<<<<<<<<<< - * self.__obj = obj - * self._owned = 0 - */ - if (__pyx_v_obj) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":477 - * self.callback = callback - * if obj: - * self.__obj = obj # <<<<<<<<<<<<<< - * self._owned = 0 - * else: - */ - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->__pyx_base.__pyx___obj = ((struct evhttp_request *)__pyx_v_obj); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":478 - * if obj: - * self.__obj = obj - * self._owned = 0 # <<<<<<<<<<<<<< - * else: - * self.__obj = evhttp_request_new(_http_request_cb_handler, self) - */ - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_owned = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":480 - * self._owned = 0 - * else: - * self.__obj = evhttp_request_new(_http_request_cb_handler, self) # <<<<<<<<<<<<<< - * if not self.__obj: - * raise IOError('evhttp_request_new() failed') - */ - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->__pyx_base.__pyx___obj = evhttp_request_new(__pyx_f_6gevent_4core__http_request_cb_handler, ((void *)__pyx_v_self)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":481 - * else: - * self.__obj = evhttp_request_new(_http_request_cb_handler, self) - * if not self.__obj: # <<<<<<<<<<<<<< - * raise IOError('evhttp_request_new() failed') - * self._owned = 1 - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->__pyx_base.__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":482 - * self.__obj = evhttp_request_new(_http_request_cb_handler, self) - * if not self.__obj: - * raise IOError('evhttp_request_new() failed') # <<<<<<<<<<<<<< - * self._owned = 1 - * self._addref() - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":483 - * if not self.__obj: - * raise IOError('evhttp_request_new() failed') - * self._owned = 1 # <<<<<<<<<<<<<< - * self._addref() - * - */ - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_owned = 1; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":484 - * raise IOError('evhttp_request_new() failed') - * self._owned = 1 - * self._addref() # <<<<<<<<<<<<<< - * - * cdef _addref(self): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_4core_http_request_client *)((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->__pyx_vtab)->_addref(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L6:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_request_client.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":486 - * self._addref() - * - * cdef _addref(self): # <<<<<<<<<<<<<< - * if self._incref <= 0: - * Py_INCREF(self) - */ - -static PyObject *__pyx_f_6gevent_4core_19http_request_client__addref(struct __pyx_obj_6gevent_4core_http_request_client *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("_addref"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":487 - * - * cdef _addref(self): - * if self._incref <= 0: # <<<<<<<<<<<<<< - * Py_INCREF(self) - * self._incref += 1 - */ - __pyx_t_1 = (__pyx_v_self->_incref <= 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":488 - * cdef _addref(self): - * if self._incref <= 0: - * Py_INCREF(self) # <<<<<<<<<<<<<< - * self._incref += 1 - * - */ - Py_INCREF(((PyObject*)__pyx_v_self)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":489 - * if self._incref <= 0: - * Py_INCREF(self) - * self._incref += 1 # <<<<<<<<<<<<<< - * - * cdef _delref(self): - */ - __pyx_v_self->_incref = (__pyx_v_self->_incref + 1); - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":491 - * self._incref += 1 - * - * cdef _delref(self): # <<<<<<<<<<<<<< - * if self._incref > 0: - * Py_DECREF(self) - */ - -static PyObject *__pyx_f_6gevent_4core_19http_request_client__delref(struct __pyx_obj_6gevent_4core_http_request_client *__pyx_v_self) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("_delref"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":492 - * - * cdef _delref(self): - * if self._incref > 0: # <<<<<<<<<<<<<< - * Py_DECREF(self) - * self._incref -= 1 - */ - __pyx_t_1 = (__pyx_v_self->_incref > 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":493 - * cdef _delref(self): - * if self._incref > 0: - * Py_DECREF(self) # <<<<<<<<<<<<<< - * self._incref -= 1 - * self.callback = None - */ - Py_DECREF(((PyObject*)__pyx_v_self)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":494 - * if self._incref > 0: - * Py_DECREF(self) - * self._incref -= 1 # <<<<<<<<<<<<<< - * self.callback = None - * - */ - __pyx_v_self->_incref = (__pyx_v_self->_incref - 1); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":495 - * Py_DECREF(self) - * self._incref -= 1 - * self.callback = None # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->callback); - __Pyx_DECREF(__pyx_v_self->callback); - __pyx_v_self->callback = Py_None; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":497 - * self.callback = None - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: - */ - -static void __pyx_pf_6gevent_4core_19http_request_client_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_6gevent_4core_19http_request_client_1__dealloc__(PyObject *__pyx_v_self) { - struct evhttp_request *__pyx_v_obj; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":498 - * - * def __dealloc__(self): - * cdef evhttp_request* obj = self.__obj # <<<<<<<<<<<<<< - * if obj != NULL: - * self.detach() - */ - __pyx_v_obj = ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->__pyx_base.__pyx___obj; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":499 - * def __dealloc__(self): - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: # <<<<<<<<<<<<<< - * self.detach() - * if self._owned: - */ - __pyx_t_1 = (__pyx_v_obj != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":500 - * cdef evhttp_request* obj = self.__obj - * if obj != NULL: - * self.detach() # <<<<<<<<<<<<<< - * if self._owned: - * evhttp_request_free(obj) - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":501 - * if obj != NULL: - * self.detach() - * if self._owned: # <<<<<<<<<<<<<< - * evhttp_request_free(obj) - * - */ - if (((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_owned) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":502 - * self.detach() - * if self._owned: - * evhttp_request_free(obj) # <<<<<<<<<<<<<< - * - * - */ - evhttp_request_free(__pyx_v_obj); - goto __pyx_L6; - } - __pyx_L6:; - goto __pyx_L5; - } - __pyx_L5:; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_request_client.__dealloc__"); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":469 - * """Wrapper around libevent's :class:`evhttp_request` structure.""" - * - * cdef public int _owned # <<<<<<<<<<<<<< - * cdef public callback - * cdef int _incref - */ - -static PyObject *__pyx_pf_6gevent_4core_19http_request_client_6_owned___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_19http_request_client_6_owned___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_owned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.http_request_client._owned.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_19http_request_client_6_owned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_19http_request_client_6_owned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->_owned = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("gevent.core.http_request_client._owned.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":470 - * - * cdef public int _owned - * cdef public callback # <<<<<<<<<<<<<< - * cdef int _incref - * - */ - -static PyObject *__pyx_pf_6gevent_4core_19http_request_client_8callback___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_19http_request_client_8callback___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_19http_request_client_8callback_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_19http_request_client_8callback_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_19http_request_client_8callback_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_19http_request_client_8callback_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback); - ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_self)->callback = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":510 - * cdef public int _owned - * - * def __init__(self, size_t obj, owned=0): # <<<<<<<<<<<<<< - * self.__obj = obj - * self._owned = owned - */ - -static int __pyx_pf_6gevent_4core_15http_connection___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_15http_connection___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - size_t __pyx_v_obj; - PyObject *__pyx_v_owned = 0; - int __pyx_r; - int __pyx_t_1; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__owned,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)__pyx_int_0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__owned); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_obj = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_owned = values[1]; - } else { - __pyx_v_owned = ((PyObject *)__pyx_int_0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_owned = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_obj = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_obj == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":511 - * - * def __init__(self, size_t obj, owned=0): - * self.__obj = obj # <<<<<<<<<<<<<< - * self._owned = owned - * - */ - ((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj = ((struct evhttp_connection *)__pyx_v_obj); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":512 - * def __init__(self, size_t obj, owned=0): - * self.__obj = obj - * self._owned = owned # <<<<<<<<<<<<<< - * - * @classmethod - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_owned); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->_owned = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("gevent.core.http_connection.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":515 - * - * @classmethod - * def new(cls, char* address, unsigned short port): # <<<<<<<<<<<<<< - * cdef void* ptr = evhttp_connection_new(address, port) - * if ptr != NULL: - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_1new(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_1new(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_address; - unsigned short __pyx_v_port; - void *__pyx_v_ptr; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__address,&__pyx_n_s__port,0}; - __Pyx_RefNannySetupContext("new"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__address); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("new", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "new") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_address = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_address) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_port = __Pyx_PyInt_AsUnsignedShort(values[1]); if (unlikely((__pyx_v_port == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_address = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_address) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_port = __Pyx_PyInt_AsUnsignedShort(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_port == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("new", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.new"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":516 - * @classmethod - * def new(cls, char* address, unsigned short port): - * cdef void* ptr = evhttp_connection_new(address, port) # <<<<<<<<<<<<<< - * if ptr != NULL: - * return cls(ptr, 1) - */ - __pyx_v_ptr = evhttp_connection_new(__pyx_v_address, __pyx_v_port); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":517 - * def new(cls, char* address, unsigned short port): - * cdef void* ptr = evhttp_connection_new(address, port) - * if ptr != NULL: # <<<<<<<<<<<<<< - * return cls(ptr, 1) - * - */ - __pyx_t_1 = (__pyx_v_ptr != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":518 - * cdef void* ptr = evhttp_connection_new(address, port) - * if ptr != NULL: - * return cls(ptr, 1) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_v_cls, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_connection.new"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":520 - * return cls(ptr, 1) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef evhttp_connection* obj = self.__obj - * if obj != NULL: - */ - -static void __pyx_pf_6gevent_4core_15http_connection_2__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_6gevent_4core_15http_connection_2__dealloc__(PyObject *__pyx_v_self) { - struct evhttp_connection *__pyx_v_obj; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":521 - * - * def __dealloc__(self): - * cdef evhttp_connection* obj = self.__obj # <<<<<<<<<<<<<< - * if obj != NULL: - * self.__obj = NULL - */ - __pyx_v_obj = ((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":522 - * def __dealloc__(self): - * cdef evhttp_connection* obj = self.__obj - * if obj != NULL: # <<<<<<<<<<<<<< - * self.__obj = NULL - * if self._owned: - */ - __pyx_t_1 = (__pyx_v_obj != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":523 - * cdef evhttp_connection* obj = self.__obj - * if obj != NULL: - * self.__obj = NULL # <<<<<<<<<<<<<< - * if self._owned: - * evhttp_connection_free(obj) - */ - ((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj = NULL; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":524 - * if obj != NULL: - * self.__obj = NULL - * if self._owned: # <<<<<<<<<<<<<< - * evhttp_connection_free(obj) - * - */ - if (((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->_owned) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":525 - * self.__obj = NULL - * if self._owned: - * evhttp_connection_free(obj) # <<<<<<<<<<<<<< - * - * property _obj: - */ - evhttp_connection_free(__pyx_v_obj); - goto __pyx_L6; - } - __pyx_L6:; - goto __pyx_L5; - } - __pyx_L5:; - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":529 - * property _obj: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.__obj) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4_obj___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4_obj___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":530 - * - * def __get__(self): - * return (self.__obj) # <<<<<<<<<<<<<< - * - * def __nonzero__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.http_connection._obj.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":532 - * return (self.__obj) - * - * def __nonzero__(self): # <<<<<<<<<<<<<< - * if self.__obj: - * return True - */ - -static int __pyx_pf_6gevent_4core_15http_connection_3__nonzero__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_15http_connection_3__nonzero__(PyObject *__pyx_v_self) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__nonzero__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":533 - * - * def __nonzero__(self): - * if self.__obj: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":534 - * def __nonzero__(self): - * if self.__obj: - * return True # <<<<<<<<<<<<<< - * else: - * return False - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":536 - * return True - * else: - * return False # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_r = 0; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":538 - * return False - * - * def __str__(self): # <<<<<<<<<<<<<< - * try: - * peer = self.peer - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_peer; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__str__"); - __pyx_v_peer = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":539 - * - * def __str__(self): - * try: # <<<<<<<<<<<<<< - * peer = self.peer - * except HttpConnectionDeleted: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":540 - * def __str__(self): - * try: - * peer = self.peer # <<<<<<<<<<<<<< - * except HttpConnectionDeleted: - * peer = 'deleted' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__peer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_peer); - __pyx_v_peer = __pyx_t_1; - __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L12_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":541 - * try: - * peer = self.peer - * except HttpConnectionDeleted: # <<<<<<<<<<<<<< - * peer = 'deleted' - * return '<%s %s>' % (self.__class__.__name__, peer) - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyErr_ExceptionMatches(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - __Pyx_AddTraceback("gevent.core.http_connection.__str__"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":542 - * peer = self.peer - * except HttpConnectionDeleted: - * peer = 'deleted' # <<<<<<<<<<<<<< - * return '<%s %s>' % (self.__class__.__name__, peer) - * - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s__deleted)); - __Pyx_DECREF(__pyx_v_peer); - __pyx_v_peer = ((PyObject *)__pyx_n_s__deleted); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6_exception_handled; - } - __pyx_L7_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L6_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L12_try_end:; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":543 - * except HttpConnectionDeleted: - * peer = 'deleted' - * return '<%s %s>' % (self.__class__.__name__, peer) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____name__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_peer); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_peer); - __Pyx_GIVEREF(__pyx_v_peer); - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.http_connection.__str__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_peer); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":545 - * return '<%s %s>' % (self.__class__.__name__, peer) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * try: - * peer = ' %s' % (self.peer, ) - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_5__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_5__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_peer; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__repr__"); - __pyx_v_peer = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":546 - * - * def __repr__(self): - * try: # <<<<<<<<<<<<<< - * peer = ' %s' % (self.peer, ) - * except HttpConnectionDeleted: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":547 - * def __repr__(self): - * try: - * peer = ' %s' % (self.peer, ) # <<<<<<<<<<<<<< - * except HttpConnectionDeleted: - * peer = '' - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__peer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_peer); - __pyx_v_peer = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L12_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":548 - * try: - * peer = ' %s' % (self.peer, ) - * except HttpConnectionDeleted: # <<<<<<<<<<<<<< - * peer = '' - * return '<%s _obj=0x%x%s>' % (self.__class__.__name__, self._obj, peer) - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyErr_ExceptionMatches(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - __Pyx_AddTraceback("gevent.core.http_connection.__repr__"); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":549 - * peer = ' %s' % (self.peer, ) - * except HttpConnectionDeleted: - * peer = '' # <<<<<<<<<<<<<< - * return '<%s _obj=0x%x%s>' % (self.__class__.__name__, self._obj, peer) - * - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_DECREF(__pyx_v_peer); - __pyx_v_peer = ((PyObject *)__pyx_kp_s_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6_exception_handled; - } - __pyx_L7_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L6_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L12_try_end:; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":550 - * except HttpConnectionDeleted: - * peer = '' - * return '<%s _obj=0x%x%s>' % (self.__class__.__name__, self._obj, peer) # <<<<<<<<<<<<<< - * - * property peer: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___obj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_peer); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_peer); - __Pyx_GIVEREF(__pyx_v_peer); - __pyx_t_2 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.http_connection.__repr__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_peer); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":554 - * property peer: - * - * def __get__(self): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpConnectionDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4peer___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_4peer___get__(PyObject *__pyx_v_self) { - char *__pyx_v_address; - ev_uint16_t __pyx_v_port; - PyObject *__pyx_v_addr; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __pyx_v_addr = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":555 - * - * def __get__(self): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpConnectionDeleted - * cdef char* address = NULL - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":556 - * def __get__(self): - * if not self.__obj: - * raise HttpConnectionDeleted # <<<<<<<<<<<<<< - * cdef char* address = NULL - * cdef ev_uint16_t port = 0 - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":557 - * if not self.__obj: - * raise HttpConnectionDeleted - * cdef char* address = NULL # <<<<<<<<<<<<<< - * cdef ev_uint16_t port = 0 - * evhttp_connection_get_peer(self.__obj, &address, &port) - */ - __pyx_v_address = NULL; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":558 - * raise HttpConnectionDeleted - * cdef char* address = NULL - * cdef ev_uint16_t port = 0 # <<<<<<<<<<<<<< - * evhttp_connection_get_peer(self.__obj, &address, &port) - * if address: - */ - __pyx_v_port = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":559 - * cdef char* address = NULL - * cdef ev_uint16_t port = 0 - * evhttp_connection_get_peer(self.__obj, &address, &port) # <<<<<<<<<<<<<< - * if address: - * addr = address - */ - evhttp_connection_get_peer(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj, (&__pyx_v_address), (&__pyx_v_port)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":560 - * cdef ev_uint16_t port = 0 - * evhttp_connection_get_peer(self.__obj, &address, &port) - * if address: # <<<<<<<<<<<<<< - * addr = address - * else: - */ - __pyx_t_1 = (__pyx_v_address != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":561 - * evhttp_connection_get_peer(self.__obj, &address, &port) - * if address: - * addr = address # <<<<<<<<<<<<<< - * else: - * addr = None - */ - __pyx_t_2 = PyBytes_FromString(__pyx_v_address); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject*)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_addr); - __pyx_v_addr = ((PyObject *)__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":563 - * addr = address - * else: - * addr = None # <<<<<<<<<<<<<< - * return (addr, port) - * - */ - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v_addr); - __pyx_v_addr = Py_None; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":564 - * else: - * addr = None - * return (addr, port) # <<<<<<<<<<<<<< - * - * def set_local_address(self, char *addr): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_ev_uint16_t(__pyx_v_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_v_addr); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_addr); - __Pyx_GIVEREF(__pyx_v_addr); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_connection.peer.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_addr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":566 - * return (addr, port) - * - * def set_local_address(self, char *addr): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpConnectionDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_6set_local_address(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_6set_local_address(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr) { - char *__pyx_v_addr; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_local_address"); - assert(__pyx_arg_addr); { - __pyx_v_addr = PyBytes_AsString(__pyx_arg_addr); if (unlikely((!__pyx_v_addr) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.set_local_address"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":567 - * - * def set_local_address(self, char *addr): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpConnectionDeleted - * evhttp_connection_set_local_address(self.__obj, addr) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":568 - * def set_local_address(self, char *addr): - * if not self.__obj: - * raise HttpConnectionDeleted # <<<<<<<<<<<<<< - * evhttp_connection_set_local_address(self.__obj, addr) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":569 - * if not self.__obj: - * raise HttpConnectionDeleted - * evhttp_connection_set_local_address(self.__obj, addr) # <<<<<<<<<<<<<< - * - * def set_timeout(self, int secs): - */ - evhttp_connection_set_local_address(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj, __pyx_v_addr); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_connection.set_local_address"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":571 - * evhttp_connection_set_local_address(self.__obj, addr) - * - * def set_timeout(self, int secs): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpConnectionDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_7set_timeout(PyObject *__pyx_v_self, PyObject *__pyx_arg_secs); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_7set_timeout(PyObject *__pyx_v_self, PyObject *__pyx_arg_secs) { - int __pyx_v_secs; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_timeout"); - assert(__pyx_arg_secs); { - __pyx_v_secs = __Pyx_PyInt_AsInt(__pyx_arg_secs); if (unlikely((__pyx_v_secs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.set_timeout"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":572 - * - * def set_timeout(self, int secs): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpConnectionDeleted - * evhttp_connection_set_timeout(self.__obj, secs) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":573 - * def set_timeout(self, int secs): - * if not self.__obj: - * raise HttpConnectionDeleted # <<<<<<<<<<<<<< - * evhttp_connection_set_timeout(self.__obj, secs) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":574 - * if not self.__obj: - * raise HttpConnectionDeleted - * evhttp_connection_set_timeout(self.__obj, secs) # <<<<<<<<<<<<<< - * - * def set_retries(self, int retry_max): - */ - evhttp_connection_set_timeout(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj, __pyx_v_secs); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_connection.set_timeout"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":576 - * evhttp_connection_set_timeout(self.__obj, secs) - * - * def set_retries(self, int retry_max): # <<<<<<<<<<<<<< - * if not self.__obj: - * raise HttpConnectionDeleted - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_8set_retries(PyObject *__pyx_v_self, PyObject *__pyx_arg_retry_max); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_8set_retries(PyObject *__pyx_v_self, PyObject *__pyx_arg_retry_max) { - int __pyx_v_retry_max; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_retries"); - assert(__pyx_arg_retry_max); { - __pyx_v_retry_max = __Pyx_PyInt_AsInt(__pyx_arg_retry_max); if (unlikely((__pyx_v_retry_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.set_retries"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":577 - * - * def set_retries(self, int retry_max): - * if not self.__obj: # <<<<<<<<<<<<<< - * raise HttpConnectionDeleted - * evhttp_connection_set_retries(self.__obj, retry_max) - */ - __pyx_t_1 = (!(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj != 0)); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":578 - * def set_retries(self, int retry_max): - * if not self.__obj: - * raise HttpConnectionDeleted # <<<<<<<<<<<<<< - * evhttp_connection_set_retries(self.__obj, retry_max) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_38); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":579 - * if not self.__obj: - * raise HttpConnectionDeleted - * evhttp_connection_set_retries(self.__obj, retry_max) # <<<<<<<<<<<<<< - * - * def make_request(self, http_request_client req, int type, char* uri): - */ - evhttp_connection_set_retries(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj, __pyx_v_retry_max); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http_connection.set_retries"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":581 - * evhttp_connection_set_retries(self.__obj, retry_max) - * - * def make_request(self, http_request_client req, int type, char* uri): # <<<<<<<<<<<<<< - * req._owned = 0 - * cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_9make_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_9make_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_6gevent_4core_http_request_client *__pyx_v_req = 0; - int __pyx_v_type; - char *__pyx_v_uri; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__req,&__pyx_n_s__type,&__pyx_n_s__uri,0}; - __Pyx_RefNannySetupContext("make_request"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__req); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("make_request", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__uri); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("make_request", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "make_request") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_req = ((struct __pyx_obj_6gevent_4core_http_request_client *)values[0]); - __pyx_v_type = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_uri = PyBytes_AsString(values[2]); if (unlikely((!__pyx_v_uri) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_req = ((struct __pyx_obj_6gevent_4core_http_request_client *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_uri = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((!__pyx_v_uri) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("make_request", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http_connection.make_request"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_req), __pyx_ptype_6gevent_4core_http_request_client, 1, "req", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":582 - * - * def make_request(self, http_request_client req, int type, char* uri): - * req._owned = 0 # <<<<<<<<<<<<<< - * cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) - * if result != 0: - */ - __pyx_v_req->_owned = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":583 - * def make_request(self, http_request_client req, int type, char* uri): - * req._owned = 0 - * cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) # <<<<<<<<<<<<<< - * if result != 0: - * req.detach() - */ - __pyx_v_result = evhttp_make_request(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->__pyx___obj, __pyx_v_req->__pyx_base.__pyx___obj, __pyx_v_type, __pyx_v_uri); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":584 - * req._owned = 0 - * cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) - * if result != 0: # <<<<<<<<<<<<<< - * req.detach() - * return result - */ - __pyx_t_1 = (__pyx_v_result != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":585 - * cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) - * if result != 0: - * req.detach() # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_req), __pyx_n_s__detach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":586 - * if result != 0: - * req.detach() - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http_connection.make_request"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":508 - * - * cdef evhttp_connection* __obj - * cdef public int _owned # <<<<<<<<<<<<<< - * - * def __init__(self, size_t obj, owned=0): - */ - -static PyObject *__pyx_pf_6gevent_4core_15http_connection_6_owned___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_15http_connection_6_owned___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->_owned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.http_connection._owned.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_15http_connection_6_owned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_15http_connection_6_owned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_6gevent_4core_http_connection *)__pyx_v_self)->_owned = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("gevent.core.http_connection._owned.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":589 - * - * - * cdef void _http_request_cb_handler(evhttp_request* c_request, void *arg) with gil: # <<<<<<<<<<<<<< - * if arg == NULL: - * return - */ - -static void __pyx_f_6gevent_4core__http_request_cb_handler(struct evhttp_request *__pyx_v_c_request, void *__pyx_v_arg) { - struct __pyx_obj_6gevent_4core_http_request_client *__pyx_v_obj = 0; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_http_request_cb_handler"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":590 - * - * cdef void _http_request_cb_handler(evhttp_request* c_request, void *arg) with gil: - * if arg == NULL: # <<<<<<<<<<<<<< - * return - * cdef http_request_client obj = (arg) - */ - __pyx_t_1 = (__pyx_v_arg == NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":591 - * cdef void _http_request_cb_handler(evhttp_request* c_request, void *arg) with gil: - * if arg == NULL: - * return # <<<<<<<<<<<<<< - * cdef http_request_client obj = (arg) - * try: - */ - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":592 - * if arg == NULL: - * return - * cdef http_request_client obj = (arg) # <<<<<<<<<<<<<< - * try: - * if obj.__obj != NULL: - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_arg))); - __pyx_v_obj = ((struct __pyx_obj_6gevent_4core_http_request_client *)__pyx_v_arg); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":593 - * return - * cdef http_request_client obj = (arg) - * try: # <<<<<<<<<<<<<< - * if obj.__obj != NULL: - * if obj.__obj != c_request: - */ - /*try:*/ { - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":594 - * cdef http_request_client obj = (arg) - * try: - * if obj.__obj != NULL: # <<<<<<<<<<<<<< - * if obj.__obj != c_request: - * # sometimes this happens, don't know why - */ - __pyx_t_1 = (__pyx_v_obj->__pyx_base.__pyx___obj != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":595 - * try: - * if obj.__obj != NULL: - * if obj.__obj != c_request: # <<<<<<<<<<<<<< - * # sometimes this happens, don't know why - * sys.stderr.write("Internal error in evhttp\n") - */ - __pyx_t_1 = (__pyx_v_obj->__pyx_base.__pyx___obj != __pyx_v_c_request); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":597 - * if obj.__obj != c_request: - * # sometimes this happens, don't know why - * sys.stderr.write("Internal error in evhttp\n") # <<<<<<<<<<<<<< - * if obj.callback is not None: - * # preferring c_request to obj.__obj because the latter sometimes causes crashes - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":598 - * # sometimes this happens, don't know why - * sys.stderr.write("Internal error in evhttp\n") - * if obj.callback is not None: # <<<<<<<<<<<<<< - * # preferring c_request to obj.__obj because the latter sometimes causes crashes - * obj.callback(http_request_client(obj=c_request)) - */ - __pyx_t_1 = (__pyx_v_obj->callback != Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":600 - * if obj.callback is not None: - * # preferring c_request to obj.__obj because the latter sometimes causes crashes - * obj.callback(http_request_client(obj=c_request)) # <<<<<<<<<<<<<< - * obj.detach() - * except: - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_c_request)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__obj), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_http_request_client)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_v_obj->callback, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":601 - * # preferring c_request to obj.__obj because the latter sometimes causes crashes - * obj.callback(http_request_client(obj=c_request)) - * obj.detach() # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_obj), __pyx_n_s__detach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L15; - } - __pyx_L15:; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":602 - * obj.callback(http_request_client(obj=c_request)) - * obj.detach() - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * try: - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core._http_request_cb_handler"); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":603 - * obj.detach() - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('Failed to execute callback for evhttp request.\n') - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":604 - * except: - * traceback.print_exc() - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('Failed to execute callback for evhttp request.\n') - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":605 - * traceback.print_exc() - * try: - * sys.stderr.write('Failed to execute callback for evhttp request.\n') # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L20_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__stderr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L20_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L20_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L20_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L27_try_end; - __pyx_L20_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":606 - * try: - * sys.stderr.write('Failed to execute callback for evhttp request.\n') - * except: # <<<<<<<<<<<<<< - * pass - * finally: - */ - /*except:*/ { - PyErr_Restore(0,0,0); - goto __pyx_L21_exception_handled; - } - __pyx_L21_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L27_try_end:; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L8_exception_handled; - } - __pyx_L9_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L5; - __pyx_L8_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L14_try_end:; - } - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":609 - * pass - * finally: - * obj._delref() # <<<<<<<<<<<<<< - * - * - */ - /*finally:*/ { - int __pyx_why; - PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; - int __pyx_exc_lineno; - __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; - __pyx_why = 0; goto __pyx_L6; - __pyx_L5: { - __pyx_why = 4; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); - __pyx_exc_lineno = __pyx_lineno; - goto __pyx_L6; - } - __pyx_L6:; - __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_4core_http_request_client *)__pyx_v_obj->__pyx_vtab)->_delref(__pyx_v_obj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L28_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L29; - __pyx_L28_error:; - if (__pyx_why == 4) { - Py_XDECREF(__pyx_exc_type); - Py_XDECREF(__pyx_exc_value); - Py_XDECREF(__pyx_exc_tb); - } - goto __pyx_L1_error; - __pyx_L29:; - switch (__pyx_why) { - case 4: { - __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); - __pyx_lineno = __pyx_exc_lineno; - __pyx_exc_type = 0; - __pyx_exc_value = 0; - __pyx_exc_tb = 0; - goto __pyx_L1_error; - } - } - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("gevent.core._http_request_cb_handler"); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":612 - * - * - * cdef void _http_cb_handler(evhttp_request* request, void *arg) with gil: # <<<<<<<<<<<<<< - * cdef http server = arg - * cdef http_request req = http_request(request, server.default_response_headers) - */ - -static void __pyx_f_6gevent_4core__http_cb_handler(struct evhttp_request *__pyx_v_request, void *__pyx_v_arg) { - struct __pyx_obj_6gevent_4core_http *__pyx_v_server = 0; - struct __pyx_obj_6gevent_4core_http_request *__pyx_v_req = 0; - struct evhttp_connection *__pyx_v_conn; - PyObject *__pyx_v_requests; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_http_cb_handler"); - __pyx_v_requests = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":613 - * - * cdef void _http_cb_handler(evhttp_request* request, void *arg) with gil: - * cdef http server = arg # <<<<<<<<<<<<<< - * cdef http_request req = http_request(request, server.default_response_headers) - * cdef evhttp_connection* conn = request.evcon - */ - if (!(likely(((((PyObject *)__pyx_v_arg)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_arg), __pyx_ptype_6gevent_4core_http))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_arg)); - __pyx_v_server = ((struct __pyx_obj_6gevent_4core_http *)((PyObject *)__pyx_v_arg)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":614 - * cdef void _http_cb_handler(evhttp_request* request, void *arg) with gil: - * cdef http server = arg - * cdef http_request req = http_request(request, server.default_response_headers) # <<<<<<<<<<<<<< - * cdef evhttp_connection* conn = request.evcon - * cdef object requests - */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_request)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_server->default_response_headers); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_server->default_response_headers); - __Pyx_GIVEREF(__pyx_v_server->default_response_headers); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_http_request)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_req = ((struct __pyx_obj_6gevent_4core_http_request *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":615 - * cdef http server = arg - * cdef http_request req = http_request(request, server.default_response_headers) - * cdef evhttp_connection* conn = request.evcon # <<<<<<<<<<<<<< - * cdef object requests - * try: - */ - __pyx_v_conn = __pyx_v_request->evcon; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":617 - * cdef evhttp_connection* conn = request.evcon - * cdef object requests - * try: # <<<<<<<<<<<<<< - * evhttp_connection_set_closecb(conn, _http_closecb_handler, arg) - * requests = server._requests.pop(conn, None) - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":618 - * cdef object requests - * try: - * evhttp_connection_set_closecb(conn, _http_closecb_handler, arg) # <<<<<<<<<<<<<< - * requests = server._requests.pop(conn, None) - * if requests is None: - */ - evhttp_connection_set_closecb(__pyx_v_conn, __pyx_f_6gevent_4core__http_closecb_handler, __pyx_v_arg); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":619 - * try: - * evhttp_connection_set_closecb(conn, _http_closecb_handler, arg) - * requests = server._requests.pop(conn, None) # <<<<<<<<<<<<<< - * if requests is None: - * requests = weakref.WeakKeyDictionary() - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_server->_requests), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_conn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_requests); - __pyx_v_requests = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":620 - * evhttp_connection_set_closecb(conn, _http_closecb_handler, arg) - * requests = server._requests.pop(conn, None) - * if requests is None: # <<<<<<<<<<<<<< - * requests = weakref.WeakKeyDictionary() - * server._requests[conn] = requests - */ - __pyx_t_4 = (__pyx_v_requests == Py_None); - if (__pyx_t_4) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":621 - * requests = server._requests.pop(conn, None) - * if requests is None: - * requests = weakref.WeakKeyDictionary() # <<<<<<<<<<<<<< - * server._requests[conn] = requests - * requests[req] = True - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__weakref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WeakKeyDictionary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_requests); - __pyx_v_requests = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":622 - * if requests is None: - * requests = weakref.WeakKeyDictionary() - * server._requests[conn] = requests # <<<<<<<<<<<<<< - * requests[req] = True - * server.handle(req) - */ - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_server->_requests), ((size_t)__pyx_v_conn), __pyx_v_requests, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - goto __pyx_L11; - } - __pyx_L11:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":623 - * requests = weakref.WeakKeyDictionary() - * server._requests[conn] = requests - * requests[req] = True # <<<<<<<<<<<<<< - * server.handle(req) - * except: - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_v_requests, ((PyObject *)__pyx_v_req), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":624 - * server._requests[conn] = requests - * requests[req] = True - * server.handle(req) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_req)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_req)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_req)); - __pyx_t_3 = PyObject_Call(__pyx_v_server->handle, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L10_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":625 - * requests[req] = True - * server.handle(req) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * try: - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core._http_cb_handler"); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":626 - * server.handle(req) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * try: - * sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":627 - * except: - * traceback.print_exc() - * try: # <<<<<<<<<<<<<< - * sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) - * except: - */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":628 - * traceback.print_exc() - * try: - * sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) # <<<<<<<<<<<<<< - * except: - * traceback.print_exc() - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__stderr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_INCREF(((PyObject *)__pyx_v_server)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_server)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_server)); - __Pyx_INCREF(((PyObject *)__pyx_v_req)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_req)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_req)); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L14_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L21_try_end; - __pyx_L14_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":629 - * try: - * sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) - * except: # <<<<<<<<<<<<<< - * traceback.print_exc() - * # without clearing exc_info a reference to the request is somehow leaked - */ - /*except:*/ { - __Pyx_AddTraceback("gevent.core._http_cb_handler"); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_5); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":630 - * sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) - * except: - * traceback.print_exc() # <<<<<<<<<<<<<< - * # without clearing exc_info a reference to the request is somehow leaked - * sys.exc_clear() - */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__traceback); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__print_exc); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L15_exception_handled; - } - __pyx_L16_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L5_except_error; - __pyx_L15_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L21_try_end:; - } - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":632 - * traceback.print_exc() - * # without clearing exc_info a reference to the request is somehow leaked - * sys.exc_clear() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__exc_clear); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L4_exception_handled; - } - __pyx_L5_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L10_try_end:; - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_WriteUnraisable("gevent.core._http_cb_handler"); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_server); - __Pyx_XDECREF((PyObject *)__pyx_v_req); - __Pyx_DECREF(__pyx_v_requests); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":635 - * - * - * cdef void _http_closecb_handler(evhttp_connection* connection, void *arg) with gil: # <<<<<<<<<<<<<< - * cdef http server = arg - * cdef object requests - */ - -static void __pyx_f_6gevent_4core__http_closecb_handler(struct evhttp_connection *__pyx_v_connection, void *__pyx_v_arg) { - struct __pyx_obj_6gevent_4core_http *__pyx_v_server = 0; - PyObject *__pyx_v_request; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_http_closecb_handler"); - __pyx_v_request = Py_None; __Pyx_INCREF(Py_None); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":636 - * - * cdef void _http_closecb_handler(evhttp_connection* connection, void *arg) with gil: - * cdef http server = arg # <<<<<<<<<<<<<< - * cdef object requests - * for request in server._requests.pop(connection, {}).keys(): - */ - if (!(likely(((((PyObject *)__pyx_v_arg)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_arg), __pyx_ptype_6gevent_4core_http))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_arg)); - __pyx_v_server = ((struct __pyx_obj_6gevent_4core_http *)((PyObject *)__pyx_v_arg)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":638 - * cdef http server = arg - * cdef object requests - * for request in server._requests.pop(connection, {}).keys(): # <<<<<<<<<<<<<< - * request.detach() - * - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_server->_requests), __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_connection)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__keys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); - } else { - __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; - } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; - } else { - __pyx_t_4 = PyIter_Next(__pyx_t_5); - if (!__pyx_t_4) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_v_request); - __pyx_v_request = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":639 - * cdef object requests - * for request in server._requests.pop(connection, {}).keys(): - * request.detach() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_request, __pyx_n_s__detach); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("gevent.core._http_closecb_handler"); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_server); - __Pyx_DECREF(__pyx_v_request); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":642 - * - * - * cdef void _http_cb_reply_error(evhttp_request* request, void *arg): # <<<<<<<<<<<<<< - * report_internal_error(request) - * - */ - -static void __pyx_f_6gevent_4core__http_cb_reply_error(struct evhttp_request *__pyx_v_request, void *__pyx_v_arg) { - __Pyx_RefNannySetupContext("_http_cb_reply_error"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":643 - * - * cdef void _http_cb_reply_error(evhttp_request* request, void *arg): - * report_internal_error(request) # <<<<<<<<<<<<<< - * - * - */ - __pyx_f_6gevent_4core_report_internal_error(__pyx_v_request); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":646 - * - * - * cdef void report_internal_error(evhttp_request* request): # <<<<<<<<<<<<<< - * cdef evbuffer* c_buf - * if request != NULL and request.response_code == 0: - */ - -static void __pyx_f_6gevent_4core_report_internal_error(struct evhttp_request *__pyx_v_request) { - struct evbuffer *__pyx_v_c_buf; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("report_internal_error"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":648 - * cdef void report_internal_error(evhttp_request* request): - * cdef evbuffer* c_buf - * if request != NULL and request.response_code == 0: # <<<<<<<<<<<<<< - * evhttp_add_header(request.output_headers, "Connection", "close") - * evhttp_add_header(request.output_headers, "Content-type", "text/plain") - */ - __pyx_t_1 = (__pyx_v_request != NULL); - if (__pyx_t_1) { - __pyx_t_2 = (__pyx_v_request->response_code == 0); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":649 - * cdef evbuffer* c_buf - * if request != NULL and request.response_code == 0: - * evhttp_add_header(request.output_headers, "Connection", "close") # <<<<<<<<<<<<<< - * evhttp_add_header(request.output_headers, "Content-type", "text/plain") - * c_buf = evbuffer_new() - */ - evhttp_add_header(__pyx_v_request->output_headers, __pyx_k__Connection, __pyx_k__close); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":650 - * if request != NULL and request.response_code == 0: - * evhttp_add_header(request.output_headers, "Connection", "close") - * evhttp_add_header(request.output_headers, "Content-type", "text/plain") # <<<<<<<<<<<<<< - * c_buf = evbuffer_new() - * evhttp_add_header(request.output_headers, "Content-length", "21") - */ - evhttp_add_header(__pyx_v_request->output_headers, __pyx_k_45, __pyx_k_46); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":651 - * evhttp_add_header(request.output_headers, "Connection", "close") - * evhttp_add_header(request.output_headers, "Content-type", "text/plain") - * c_buf = evbuffer_new() # <<<<<<<<<<<<<< - * evhttp_add_header(request.output_headers, "Content-length", "21") - * evbuffer_add(c_buf, "Internal Server Error", 21) - */ - __pyx_v_c_buf = evbuffer_new(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":652 - * evhttp_add_header(request.output_headers, "Content-type", "text/plain") - * c_buf = evbuffer_new() - * evhttp_add_header(request.output_headers, "Content-length", "21") # <<<<<<<<<<<<<< - * evbuffer_add(c_buf, "Internal Server Error", 21) - * evhttp_send_reply(request, 500, "Internal Server Error", c_buf) - */ - evhttp_add_header(__pyx_v_request->output_headers, __pyx_k_47, __pyx_k__21); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":653 - * c_buf = evbuffer_new() - * evhttp_add_header(request.output_headers, "Content-length", "21") - * evbuffer_add(c_buf, "Internal Server Error", 21) # <<<<<<<<<<<<<< - * evhttp_send_reply(request, 500, "Internal Server Error", c_buf) - * evbuffer_free(c_buf) - */ - evbuffer_add(__pyx_v_c_buf, __pyx_k_48, 21); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":654 - * evhttp_add_header(request.output_headers, "Content-length", "21") - * evbuffer_add(c_buf, "Internal Server Error", 21) - * evhttp_send_reply(request, 500, "Internal Server Error", c_buf) # <<<<<<<<<<<<<< - * evbuffer_free(c_buf) - * - */ - evhttp_send_reply(__pyx_v_request, 500, __pyx_k_48, __pyx_v_c_buf); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":655 - * evbuffer_add(c_buf, "Internal Server Error", 21) - * evhttp_send_reply(request, 500, "Internal Server Error", c_buf) - * evbuffer_free(c_buf) # <<<<<<<<<<<<<< - * - * - */ - evbuffer_free(__pyx_v_c_buf); - goto __pyx_L3; - } - __pyx_L3:; - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":664 - * cdef public dict _requests - * - * def __init__(self, object handle, object default_response_headers=None): # <<<<<<<<<<<<<< - * self.handle = handle - * if default_response_headers is None: - */ - -static int __pyx_pf_6gevent_4core_4http___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6gevent_4core_4http___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_handle = 0; - PyObject *__pyx_v_default_response_headers = 0; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s_32,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_32); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_handle = values[0]; - __pyx_v_default_response_headers = values[1]; - } else { - __pyx_v_default_response_headers = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_default_response_headers = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_handle = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":665 - * - * def __init__(self, object handle, object default_response_headers=None): - * self.handle = handle # <<<<<<<<<<<<<< - * if default_response_headers is None: - * self.default_response_headers = [] - */ - __Pyx_INCREF(__pyx_v_handle); - __Pyx_GIVEREF(__pyx_v_handle); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle = __pyx_v_handle; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":666 - * def __init__(self, object handle, object default_response_headers=None): - * self.handle = handle - * if default_response_headers is None: # <<<<<<<<<<<<<< - * self.default_response_headers = [] - * else: - */ - __pyx_t_1 = (__pyx_v_default_response_headers == Py_None); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":667 - * self.handle = handle - * if default_response_headers is None: - * self.default_response_headers = [] # <<<<<<<<<<<<<< - * else: - * self.default_response_headers = default_response_headers - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":669 - * self.default_response_headers = [] - * else: - * self.default_response_headers = default_response_headers # <<<<<<<<<<<<<< - * self._requests = {} # maps connection id to WeakKeyDictionary which holds requests - * self.__obj = evhttp_new(current_base) - */ - __Pyx_INCREF(__pyx_v_default_response_headers); - __Pyx_GIVEREF(__pyx_v_default_response_headers); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers = __pyx_v_default_response_headers; - } - __pyx_L6:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":670 - * else: - * self.default_response_headers = default_response_headers - * self._requests = {} # maps connection id to WeakKeyDictionary which holds requests # <<<<<<<<<<<<<< - * self.__obj = evhttp_new(current_base) - * evhttp_set_gencb(self.__obj, _http_cb_handler, self) - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests)); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":671 - * self.default_response_headers = default_response_headers - * self._requests = {} # maps connection id to WeakKeyDictionary which holds requests - * self.__obj = evhttp_new(current_base) # <<<<<<<<<<<<<< - * evhttp_set_gencb(self.__obj, _http_cb_handler, self) - * - */ - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj = evhttp_new(current_base); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":672 - * self._requests = {} # maps connection id to WeakKeyDictionary which holds requests - * self.__obj = evhttp_new(current_base) - * evhttp_set_gencb(self.__obj, _http_cb_handler, self) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - evhttp_set_gencb(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj, __pyx_f_6gevent_4core__http_cb_handler, ((void *)__pyx_v_self)); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("gevent.core.http.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":674 - * evhttp_set_gencb(self.__obj, _http_cb_handler, self) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.__obj != NULL: - * evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) - */ - -static void __pyx_pf_6gevent_4core_4http_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_6gevent_4core_4http_1__dealloc__(PyObject *__pyx_v_self) { - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":675 - * - * def __dealloc__(self): - * if self.__obj != NULL: # <<<<<<<<<<<<<< - * evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) - * evhttp_free(self.__obj) - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj != NULL); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":676 - * def __dealloc__(self): - * if self.__obj != NULL: - * evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) # <<<<<<<<<<<<<< - * evhttp_free(self.__obj) - * self.__obj = NULL - */ - evhttp_set_gencb(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj, __pyx_f_6gevent_4core__http_cb_reply_error, NULL); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":677 - * if self.__obj != NULL: - * evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) - * evhttp_free(self.__obj) # <<<<<<<<<<<<<< - * self.__obj = NULL - * - */ - evhttp_free(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":678 - * evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) - * evhttp_free(self.__obj) - * self.__obj = NULL # <<<<<<<<<<<<<< - * - * property _obj: - */ - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj = NULL; - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":682 - * property _obj: - * - * def __get__(self): # <<<<<<<<<<<<<< - * return (self.__obj) - * - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_4_obj___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_4_obj___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":683 - * - * def __get__(self): - * return (self.__obj) # <<<<<<<<<<<<<< - * - * def __nonzero__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("gevent.core.http._obj.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":685 - * return (self.__obj) - * - * def __nonzero__(self): # <<<<<<<<<<<<<< - * if self.__obj: - * return True - */ - -static int __pyx_pf_6gevent_4core_4http_2__nonzero__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_2__nonzero__(PyObject *__pyx_v_self) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__nonzero__"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":686 - * - * def __nonzero__(self): - * if self.__obj: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_t_1 = (((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj != 0); - if (__pyx_t_1) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":687 - * def __nonzero__(self): - * if self.__obj: - * return True # <<<<<<<<<<<<<< - * else: - * return False - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":689 - * return True - * else: - * return False # <<<<<<<<<<<<<< - * - * def bind(self, char* address='127.0.0.1', int port=80): - */ - __pyx_r = 0; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":691 - * return False - * - * def bind(self, char* address='127.0.0.1', int port=80): # <<<<<<<<<<<<<< - * cdef int res = evhttp_bind_socket(self.__obj, address, port) - * if res: - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_3bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_3bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_address; - int __pyx_v_port; - int __pyx_v_res; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__address,&__pyx_n_s__port,0}; - __Pyx_RefNannySetupContext("bind"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__address); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "bind") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - if (values[0]) { - __pyx_v_address = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_address) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_address = ((char *)__pyx_k_49); - } - if (values[1]) { - __pyx_v_port = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_port = ((int)80); - } - } else { - __pyx_v_address = ((char *)__pyx_k_49); - __pyx_v_port = ((int)80); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_port = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_address = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_address) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("bind", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http.bind"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":692 - * - * def bind(self, char* address='127.0.0.1', int port=80): - * cdef int res = evhttp_bind_socket(self.__obj, address, port) # <<<<<<<<<<<<<< - * if res: - * raise RuntimeError('evhttp_bind_socket(%r, %r) returned %r' % (address, port, res)) - */ - __pyx_v_res = evhttp_bind_socket(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj, __pyx_v_address, __pyx_v_port); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":693 - * def bind(self, char* address='127.0.0.1', int port=80): - * cdef int res = evhttp_bind_socket(self.__obj, address, port) - * if res: # <<<<<<<<<<<<<< - * raise RuntimeError('evhttp_bind_socket(%r, %r) returned %r' % (address, port, res)) - * - */ - if (__pyx_v_res) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":694 - * cdef int res = evhttp_bind_socket(self.__obj, address, port) - * if res: - * raise RuntimeError('evhttp_bind_socket(%r, %r) returned %r' % (address, port, res)) # <<<<<<<<<<<<<< - * - * def accept(self, int fd): - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_address); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_res); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("gevent.core.http.bind"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":696 - * raise RuntimeError('evhttp_bind_socket(%r, %r) returned %r' % (address, port, res)) - * - * def accept(self, int fd): # <<<<<<<<<<<<<< - * cdef res = evhttp_accept_socket(self.__obj, fd) - * if res: - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_4accept(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_4accept(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd) { - int __pyx_v_fd; - PyObject *__pyx_v_res = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("accept"); - assert(__pyx_arg_fd); { - __pyx_v_fd = __Pyx_PyInt_AsInt(__pyx_arg_fd); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.http.accept"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":697 - * - * def accept(self, int fd): - * cdef res = evhttp_accept_socket(self.__obj, fd) # <<<<<<<<<<<<<< - * if res: - * raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, res)) - */ - __pyx_t_1 = PyInt_FromLong(evhttp_accept_socket(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->__pyx___obj, __pyx_v_fd)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_res = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":698 - * def accept(self, int fd): - * cdef res = evhttp_accept_socket(self.__obj, fd) - * if res: # <<<<<<<<<<<<<< - * raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, res)) - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_res); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":699 - * cdef res = evhttp_accept_socket(self.__obj, fd) - * if res: - * raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, res)) # <<<<<<<<<<<<<< - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_res); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_res); - __Pyx_GIVEREF(__pyx_v_res); - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("gevent.core.http.accept"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_res); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":660 - * cdef class http: - * cdef evhttp* __obj - * cdef public object handle # <<<<<<<<<<<<<< - * cdef public object default_response_headers - * cdef public dict _requests - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_6handle___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_6handle___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_6handle_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_6handle_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_6handle_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_6handle_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->handle = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":661 - * cdef evhttp* __obj - * cdef public object handle - * cdef public object default_response_headers # <<<<<<<<<<<<<< - * cdef public dict _requests - * - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_24default_response_headers___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_24default_response_headers___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - __pyx_r = ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_24default_response_headers_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_24default_response_headers_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_24default_response_headers_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_24default_response_headers_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - __Pyx_DECREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->default_response_headers = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":662 - * cdef public object handle - * cdef public object default_response_headers - * cdef public dict _requests # <<<<<<<<<<<<<< - * - * def __init__(self, object handle, object default_response_headers=None): - */ - -static PyObject *__pyx_pf_6gevent_4core_4http_9_requests___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6gevent_4core_4http_9_requests___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests)); - __pyx_r = ((PyObject *)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_9_requests_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_9_requests_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests)); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests = ((PyObject*)__pyx_v_value); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("gevent.core.http._requests.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_6gevent_4core_4http_9_requests_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_6gevent_4core_4http_9_requests_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests)); - ((struct __pyx_obj_6gevent_4core_http *)__pyx_v_self)->_requests = ((PyObject*)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "gevent/core.pyx":466 - * include "evhttp.pxi" - * - * def set_exc_info(object type, object value): # <<<<<<<<<<<<<< - * cdef PyThreadState* tstate = PyThreadState_GET() - * Py_XDECREF(tstate.exc_type) - */ - -static PyObject *__pyx_pf_6gevent_4core_14set_exc_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6gevent_4core_14set_exc_info = {__Pyx_NAMESTR("set_exc_info"), (PyCFunction)__pyx_pf_6gevent_4core_14set_exc_info, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6gevent_4core_14set_exc_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_type = 0; - PyObject *__pyx_v_value = 0; - PyThreadState *__pyx_v_tstate; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__type,&__pyx_n_s__value,0}; - __Pyx_RefNannySetupContext("set_exc_info"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_exc_info", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_exc_info") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_type = values[0]; - __pyx_v_value = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_type = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_exc_info", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("gevent.core.set_exc_info"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "gevent/core.pyx":467 - * - * def set_exc_info(object type, object value): - * cdef PyThreadState* tstate = PyThreadState_GET() # <<<<<<<<<<<<<< - * Py_XDECREF(tstate.exc_type) - * Py_XDECREF(tstate.exc_value) - */ - __pyx_v_tstate = PyThreadState_GET(); - - /* "gevent/core.pyx":468 - * def set_exc_info(object type, object value): - * cdef PyThreadState* tstate = PyThreadState_GET() - * Py_XDECREF(tstate.exc_type) # <<<<<<<<<<<<<< - * Py_XDECREF(tstate.exc_value) - * Py_XDECREF(tstate.exc_traceback) - */ - Py_XDECREF(__pyx_v_tstate->exc_type); - - /* "gevent/core.pyx":469 - * cdef PyThreadState* tstate = PyThreadState_GET() - * Py_XDECREF(tstate.exc_type) - * Py_XDECREF(tstate.exc_value) # <<<<<<<<<<<<<< - * Py_XDECREF(tstate.exc_traceback) - * if value is None: - */ - Py_XDECREF(__pyx_v_tstate->exc_value); - - /* "gevent/core.pyx":470 - * Py_XDECREF(tstate.exc_type) - * Py_XDECREF(tstate.exc_value) - * Py_XDECREF(tstate.exc_traceback) # <<<<<<<<<<<<<< - * if value is None: - * tstate.exc_type = NULL - */ - Py_XDECREF(__pyx_v_tstate->exc_traceback); - - /* "gevent/core.pyx":471 - * Py_XDECREF(tstate.exc_value) - * Py_XDECREF(tstate.exc_traceback) - * if value is None: # <<<<<<<<<<<<<< - * tstate.exc_type = NULL - * tstate.exc_value = NULL - */ - __pyx_t_1 = (__pyx_v_value == Py_None); - if (__pyx_t_1) { - - /* "gevent/core.pyx":472 - * Py_XDECREF(tstate.exc_traceback) - * if value is None: - * tstate.exc_type = NULL # <<<<<<<<<<<<<< - * tstate.exc_value = NULL - * else: - */ - __pyx_v_tstate->exc_type = NULL; - - /* "gevent/core.pyx":473 - * if value is None: - * tstate.exc_type = NULL - * tstate.exc_value = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(type) - */ - __pyx_v_tstate->exc_value = NULL; - goto __pyx_L6; - } - /*else*/ { - - /* "gevent/core.pyx":475 - * tstate.exc_value = NULL - * else: - * Py_INCREF(type) # <<<<<<<<<<<<<< - * Py_INCREF(value) - * tstate.exc_type = type - */ - Py_INCREF(((PyObject*)__pyx_v_type)); - - /* "gevent/core.pyx":476 - * else: - * Py_INCREF(type) - * Py_INCREF(value) # <<<<<<<<<<<<<< - * tstate.exc_type = type - * tstate.exc_value = value - */ - Py_INCREF(((PyObject*)__pyx_v_value)); - - /* "gevent/core.pyx":477 - * Py_INCREF(type) - * Py_INCREF(value) - * tstate.exc_type = type # <<<<<<<<<<<<<< - * tstate.exc_value = value - * tstate.exc_traceback = NULL - */ - __pyx_v_tstate->exc_type = ((PyObject*)__pyx_v_type); - - /* "gevent/core.pyx":478 - * Py_INCREF(value) - * tstate.exc_type = type - * tstate.exc_value = value # <<<<<<<<<<<<<< - * tstate.exc_traceback = NULL - */ - __pyx_v_tstate->exc_value = ((PyObject*)__pyx_v_value); - } - __pyx_L6:; - - /* "gevent/core.pyx":479 - * tstate.exc_type = type - * tstate.exc_value = value - * tstate.exc_traceback = NULL # <<<<<<<<<<<<<< - */ - __pyx_v_tstate->exc_traceback = NULL; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_6gevent_4core_event __pyx_vtable_6gevent_4core_event; - -static PyObject *__pyx_tp_new_6gevent_4core_event(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_event *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_event *)o); - p->__pyx_vtab = __pyx_vtabptr_6gevent_4core_event; - p->callback = Py_None; Py_INCREF(Py_None); - p->arg = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_event(PyObject *o) { - struct __pyx_obj_6gevent_4core_event *p = (struct __pyx_obj_6gevent_4core_event *)o; - Py_XDECREF(p->callback); - Py_XDECREF(p->arg); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_6gevent_4core_event(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6gevent_4core_event *p = (struct __pyx_obj_6gevent_4core_event *)o; - if (p->callback) { - e = (*v)(p->callback, a); if (e) return e; - } - if (p->arg) { - e = (*v)(p->arg, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6gevent_4core_event(PyObject *o) { - struct __pyx_obj_6gevent_4core_event *p = (struct __pyx_obj_6gevent_4core_event *)o; - PyObject* tmp; - tmp = ((PyObject*)p->callback); - p->callback = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->arg); - p->arg = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_pending(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_7pending___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_fd(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_2fd___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_events(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_6events___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_events_str(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_10events_str___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_flags(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_5flags___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_flags_str(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_9flags_str___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_callback(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_8callback___get__(o); -} - -static int __pyx_setprop_6gevent_4core_5event_callback(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_5event_8callback_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_5event_8callback_2__del__(o); - } -} - -static PyObject *__pyx_getprop_6gevent_4core_5event_arg(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_5event_3arg___get__(o); -} - -static int __pyx_setprop_6gevent_4core_5event_arg(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_5event_3arg_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_5event_3arg_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_event[] = { - {__Pyx_NAMESTR("add"), (PyCFunction)__pyx_pf_6gevent_4core_5event_1add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_5event_1add)}, - {__Pyx_NAMESTR("cancel"), (PyCFunction)__pyx_pf_6gevent_4core_5event_2cancel, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_5event_2cancel)}, - {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_6gevent_4core_5event_5__enter__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_6gevent_4core_5event_6__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_event[] = { - {(char *)"pending", __pyx_getprop_6gevent_4core_5event_pending, 0, __Pyx_DOCSTR(__pyx_k_52), 0}, - {(char *)"fd", __pyx_getprop_6gevent_4core_5event_fd, 0, 0, 0}, - {(char *)"events", __pyx_getprop_6gevent_4core_5event_events, 0, 0, 0}, - {(char *)"events_str", __pyx_getprop_6gevent_4core_5event_events_str, 0, 0, 0}, - {(char *)"flags", __pyx_getprop_6gevent_4core_5event_flags, 0, 0, 0}, - {(char *)"flags_str", __pyx_getprop_6gevent_4core_5event_flags_str, 0, 0, 0}, - {(char *)"callback", __pyx_getprop_6gevent_4core_5event_callback, __pyx_setprop_6gevent_4core_5event_callback, 0, 0}, - {(char *)"arg", __pyx_getprop_6gevent_4core_5event_arg, __pyx_setprop_6gevent_4core_5event_arg, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_event = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_event = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_event = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_event = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_event = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.event"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_event), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_6gevent_4core_5event_3__repr__, /*tp_repr*/ - &__pyx_tp_as_number_event, /*tp_as_number*/ - &__pyx_tp_as_sequence_event, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_event, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pf_6gevent_4core_5event_4__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_event, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Create a new event object with a user callback.\n\n - *evtype* -- bitmask of EV_READ or EV_WRITE, or EV_SIGNAL\n - *handle* -- a file handle, descriptor, or socket for EV_READ or EV_WRITE; a signal number for EV_SIGNAL\n - *callback* -- user callback with ``(event, evtype)`` prototype\n - *arg* -- optional object, which will be made available as :attr:`arg` property.\n "), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_event, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_event, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_5event___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_event, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_read_event __pyx_vtable_6gevent_4core_read_event; - -static PyObject *__pyx_tp_new_6gevent_4core_read_event(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_read_event *p; - PyObject *o = __pyx_tp_new_6gevent_4core_event(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_read_event *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6gevent_4core_event*)__pyx_vtabptr_6gevent_4core_read_event; - return o; -} - -static PyMethodDef __pyx_methods_6gevent_4core_read_event[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_read_event = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_read_event = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_read_event = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_read_event = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_read_event = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.read_event"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_read_event), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_read_event, /*tp_as_number*/ - &__pyx_tp_as_sequence_read_event, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_read_event, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_read_event, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Create a new scheduled event with evtype=EV_READ"), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_read_event, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_10read_event___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_read_event, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_write_event __pyx_vtable_6gevent_4core_write_event; - -static PyObject *__pyx_tp_new_6gevent_4core_write_event(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_write_event *p; - PyObject *o = __pyx_tp_new_6gevent_4core_event(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_write_event *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6gevent_4core_event*)__pyx_vtabptr_6gevent_4core_write_event; - return o; -} - -static PyMethodDef __pyx_methods_6gevent_4core_write_event[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_write_event = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_write_event = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_write_event = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_write_event = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_write_event = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.write_event"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_write_event), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_write_event, /*tp_as_number*/ - &__pyx_tp_as_sequence_write_event, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_write_event, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_write_event, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Create a new scheduled event with evtype=EV_WRITE"), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_write_event, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_11write_event___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_write_event, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_timer __pyx_vtable_6gevent_4core_timer; - -static PyObject *__pyx_tp_new_6gevent_4core_timer(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_timer *p; - PyObject *o = __pyx_tp_new_6gevent_4core_event(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_timer *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6gevent_4core_event*)__pyx_vtabptr_6gevent_4core_timer; - return o; -} - -static PyMethodDef __pyx_methods_6gevent_4core_timer[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_timer = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_timer = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_timer = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_timer = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_timer = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.timer"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_timer), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_timer, /*tp_as_number*/ - &__pyx_tp_as_sequence_timer, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_timer, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_timer, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Create a new scheduled timer"), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_timer, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_5timer___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_timer, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_signal __pyx_vtable_6gevent_4core_signal; - -static PyObject *__pyx_tp_new_6gevent_4core_signal(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_signal *p; - PyObject *o = __pyx_tp_new_6gevent_4core_event(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_signal *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6gevent_4core_event*)__pyx_vtabptr_6gevent_4core_signal; - return o; -} - -static PyMethodDef __pyx_methods_6gevent_4core_signal[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_signal = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_signal = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_signal = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_signal = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_signal = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.signal"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_signal), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_signal, /*tp_as_number*/ - &__pyx_tp_as_sequence_signal, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_signal, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_signal, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Create a new persistent signal event"), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_signal, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_6signal___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_signal, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_active_event __pyx_vtable_6gevent_4core_active_event; - -static PyObject *__pyx_tp_new_6gevent_4core_active_event(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_active_event *p; - PyObject *o = __pyx_tp_new_6gevent_4core_event(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_active_event *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6gevent_4core_event*)__pyx_vtabptr_6gevent_4core_active_event; - return o; -} - -static PyMethodDef __pyx_methods_6gevent_4core_active_event[] = { - {__Pyx_NAMESTR("add"), (PyCFunction)__pyx_pf_6gevent_4core_12active_event_1add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_active_event = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_active_event = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_active_event = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_active_event = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_active_event = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.active_event"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_active_event), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_event, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_active_event, /*tp_as_number*/ - &__pyx_tp_as_sequence_active_event, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_active_event, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_active_event, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("An event that is scheduled to run in the current loop iteration"), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_event, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_event, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_active_event, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_12active_event___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_active_event, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_6gevent_4core_buffer(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_buffer(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_6buffer__obj(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_6buffer_4_obj___get__(o); -} - -static PyMethodDef __pyx_methods_6gevent_4core_buffer[] = { - {__Pyx_NAMESTR("detach"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_3detach, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_6read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_6buffer_6read)}, - {__Pyx_NAMESTR("readline"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_7readline, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("readlines"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_8readlines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_6gevent_4core_6buffer_9write, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_buffer[] = { - {(char *)"_obj", __pyx_getprop_6gevent_4core_6buffer__obj, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_buffer = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - __pyx_pf_6gevent_4core_6buffer_2__nonzero__, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_buffer = { - __pyx_pf_6gevent_4core_6buffer_1__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_buffer = { - __pyx_pf_6gevent_4core_6buffer_1__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_buffer = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_buffer = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.buffer"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_buffer), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_buffer, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_buffer, /*tp_as_number*/ - &__pyx_tp_as_sequence_buffer, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_buffer, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_buffer, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - __Pyx_DOCSTR("file-like wrapper for libevent's :class:`evbuffer` structure.\n\n Note, that the wrapper does not own the structure, libevent does.\n "), /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - __pyx_pf_6gevent_4core_6buffer_4__iter__, /*tp_iter*/ - __pyx_pf_6gevent_4core_6buffer_5__next__, /*tp_iternext*/ - __pyx_methods_6gevent_4core_buffer, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_buffer, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_6buffer___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_buffer, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_6gevent_4core_http_request_base(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_http_request_base *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_http_request_base *)o); - p->__weakref__ = 0; - p->_input_buffer = Py_None; Py_INCREF(Py_None); - p->_output_buffer = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_http_request_base(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request_base *p = (struct __pyx_obj_6gevent_4core_http_request_base *)o; - if (p->__weakref__) PyObject_ClearWeakRefs(o); - Py_XDECREF(p->_input_buffer); - Py_XDECREF(p->_output_buffer); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_6gevent_4core_http_request_base(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6gevent_4core_http_request_base *p = (struct __pyx_obj_6gevent_4core_http_request_base *)o; - if (p->_input_buffer) { - e = (*v)(p->_input_buffer, a); if (e) return e; - } - if (p->_output_buffer) { - e = (*v)(p->_output_buffer, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6gevent_4core_http_request_base(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request_base *p = (struct __pyx_obj_6gevent_4core_http_request_base *)o; - PyObject* tmp; - tmp = ((PyObject*)p->_input_buffer); - p->_input_buffer = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_output_buffer); - p->_output_buffer = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base__obj(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_4_obj___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_connection(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_10connection___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_remote_host(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_11remote_host___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_remote_port(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_11remote_port___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_remote(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_6remote___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_kind(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_4kind___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_type(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_4type___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_typestr(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_7typestr___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_uri(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_3uri___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_major(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_5major___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_minor(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_5minor___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_version(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_7version___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_response_code(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_13response_code___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_response_code_line(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_18response_code_line___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_response(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_8response___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_chunked(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_7chunked___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_input_buffer(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_12input_buffer___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base_output_buffer(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_13output_buffer___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base__input_buffer(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer___get__(o); -} - -static int __pyx_setprop_6gevent_4core_17http_request_base__input_buffer(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_17http_request_base_13_input_buffer_2__del__(o); - } -} - -static PyObject *__pyx_getprop_6gevent_4core_17http_request_base__output_buffer(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer___get__(o); -} - -static int __pyx_setprop_6gevent_4core_17http_request_base__output_buffer(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_17http_request_base_14_output_buffer_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_http_request_base[] = { - {__Pyx_NAMESTR("detach"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_2detach, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_3_format, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_input_headers"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_6get_input_headers, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("find_input_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_7find_input_header, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("find_output_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_8find_output_header, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("add_input_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_9add_input_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("add_output_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_10add_output_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("remove_input_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_11remove_input_header, METH_O, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_17http_request_base_11remove_input_header)}, - {__Pyx_NAMESTR("remove_output_header"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_12remove_output_header, METH_O, __Pyx_DOCSTR(__pyx_doc_6gevent_4core_17http_request_base_12remove_output_header)}, - {__Pyx_NAMESTR("clear_input_headers"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_13clear_input_headers, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("clear_output_headers"), (PyCFunction)__pyx_pf_6gevent_4core_17http_request_base_14clear_output_headers, METH_NOARGS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_http_request_base[] = { - {(char *)"_obj", __pyx_getprop_6gevent_4core_17http_request_base__obj, 0, 0, 0}, - {(char *)"connection", __pyx_getprop_6gevent_4core_17http_request_base_connection, 0, 0, 0}, - {(char *)"remote_host", __pyx_getprop_6gevent_4core_17http_request_base_remote_host, 0, 0, 0}, - {(char *)"remote_port", __pyx_getprop_6gevent_4core_17http_request_base_remote_port, 0, 0, 0}, - {(char *)"remote", __pyx_getprop_6gevent_4core_17http_request_base_remote, 0, 0, 0}, - {(char *)"kind", __pyx_getprop_6gevent_4core_17http_request_base_kind, 0, 0, 0}, - {(char *)"type", __pyx_getprop_6gevent_4core_17http_request_base_type, 0, 0, 0}, - {(char *)"typestr", __pyx_getprop_6gevent_4core_17http_request_base_typestr, 0, 0, 0}, - {(char *)"uri", __pyx_getprop_6gevent_4core_17http_request_base_uri, 0, 0, 0}, - {(char *)"major", __pyx_getprop_6gevent_4core_17http_request_base_major, 0, 0, 0}, - {(char *)"minor", __pyx_getprop_6gevent_4core_17http_request_base_minor, 0, 0, 0}, - {(char *)"version", __pyx_getprop_6gevent_4core_17http_request_base_version, 0, 0, 0}, - {(char *)"response_code", __pyx_getprop_6gevent_4core_17http_request_base_response_code, 0, 0, 0}, - {(char *)"response_code_line", __pyx_getprop_6gevent_4core_17http_request_base_response_code_line, 0, 0, 0}, - {(char *)"response", __pyx_getprop_6gevent_4core_17http_request_base_response, 0, 0, 0}, - {(char *)"chunked", __pyx_getprop_6gevent_4core_17http_request_base_chunked, 0, 0, 0}, - {(char *)"input_buffer", __pyx_getprop_6gevent_4core_17http_request_base_input_buffer, 0, 0, 0}, - {(char *)"output_buffer", __pyx_getprop_6gevent_4core_17http_request_base_output_buffer, 0, 0, 0}, - {(char *)"_input_buffer", __pyx_getprop_6gevent_4core_17http_request_base__input_buffer, __pyx_setprop_6gevent_4core_17http_request_base__input_buffer, 0, 0}, - {(char *)"_output_buffer", __pyx_getprop_6gevent_4core_17http_request_base__output_buffer, __pyx_setprop_6gevent_4core_17http_request_base__output_buffer, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_http_request_base = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - __pyx_pf_6gevent_4core_17http_request_base_1__nonzero__, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_http_request_base = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_http_request_base = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_http_request_base = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_http_request_base = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.http_request_base"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_http_request_base), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_http_request_base, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_6gevent_4core_17http_request_base_5__repr__, /*tp_repr*/ - &__pyx_tp_as_number_http_request_base, /*tp_as_number*/ - &__pyx_tp_as_sequence_http_request_base, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_http_request_base, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pf_6gevent_4core_17http_request_base_4__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_http_request_base, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Wrapper around libevent's :class:`evhttp_request` structure."), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_http_request_base, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_http_request_base, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_http_request_base, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_http_request_base, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_17http_request_base___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_http_request_base, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_6gevent_4core_http_request(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_http_request *p; - PyObject *o = __pyx_tp_new_6gevent_4core_http_request_base(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_http_request *)o); - p->default_response_headers = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_http_request(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request *p = (struct __pyx_obj_6gevent_4core_http_request *)o; - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_6gevent_4core_12http_request_1__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_XDECREF(p->default_response_headers); - __pyx_tp_dealloc_6gevent_4core_http_request_base(o); -} - -static int __pyx_tp_traverse_6gevent_4core_http_request(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6gevent_4core_http_request *p = (struct __pyx_obj_6gevent_4core_http_request *)o; - e = __pyx_tp_traverse_6gevent_4core_http_request_base(o, v, a); if (e) return e; - if (p->default_response_headers) { - e = (*v)(p->default_response_headers, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6gevent_4core_http_request(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request *p = (struct __pyx_obj_6gevent_4core_http_request *)o; - PyObject* tmp; - __pyx_tp_clear_6gevent_4core_http_request_base(o); - tmp = ((PyObject*)p->default_response_headers); - p->default_response_headers = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6gevent_4core_12http_request_default_response_headers(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_12http_request_24default_response_headers___get__(o); -} - -static int __pyx_setprop_6gevent_4core_12http_request_default_response_headers(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_12http_request_24default_response_headers_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_12http_request_24default_response_headers_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_http_request[] = { - {__Pyx_NAMESTR("_add_default_response_headers"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_2_add_default_response_headers, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("send_reply"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_3send_reply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("send_reply_start"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_4send_reply_start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("send_reply_chunk"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_5send_reply_chunk, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("send_reply_end"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_6send_reply_end, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("send_error"), (PyCFunction)__pyx_pf_6gevent_4core_12http_request_7send_error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_http_request[] = { - {(char *)"default_response_headers", __pyx_getprop_6gevent_4core_12http_request_default_response_headers, __pyx_setprop_6gevent_4core_12http_request_default_response_headers, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_http_request = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_http_request = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_http_request = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_http_request = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_http_request = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.http_request"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_http_request), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_http_request, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_http_request, /*tp_as_number*/ - &__pyx_tp_as_sequence_http_request, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_http_request, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_http_request, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Wrapper around libevent's :class:`evhttp_request` structure."), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_http_request, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_http_request, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_http_request, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_http_request, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_12http_request___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_http_request, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6gevent_4core_http_request_client __pyx_vtable_6gevent_4core_http_request_client; - -static PyObject *__pyx_tp_new_6gevent_4core_http_request_client(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_http_request_client *p; - PyObject *o = __pyx_tp_new_6gevent_4core_http_request_base(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_http_request_client *)o); - p->__pyx_vtab = __pyx_vtabptr_6gevent_4core_http_request_client; - p->callback = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_http_request_client(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request_client *p = (struct __pyx_obj_6gevent_4core_http_request_client *)o; - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_6gevent_4core_19http_request_client_1__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_XDECREF(p->callback); - __pyx_tp_dealloc_6gevent_4core_http_request_base(o); -} - -static int __pyx_tp_traverse_6gevent_4core_http_request_client(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6gevent_4core_http_request_client *p = (struct __pyx_obj_6gevent_4core_http_request_client *)o; - e = __pyx_tp_traverse_6gevent_4core_http_request_base(o, v, a); if (e) return e; - if (p->callback) { - e = (*v)(p->callback, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6gevent_4core_http_request_client(PyObject *o) { - struct __pyx_obj_6gevent_4core_http_request_client *p = (struct __pyx_obj_6gevent_4core_http_request_client *)o; - PyObject* tmp; - __pyx_tp_clear_6gevent_4core_http_request_base(o); - tmp = ((PyObject*)p->callback); - p->callback = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6gevent_4core_19http_request_client__owned(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_19http_request_client_6_owned___get__(o); -} - -static int __pyx_setprop_6gevent_4core_19http_request_client__owned(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_19http_request_client_6_owned_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_6gevent_4core_19http_request_client_callback(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_19http_request_client_8callback___get__(o); -} - -static int __pyx_setprop_6gevent_4core_19http_request_client_callback(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_19http_request_client_8callback_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_19http_request_client_8callback_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_http_request_client[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_http_request_client[] = { - {(char *)"_owned", __pyx_getprop_6gevent_4core_19http_request_client__owned, __pyx_setprop_6gevent_4core_19http_request_client__owned, 0, 0}, - {(char *)"callback", __pyx_getprop_6gevent_4core_19http_request_client_callback, __pyx_setprop_6gevent_4core_19http_request_client_callback, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_http_request_client = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_http_request_client = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_http_request_client = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_http_request_client = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_http_request_client = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.http_request_client"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_http_request_client), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_http_request_client, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_http_request_client, /*tp_as_number*/ - &__pyx_tp_as_sequence_http_request_client, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_http_request_client, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_http_request_client, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Wrapper around libevent's :class:`evhttp_request` structure."), /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_http_request_client, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_http_request_client, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_http_request_client, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_http_request_client, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_19http_request_client___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_http_request_client, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_6gevent_4core_http_connection(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_http_connection(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_6gevent_4core_15http_connection_2__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_15http_connection__obj(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_15http_connection_4_obj___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_15http_connection_peer(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_15http_connection_4peer___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_15http_connection__owned(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_15http_connection_6_owned___get__(o); -} - -static int __pyx_setprop_6gevent_4core_15http_connection__owned(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_15http_connection_6_owned_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_http_connection[] = { - {__Pyx_NAMESTR("new"), (PyCFunction)__pyx_pf_6gevent_4core_15http_connection_1new, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_local_address"), (PyCFunction)__pyx_pf_6gevent_4core_15http_connection_6set_local_address, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_timeout"), (PyCFunction)__pyx_pf_6gevent_4core_15http_connection_7set_timeout, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_retries"), (PyCFunction)__pyx_pf_6gevent_4core_15http_connection_8set_retries, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("make_request"), (PyCFunction)__pyx_pf_6gevent_4core_15http_connection_9make_request, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_http_connection[] = { - {(char *)"_obj", __pyx_getprop_6gevent_4core_15http_connection__obj, 0, 0, 0}, - {(char *)"peer", __pyx_getprop_6gevent_4core_15http_connection_peer, 0, 0, 0}, - {(char *)"_owned", __pyx_getprop_6gevent_4core_15http_connection__owned, __pyx_setprop_6gevent_4core_15http_connection__owned, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_http_connection = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - __pyx_pf_6gevent_4core_15http_connection_3__nonzero__, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_http_connection = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_http_connection = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_http_connection = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_http_connection = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.http_connection"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_http_connection), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_http_connection, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_6gevent_4core_15http_connection_5__repr__, /*tp_repr*/ - &__pyx_tp_as_number_http_connection, /*tp_as_number*/ - &__pyx_tp_as_sequence_http_connection, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_http_connection, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pf_6gevent_4core_15http_connection_4__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_http_connection, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_http_connection, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_http_connection, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_15http_connection___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_http_connection, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_6gevent_4core_http(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6gevent_4core_http *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_6gevent_4core_http *)o); - p->handle = Py_None; Py_INCREF(Py_None); - p->default_response_headers = Py_None; Py_INCREF(Py_None); - p->_requests = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6gevent_4core_http(PyObject *o) { - struct __pyx_obj_6gevent_4core_http *p = (struct __pyx_obj_6gevent_4core_http *)o; - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_6gevent_4core_4http_1__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_XDECREF(p->handle); - Py_XDECREF(p->default_response_headers); - Py_XDECREF(((PyObject *)p->_requests)); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_6gevent_4core_http(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6gevent_4core_http *p = (struct __pyx_obj_6gevent_4core_http *)o; - if (p->handle) { - e = (*v)(p->handle, a); if (e) return e; - } - if (p->default_response_headers) { - e = (*v)(p->default_response_headers, a); if (e) return e; - } - if (p->_requests) { - e = (*v)(p->_requests, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6gevent_4core_http(PyObject *o) { - struct __pyx_obj_6gevent_4core_http *p = (struct __pyx_obj_6gevent_4core_http *)o; - PyObject* tmp; - tmp = ((PyObject*)p->handle); - p->handle = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->default_response_headers); - p->default_response_headers = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_requests); - p->_requests = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6gevent_4core_4http__obj(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_4http_4_obj___get__(o); -} - -static PyObject *__pyx_getprop_6gevent_4core_4http_handle(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_4http_6handle___get__(o); -} - -static int __pyx_setprop_6gevent_4core_4http_handle(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_4http_6handle_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_4http_6handle_2__del__(o); - } -} - -static PyObject *__pyx_getprop_6gevent_4core_4http_default_response_headers(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_4http_24default_response_headers___get__(o); -} - -static int __pyx_setprop_6gevent_4core_4http_default_response_headers(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_4http_24default_response_headers_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_4http_24default_response_headers_2__del__(o); - } -} - -static PyObject *__pyx_getprop_6gevent_4core_4http__requests(PyObject *o, void *x) { - return __pyx_pf_6gevent_4core_4http_9_requests___get__(o); -} - -static int __pyx_setprop_6gevent_4core_4http__requests(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_6gevent_4core_4http_9_requests_1__set__(o, v); - } - else { - return __pyx_pf_6gevent_4core_4http_9_requests_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_6gevent_4core_http[] = { - {__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_6gevent_4core_4http_3bind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_6gevent_4core_4http_4accept, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6gevent_4core_http[] = { - {(char *)"_obj", __pyx_getprop_6gevent_4core_4http__obj, 0, 0, 0}, - {(char *)"handle", __pyx_getprop_6gevent_4core_4http_handle, __pyx_setprop_6gevent_4core_4http_handle, 0, 0}, - {(char *)"default_response_headers", __pyx_getprop_6gevent_4core_4http_default_response_headers, __pyx_setprop_6gevent_4core_4http_default_response_headers, 0, 0}, - {(char *)"_requests", __pyx_getprop_6gevent_4core_4http__requests, __pyx_setprop_6gevent_4core_4http__requests, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_http = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - __pyx_pf_6gevent_4core_4http_2__nonzero__, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_http = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_http = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_http = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6gevent_4core_http = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("gevent.core.http"), /*tp_name*/ - sizeof(struct __pyx_obj_6gevent_4core_http), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6gevent_4core_http, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_http, /*tp_as_number*/ - &__pyx_tp_as_sequence_http, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_http, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_http, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6gevent_4core_http, /*tp_traverse*/ - __pyx_tp_clear_6gevent_4core_http, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6gevent_4core_http, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6gevent_4core_http, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6gevent_4core_4http___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6gevent_4core_http, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("core"), - __Pyx_DOCSTR(__pyx_k_53), /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, - {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, - {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, - {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, - {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, - {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, - {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, - {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, - {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, - {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, - {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0}, - {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, - {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, - {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1}, - {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1}, - {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, - {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0}, - {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1}, - {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0}, - {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, - {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0}, - {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, - {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, - {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0}, - {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, - {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, - {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, - {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, - {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, - {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, - {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, - {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1}, - {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0}, - {&__pyx_n_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 1}, - {&__pyx_n_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 1}, - {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, - {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0}, - {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0}, - {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, - {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, - {&__pyx_n_s__ACTIVE, __pyx_k__ACTIVE, sizeof(__pyx_k__ACTIVE), 0, 0, 1, 1}, - {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1}, - {&__pyx_n_s__BSD, __pyx_k__BSD, sizeof(__pyx_k__BSD), 0, 0, 1, 1}, - {&__pyx_n_s__CONNECT, __pyx_k__CONNECT, sizeof(__pyx_k__CONNECT), 0, 0, 1, 1}, - {&__pyx_n_s__DELETE, __pyx_k__DELETE, sizeof(__pyx_k__DELETE), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_FORMAT, __pyx_k__DNS_ERR_FORMAT, sizeof(__pyx_k__DNS_ERR_FORMAT), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_NONE, __pyx_k__DNS_ERR_NONE, sizeof(__pyx_k__DNS_ERR_NONE), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_NOTEXIST, __pyx_k__DNS_ERR_NOTEXIST, sizeof(__pyx_k__DNS_ERR_NOTEXIST), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_NOTIMPL, __pyx_k__DNS_ERR_NOTIMPL, sizeof(__pyx_k__DNS_ERR_NOTIMPL), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_REFUSED, __pyx_k__DNS_ERR_REFUSED, sizeof(__pyx_k__DNS_ERR_REFUSED), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_SHUTDOWN, __pyx_k__DNS_ERR_SHUTDOWN, sizeof(__pyx_k__DNS_ERR_SHUTDOWN), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_TIMEOUT, __pyx_k__DNS_ERR_TIMEOUT, sizeof(__pyx_k__DNS_ERR_TIMEOUT), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_TRUNCATED, __pyx_k__DNS_ERR_TRUNCATED, sizeof(__pyx_k__DNS_ERR_TRUNCATED), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_ERR_UNKNOWN, __pyx_k__DNS_ERR_UNKNOWN, sizeof(__pyx_k__DNS_ERR_UNKNOWN), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_IPv4_A, __pyx_k__DNS_IPv4_A, sizeof(__pyx_k__DNS_IPv4_A), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_IPv6_AAAA, __pyx_k__DNS_IPv6_AAAA, sizeof(__pyx_k__DNS_IPv6_AAAA), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_PTR, __pyx_k__DNS_PTR, sizeof(__pyx_k__DNS_PTR), 0, 0, 1, 1}, - {&__pyx_n_s__DNS_QUERY_NO_SEARCH, __pyx_k__DNS_QUERY_NO_SEARCH, sizeof(__pyx_k__DNS_QUERY_NO_SEARCH), 0, 0, 1, 1}, - {&__pyx_n_s__DeprecationWarning, __pyx_k__DeprecationWarning, sizeof(__pyx_k__DeprecationWarning), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQUEST, __pyx_k__EVHTTP_REQUEST, sizeof(__pyx_k__EVHTTP_REQUEST), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_CONNECT, __pyx_k__EVHTTP_REQ_CONNECT, sizeof(__pyx_k__EVHTTP_REQ_CONNECT), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_DELETE, __pyx_k__EVHTTP_REQ_DELETE, sizeof(__pyx_k__EVHTTP_REQ_DELETE), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_GET, __pyx_k__EVHTTP_REQ_GET, sizeof(__pyx_k__EVHTTP_REQ_GET), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_HEAD, __pyx_k__EVHTTP_REQ_HEAD, sizeof(__pyx_k__EVHTTP_REQ_HEAD), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_OPTIONS, __pyx_k__EVHTTP_REQ_OPTIONS, sizeof(__pyx_k__EVHTTP_REQ_OPTIONS), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_PATCH, __pyx_k__EVHTTP_REQ_PATCH, sizeof(__pyx_k__EVHTTP_REQ_PATCH), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_POST, __pyx_k__EVHTTP_REQ_POST, sizeof(__pyx_k__EVHTTP_REQ_POST), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_PUT, __pyx_k__EVHTTP_REQ_PUT, sizeof(__pyx_k__EVHTTP_REQ_PUT), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_REQ_TRACE, __pyx_k__EVHTTP_REQ_TRACE, sizeof(__pyx_k__EVHTTP_REQ_TRACE), 0, 0, 1, 1}, - {&__pyx_n_s__EVHTTP_RESPONSE, __pyx_k__EVHTTP_RESPONSE, sizeof(__pyx_k__EVHTTP_RESPONSE), 0, 0, 1, 1}, - {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, - {&__pyx_n_s__GET, __pyx_k__GET, sizeof(__pyx_k__GET), 0, 0, 1, 1}, - {&__pyx_n_s__HEAD, __pyx_k__HEAD, sizeof(__pyx_k__HEAD), 0, 0, 1, 1}, - {&__pyx_n_s__HTTP_method2name, __pyx_k__HTTP_method2name, sizeof(__pyx_k__HTTP_method2name), 0, 0, 1, 1}, - {&__pyx_n_s__HttpRequestDeleted, __pyx_k__HttpRequestDeleted, sizeof(__pyx_k__HttpRequestDeleted), 0, 0, 1, 1}, - {&__pyx_n_s__INIT, __pyx_k__INIT, sizeof(__pyx_k__INIT), 0, 0, 1, 1}, - {&__pyx_n_s__INSERTED, __pyx_k__INSERTED, sizeof(__pyx_k__INSERTED), 0, 0, 1, 1}, - {&__pyx_n_s__INTERNAL, __pyx_k__INTERNAL, sizeof(__pyx_k__INTERNAL), 0, 0, 1, 1}, - {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, - {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, - {&__pyx_n_s__OPTIONS, __pyx_k__OPTIONS, sizeof(__pyx_k__OPTIONS), 0, 0, 1, 1}, - {&__pyx_n_s__ObjectDeleted, __pyx_k__ObjectDeleted, sizeof(__pyx_k__ObjectDeleted), 0, 0, 1, 1}, - {&__pyx_n_s__PATCH, __pyx_k__PATCH, sizeof(__pyx_k__PATCH), 0, 0, 1, 1}, - {&__pyx_n_s__PERSIST, __pyx_k__PERSIST, sizeof(__pyx_k__PERSIST), 0, 0, 1, 1}, - {&__pyx_n_s__POST, __pyx_k__POST, sizeof(__pyx_k__POST), 0, 0, 1, 1}, - {&__pyx_n_s__PUT, __pyx_k__PUT, sizeof(__pyx_k__PUT), 0, 0, 1, 1}, - {&__pyx_n_s__READ, __pyx_k__READ, sizeof(__pyx_k__READ), 0, 0, 1, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__SIGNAL, __pyx_k__SIGNAL, sizeof(__pyx_k__SIGNAL), 0, 0, 1, 1}, - {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, - {&__pyx_n_s__TIMEOUT, __pyx_k__TIMEOUT, sizeof(__pyx_k__TIMEOUT), 0, 0, 1, 1}, - {&__pyx_n_s__TRACE, __pyx_k__TRACE, sizeof(__pyx_k__TRACE), 0, 0, 1, 1}, - {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, - {&__pyx_n_s__UserWarning, __pyx_k__UserWarning, sizeof(__pyx_k__UserWarning), 0, 0, 1, 1}, - {&__pyx_n_s__WRITE, __pyx_k__WRITE, sizeof(__pyx_k__WRITE), 0, 0, 1, 1}, - {&__pyx_n_s__WeakKeyDictionary, __pyx_k__WeakKeyDictionary, sizeof(__pyx_k__WeakKeyDictionary), 0, 0, 1, 1}, - {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, - {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1}, - {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, - {&__pyx_n_s____copyright__, __pyx_k____copyright__, sizeof(__pyx_k____copyright__), 0, 0, 1, 1}, - {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, - {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, - {&__pyx_n_s____obj, __pyx_k____obj, sizeof(__pyx_k____obj), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s____url__, __pyx_k____url__, sizeof(__pyx_k____url__), 0, 0, 1, 1}, - {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, - {&__pyx_n_s___addref, __pyx_k___addref, sizeof(__pyx_k___addref), 0, 0, 1, 1}, - {&__pyx_n_s___delref, __pyx_k___delref, sizeof(__pyx_k___delref), 0, 0, 1, 1}, - {&__pyx_n_s___format, __pyx_k___format, sizeof(__pyx_k___format), 0, 0, 1, 1}, - {&__pyx_n_s___incref, __pyx_k___incref, sizeof(__pyx_k___incref), 0, 0, 1, 1}, - {&__pyx_n_s___input_buffer, __pyx_k___input_buffer, sizeof(__pyx_k___input_buffer), 0, 0, 1, 1}, - {&__pyx_n_s___obj, __pyx_k___obj, sizeof(__pyx_k___obj), 0, 0, 1, 1}, - {&__pyx_n_s___output_buffer, __pyx_k___output_buffer, sizeof(__pyx_k___output_buffer), 0, 0, 1, 1}, - {&__pyx_n_s___owned, __pyx_k___owned, sizeof(__pyx_k___owned), 0, 0, 1, 1}, - {&__pyx_n_s___requests, __pyx_k___requests, sizeof(__pyx_k___requests), 0, 0, 1, 1}, - {&__pyx_n_s__active_event, __pyx_k__active_event, sizeof(__pyx_k__active_event), 0, 0, 1, 1}, - {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1}, - {&__pyx_n_s__add_output_header, __pyx_k__add_output_header, sizeof(__pyx_k__add_output_header), 0, 0, 1, 1}, - {&__pyx_n_s__address, __pyx_k__address, sizeof(__pyx_k__address), 0, 0, 1, 1}, - {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, - {&__pyx_n_s__arg, __pyx_k__arg, sizeof(__pyx_k__arg), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, - {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, - {&__pyx_n_s__cancel, __pyx_k__cancel, sizeof(__pyx_k__cancel), 0, 0, 1, 1}, - {&__pyx_n_s__chunked, __pyx_k__chunked, sizeof(__pyx_k__chunked), 0, 0, 1, 1}, - {&__pyx_n_s__code, __pyx_k__code, sizeof(__pyx_k__code), 0, 0, 1, 1}, - {&__pyx_n_s__deleted, __pyx_k__deleted, sizeof(__pyx_k__deleted), 0, 0, 1, 1}, - {&__pyx_n_s__detach, __pyx_k__detach, sizeof(__pyx_k__detach), 0, 0, 1, 1}, - {&__pyx_n_s__dispatch, __pyx_k__dispatch, sizeof(__pyx_k__dispatch), 0, 0, 1, 1}, - {&__pyx_n_s__dns_err_to_string, __pyx_k__dns_err_to_string, sizeof(__pyx_k__dns_err_to_string), 0, 0, 1, 1}, - {&__pyx_n_s__dns_init, __pyx_k__dns_init, sizeof(__pyx_k__dns_init), 0, 0, 1, 1}, - {&__pyx_n_s__dns_resolve_ipv4, __pyx_k__dns_resolve_ipv4, sizeof(__pyx_k__dns_resolve_ipv4), 0, 0, 1, 1}, - {&__pyx_n_s__dns_resolve_ipv6, __pyx_k__dns_resolve_ipv6, sizeof(__pyx_k__dns_resolve_ipv6), 0, 0, 1, 1}, - {&__pyx_n_s__dns_resolve_reverse, __pyx_k__dns_resolve_reverse, sizeof(__pyx_k__dns_resolve_reverse), 0, 0, 1, 1}, - {&__pyx_n_s__dns_shutdown, __pyx_k__dns_shutdown, sizeof(__pyx_k__dns_shutdown), 0, 0, 1, 1}, - {&__pyx_n_s__ev, __pyx_k__ev, sizeof(__pyx_k__ev), 0, 0, 1, 1}, - {&__pyx_n_s__ev_events, __pyx_k__ev_events, sizeof(__pyx_k__ev_events), 0, 0, 1, 1}, - {&__pyx_n_s__ev_fd, __pyx_k__ev_fd, sizeof(__pyx_k__ev_fd), 0, 0, 1, 1}, - {&__pyx_n_s__ev_flags, __pyx_k__ev_flags, sizeof(__pyx_k__ev_flags), 0, 0, 1, 1}, - {&__pyx_n_s__evcon, __pyx_k__evcon, sizeof(__pyx_k__evcon), 0, 0, 1, 1}, - {&__pyx_n_s__event, __pyx_k__event, sizeof(__pyx_k__event), 0, 0, 1, 1}, - {&__pyx_n_s__events_str, __pyx_k__events_str, sizeof(__pyx_k__events_str), 0, 0, 1, 1}, - {&__pyx_n_s__evtype, __pyx_k__evtype, sizeof(__pyx_k__evtype), 0, 0, 1, 1}, - {&__pyx_n_s__exc_clear, __pyx_k__exc_clear, sizeof(__pyx_k__exc_clear), 0, 0, 1, 1}, - {&__pyx_n_s__exc_traceback, __pyx_k__exc_traceback, sizeof(__pyx_k__exc_traceback), 0, 0, 1, 1}, - {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1}, - {&__pyx_n_s__exc_value, __pyx_k__exc_value, sizeof(__pyx_k__exc_value), 0, 0, 1, 1}, - {&__pyx_n_s__fail_requests, __pyx_k__fail_requests, sizeof(__pyx_k__fail_requests), 0, 0, 1, 1}, - {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1}, - {&__pyx_n_s__find_output_header, __pyx_k__find_output_header, sizeof(__pyx_k__find_output_header), 0, 0, 1, 1}, - {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, - {&__pyx_n_s__flags_str, __pyx_k__flags_str, sizeof(__pyx_k__flags_str), 0, 0, 1, 1}, - {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, - {&__pyx_n_s__get_header_version, __pyx_k__get_header_version, sizeof(__pyx_k__get_header_version), 0, 0, 1, 1}, - {&__pyx_n_s__get_method, __pyx_k__get_method, sizeof(__pyx_k__get_method), 0, 0, 1, 1}, - {&__pyx_n_s__get_version, __pyx_k__get_version, sizeof(__pyx_k__get_version), 0, 0, 1, 1}, - {&__pyx_n_s__handle, __pyx_k__handle, sizeof(__pyx_k__handle), 0, 0, 1, 1}, - {&__pyx_n_s__hex, __pyx_k__hex, sizeof(__pyx_k__hex), 0, 0, 1, 1}, - {&__pyx_n_s__hint, __pyx_k__hint, sizeof(__pyx_k__hint), 0, 0, 1, 1}, - {&__pyx_n_s__http, __pyx_k__http, sizeof(__pyx_k__http), 0, 0, 1, 1}, - {&__pyx_n_s__http_connection, __pyx_k__http_connection, sizeof(__pyx_k__http_connection), 0, 0, 1, 1}, - {&__pyx_n_s__http_request, __pyx_k__http_request, sizeof(__pyx_k__http_request), 0, 0, 1, 1}, - {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, - {&__pyx_n_s__indent, __pyx_k__indent, sizeof(__pyx_k__indent), 0, 0, 1, 1}, - {&__pyx_n_s__init, __pyx_k__init, sizeof(__pyx_k__init), 0, 0, 1, 1}, - {&__pyx_n_s__input_buffer, __pyx_k__input_buffer, sizeof(__pyx_k__input_buffer), 0, 0, 1, 1}, - {&__pyx_n_s__input_headers, __pyx_k__input_headers, sizeof(__pyx_k__input_headers), 0, 0, 1, 1}, - {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, - {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, - {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1}, - {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1}, - {&__pyx_n_s__loop, __pyx_k__loop, sizeof(__pyx_k__loop), 0, 0, 1, 1}, - {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1}, - {&__pyx_n_s__major, __pyx_k__major, sizeof(__pyx_k__major), 0, 0, 1, 1}, - {&__pyx_n_s__minor, __pyx_k__minor, sizeof(__pyx_k__minor), 0, 0, 1, 1}, - {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1}, - {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, - {&__pyx_n_s__new, __pyx_k__new, sizeof(__pyx_k__new), 0, 0, 1, 1}, - {&__pyx_n_s__nonblock, __pyx_k__nonblock, sizeof(__pyx_k__nonblock), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, - {&__pyx_n_s__output_buffer, __pyx_k__output_buffer, sizeof(__pyx_k__output_buffer), 0, 0, 1, 1}, - {&__pyx_n_s__output_headers, __pyx_k__output_headers, sizeof(__pyx_k__output_headers), 0, 0, 1, 1}, - {&__pyx_n_s__owned, __pyx_k__owned, sizeof(__pyx_k__owned), 0, 0, 1, 1}, - {&__pyx_n_s__packed_ip, __pyx_k__packed_ip, sizeof(__pyx_k__packed_ip), 0, 0, 1, 1}, - {&__pyx_n_s__peer, __pyx_k__peer, sizeof(__pyx_k__peer), 0, 0, 1, 1}, - {&__pyx_n_s__pending, __pyx_k__pending, sizeof(__pyx_k__pending), 0, 0, 1, 1}, - {&__pyx_n_s__persist, __pyx_k__persist, sizeof(__pyx_k__persist), 0, 0, 1, 1}, - {&__pyx_n_s__pformat, __pyx_k__pformat, sizeof(__pyx_k__pformat), 0, 0, 1, 1}, - {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, - {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1}, - {&__pyx_n_s__pprint, __pyx_k__pprint, sizeof(__pyx_k__pprint), 0, 0, 1, 1}, - {&__pyx_n_s__print_exc, __pyx_k__print_exc, sizeof(__pyx_k__print_exc), 0, 0, 1, 1}, - {&__pyx_n_s__read_event, __pyx_k__read_event, sizeof(__pyx_k__read_event), 0, 0, 1, 1}, - {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1}, - {&__pyx_n_s__readwrite_event, __pyx_k__readwrite_event, sizeof(__pyx_k__readwrite_event), 0, 0, 1, 1}, - {&__pyx_n_s__reason, __pyx_k__reason, sizeof(__pyx_k__reason), 0, 0, 1, 1}, - {&__pyx_n_s__reinit, __pyx_k__reinit, sizeof(__pyx_k__reinit), 0, 0, 1, 1}, - {&__pyx_n_s__remote_host, __pyx_k__remote_host, sizeof(__pyx_k__remote_host), 0, 0, 1, 1}, - {&__pyx_n_s__remote_port, __pyx_k__remote_port, sizeof(__pyx_k__remote_port), 0, 0, 1, 1}, - {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1}, - {&__pyx_n_s__req, __pyx_k__req, sizeof(__pyx_k__req), 0, 0, 1, 1}, - {&__pyx_n_s__response_code, __pyx_k__response_code, sizeof(__pyx_k__response_code), 0, 0, 1, 1}, - {&__pyx_n_s__response_code_line, __pyx_k__response_code_line, sizeof(__pyx_k__response_code_line), 0, 0, 1, 1}, - {&__pyx_n_s__seconds, __pyx_k__seconds, sizeof(__pyx_k__seconds), 0, 0, 1, 1}, - {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, - {&__pyx_n_s__set_exc_info, __pyx_k__set_exc_info, sizeof(__pyx_k__set_exc_info), 0, 0, 1, 1}, - {&__pyx_n_s__signal, __pyx_k__signal, sizeof(__pyx_k__signal), 0, 0, 1, 1}, - {&__pyx_n_s__signalnum, __pyx_k__signalnum, sizeof(__pyx_k__signalnum), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__stacklevel, __pyx_k__stacklevel, sizeof(__pyx_k__stacklevel), 0, 0, 1, 1}, - {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1}, - {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, - {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1}, - {&__pyx_n_s__timer, __pyx_k__timer, sizeof(__pyx_k__timer), 0, 0, 1, 1}, - {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1}, - {&__pyx_n_s__tv_sec, __pyx_k__tv_sec, sizeof(__pyx_k__tv_sec), 0, 0, 1, 1}, - {&__pyx_n_s__tv_usec, __pyx_k__tv_usec, sizeof(__pyx_k__tv_usec), 0, 0, 1, 1}, - {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1}, - {&__pyx_n_s__typestr, __pyx_k__typestr, sizeof(__pyx_k__typestr), 0, 0, 1, 1}, - {&__pyx_n_s__uri, __pyx_k__uri, sizeof(__pyx_k__uri), 0, 0, 1, 1}, - {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, - {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1}, - {&__pyx_n_s__warnings, __pyx_k__warnings, sizeof(__pyx_k__warnings), 0, 0, 1, 1}, - {&__pyx_n_s__weakref, __pyx_k__weakref, sizeof(__pyx_k__weakref), 0, 0, 1, 1}, - {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, - {&__pyx_n_s__write_event, __pyx_k__write_event, sizeof(__pyx_k__write_event), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_UserWarning = __Pyx_GetName(__pyx_b, __pyx_n_s__UserWarning); if (!__pyx_builtin_UserWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_hex = __Pyx_GetName(__pyx_b, __pyx_n_s__hex); if (!__pyx_builtin_hex) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_DeprecationWarning = __Pyx_GetName(__pyx_b, __pyx_n_s__DeprecationWarning); if (!__pyx_builtin_DeprecationWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":364 - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.input_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') # <<<<<<<<<<<<<< - * - * def add_output_header(self, char* key, char* value): - */ - __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); - PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":370 - * raise HttpRequestDeleted - * if evhttp_add_header(self.__obj.output_headers, key, value): - * raise RuntimeError('Internal error in evhttp_add_header') # <<<<<<<<<<<<<< - * - * def remove_input_header(self, char* key): - */ - __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); - PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":482 - * self.__obj = evhttp_request_new(_http_request_cb_handler, self) - * if not self.__obj: - * raise IOError('evhttp_request_new() failed') # <<<<<<<<<<<<<< - * self._owned = 1 - * self._addref() - */ - __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_36)); - PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_36)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":597 - * if obj.__obj != c_request: - * # sometimes this happens, don't know why - * sys.stderr.write("Internal error in evhttp\n") # <<<<<<<<<<<<<< - * if obj.callback is not None: - * # preferring c_request to obj.__obj because the latter sometimes causes crashes - */ - __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); - PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":605 - * traceback.print_exc() - * try: - * sys.stderr.write('Failed to execute callback for evhttp request.\n') # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_42)); - PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_42)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); - - /* "gevent/core.pyx":31 - * """ - * - * __author__ = ( 'Dug Song ', # <<<<<<<<<<<<<< - * 'Martin Murray ' ) - * __copyright__ = ( 'Copyright (c) 2004 Dug Song', - */ - __pyx_k_tuple_56 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_54)); - PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_54)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_55)); - PyTuple_SET_ITEM(__pyx_k_tuple_56, 1, ((PyObject *)__pyx_kp_s_55)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); - - /* "gevent/core.pyx":33 - * __author__ = ( 'Dug Song ', - * 'Martin Murray ' ) - * __copyright__ = ( 'Copyright (c) 2004 Dug Song', # <<<<<<<<<<<<<< - * 'Copyright (c) 2003 Martin Murray' ) - * __license__ = 'BSD' - */ - __pyx_k_tuple_59 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_59)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_57)); - PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_kp_s_57)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_58)); - PyTuple_SET_ITEM(__pyx_k_tuple_59, 1, ((PyObject *)__pyx_kp_s_58)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_65 = PyInt_FromLong(65); if (unlikely(!__pyx_int_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_66 = PyInt_FromLong(66); if (unlikely(!__pyx_int_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_67 = PyInt_FromLong(67); if (unlikely(!__pyx_int_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_68 = PyInt_FromLong(68); if (unlikely(!__pyx_int_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initcore(void); /*proto*/ -PyMODINIT_FUNC initcore(void) -#else -PyMODINIT_FUNC PyInit_core(void); /*proto*/ -PyMODINIT_FUNC PyInit_core(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_core(void)", __LINE__, __FILE__); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("core"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_53), 0, PYTHON_API_VERSION); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); - #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main_gevent__core) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_vtabptr_6gevent_4core_event = &__pyx_vtable_6gevent_4core_event; - __pyx_vtable_6gevent_4core_event._addref = (PyObject *(*)(struct __pyx_obj_6gevent_4core_event *))__pyx_f_6gevent_4core_5event__addref; - __pyx_vtable_6gevent_4core_event._delref = (PyObject *(*)(struct __pyx_obj_6gevent_4core_event *))__pyx_f_6gevent_4core_5event__delref; - if (PyType_Ready(&__pyx_type_6gevent_4core_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_event.tp_dict, __pyx_vtabptr_6gevent_4core_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "event", (PyObject *)&__pyx_type_6gevent_4core_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_event = &__pyx_type_6gevent_4core_event; - __pyx_vtabptr_6gevent_4core_read_event = &__pyx_vtable_6gevent_4core_read_event; - __pyx_vtable_6gevent_4core_read_event.__pyx_base = *__pyx_vtabptr_6gevent_4core_event; - __pyx_type_6gevent_4core_read_event.tp_base = __pyx_ptype_6gevent_4core_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_read_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_read_event.tp_dict, __pyx_vtabptr_6gevent_4core_read_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "read_event", (PyObject *)&__pyx_type_6gevent_4core_read_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_read_event = &__pyx_type_6gevent_4core_read_event; - __pyx_vtabptr_6gevent_4core_write_event = &__pyx_vtable_6gevent_4core_write_event; - __pyx_vtable_6gevent_4core_write_event.__pyx_base = *__pyx_vtabptr_6gevent_4core_event; - __pyx_type_6gevent_4core_write_event.tp_base = __pyx_ptype_6gevent_4core_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_write_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_write_event.tp_dict, __pyx_vtabptr_6gevent_4core_write_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "write_event", (PyObject *)&__pyx_type_6gevent_4core_write_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_write_event = &__pyx_type_6gevent_4core_write_event; - __pyx_vtabptr_6gevent_4core_timer = &__pyx_vtable_6gevent_4core_timer; - __pyx_vtable_6gevent_4core_timer.__pyx_base = *__pyx_vtabptr_6gevent_4core_event; - __pyx_type_6gevent_4core_timer.tp_base = __pyx_ptype_6gevent_4core_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_timer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_timer.tp_dict, __pyx_vtabptr_6gevent_4core_timer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "timer", (PyObject *)&__pyx_type_6gevent_4core_timer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_timer = &__pyx_type_6gevent_4core_timer; - __pyx_vtabptr_6gevent_4core_signal = &__pyx_vtable_6gevent_4core_signal; - __pyx_vtable_6gevent_4core_signal.__pyx_base = *__pyx_vtabptr_6gevent_4core_event; - __pyx_type_6gevent_4core_signal.tp_base = __pyx_ptype_6gevent_4core_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_signal.tp_dict, __pyx_vtabptr_6gevent_4core_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "signal", (PyObject *)&__pyx_type_6gevent_4core_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_signal = &__pyx_type_6gevent_4core_signal; - __pyx_vtabptr_6gevent_4core_active_event = &__pyx_vtable_6gevent_4core_active_event; - __pyx_vtable_6gevent_4core_active_event.__pyx_base = *__pyx_vtabptr_6gevent_4core_event; - __pyx_type_6gevent_4core_active_event.tp_base = __pyx_ptype_6gevent_4core_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_active_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_active_event.tp_dict, __pyx_vtabptr_6gevent_4core_active_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "active_event", (PyObject *)&__pyx_type_6gevent_4core_active_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_active_event = &__pyx_type_6gevent_4core_active_event; - if (PyType_Ready(&__pyx_type_6gevent_4core_buffer) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "buffer", (PyObject *)&__pyx_type_6gevent_4core_buffer) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_buffer = &__pyx_type_6gevent_4core_buffer; - if (PyType_Ready(&__pyx_type_6gevent_4core_http_request_base) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "http_request_base", (PyObject *)&__pyx_type_6gevent_4core_http_request_base) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_type_6gevent_4core_http_request_base.tp_weaklistoffset == 0) __pyx_type_6gevent_4core_http_request_base.tp_weaklistoffset = offsetof(struct __pyx_obj_6gevent_4core_http_request_base, __weakref__); - __pyx_ptype_6gevent_4core_http_request_base = &__pyx_type_6gevent_4core_http_request_base; - __pyx_type_6gevent_4core_http_request.tp_base = __pyx_ptype_6gevent_4core_http_request_base; - if (PyType_Ready(&__pyx_type_6gevent_4core_http_request) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "http_request", (PyObject *)&__pyx_type_6gevent_4core_http_request) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_type_6gevent_4core_http_request.tp_weaklistoffset == 0) __pyx_type_6gevent_4core_http_request.tp_weaklistoffset = offsetof(struct __pyx_obj_6gevent_4core_http_request, __pyx_base.__weakref__); - __pyx_ptype_6gevent_4core_http_request = &__pyx_type_6gevent_4core_http_request; - __pyx_vtabptr_6gevent_4core_http_request_client = &__pyx_vtable_6gevent_4core_http_request_client; - __pyx_vtable_6gevent_4core_http_request_client._addref = (PyObject *(*)(struct __pyx_obj_6gevent_4core_http_request_client *))__pyx_f_6gevent_4core_19http_request_client__addref; - __pyx_vtable_6gevent_4core_http_request_client._delref = (PyObject *(*)(struct __pyx_obj_6gevent_4core_http_request_client *))__pyx_f_6gevent_4core_19http_request_client__delref; - __pyx_type_6gevent_4core_http_request_client.tp_base = __pyx_ptype_6gevent_4core_http_request_base; - if (PyType_Ready(&__pyx_type_6gevent_4core_http_request_client) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6gevent_4core_http_request_client.tp_dict, __pyx_vtabptr_6gevent_4core_http_request_client) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "http_request_client", (PyObject *)&__pyx_type_6gevent_4core_http_request_client) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_type_6gevent_4core_http_request_client.tp_weaklistoffset == 0) __pyx_type_6gevent_4core_http_request_client.tp_weaklistoffset = offsetof(struct __pyx_obj_6gevent_4core_http_request_client, __pyx_base.__weakref__); - __pyx_ptype_6gevent_4core_http_request_client = &__pyx_type_6gevent_4core_http_request_client; - if (PyType_Ready(&__pyx_type_6gevent_4core_http_connection) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "http_connection", (PyObject *)&__pyx_type_6gevent_4core_http_connection) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_http_connection = &__pyx_type_6gevent_4core_http_connection; - if (PyType_Ready(&__pyx_type_6gevent_4core_http) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "http", (PyObject *)&__pyx_type_6gevent_4core_http) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6gevent_4core_http = &__pyx_type_6gevent_4core_http; - /*--- Type import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "gevent/core.pyx":31 - * """ - * - * __author__ = ( 'Dug Song ', # <<<<<<<<<<<<<< - * 'Martin Murray ' ) - * __copyright__ = ( 'Copyright (c) 2004 Dug Song', - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_k_tuple_56)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":33 - * __author__ = ( 'Dug Song ', - * 'Martin Murray ' ) - * __copyright__ = ( 'Copyright (c) 2004 Dug Song', # <<<<<<<<<<<<<< - * 'Copyright (c) 2003 Martin Murray' ) - * __license__ = 'BSD' - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_k_tuple_59)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":35 - * __copyright__ = ( 'Copyright (c) 2004 Dug Song', - * 'Copyright (c) 2003 Martin Murray' ) - * __license__ = 'BSD' # <<<<<<<<<<<<<< - * __url__ = 'http://monkey.org/~dugsong/pyevent/' - * __version__ = '0.4+' - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_n_s__BSD)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":36 - * 'Copyright (c) 2003 Martin Murray' ) - * __license__ = 'BSD' - * __url__ = 'http://monkey.org/~dugsong/pyevent/' # <<<<<<<<<<<<<< - * __version__ = '0.4+' - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____url__, ((PyObject *)__pyx_kp_s_60)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":37 - * __license__ = 'BSD' - * __url__ = 'http://monkey.org/~dugsong/pyevent/' - * __version__ = '0.4+' # <<<<<<<<<<<<<< - * - * __all__ = ['event', 'read_event', 'write_event', 'timer', 'signal', 'active_event', - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_61)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "gevent/core.pyx":39 - * __version__ = '0.4+' - * - * __all__ = ['event', 'read_event', 'write_event', 'timer', 'signal', 'active_event', # <<<<<<<<<<<<<< - * 'init', 'dispatch', 'loop', 'get_version', 'get_method', 'get_header_version'] - * # note, that .pxi files append stuff to __all__ - */ - __pyx_t_1 = PyList_New(12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__event)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__event)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__event)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__read_event)); - PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__read_event)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__read_event)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__write_event)); - PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__write_event)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__write_event)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__timer)); - PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__timer)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__timer)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__signal)); - PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__signal)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__signal)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__active_event)); - PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__active_event)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__active_event)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__init)); - PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__init)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__init)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dispatch)); - PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__dispatch)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dispatch)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__loop)); - PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__loop)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loop)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__get_version)); - PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__get_version)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_version)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__get_method)); - PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_s__get_method)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_method)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__get_header_version)); - PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_s__get_header_version)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_header_version)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "gevent/core.pyx":43 - * # note, that .pxi files append stuff to __all__ - * - * import sys # <<<<<<<<<<<<<< - * import traceback - * from pprint import pformat - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":44 - * - * import sys - * import traceback # <<<<<<<<<<<<<< - * from pprint import pformat - * import weakref - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__traceback), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__traceback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":45 - * import sys - * import traceback - * from pprint import pformat # <<<<<<<<<<<<<< - * import weakref - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__pformat)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__pformat)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pformat)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__pprint), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pformat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":46 - * import traceback - * from pprint import pformat - * import weakref # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weakref, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":303 - * """Create a new scheduled event with evtype=EV_READ""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_READ - * if persist: - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_k_12 = __pyx_t_2; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "gevent/core.pyx":314 - * """Create a new scheduled event with evtype=EV_WRITE""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_WRITE - * if persist: - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_k_13 = __pyx_t_2; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "gevent/core.pyx":322 - * - * - * class readwrite_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_READ|EV_WRITE""" - * - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - - /* "gevent/core.pyx":325 - * """Create a new scheduled event with evtype=EV_READ|EV_WRITE""" - * - * def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): # <<<<<<<<<<<<<< - * cdef short evtype = EV_READ|EV_WRITE - * if persist: - */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_k_14 = __pyx_t_1; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_6gevent_4core_15readwrite_event___init__, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":322 - * - * - * class readwrite_event(event): # <<<<<<<<<<<<<< - * """Create a new scheduled event with evtype=EV_READ|EV_WRITE""" - * - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_event))); - if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_63)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__readwrite_event, __pyx_n_s_62); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__readwrite_event, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - - /* "gevent/core.pyx":384 - * - * - * def init(): # <<<<<<<<<<<<<< - * """Initialize event queue.""" - * event_init() - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_init, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__init, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":389 - * - * - * def dispatch(): # <<<<<<<<<<<<<< - * """Dispatch all events on the event queue. - * Returns 0 on success, and 1 if no events are registered. - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1dispatch, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dispatch, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":402 - * - * - * def loop(nonblock=False): # <<<<<<<<<<<<<< - * """Dispatch all pending events on queue in a single pass. - * Returns 0 on success, and 1 if no events are registered. - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_k_15 = __pyx_t_2; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_2loop, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__loop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":418 - * - * - * def get_version(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_get_version`""" - * return event_get_version() - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_version, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":423 - * - * - * def get_method(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_get_method`""" - * return event_get_method() - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_4get_method, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_method, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":436 - * # _EVENT_VERSION is available since libevent 1.4.0-beta - * - * def get_header_version(): # <<<<<<<<<<<<<< - * """Return _EVENT_VERSION""" - * emit_ifdef() - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_5get_header_version, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_header_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":447 - * # which will work in every version other than 1.4.0-beta - * - * def reinit(): # <<<<<<<<<<<<<< - * """Wrapper for :meth:`event_reinit`.""" - * emit_ifdef() - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_6reinit, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reinit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":1 - * __all__ += ['dns_init', 'dns_shutdown', 'dns_err_to_string', # <<<<<<<<<<<<<< - * 'dns_resolve_ipv4', 'dns_resolve_ipv6', - * 'dns_resolve_reverse', 'dns_resolve_reverse_ipv6'] - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s____all__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_init)); - PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__dns_init)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_init)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_shutdown)); - PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__dns_shutdown)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_shutdown)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_err_to_string)); - PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__dns_err_to_string)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_err_to_string)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_resolve_ipv4)); - PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__dns_resolve_ipv4)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_resolve_ipv4)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_resolve_ipv6)); - PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__dns_resolve_ipv6)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_resolve_ipv6)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__dns_resolve_reverse)); - PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__dns_resolve_reverse)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dns_resolve_reverse)); - __Pyx_INCREF(((PyObject *)__pyx_n_s_64)); - PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s_64)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_64)); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":20 - * - * # Result codes - * DNS_ERR_NONE = 0 # <<<<<<<<<<<<<< - * DNS_ERR_FORMAT = 1 - * DNS_ERR_SERVERFAILED = 2 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_NONE, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":21 - * # Result codes - * DNS_ERR_NONE = 0 - * DNS_ERR_FORMAT = 1 # <<<<<<<<<<<<<< - * DNS_ERR_SERVERFAILED = 2 - * DNS_ERR_NOTEXIST = 3 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_FORMAT, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":22 - * DNS_ERR_NONE = 0 - * DNS_ERR_FORMAT = 1 - * DNS_ERR_SERVERFAILED = 2 # <<<<<<<<<<<<<< - * DNS_ERR_NOTEXIST = 3 - * DNS_ERR_NOTIMPL = 4 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_65, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":23 - * DNS_ERR_FORMAT = 1 - * DNS_ERR_SERVERFAILED = 2 - * DNS_ERR_NOTEXIST = 3 # <<<<<<<<<<<<<< - * DNS_ERR_NOTIMPL = 4 - * DNS_ERR_REFUSED = 5 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_NOTEXIST, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":24 - * DNS_ERR_SERVERFAILED = 2 - * DNS_ERR_NOTEXIST = 3 - * DNS_ERR_NOTIMPL = 4 # <<<<<<<<<<<<<< - * DNS_ERR_REFUSED = 5 - * DNS_ERR_TRUNCATED = 65 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_NOTIMPL, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":25 - * DNS_ERR_NOTEXIST = 3 - * DNS_ERR_NOTIMPL = 4 - * DNS_ERR_REFUSED = 5 # <<<<<<<<<<<<<< - * DNS_ERR_TRUNCATED = 65 - * DNS_ERR_UNKNOWN = 66 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_REFUSED, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":26 - * DNS_ERR_NOTIMPL = 4 - * DNS_ERR_REFUSED = 5 - * DNS_ERR_TRUNCATED = 65 # <<<<<<<<<<<<<< - * DNS_ERR_UNKNOWN = 66 - * DNS_ERR_TIMEOUT = 67 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_TRUNCATED, __pyx_int_65) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":27 - * DNS_ERR_REFUSED = 5 - * DNS_ERR_TRUNCATED = 65 - * DNS_ERR_UNKNOWN = 66 # <<<<<<<<<<<<<< - * DNS_ERR_TIMEOUT = 67 - * DNS_ERR_SHUTDOWN = 68 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_UNKNOWN, __pyx_int_66) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":28 - * DNS_ERR_TRUNCATED = 65 - * DNS_ERR_UNKNOWN = 66 - * DNS_ERR_TIMEOUT = 67 # <<<<<<<<<<<<<< - * DNS_ERR_SHUTDOWN = 68 - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_TIMEOUT, __pyx_int_67) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":29 - * DNS_ERR_UNKNOWN = 66 - * DNS_ERR_TIMEOUT = 67 - * DNS_ERR_SHUTDOWN = 68 # <<<<<<<<<<<<<< - * - * # Types - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_ERR_SHUTDOWN, __pyx_int_68) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":32 - * - * # Types - * DNS_IPv4_A = 1 # <<<<<<<<<<<<<< - * DNS_PTR = 2 - * DNS_IPv6_AAAA = 3 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_IPv4_A, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":33 - * # Types - * DNS_IPv4_A = 1 - * DNS_PTR = 2 # <<<<<<<<<<<<<< - * DNS_IPv6_AAAA = 3 - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_PTR, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":34 - * DNS_IPv4_A = 1 - * DNS_PTR = 2 - * DNS_IPv6_AAAA = 3 # <<<<<<<<<<<<<< - * - * # Flags - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_IPv6_AAAA, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":37 - * - * # Flags - * DNS_QUERY_NO_SEARCH = 1 # <<<<<<<<<<<<<< - * - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DNS_QUERY_NO_SEARCH, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":40 - * - * - * def dns_init(): # <<<<<<<<<<<<<< - * """Initialize async DNS resolver.""" - * evdns_init() - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_7dns_init, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":45 - * - * - * def dns_shutdown(int fail_requests=0): # <<<<<<<<<<<<<< - * """Shutdown the async DNS resolver and terminate all active requests.""" - * evdns_shutdown(fail_requests) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_8dns_shutdown, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":50 - * - * - * def dns_err_to_string(int err): # <<<<<<<<<<<<<< - * cdef const_char_ptr result = evdns_err_to_string(err) - * if result: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_9dns_err_to_string, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_err_to_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":84 - * - * - * def dns_resolve_ipv4(char *name, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup an A record for a given name. - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_10dns_resolve_ipv4, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_resolve_ipv4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":97 - * - * - * def dns_resolve_ipv6(char *name, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup an AAAA record for a given name. - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_11dns_resolve_ipv6, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_resolve_ipv6, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":110 - * - * - * def dns_resolve_reverse(char* packed_ip, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup a PTR record for a given IPv4 address. - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_12dns_resolve_reverse, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dns_resolve_reverse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evdns.pxi":123 - * - * - * def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback): # <<<<<<<<<<<<<< - * """Lookup a PTR record for a given IPv6 address. - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13dns_resolve_reverse_ipv6, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "gevent/core.pyx":456 - * - * # XXX - make sure event queue is always initialized. - * init() # <<<<<<<<<<<<<< - * - * if get_version() != get_header_version() and get_header_version() is not None and get_version() != '1.3.99-trunk': - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "gevent/core.pyx":458 - * init() - * - * if get_version() != get_header_version() and get_header_version() is not None and get_version() != '1.3.99-trunk': # <<<<<<<<<<<<<< - * import warnings - * msg = "libevent version mismatch: system version is %r but this gevent is compiled against %r" % (get_version(), get_header_version()) - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_header_version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_header_version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = (__pyx_t_2 != Py_None); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_66), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_6; - } else { - __pyx_t_7 = __pyx_t_5; - } - __pyx_t_5 = __pyx_t_7; - } else { - __pyx_t_5 = __pyx_t_4; - } - if (__pyx_t_5) { - - /* "gevent/core.pyx":459 - * - * if get_version() != get_header_version() and get_header_version() is not None and get_version() != '1.3.99-trunk': - * import warnings # <<<<<<<<<<<<<< - * msg = "libevent version mismatch: system version is %r but this gevent is compiled against %r" % (get_version(), get_header_version()) - * warnings.warn(msg, UserWarning, stacklevel=2) - */ - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "gevent/core.pyx":460 - * if get_version() != get_header_version() and get_header_version() is not None and get_version() != '1.3.99-trunk': - * import warnings - * msg = "libevent version mismatch: system version is %r but this gevent is compiled against %r" % (get_version(), get_header_version()) # <<<<<<<<<<<<<< - * warnings.warn(msg, UserWarning, stacklevel=2) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_header_version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__msg, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "gevent/core.pyx":461 - * import warnings - * msg = "libevent version mismatch: system version is %r but this gevent is compiled against %r" % (get_version(), get_header_version()) - * warnings.warn(msg, UserWarning, stacklevel=2) # <<<<<<<<<<<<<< - * - * include "evbuffer.pxi" - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_builtin_UserWarning); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_UserWarning); - __Pyx_GIVEREF(__pyx_builtin_UserWarning); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__stacklevel), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L2; - } - __pyx_L2:; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":1 - * __all__ += ['buffer'] # <<<<<<<<<<<<<< - * - * cdef extern from "string.h": - */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s____all__); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__buffer)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer)); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_8, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evbuffer.pxi":108 - * return list(self) - * - * def write(self, bytes data): # <<<<<<<<<<<<<< - * cdef int result = evbuffer_add(self.__obj, data, len(data)) - * if result < 0: - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s____all__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":1 - * __all__ += ['http_request', 'http_connection', 'http'] # <<<<<<<<<<<<<< - * - * cdef extern from *: - */ - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__http_request)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__http_request)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__http_request)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__http_connection)); - PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__http_connection)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__http_connection)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__http)); - PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__http)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__http)); - __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":6 - * cdef void emit_ifdef_modern "#if defined(LIBEVENT_HTTP_MODERN) //" () - * - * EVHTTP_REQUEST = 0 # <<<<<<<<<<<<<< - * EVHTTP_RESPONSE = 1 - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQUEST, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":7 - * - * EVHTTP_REQUEST = 0 - * EVHTTP_RESPONSE = 1 # <<<<<<<<<<<<<< - * - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_RESPONSE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":10 - * - * - * emit_ifdef_modern() # <<<<<<<<<<<<<< - * - * EVHTTP_REQ_GET = 1 << 0 - */ - #if defined(LIBEVENT_HTTP_MODERN) //(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":12 - * emit_ifdef_modern() - * - * EVHTTP_REQ_GET = 1 << 0 # <<<<<<<<<<<<<< - * EVHTTP_REQ_POST = 1 << 1 - * EVHTTP_REQ_HEAD = 1 << 2 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_GET, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":13 - * - * EVHTTP_REQ_GET = 1 << 0 - * EVHTTP_REQ_POST = 1 << 1 # <<<<<<<<<<<<<< - * EVHTTP_REQ_HEAD = 1 << 2 - * EVHTTP_REQ_PUT = 1 << 3 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_POST, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":14 - * EVHTTP_REQ_GET = 1 << 0 - * EVHTTP_REQ_POST = 1 << 1 - * EVHTTP_REQ_HEAD = 1 << 2 # <<<<<<<<<<<<<< - * EVHTTP_REQ_PUT = 1 << 3 - * EVHTTP_REQ_DELETE = 1 << 4 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_HEAD, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":15 - * EVHTTP_REQ_POST = 1 << 1 - * EVHTTP_REQ_HEAD = 1 << 2 - * EVHTTP_REQ_PUT = 1 << 3 # <<<<<<<<<<<<<< - * EVHTTP_REQ_DELETE = 1 << 4 - * EVHTTP_REQ_OPTIONS = 1 << 5 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_PUT, __pyx_int_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":16 - * EVHTTP_REQ_HEAD = 1 << 2 - * EVHTTP_REQ_PUT = 1 << 3 - * EVHTTP_REQ_DELETE = 1 << 4 # <<<<<<<<<<<<<< - * EVHTTP_REQ_OPTIONS = 1 << 5 - * EVHTTP_REQ_TRACE = 1 << 6 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_DELETE, __pyx_int_16) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":17 - * EVHTTP_REQ_PUT = 1 << 3 - * EVHTTP_REQ_DELETE = 1 << 4 - * EVHTTP_REQ_OPTIONS = 1 << 5 # <<<<<<<<<<<<<< - * EVHTTP_REQ_TRACE = 1 << 6 - * EVHTTP_REQ_CONNECT = 1 << 7 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_OPTIONS, __pyx_int_32) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":18 - * EVHTTP_REQ_DELETE = 1 << 4 - * EVHTTP_REQ_OPTIONS = 1 << 5 - * EVHTTP_REQ_TRACE = 1 << 6 # <<<<<<<<<<<<<< - * EVHTTP_REQ_CONNECT = 1 << 7 - * EVHTTP_REQ_PATCH = 1 << 8 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_TRACE, __pyx_int_64) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":19 - * EVHTTP_REQ_OPTIONS = 1 << 5 - * EVHTTP_REQ_TRACE = 1 << 6 - * EVHTTP_REQ_CONNECT = 1 << 7 # <<<<<<<<<<<<<< - * EVHTTP_REQ_PATCH = 1 << 8 - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_CONNECT, __pyx_int_128) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":20 - * EVHTTP_REQ_TRACE = 1 << 6 - * EVHTTP_REQ_CONNECT = 1 << 7 - * EVHTTP_REQ_PATCH = 1 << 8 # <<<<<<<<<<<<<< - * - * HTTP_method2name = { - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_PATCH, __pyx_int_256) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":22 - * EVHTTP_REQ_PATCH = 1 << 8 - * - * HTTP_method2name = { # <<<<<<<<<<<<<< - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":23 - * - * HTTP_method2name = { - * EVHTTP_REQ_GET: "GET", # <<<<<<<<<<<<<< - * EVHTTP_REQ_POST: "POST", - * EVHTTP_REQ_HEAD: "HEAD", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_GET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__GET)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":24 - * HTTP_method2name = { - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", # <<<<<<<<<<<<<< - * EVHTTP_REQ_HEAD: "HEAD", - * EVHTTP_REQ_PUT: "PUT", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_POST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__POST)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":25 - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", - * EVHTTP_REQ_HEAD: "HEAD", # <<<<<<<<<<<<<< - * EVHTTP_REQ_PUT: "PUT", - * EVHTTP_REQ_DELETE: "DELETE", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_HEAD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__HEAD)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":26 - * EVHTTP_REQ_POST: "POST", - * EVHTTP_REQ_HEAD: "HEAD", - * EVHTTP_REQ_PUT: "PUT", # <<<<<<<<<<<<<< - * EVHTTP_REQ_DELETE: "DELETE", - * EVHTTP_REQ_OPTIONS: "OPTIONS", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_PUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__PUT)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":27 - * EVHTTP_REQ_HEAD: "HEAD", - * EVHTTP_REQ_PUT: "PUT", - * EVHTTP_REQ_DELETE: "DELETE", # <<<<<<<<<<<<<< - * EVHTTP_REQ_OPTIONS: "OPTIONS", - * EVHTTP_REQ_TRACE: "TRACE", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_DELETE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__DELETE)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":28 - * EVHTTP_REQ_PUT: "PUT", - * EVHTTP_REQ_DELETE: "DELETE", - * EVHTTP_REQ_OPTIONS: "OPTIONS", # <<<<<<<<<<<<<< - * EVHTTP_REQ_TRACE: "TRACE", - * EVHTTP_REQ_CONNECT: "CONNECT", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_OPTIONS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__OPTIONS)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":29 - * EVHTTP_REQ_DELETE: "DELETE", - * EVHTTP_REQ_OPTIONS: "OPTIONS", - * EVHTTP_REQ_TRACE: "TRACE", # <<<<<<<<<<<<<< - * EVHTTP_REQ_CONNECT: "CONNECT", - * EVHTTP_REQ_PATCH: "PATCH" - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_TRACE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__TRACE)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":30 - * EVHTTP_REQ_OPTIONS: "OPTIONS", - * EVHTTP_REQ_TRACE: "TRACE", - * EVHTTP_REQ_CONNECT: "CONNECT", # <<<<<<<<<<<<<< - * EVHTTP_REQ_PATCH: "PATCH" - * } - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_CONNECT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__CONNECT)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":31 - * EVHTTP_REQ_TRACE: "TRACE", - * EVHTTP_REQ_CONNECT: "CONNECT", - * EVHTTP_REQ_PATCH: "PATCH" # <<<<<<<<<<<<<< - * } - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_PATCH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__PATCH)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HTTP_method2name, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":34 - * } - * - * emit_else() # <<<<<<<<<<<<<< - * - * EVHTTP_REQ_GET = 0 - */ - #else //(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":36 - * emit_else() - * - * EVHTTP_REQ_GET = 0 # <<<<<<<<<<<<<< - * EVHTTP_REQ_POST = 1 - * EVHTTP_REQ_HEAD = 2 - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_GET, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":37 - * - * EVHTTP_REQ_GET = 0 - * EVHTTP_REQ_POST = 1 # <<<<<<<<<<<<<< - * EVHTTP_REQ_HEAD = 2 - * - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_POST, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":38 - * EVHTTP_REQ_GET = 0 - * EVHTTP_REQ_POST = 1 - * EVHTTP_REQ_HEAD = 2 # <<<<<<<<<<<<<< - * - * HTTP_method2name = { - */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EVHTTP_REQ_HEAD, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":40 - * EVHTTP_REQ_HEAD = 2 - * - * HTTP_method2name = { # <<<<<<<<<<<<<< - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":41 - * - * HTTP_method2name = { - * EVHTTP_REQ_GET: "GET", # <<<<<<<<<<<<<< - * EVHTTP_REQ_POST: "POST", - * EVHTTP_REQ_HEAD: "HEAD", - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_GET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__GET)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":42 - * HTTP_method2name = { - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", # <<<<<<<<<<<<<< - * EVHTTP_REQ_HEAD: "HEAD", - * } - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_POST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__POST)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":43 - * EVHTTP_REQ_GET: "GET", - * EVHTTP_REQ_POST: "POST", - * EVHTTP_REQ_HEAD: "HEAD", # <<<<<<<<<<<<<< - * } - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EVHTTP_REQ_HEAD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_n_s__HEAD)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HTTP_method2name, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":46 - * } - * - * emit_endif() # <<<<<<<<<<<<<< - * - * - */ - #endif //(); - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":132 - * - * - * class ObjectDeleted(AttributeError): # <<<<<<<<<<<<<< - * pass - * - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_builtin_AttributeError); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_AttributeError); - __Pyx_GIVEREF(__pyx_builtin_AttributeError); - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8), __pyx_n_s__ObjectDeleted, __pyx_n_s_62); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ObjectDeleted, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":136 - * - * - * class HttpRequestDeleted(ObjectDeleted): # <<<<<<<<<<<<<< - * """Raised when an attribute is accessed of http_request instance whose _obj is 0""" - * - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ObjectDeleted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - if (PyDict_SetItemString(((PyObject *)__pyx_t_8), "__doc__", ((PyObject *)__pyx_kp_s_68)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8), __pyx_n_s__HttpRequestDeleted, __pyx_n_s_62); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HttpRequestDeleted, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":140 - * - * - * class HttpConnectionDeleted(ObjectDeleted): # <<<<<<<<<<<<<< - * """Raised when an attribute is accessed of http_connection instance whose _obj is 0""" - * - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ObjectDeleted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - if (PyDict_SetItemString(((PyObject *)__pyx_t_8), "__doc__", ((PyObject *)__pyx_kp_s_69)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8), __pyx_n_s_38, __pyx_n_s_62); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_38, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":403 - * cdef public object default_response_headers - * - * def __init__(self, size_t obj, object default_response_headers=[]): # <<<<<<<<<<<<<< - * http_request_base.__init__(self, obj) - * self.default_response_headers = default_response_headers - */ - __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_k_33 = ((PyObject *)__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - - /* "/home/denis/tmp/gevent-0.13/gevent/evhttp.pxi":515 - * - * @classmethod - * def new(cls, char* address, unsigned short port): # <<<<<<<<<<<<<< - * cdef void* ptr = evhttp_connection_new(address, port) - * if ptr != NULL: - */ - __pyx_t_8 = __Pyx_GetName((PyObject *)__pyx_ptype_6gevent_4core_http_connection, __pyx_n_s__new); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_4core_http_connection->tp_dict, __pyx_n_s__new, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyType_Modified(__pyx_ptype_6gevent_4core_http_connection); - - /* "gevent/core.pyx":466 - * include "evhttp.pxi" - * - * def set_exc_info(object type, object value): # <<<<<<<<<<<<<< - * cdef PyThreadState* tstate = PyThreadState_GET() - * Py_XDECREF(tstate.exc_type) - */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_14set_exc_info, NULL, __pyx_n_s_62); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_exc_info, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "gevent/core.pyx":1 - * # # <<<<<<<<<<<<<< - * # event.pyx - * # - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - if (__pyx_m) { - __Pyx_AddTraceback("init gevent.core"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init gevent.core"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* Runtime support code */ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *local_type, *local_value, *local_tb; - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - PyErr_NormalizeException(&local_type, &local_value, &local_tb); - if (unlikely(tstate->curexc_type)) - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - #endif - *type = local_type; - *value = local_value; - *tb = local_tb; - Py_INCREF(local_type); - Py_INCREF(local_value); - Py_INCREF(local_tb); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *number, *more_or_less; - - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - number = (num_expected == 1) ? "" : "s"; - PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); -} - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); - } - } - return item; -} - -static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } - } - -bad: - return; -} -#endif - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) - #endif - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - return 0; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -static PyObject* __Pyx_PyEval_CallObjectWithKeywords(PyObject *callable, PyObject *args, PyObject *kwargs) { - PyObject* result; - if (likely(PyDict_Check(kwargs))) { - return PyEval_CallObjectWithKeywords(callable, args, kwargs); - } else { - PyObject* real_dict; - real_dict = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, kwargs, NULL); - if (unlikely(!real_dict)) - return NULL; - result = PyEval_CallObjectWithKeywords(callable, args, real_dict); - Py_DECREF(real_dict); - return result; /* may be NULL */ - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - - -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} - -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - -static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { - PyObject *metaclass; - /* Default metaclass */ -#if PY_MAJOR_VERSION < 3 - if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { - PyObject *base = PyTuple_GET_ITEM(bases, 0); - metaclass = PyObject_GetAttrString(base, "__class__"); - if (!metaclass) { - PyErr_Clear(); - metaclass = (PyObject*) Py_TYPE(base); - } - } else { - metaclass = (PyObject *) &PyClass_Type; - } -#else - if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { - PyObject *base = PyTuple_GET_ITEM(bases, 0); - metaclass = (PyObject*) Py_TYPE(base); - } else { - metaclass = (PyObject *) &PyType_Type; - } -#endif - Py_INCREF(metaclass); - return metaclass; -} - -static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname) { - PyObject *result; - PyObject *metaclass; - - if (PyDict_SetItemString(dict, "__module__", modname) < 0) - return NULL; - - /* Python2 __metaclass__ */ - metaclass = PyDict_GetItemString(dict, "__metaclass__"); - if (metaclass) { - Py_INCREF(metaclass); - } else { - metaclass = __Pyx_FindPy2Metaclass(bases); - } - result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); - Py_DECREF(metaclass); - return result; -} - - -static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) { - __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType); - if (op == NULL) - return NULL; - op->func.m_ml = ml; - Py_XINCREF(self); - op->func.m_self = self; - Py_XINCREF(module); - op->func.m_module = module; - PyObject_GC_Track(op); - return (PyObject *)op; -} - -static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) { - PyObject_GC_UnTrack(m); - Py_XDECREF(m->func.m_self); - Py_XDECREF(m->func.m_module); - PyObject_GC_Del(m); -} - -static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) { - if (obj == Py_None) - obj = NULL; - return PyMethod_New(func, obj, type); -} - -static int __pyx_binding_PyCFunctionType_init(void) { - __pyx_binding_PyCFunctionType_type = PyCFunction_Type; - __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method"); - __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc; - __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get; - if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) { - return -1; - } - __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type; - return 0; - -} - -static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { - /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */ - static PyTypeObject *methoddescr_type = NULL; - if (methoddescr_type == NULL) { - PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append"); - if (!meth) return NULL; - methoddescr_type = Py_TYPE(meth); - Py_DECREF(meth); - } - if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */ - PyMethodDescrObject *descr = (PyMethodDescrObject *)method; - #if PY_VERSION_HEX < 0x03020000 - PyTypeObject *d_type = descr->d_type; - #else - PyTypeObject *d_type = descr->d_common.d_type; - #endif - return PyDescr_NewClassMethod(d_type, descr->d_method); - } - else if (PyMethod_Check(method)) { /* python classes */ - return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); - } - else if (PyCFunction_Check(method)) { - return PyClassMethod_New(method); - } -#ifdef __pyx_binding_PyCFunctionType_USED - else if (PyObject_TypeCheck(method, __pyx_binding_PyCFunctionType)) { /* binded CFunction */ - return PyClassMethod_New(method); - } -#endif - PyErr_Format(PyExc_TypeError, - "Class-level classmethod() can only be called on " - "a method_descriptor or instance method."); - return NULL; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_ev_uint16_t(ev_uint16_t val) { - const ev_uint16_t neg_one = (ev_uint16_t)-1, const_zero = (ev_uint16_t)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(ev_uint16_t) == sizeof(char)) || - (sizeof(ev_uint16_t) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(ev_uint16_t) == sizeof(int)) || - (sizeof(ev_uint16_t) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(ev_uint16_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(ev_uint16_t), - little, !is_unsigned); - } -} - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - signed long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return (signed PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - signed PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static void __Pyx_WriteUnraisable(const char *name) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); - #else - py_srcfile = PyUnicode_FromString(__pyx_filename); - #endif - if (!py_srcfile) goto bad; - if (__pyx_clineno) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( - 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*int kwonlyargcount,*/ - #endif - 0, /*int nlocals,*/ - 0, /*int stacksize,*/ - 0, /*int flags,*/ - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - if (!py_code) goto bad; - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - py_globals, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else /* Python 3+ has unicode identifiers */ - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -/* Type Conversion Functions */ - -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} - -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_VERSION_HEX < 0x03000000 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} - -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} - - -#endif /* Py_PYTHON_H */ diff -Nru python-gevent-0.13.7/gevent/core.ppyx python-gevent-1.0/gevent/core.ppyx --- python-gevent-0.13.7/gevent/core.ppyx 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/core.ppyx 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1085 @@ +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +cimport cython +cimport libev +from python cimport * +import sys +# Work around lack of absolute_import in Cython +os = __import__('os', level=0) +import traceback +import signal as signalmodule + + +__all__ = ['get_version', + 'get_header_version', + 'supported_backends', + 'recommended_backends', + 'embeddable_backends', + 'time', + 'loop'] + + +cdef extern from "callbacks.h": + void gevent_callback_io(libev.ev_loop, void*, int) + void gevent_callback_timer(libev.ev_loop, void*, int) + void gevent_callback_signal(libev.ev_loop, void*, int) + void gevent_callback_idle(libev.ev_loop, void*, int) + void gevent_callback_prepare(libev.ev_loop, void*, int) + void gevent_callback_fork(libev.ev_loop, void*, int) + void gevent_callback_async(libev.ev_loop, void*, int) + void gevent_callback_child(libev.ev_loop, void*, int) + void gevent_callback_stat(libev.ev_loop, void*, int) + void gevent_run_callbacks(libev.ev_loop, void*, int) + void gevent_periodic_signal_check(libev.ev_loop, void*, int) + void gevent_call(loop, callback) + void gevent_noop(libev.ev_loop, void*, int) + +cdef extern from *: + int errno + +cdef extern from "stathelper.c": + object _pystat_fromstructstat(void*) + + +UNDEF = libev.EV_UNDEF +NONE = libev.EV_NONE +READ = libev.EV_READ +WRITE = libev.EV_WRITE +TIMER = libev.EV_TIMER +PERIODIC = libev.EV_PERIODIC +SIGNAL = libev.EV_SIGNAL +CHILD = libev.EV_CHILD +STAT = libev.EV_STAT +IDLE = libev.EV_IDLE +PREPARE = libev.EV_PREPARE +CHECK = libev.EV_CHECK +EMBED = libev.EV_EMBED +FORK = libev.EV_FORK +CLEANUP = libev.EV_CLEANUP +ASYNC = libev.EV_ASYNC +CUSTOM = libev.EV_CUSTOM +ERROR = libev.EV_ERROR + +READWRITE = libev.EV_READ | libev.EV_WRITE + +MINPRI = libev.EV_MINPRI +MAXPRI = libev.EV_MAXPRI + +BACKEND_PORT = libev.EVBACKEND_PORT +BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE +BACKEND_EPOLL = libev.EVBACKEND_EPOLL +BACKEND_POLL = libev.EVBACKEND_POLL +BACKEND_SELECT = libev.EVBACKEND_SELECT +FORKCHECK = libev.EVFLAG_FORKCHECK +NOINOTIFY = libev.EVFLAG_NOINOTIFY +SIGNALFD = libev.EVFLAG_SIGNALFD +NOSIGMASK = libev.EVFLAG_NOSIGMASK + + +@cython.internal +cdef class _EVENTSType: + + def __repr__(self): + return 'gevent.core.EVENTS' + + +cdef public object GEVENT_CORE_EVENTS = _EVENTSType() +EVENTS = GEVENT_CORE_EVENTS + + +def get_version(): + return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) + + +def get_header_version(): + return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) + + +# This list backends in the order they are actually tried by libev +_flags = [(libev.EVBACKEND_PORT, 'port'), + (libev.EVBACKEND_KQUEUE, 'kqueue'), + (libev.EVBACKEND_EPOLL, 'epoll'), + (libev.EVBACKEND_POLL, 'poll'), + (libev.EVBACKEND_SELECT, 'select'), + (libev.EVFLAG_NOENV, 'noenv'), + (libev.EVFLAG_FORKCHECK, 'forkcheck'), + (libev.EVFLAG_NOINOTIFY, 'noinotify'), + (libev.EVFLAG_SIGNALFD, 'signalfd'), + (libev.EVFLAG_NOSIGMASK, 'nosigmask')] + + +_flags_str2int = dict((string, flag) for (flag, string) in _flags) + + +_events = [(libev.EV_READ, 'READ'), + (libev.EV_WRITE, 'WRITE'), + (libev.EV__IOFDSET, '_IOFDSET'), + (libev.EV_PERIODIC, 'PERIODIC'), + (libev.EV_SIGNAL, 'SIGNAL'), + (libev.EV_CHILD, 'CHILD'), + (libev.EV_STAT, 'STAT'), + (libev.EV_IDLE, 'IDLE'), + (libev.EV_PREPARE, 'PREPARE'), + (libev.EV_CHECK, 'CHECK'), + (libev.EV_EMBED, 'EMBED'), + (libev.EV_FORK, 'FORK'), + (libev.EV_CLEANUP, 'CLEANUP'), + (libev.EV_ASYNC, 'ASYNC'), + (libev.EV_CUSTOM, 'CUSTOM'), + (libev.EV_ERROR, 'ERROR')] + + +cpdef _flags_to_list(unsigned int flags): + cdef list result = [] + for code, value in _flags: + if flags & code: + result.append(value) + flags &= ~code + if not flags: + break + if flags: + result.append(flags) + return result + + +if sys.version_info[0] >= 3: + basestring = (bytes, str) +else: + basestring = __builtins__.basestring + + +cpdef unsigned int _flags_to_int(object flags) except? -1: + # Note, that order does not matter, libev has its own predefined order + if not flags: + return 0 + if isinstance(flags, (int, long)): + return flags + cdef unsigned int result = 0 + try: + if isinstance(flags, basestring): + flags = flags.split(',') + for value in flags: + value = value.strip().lower() + if value: + result |= _flags_str2int[value] + except KeyError, ex: + raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) + return result + + +cdef str _str_hex(object flag): + if isinstance(flag, (int, long)): + return hex(flag) + return str(flag) + + +cpdef _check_flags(unsigned int flags): + cdef list as_list + flags &= libev.EVBACKEND_MASK + if not flags: + return + if not (flags & libev.EVBACKEND_ALL): + raise ValueError('Invalid value for backend: 0x%x' % flags) + if not (flags & libev.ev_supported_backends()): + as_list = [_str_hex(x) for x in _flags_to_list(flags)] + raise ValueError('Unsupported backend: %s' % '|'.join(as_list)) + + +cpdef _events_to_str(int events): + cdef list result = [] + cdef int c_flag + for (flag, string) in _events: + c_flag = flag + if events & c_flag: + result.append(string) + events = events & (~c_flag) + if not events: + break + if events: + result.append(hex(events)) + return '|'.join(result) + + +def supported_backends(): + return _flags_to_list(libev.ev_supported_backends()) + + +def recommended_backends(): + return _flags_to_list(libev.ev_recommended_backends()) + + +def embeddable_backends(): + return _flags_to_list(libev.ev_embeddable_backends()) + + +def time(): + return libev.ev_time() + + +#define LOOP_PROPERTY(NAME) property NAME: \ + \ + def __get__(self): \ + CHECK_LOOP3(self) \ + return self._ptr.NAME + + +cdef bint _default_loop_destroyed = False + + +#define CHECK_LOOP2(LOOP) \ + if not LOOP._ptr: \ + raise ValueError('operation on destroyed loop') + + +#define CHECK_LOOP3(LOOP) \ + if not LOOP._ptr: \ + raise ValueError('operation on destroyed loop') + + + +cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: + cdef libev.ev_loop* _ptr + cdef public object error_handler + cdef libev.ev_prepare _prepare + cdef public list _callbacks + cdef libev.ev_timer _timer0 +#ifdef _WIN32 + cdef libev.ev_timer _periodic_signal_checker +#endif + + def __init__(self, object flags=None, object default=None, size_t ptr=0): + cdef unsigned int c_flags + cdef object old_handler = None + libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) +#ifdef _WIN32 + libev.ev_timer_init(&self._periodic_signal_checker, gevent_periodic_signal_check, 0.3, 0.3) +#endif + libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) + if ptr: + self._ptr = ptr + else: + c_flags = _flags_to_int(flags) + _check_flags(c_flags) + c_flags |= libev.EVFLAG_NOENV + if default is None: + default = True + if _default_loop_destroyed: + default = False + if default: + self._ptr = libev.gevent_ev_default_loop(c_flags) + if not self._ptr: + raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) +#ifdef _WIN32 + libev.ev_timer_start(self._ptr, &self._periodic_signal_checker) + libev.ev_unref(self._ptr) +#endif + else: + self._ptr = libev.ev_loop_new(c_flags) + if not self._ptr: + raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + if default or __SYSERR_CALLBACK is None: + set_syserr_cb(self._handle_syserr) + libev.ev_prepare_start(self._ptr, &self._prepare) + libev.ev_unref(self._ptr) + self._callbacks = [] + + cdef _run_callbacks(self): + cdef callback cb + cdef object callbacks + cdef int count = 1000 + libev.ev_timer_stop(self._ptr, &self._timer0) + while self._callbacks and count > 0: + callbacks = self._callbacks + self._callbacks = [] + for cb in callbacks: + libev.ev_unref(self._ptr) + gevent_call(self, cb) + count -= 1 + if self._callbacks: + libev.ev_timer_start(self._ptr, &self._timer0) + + def _stop_watchers(self): + if libev.ev_is_active(&self._prepare): + libev.ev_ref(self._ptr) + libev.ev_prepare_stop(self._ptr, &self._prepare) +#ifdef _WIN32 + if libev.ev_is_active(&self._periodic_signal_checker): + libev.ev_ref(self._ptr) + libev.ev_timer_stop(self._ptr, &self._periodic_signal_checker) +#endif + + def destroy(self): + global _default_loop_destroyed + if self._ptr: + self._stop_watchers() + if __SYSERR_CALLBACK == self._handle_syserr: + set_syserr_cb(None) + if libev.ev_is_default_loop(self._ptr): + _default_loop_destroyed = True + libev.ev_loop_destroy(self._ptr) + self._ptr = NULL + + def __dealloc__(self): + if self._ptr: + self._stop_watchers() + if not libev.ev_is_default_loop(self._ptr): + libev.ev_loop_destroy(self._ptr) + self._ptr = NULL + + property ptr: + + def __get__(self): + return self._ptr + + property WatcherType: + + def __get__(self): + return watcher + + property MAXPRI: + + def __get__(self): + return libev.EV_MAXPRI + + property MINPRI: + + def __get__(self): + return libev.EV_MINPRI + + def _handle_syserr(self, message, errno): + self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) + + cpdef handle_error(self, context, type, value, tb): + cdef object handle_error + cdef object error_handler = self.error_handler + if error_handler is not None: + # we do want to do getattr every time so that setting Hub.handle_error property just works + handle_error = getattr(error_handler, 'handle_error', error_handler) + handle_error(context, type, value, tb) + else: + self._default_handle_error(context, type, value, tb) + + cpdef _default_handle_error(self, context, type, value, tb): + # note: Hub sets its own error handler so this is not used by gevent + # this is here to make core.loop usable without the rest of gevent + traceback.print_exception(type, value, tb) + if self._ptr: + libev.ev_break(self._ptr, libev.EVBREAK_ONE) + + def run(self, nowait=False, once=False): + CHECK_LOOP2(self) + cdef unsigned int flags = 0 + if nowait: + flags |= libev.EVRUN_NOWAIT + if once: + flags |= libev.EVRUN_ONCE + with nogil: + libev.ev_run(self._ptr, flags) + + def reinit(self): + if self._ptr: + libev.ev_loop_fork(self._ptr) + + def ref(self): + CHECK_LOOP2(self) + libev.ev_ref(self._ptr) + + def unref(self): + CHECK_LOOP2(self) + libev.ev_unref(self._ptr) + + def break_(self, int how=libev.EVBREAK_ONE): + CHECK_LOOP2(self) + libev.ev_break(self._ptr, how) + + def verify(self): + CHECK_LOOP2(self) + libev.ev_verify(self._ptr) + + def now(self): + CHECK_LOOP2(self) + return libev.ev_now(self._ptr) + + def update(self): + CHECK_LOOP2(self) + libev.ev_now_update(self._ptr) + + def __repr__(self): + return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), self._format()) + + property default: + + def __get__(self): + CHECK_LOOP3(self) + return True if libev.ev_is_default_loop(self._ptr) else False + + property iteration: + + def __get__(self): + CHECK_LOOP3(self) + return libev.ev_iteration(self._ptr) + + property depth: + + def __get__(self): + CHECK_LOOP3(self) + return libev.ev_depth(self._ptr) + + property backend_int: + + def __get__(self): + CHECK_LOOP3(self) + return libev.ev_backend(self._ptr) + + property backend: + + def __get__(self): + CHECK_LOOP3(self) + cdef unsigned int backend = libev.ev_backend(self._ptr) + for key, value in _flags: + if key == backend: + return value + return backend + + property pendingcnt: + + def __get__(self): + CHECK_LOOP3(self) + return libev.ev_pending_count(self._ptr) + + def io(self, int fd, int events, ref=True, priority=None): + return io(self, fd, events, ref, priority) + + def timer(self, double after, double repeat=0.0, ref=True, priority=None): + return timer(self, after, repeat, ref, priority) + + def signal(self, int signum, ref=True, priority=None): + return signal(self, signum, ref, priority) + + def idle(self, ref=True, priority=None): + return idle(self, ref, priority) + + def prepare(self, ref=True, priority=None): + return prepare(self, ref, priority) + + def fork(self, ref=True, priority=None): + return fork(self, ref, priority) + + def async(self, ref=True, priority=None): + return async(self, ref, priority) + +#ifdef _WIN32 +#else + + def child(self, int pid, bint trace=0, ref=True): + return child(self, pid, trace, ref) + + def install_sigchld(self): + libev.gevent_install_sigchld_handler() + +#endif + + def stat(self, bytes path, float interval=0.0, ref=True, priority=None): + return stat(self, path, interval, ref, priority) + + def run_callback(self, func, *args): + CHECK_LOOP2(self) + cdef callback cb = callback(func, args) + self._callbacks.append(cb) + libev.ev_ref(self._ptr) + return cb + + def _format(self): + if not self._ptr: + return 'destroyed' + cdef object msg = self.backend + if self.default: + msg += ' default' + msg += ' pending=%s' % self.pendingcnt +#ifdef LIBEV_EMBED + msg += self._format_details() +#endif + return msg + +#ifdef LIBEV_EMBED + + def _format_details(self): + cdef str msg = '' + cdef object fileno = self.fileno() + cdef object sigfd = None + cdef object activecnt = None + try: + sigfd = self.sigfd + except AttributeError: + sigfd = None + try: + activecnt = self.activecnt + except AttributeError: + pass + if activecnt is not None: + msg += ' ref=' + repr(activecnt) + if fileno is not None: + msg += ' fileno=' + repr(fileno) + if sigfd is not None and sigfd != -1: + msg += ' sigfd=' + repr(sigfd) + return msg + + def fileno(self): + cdef int fd + if self._ptr: + fd = self._ptr.backend_fd + if fd >= 0: + return fd + + LOOP_PROPERTY(activecnt) + + LOOP_PROPERTY(sig_pending) + +#if EV_USE_SIGNALFD + LOOP_PROPERTY(sigfd) +#endif + + property origflags: + + def __get__(self): + CHECK_LOOP3(self) + return _flags_to_list(self._ptr.origflags) + + property origflags_int: + + def __get__(self): + CHECK_LOOP3(self) + return self._ptr.origflags + +#endif + + +cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: + cdef public object callback + cdef public tuple args + + def __init__(self, callback, args): + self.callback = callback + self.args = args + + def stop(self): + self.callback = None + self.args = None + + # Note, that __nonzero__ and pending are different + # nonzero is used in contexts where we need to know whether to schedule another callback, + # so it's true if it's pending or currently running + # 'pending' has the same meaning as libev watchers: it is cleared before entering callback + + def __nonzero__(self): + # it's nonzero if it's pending or currently executing + return self.args is not None + + property pending: + + def __get__(self): + return self.callback is not None + + def __repr__(self): + if Py_ReprEnter(self) != 0: + return "<...>" + try: + format = self._format() + result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + if self.pending: + result += " pending" + if self.callback is not None: + result += " callback=%r" % (self.callback, ) + if self.args is not None: + result += " args=%r" % (self.args, ) + if self.callback is None and self.args is None: + result += " stopped" + return result + ">" + finally: + Py_ReprLeave(self) + + def _format(self): + return '' + + +#define PYTHON_INCREF if not self._flags & 1: \ + Py_INCREF(self) \ + self._flags |= 1 + +#define LIBEV_UNREF if self._flags & 6 == 4: \ + libev.ev_unref(self.loop._ptr) \ + self._flags |= 2 + +# about readonly _flags attribute: +# bit #1 set if object owns Python reference to itself (Py_INCREF was called and we must call Py_DECREF later) +# bit #2 set if ev_unref() was called and we must call ev_ref() later +# bit #3 set if user wants to call ev_unref() before start() + +#define WATCHER_BASE(TYPE) \ + cdef public loop loop \ + cdef object _callback \ + cdef public tuple args \ + cdef readonly int _flags \ + cdef libev.ev_##TYPE _watcher \ + \ + property ref: \ + \ + def __get__(self): \ + return False if self._flags & 4 else True \ + \ + def __set__(self, object value): \ + CHECK_LOOP3(self.loop) \ + if value: \ + if not self._flags & 4: \ + return # ref is already True \ + if self._flags & 2: # ev_unref was called, undo \ + libev.ev_ref(self.loop._ptr) \ + self._flags &= ~6 # do not want unref, no outstanding unref \ + else: \ + if self._flags & 4: \ + return # ref is already False \ + self._flags |= 4 \ + if not self._flags & 2 and libev.ev_is_active(&self._watcher): \ + libev.ev_unref(self.loop._ptr) \ + self._flags |= 2 \ + \ + property callback: \ + \ + def __get__(self): \ + return self._callback \ + \ + def __set__(self, object callback): \ + if not PyCallable_Check(callback) and callback is not None: \ + raise TypeError("Expected callable, not %r" % (callback, )) \ + self._callback = callback \ + \ + def stop(self): \ + CHECK_LOOP2(self.loop) \ + if self._flags & 2: \ + libev.ev_ref(self.loop._ptr) \ + self._flags &= ~2 \ + libev.ev_##TYPE##_stop(self.loop._ptr, &self._watcher) \ + self._callback = None \ + self.args = None \ + if self._flags & 1: \ + Py_DECREF(self) \ + self._flags &= ~1 \ + \ + property priority: \ + \ + def __get__(self): \ + return libev.ev_priority(&self._watcher) \ + \ + def __set__(self, int priority): \ + if libev.ev_is_active(&self._watcher): \ + raise AttributeError("Cannot set priority of an active watcher") \ + libev.ev_set_priority(&self._watcher, priority) \ + \ + def feed(self, int revents, object callback, *args): \ + CHECK_LOOP2(self.loop) \ + self.callback = callback \ + self.args = args \ + LIBEV_UNREF \ + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) \ + PYTHON_INCREF + +#define ACTIVE property active: \ + \ + def __get__(self): \ + return True if libev.ev_is_active(&self._watcher) else False + +#define START(TYPE) def start(self, object callback, *args): \ + CHECK_LOOP2(self.loop) \ + if callback is None: \ + raise TypeError('callback must be callable, not None') \ + self.callback = callback \ + self.args = args \ + LIBEV_UNREF \ + libev.ev_##TYPE##_start(self.loop._ptr, &self._watcher) \ + PYTHON_INCREF + + +#define PENDING \ + property pending: \ + \ + def __get__(self): \ + return True if libev.ev_is_pending(&self._watcher) else False + + + +#define WATCHER(TYPE) WATCHER_BASE(TYPE) \ + \ + START(TYPE) \ + \ + ACTIVE \ + \ + PENDING + + +#define COMMA , + + +#define INIT(TYPE, ARGS_INITIALIZERS, ARGS) \ + def __init__(self, loop loop ARGS_INITIALIZERS, ref=True, priority=None): \ + libev.ev_##TYPE##_init(&self._watcher, gevent_callback_##TYPE ARGS) \ + self.loop = loop \ + if ref: \ + self._flags = 0 \ + else: \ + self._flags = 4 \ + if priority is not None: \ + libev.ev_set_priority(&self._watcher, priority) + + +cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Type]: + """Abstract base class for all the watchers""" + + def __repr__(self): + if Py_ReprEnter(self) != 0: + return "<...>" + try: + format = self._format() + result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + if self.active: + result += " active" + if self.pending: + result += " pending" + if self.callback is not None: + result += " callback=%r" % (self.callback, ) + if self.args is not None: + result += " args=%r" % (self.args, ) + return result + ">" + finally: + Py_ReprLeave(self) + + def _format(self): + return '' + + +cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]: + + WATCHER_BASE(io) + + def start(self, object callback, *args, pass_events=False): + CHECK_LOOP2(self.loop) + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + if pass_events: + self.args = (GEVENT_CORE_EVENTS, ) + args + else: + self.args = args + LIBEV_UNREF + libev.ev_io_start(self.loop._ptr, &self._watcher) + PYTHON_INCREF + + ACTIVE + + PENDING + +#ifdef _WIN32 + + def __init__(self, loop loop, long fd, int events, ref=True, priority=None): + if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + raise ValueError('illegal event mask: %r' % events) + cdef int vfd = libev.vfd_open(fd) + libev.vfd_free(self._watcher.fd) + libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + +#else + + def __init__(self, loop loop, int fd, int events, ref=True, priority=None): + if fd < 0: + raise ValueError('fd must be non-negative: %r' % fd) + if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + raise ValueError('illegal event mask: %r' % events) + libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + +#endif + + property fd: + + def __get__(self): + return libev.vfd_get(self._watcher.fd) + + def __set__(self, long fd): + if libev.ev_is_active(&self._watcher): + raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + cdef int vfd = libev.vfd_open(fd) + libev.vfd_free(self._watcher.fd) + libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, self._watcher.events) + + property events: + + def __get__(self): + return self._watcher.events + + def __set__(self, int events): + if libev.ev_is_active(&self._watcher): + raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") + libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + + property events_str: + + def __get__(self): + return _events_to_str(self._watcher.events) + + def _format(self): + return ' fd=%s events=%s' % (self.fd, self.events_str) + +#ifdef _WIN32 + + def __cinit__(self): + self._watcher.fd = -1; + + def __dealloc__(self): + libev.vfd_free(self._watcher.fd) + +#endif + + +cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer_Type]: + + WATCHER_BASE(timer) + + def start(self, object callback, *args, update=True): + CHECK_LOOP2(self.loop) + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + LIBEV_UNREF + if update: + libev.ev_now_update(self.loop._ptr) + libev.ev_timer_start(self.loop._ptr, &self._watcher) + PYTHON_INCREF + + ACTIVE + + PENDING + + def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): + if repeat < 0.0: + raise ValueError("repeat must be positive or zero: %r" % repeat) + libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + property at: + + def __get__(self): + return self._watcher.at + + # QQQ: add 'after' and 'repeat' properties? + + def again(self, object callback, *args, update=True): + CHECK_LOOP2(self.loop) + self.callback = callback + self.args = args + LIBEV_UNREF + if update: + libev.ev_now_update(self.loop._ptr) + libev.ev_timer_again(self.loop._ptr, &self._watcher) + PYTHON_INCREF + + +cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSignal_Type]: + + WATCHER(signal) + + def __init__(self, loop loop, int signalnum, ref=True, priority=None): + if signalnum < 1 or signalnum >= signalmodule.NSIG: + raise ValueError('illegal signal number: %r' % signalnum) + # still possible to crash on one of libev's asserts: + # 1) "libev: ev_signal_start called with illegal signal number" + # EV_NSIG might be different from signal.NSIG on some platforms + # 2) "libev: a signal must not be attached to two different loops" + # we probably could check that in LIBEV_EMBED mode, but not in general + libev.ev_signal_init(&self._watcher, gevent_callback_signal, signalnum) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + +cdef public class idle(watcher) [object PyGeventIdleObject, type PyGeventIdle_Type]: + + WATCHER(idle) + + INIT(idle,,) + + +cdef public class prepare(watcher) [object PyGeventPrepareObject, type PyGeventPrepare_Type]: + + WATCHER(prepare) + + INIT(prepare,,) + + +cdef public class fork(watcher) [object PyGeventForkObject, type PyGeventFork_Type]: + + WATCHER(fork) + + INIT(fork,,) + + +cdef public class async(watcher) [object PyGeventAsyncObject, type PyGeventAsync_Type]: + + WATCHER_BASE(async) + + START(async) + + ACTIVE + + property pending: + + def __get__(self): + return True if libev.ev_async_pending(&self._watcher) else False + + INIT(async,,) + + def send(self): + CHECK_LOOP2(self.loop) + libev.ev_async_send(self.loop._ptr, &self._watcher) + +#ifdef _WIN32 +#else + +cdef public class child(watcher) [object PyGeventChildObject, type PyGeventChild_Type]: + + WATCHER(child) + + def __init__(self, loop loop, int pid, bint trace=0, ref=True): + if not loop.default: + raise TypeError('child watchers are only available on the default loop') + libev.gevent_install_sigchld_handler() + libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + + def _format(self): + return ' pid=%r rstatus=%r' % (self.pid, self.rstatus) + + property pid: + + def __get__(self): + return self._watcher.pid + + property rpid: + + def __get__(self): + return self._watcher.rpid + + def __set__(self, int value): + self._watcher.rpid = value + + property rstatus: + + def __get__(self): + return self._watcher.rstatus + + def __set__(self, int value): + self._watcher.rstatus = value + +#endif + + +cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Type]: + + WATCHER(stat) + cdef readonly bytes path + + def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): + self.path = path + libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + property attr: + + def __get__(self): + if not self._watcher.attr.st_nlink: + return + return _pystat_fromstructstat(&self._watcher.attr) + + property prev: + + def __get__(self): + if not self._watcher.prev.st_nlink: + return + return _pystat_fromstructstat(&self._watcher.prev) + + property interval: + + def __get__(self): + return self._watcher.interval + + +__SYSERR_CALLBACK = None + + +cdef void _syserr_cb(char* msg) with gil: + try: + __SYSERR_CALLBACK(msg, errno) + except: + set_syserr_cb(None) + print_exc = getattr(traceback, 'print_exc', None) + if print_exc is not None: + print_exc() + + +cpdef set_syserr_cb(callback): + global __SYSERR_CALLBACK + if callback is None: + libev.ev_set_syserr_cb(NULL) + __SYSERR_CALLBACK = None + elif callable(callback): + libev.ev_set_syserr_cb(_syserr_cb) + __SYSERR_CALLBACK = callback + else: + raise TypeError('Expected callable or None, got %r' % (callback, )) + + +#ifdef LIBEV_EMBED +LIBEV_EMBED = True +EV_USE_FLOOR = libev.EV_USE_FLOOR +EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL +EV_USE_REALTIME = libev.EV_USE_REALTIME +EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC +EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP +EV_USE_INOTIFY = libev.EV_USE_INOTIFY +EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD +EV_USE_EVENTFD = libev.EV_USE_EVENTFD +EV_USE_4HEAP = libev.EV_USE_4HEAP +#else +LIBEV_EMBED = False +#endif diff -Nru python-gevent-0.13.7/gevent/core.pyx python-gevent-1.0/gevent/core.pyx --- python-gevent-0.13.7/gevent/core.pyx 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/core.pyx 2013-11-26 16:26:18.000000000 +0000 @@ -1,479 +1,1949 @@ -# -# event.pyx -# -# libevent Python bindings -# -# Copyright (c) 2004 Dug Song -# Copyright (c) 2003 Martin Murray -# Copyright (c) 2009-2010 Denis Bilenko -# - -"""Wrappers around libevent API. - -This module provides a mechanism to execute a function when a -specific event on a file handle, file descriptor, or signal occurs, -or after a given time has passed. It also provides wrappers around -structures and functions from libevent-dns and libevent-http. - -This module does not work with the greenlets. A callback passed -to a method from this module will be executed in the event loop, -which is running in the :class:`Hub ` greenlet. -Therefore it must not use any synchronous gevent API, -that is, the functions that switch to the Hub. It's OK to call asynchronous -stuff like :func:`gevent.spawn`, :meth:`Event.set `. - -The code is based on pyevent_. - -.. _pyevent: http://code.google.com/p/pyevent/ -""" - -__author__ = ( 'Dug Song ', - 'Martin Murray ' ) -__copyright__ = ( 'Copyright (c) 2004 Dug Song', - 'Copyright (c) 2003 Martin Murray' ) -__license__ = 'BSD' -__url__ = 'http://monkey.org/~dugsong/pyevent/' -__version__ = '0.4+' - -__all__ = ['event', 'read_event', 'write_event', 'timer', 'signal', 'active_event', - 'init', 'dispatch', 'loop', 'get_version', 'get_method', 'get_header_version'] -# note, that .pxi files append stuff to __all__ - +# Generated by cythonpp.py on 2013-11-26 17:25:45 +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +cimport cython +cimport libev +from python cimport * import sys +# Work around lack of absolute_import in Cython +os = __import__('os', level=0) import traceback -from pprint import pformat -import weakref +import signal as signalmodule -cdef extern from "sys/types.h": - ctypedef unsigned char u_char +__all__ = ['get_version', + 'get_header_version', + 'supported_backends', + 'recommended_backends', + 'embeddable_backends', + 'time', + 'loop'] + + +cdef extern from "callbacks.h": + void gevent_callback_io(libev.ev_loop, void*, int) + void gevent_callback_timer(libev.ev_loop, void*, int) + void gevent_callback_signal(libev.ev_loop, void*, int) + void gevent_callback_idle(libev.ev_loop, void*, int) + void gevent_callback_prepare(libev.ev_loop, void*, int) + void gevent_callback_fork(libev.ev_loop, void*, int) + void gevent_callback_async(libev.ev_loop, void*, int) + void gevent_callback_child(libev.ev_loop, void*, int) + void gevent_callback_stat(libev.ev_loop, void*, int) + void gevent_run_callbacks(libev.ev_loop, void*, int) + void gevent_periodic_signal_check(libev.ev_loop, void*, int) + void gevent_call(loop, callback) + void gevent_noop(libev.ev_loop, void*, int) -cdef extern from "Python.h": - struct PyObject: - pass - ctypedef PyObject* PyObjectPtr "PyObject*" - void Py_INCREF(PyObjectPtr o) - void Py_DECREF(PyObjectPtr o) - void Py_XDECREF(PyObjectPtr o) - object PyString_FromStringAndSize(char *v, int len) - object PyString_FromString(char *v) - -cdef extern from "frameobject.h": - ctypedef struct PyThreadState: - PyObjectPtr exc_type - PyObjectPtr exc_value - PyObjectPtr exc_traceback - - PyThreadState* PyThreadState_GET() - -ctypedef void (*event_handler)(int fd, short evtype, void *arg) - -ctypedef void* event_base - -cdef extern from "libevent.h": - - # event.h: - struct timeval: - unsigned int tv_sec - unsigned int tv_usec - - struct event_t "event": - int ev_fd - short ev_events - int ev_flags - void *ev_arg - - void* event_init() - int event_reinit(void *base) - char* event_get_version() - char* event_get_method() - void event_set(event_t *ev, int fd, short event, event_handler handler, void *arg) - void evtimer_set(event_t *ev, event_handler handler, void *arg) - int event_add(event_t *ev, timeval *tv) - int event_del(event_t *ev) - int event_dispatch() nogil - int event_loop(int loop) nogil - int event_pending(event_t *ev, short, timeval *tv) - void event_active(event_t *ev, int res, short ncalls) - - int EVLOOP_ONCE - int EVLOOP_NONBLOCK - char* _EVENT_VERSION - - int EV_TIMEOUT - int EV_READ - int EV_WRITE - int EV_SIGNAL - int EV_PERSIST - - int EVLIST_TIMEOUT - int EVLIST_INSERTED - int EVLIST_SIGNAL - int EVLIST_ACTIVE - int EVLIST_INTERNAL - int EVLIST_INIT +cdef extern from *: + int errno +cdef extern from "stathelper.c": + object _pystat_fromstructstat(void*) -cdef extern from "string.h": - char* strerror(int errnum) -cdef extern from "errno.h": - int errno +UNDEF = libev.EV_UNDEF +NONE = libev.EV_NONE +READ = libev.EV_READ +WRITE = libev.EV_WRITE +TIMER = libev.EV_TIMER +PERIODIC = libev.EV_PERIODIC +SIGNAL = libev.EV_SIGNAL +CHILD = libev.EV_CHILD +STAT = libev.EV_STAT +IDLE = libev.EV_IDLE +PREPARE = libev.EV_PREPARE +CHECK = libev.EV_CHECK +EMBED = libev.EV_EMBED +FORK = libev.EV_FORK +CLEANUP = libev.EV_CLEANUP +ASYNC = libev.EV_ASYNC +CUSTOM = libev.EV_CUSTOM +ERROR = libev.EV_ERROR + +READWRITE = libev.EV_READ | libev.EV_WRITE + +MINPRI = libev.EV_MINPRI +MAXPRI = libev.EV_MAXPRI + +BACKEND_PORT = libev.EVBACKEND_PORT +BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE +BACKEND_EPOLL = libev.EVBACKEND_EPOLL +BACKEND_POLL = libev.EVBACKEND_POLL +BACKEND_SELECT = libev.EVBACKEND_SELECT +FORKCHECK = libev.EVFLAG_FORKCHECK +NOINOTIFY = libev.EVFLAG_NOINOTIFY +SIGNALFD = libev.EVFLAG_SIGNALFD +NOSIGMASK = libev.EVFLAG_NOSIGMASK + + +@cython.internal +cdef class _EVENTSType: + + def __repr__(self): + return 'gevent.core.EVENTS' + + +cdef public object GEVENT_CORE_EVENTS = _EVENTSType() +EVENTS = GEVENT_CORE_EVENTS + + +def get_version(): + return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) -cdef extern from "libevent.h": - event_base* current_base +def get_header_version(): + return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) -cdef void __event_handler(int fd, short evtype, void *arg) with gil: - cdef event self = arg +# This list backends in the order they are actually tried by libev +_flags = [(libev.EVBACKEND_PORT, 'port'), + (libev.EVBACKEND_KQUEUE, 'kqueue'), + (libev.EVBACKEND_EPOLL, 'epoll'), + (libev.EVBACKEND_POLL, 'poll'), + (libev.EVBACKEND_SELECT, 'select'), + (libev.EVFLAG_NOENV, 'noenv'), + (libev.EVFLAG_FORKCHECK, 'forkcheck'), + (libev.EVFLAG_NOINOTIFY, 'noinotify'), + (libev.EVFLAG_SIGNALFD, 'signalfd'), + (libev.EVFLAG_NOSIGMASK, 'nosigmask')] + + +_flags_str2int = dict((string, flag) for (flag, string) in _flags) + + +_events = [(libev.EV_READ, 'READ'), + (libev.EV_WRITE, 'WRITE'), + (libev.EV__IOFDSET, '_IOFDSET'), + (libev.EV_PERIODIC, 'PERIODIC'), + (libev.EV_SIGNAL, 'SIGNAL'), + (libev.EV_CHILD, 'CHILD'), + (libev.EV_STAT, 'STAT'), + (libev.EV_IDLE, 'IDLE'), + (libev.EV_PREPARE, 'PREPARE'), + (libev.EV_CHECK, 'CHECK'), + (libev.EV_EMBED, 'EMBED'), + (libev.EV_FORK, 'FORK'), + (libev.EV_CLEANUP, 'CLEANUP'), + (libev.EV_ASYNC, 'ASYNC'), + (libev.EV_CUSTOM, 'CUSTOM'), + (libev.EV_ERROR, 'ERROR')] + + +cpdef _flags_to_list(unsigned int flags): + cdef list result = [] + for code, value in _flags: + if flags & code: + result.append(value) + flags &= ~code + if not flags: + break + if flags: + result.append(flags) + return result + + +if sys.version_info[0] >= 3: + basestring = (bytes, str) +else: + basestring = __builtins__.basestring + + +cpdef unsigned int _flags_to_int(object flags) except? -1: + # Note, that order does not matter, libev has its own predefined order + if not flags: + return 0 + if isinstance(flags, (int, long)): + return flags + cdef unsigned int result = 0 try: - self.callback(self, evtype) - except: - traceback.print_exc() + if isinstance(flags, basestring): + flags = flags.split(',') + for value in flags: + value = value.strip().lower() + if value: + result |= _flags_str2int[value] + except KeyError, ex: + raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) + return result + + +cdef str _str_hex(object flag): + if isinstance(flag, (int, long)): + return hex(flag) + return str(flag) + + +cpdef _check_flags(unsigned int flags): + cdef list as_list + flags &= libev.EVBACKEND_MASK + if not flags: + return + if not (flags & libev.EVBACKEND_ALL): + raise ValueError('Invalid value for backend: 0x%x' % flags) + if not (flags & libev.ev_supported_backends()): + as_list = [_str_hex(x) for x in _flags_to_list(flags)] + raise ValueError('Unsupported backend: %s' % '|'.join(as_list)) + + +cpdef _events_to_str(int events): + cdef list result = [] + cdef int c_flag + for (flag, string) in _events: + c_flag = flag + if events & c_flag: + result.append(string) + events = events & (~c_flag) + if not events: + break + if events: + result.append(hex(events)) + return '|'.join(result) + + +def supported_backends(): + return _flags_to_list(libev.ev_supported_backends()) + + +def recommended_backends(): + return _flags_to_list(libev.ev_recommended_backends()) + + +def embeddable_backends(): + return _flags_to_list(libev.ev_embeddable_backends()) + + +def time(): + return libev.ev_time() + + + + +cdef bint _default_loop_destroyed = False + + + + + + + +cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: + cdef libev.ev_loop* _ptr + cdef public object error_handler + cdef libev.ev_prepare _prepare + cdef public list _callbacks + cdef libev.ev_timer _timer0 +#ifdef _WIN32 + cdef libev.ev_timer _periodic_signal_checker +#endif + + def __init__(self, object flags=None, object default=None, size_t ptr=0): + cdef unsigned int c_flags + cdef object old_handler = None + libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) +#ifdef _WIN32 + libev.ev_timer_init(&self._periodic_signal_checker, gevent_periodic_signal_check, 0.3, 0.3) +#endif + libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) + if ptr: + self._ptr = ptr + else: + c_flags = _flags_to_int(flags) + _check_flags(c_flags) + c_flags |= libev.EVFLAG_NOENV + if default is None: + default = True + if _default_loop_destroyed: + default = False + if default: + self._ptr = libev.gevent_ev_default_loop(c_flags) + if not self._ptr: + raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) +#ifdef _WIN32 + libev.ev_timer_start(self._ptr, &self._periodic_signal_checker) + libev.ev_unref(self._ptr) +#endif + else: + self._ptr = libev.ev_loop_new(c_flags) + if not self._ptr: + raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + if default or __SYSERR_CALLBACK is None: + set_syserr_cb(self._handle_syserr) + libev.ev_prepare_start(self._ptr, &self._prepare) + libev.ev_unref(self._ptr) + self._callbacks = [] + + cdef _run_callbacks(self): + cdef callback cb + cdef object callbacks + cdef int count = 1000 + libev.ev_timer_stop(self._ptr, &self._timer0) + while self._callbacks and count > 0: + callbacks = self._callbacks + self._callbacks = [] + for cb in callbacks: + libev.ev_unref(self._ptr) + gevent_call(self, cb) + count -= 1 + if self._callbacks: + libev.ev_timer_start(self._ptr, &self._timer0) + + def _stop_watchers(self): + if libev.ev_is_active(&self._prepare): + libev.ev_ref(self._ptr) + libev.ev_prepare_stop(self._ptr, &self._prepare) +#ifdef _WIN32 + if libev.ev_is_active(&self._periodic_signal_checker): + libev.ev_ref(self._ptr) + libev.ev_timer_stop(self._ptr, &self._periodic_signal_checker) +#endif + + def destroy(self): + global _default_loop_destroyed + if self._ptr: + self._stop_watchers() + if __SYSERR_CALLBACK == self._handle_syserr: + set_syserr_cb(None) + if libev.ev_is_default_loop(self._ptr): + _default_loop_destroyed = True + libev.ev_loop_destroy(self._ptr) + self._ptr = NULL + + def __dealloc__(self): + if self._ptr: + self._stop_watchers() + if not libev.ev_is_default_loop(self._ptr): + libev.ev_loop_destroy(self._ptr) + self._ptr = NULL + + property ptr: + + def __get__(self): + return self._ptr + + property WatcherType: + + def __get__(self): + return watcher + + property MAXPRI: + + def __get__(self): + return libev.EV_MAXPRI + + property MINPRI: + + def __get__(self): + return libev.EV_MINPRI + + def _handle_syserr(self, message, errno): + self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) + + cpdef handle_error(self, context, type, value, tb): + cdef object handle_error + cdef object error_handler = self.error_handler + if error_handler is not None: + # we do want to do getattr every time so that setting Hub.handle_error property just works + handle_error = getattr(error_handler, 'handle_error', error_handler) + handle_error(context, type, value, tb) + else: + self._default_handle_error(context, type, value, tb) + + cpdef _default_handle_error(self, context, type, value, tb): + # note: Hub sets its own error handler so this is not used by gevent + # this is here to make core.loop usable without the rest of gevent + traceback.print_exception(type, value, tb) + if self._ptr: + libev.ev_break(self._ptr, libev.EVBREAK_ONE) + + def run(self, nowait=False, once=False): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + cdef unsigned int flags = 0 + if nowait: + flags |= libev.EVRUN_NOWAIT + if once: + flags |= libev.EVRUN_ONCE + with nogil: + libev.ev_run(self._ptr, flags) + + def reinit(self): + if self._ptr: + libev.ev_loop_fork(self._ptr) + + def ref(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_ref(self._ptr) + + def unref(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_unref(self._ptr) + + def break_(self, int how=libev.EVBREAK_ONE): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_break(self._ptr, how) + + def verify(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_verify(self._ptr) + + def now(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return libev.ev_now(self._ptr) + + def update(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_now_update(self._ptr) + + def __repr__(self): + return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), self._format()) + + property default: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return True if libev.ev_is_default_loop(self._ptr) else False + + property iteration: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return libev.ev_iteration(self._ptr) + + property depth: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return libev.ev_depth(self._ptr) + + property backend_int: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return libev.ev_backend(self._ptr) + + property backend: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + cdef unsigned int backend = libev.ev_backend(self._ptr) + for key, value in _flags: + if key == backend: + return value + return backend + + property pendingcnt: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return libev.ev_pending_count(self._ptr) + + def io(self, int fd, int events, ref=True, priority=None): + return io(self, fd, events, ref, priority) + + def timer(self, double after, double repeat=0.0, ref=True, priority=None): + return timer(self, after, repeat, ref, priority) + + def signal(self, int signum, ref=True, priority=None): + return signal(self, signum, ref, priority) + + def idle(self, ref=True, priority=None): + return idle(self, ref, priority) + + def prepare(self, ref=True, priority=None): + return prepare(self, ref, priority) + + def fork(self, ref=True, priority=None): + return fork(self, ref, priority) + + def async(self, ref=True, priority=None): + return async(self, ref, priority) + +#ifdef _WIN32 +#else + + def child(self, int pid, bint trace=0, ref=True): + return child(self, pid, trace, ref) + + def install_sigchld(self): + libev.gevent_install_sigchld_handler() + +#endif + + def stat(self, bytes path, float interval=0.0, ref=True, priority=None): + return stat(self, path, interval, ref, priority) + + def run_callback(self, func, *args): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + cdef callback cb = callback(func, args) + self._callbacks.append(cb) + libev.ev_ref(self._ptr) + return cb + + def _format(self): + if not self._ptr: + return 'destroyed' + cdef object msg = self.backend + if self.default: + msg += ' default' + msg += ' pending=%s' % self.pendingcnt +#ifdef LIBEV_EMBED + msg += self._format_details() +#endif + return msg + +#ifdef LIBEV_EMBED + + def _format_details(self): + cdef str msg = '' + cdef object fileno = self.fileno() + cdef object sigfd = None + cdef object activecnt = None try: - sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - except: - traceback.print_exc() - sys.exc_clear() - finally: - if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - self._delref() - - -cdef class event: - """Create a new event object with a user callback. - - - *evtype* -- bitmask of EV_READ or EV_WRITE, or EV_SIGNAL - - *handle* -- a file handle, descriptor, or socket for EV_READ or EV_WRITE; a signal number for EV_SIGNAL - - *callback* -- user callback with ``(event, evtype)`` prototype - - *arg* -- optional object, which will be made available as :attr:`arg` property. - """ - cdef event_t ev + sigfd = self.sigfd + except AttributeError: + sigfd = None + try: + activecnt = self.activecnt + except AttributeError: + pass + if activecnt is not None: + msg += ' ref=' + repr(activecnt) + if fileno is not None: + msg += ' fileno=' + repr(fileno) + if sigfd is not None and sigfd != -1: + msg += ' sigfd=' + repr(sigfd) + return msg + + def fileno(self): + cdef int fd + if self._ptr: + fd = self._ptr.backend_fd + if fd >= 0: + return fd + + property activecnt: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return self._ptr.activecnt + + property sig_pending: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return self._ptr.sig_pending + +#if EV_USE_SIGNALFD + property sigfd: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return self._ptr.sigfd +#endif + + property origflags: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return _flags_to_list(self._ptr.origflags) + + property origflags_int: + + def __get__(self): + + if not self._ptr: + raise ValueError('operation on destroyed loop') + return self._ptr.origflags + +#endif + + +cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: cdef public object callback - cdef public object arg - cdef int _incref # 1 if we already INCREFed this object once (because libevent references it) + cdef public tuple args - def __init__(self, short evtype, int handle, callback, arg=None): + def __init__(self, callback, args): self.callback = callback - self.arg = arg - self._incref = 0 - cdef void* c_self = self - if evtype == 0 and not handle: - evtimer_set(&self.ev, __event_handler, c_self) - else: - event_set(&self.ev, handle, evtype, __event_handler, c_self) + self.args = args - cdef _addref(self): - if self._incref <= 0: - Py_INCREF(self) - self._incref += 1 + def stop(self): + self.callback = None + self.args = None + + # Note, that __nonzero__ and pending are different + # nonzero is used in contexts where we need to know whether to schedule another callback, + # so it's true if it's pending or currently running + # 'pending' has the same meaning as libev watchers: it is cleared before entering callback + + def __nonzero__(self): + # it's nonzero if it's pending or currently executing + return self.args is not None + + property pending: - cdef _delref(self): - if self._incref > 0: + def __get__(self): + return self.callback is not None + + def __repr__(self): + if Py_ReprEnter(self) != 0: + return "<...>" + try: + format = self._format() + result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + if self.pending: + result += " pending" + if self.callback is not None: + result += " callback=%r" % (self.callback, ) + if self.args is not None: + result += " args=%r" % (self.args, ) + if self.callback is None and self.args is None: + result += " stopped" + return result + ">" + finally: + Py_ReprLeave(self) + + def _format(self): + return '' + + + + +# about readonly _flags attribute: +# bit #1 set if object owns Python reference to itself (Py_INCREF was called and we must call Py_DECREF later) +# bit #2 set if ev_unref() was called and we must call ev_ref() later +# bit #3 set if user wants to call ev_unref() before start() + + + + + + + + + + + + + + +cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Type]: + """Abstract base class for all the watchers""" + + def __repr__(self): + if Py_ReprEnter(self) != 0: + return "<...>" + try: + format = self._format() + result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + if self.active: + result += " active" + if self.pending: + result += " pending" + if self.callback is not None: + result += " callback=%r" % (self.callback, ) + if self.args is not None: + result += " args=%r" % (self.args, ) + return result + ">" + finally: + Py_ReprLeave(self) + + def _format(self): + return '' + + +cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_io _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_io_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: Py_DECREF(self) - self._incref -= 1 + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args, pass_events=False): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + if pass_events: + self.args = (GEVENT_CORE_EVENTS, ) + args + else: + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_io_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + property pending: - """Return True if the event is still scheduled to run.""" def __get__(self): - return event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL) + return True if libev.ev_is_pending(&self._watcher) else False + +#ifdef _WIN32 + + def __init__(self, loop loop, long fd, int events, ref=True, priority=None): + if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + raise ValueError('illegal event mask: %r' % events) + cdef int vfd = libev.vfd_open(fd) + libev.vfd_free(self._watcher.fd) + libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + +#else + + def __init__(self, loop loop, int fd, int events, ref=True, priority=None): + if fd < 0: + raise ValueError('fd must be non-negative: %r' % fd) + if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + raise ValueError('illegal event mask: %r' % events) + libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + +#endif property fd: def __get__(self): - return self.ev.ev_fd + return libev.vfd_get(self._watcher.fd) + + def __set__(self, long fd): + if libev.ev_is_active(&self._watcher): + raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + cdef int vfd = libev.vfd_open(fd) + libev.vfd_free(self._watcher.fd) + libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, self._watcher.events) property events: def __get__(self): - return self.ev.ev_events + return self._watcher.events + + def __set__(self, int events): + if libev.ev_is_active(&self._watcher): + raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") + libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) property events_str: def __get__(self): - result = [] - cdef int events = self.ev.ev_events - cdef int c_event - for (event, txt) in ((EV_TIMEOUT, 'TIMEOUT'), (EV_READ, 'READ'), (EV_WRITE, 'WRITE'), - (EV_SIGNAL, 'SIGNAL'), (EV_PERSIST, 'PERSIST')): - c_event = event - if events & c_event: - result.append(txt) - events = events & (~c_event) - if events: - result.append(hex(events)) - return '|'.join(result) - - property flags: - - def __get__(self): - return self.ev.ev_flags - - property flags_str: - - def __get__(self): - result = [] - cdef int flags = self.ev.ev_flags - cdef int c_flag - for (flag, txt) in ((EVLIST_TIMEOUT, 'TIMEOUT'), (EVLIST_INSERTED, 'INSERTED'), (EVLIST_SIGNAL, 'SIGNAL'), - (EVLIST_ACTIVE, 'ACTIVE'), (EVLIST_INTERNAL, 'INTERNAL'), (EVLIST_INIT, 'INIT')): - c_flag = flag - if flags & c_flag: - result.append(txt) - flags = flags & (~c_flag) - if flags: - result.append(hex(flags)) - return '|'.join(result) - - def add(self, timeout=None): - """Add event to be executed after an optional *timeout* - number of seconds - after which the event will be executed.""" - cdef timeval tv - cdef double c_timeout - cdef int result - if timeout is None: - result = event_add(&self.ev, NULL) - else: - c_timeout = timeout - if c_timeout < 0.0: - #raise ValueError('Expected a non-negative number or None: %r' % (timeout, )) - import warnings - warnings.warn('Negative timeouts are deprecated. Use None to disable timeout.', DeprecationWarning, stacklevel=2) - result = event_add(&self.ev, NULL) - else: - tv.tv_sec = c_timeout - tv.tv_usec = ((c_timeout - tv.tv_sec) * 1000000.0) - result = event_add(&self.ev, &tv) - if result < 0: - if errno: - raise IOError(errno, strerror(errno)) + return _events_to_str(self._watcher.events) + + def _format(self): + return ' fd=%s events=%s' % (self.fd, self.events_str) + +#ifdef _WIN32 + + def __cinit__(self): + self._watcher.fd = -1; + + def __dealloc__(self): + libev.vfd_free(self._watcher.fd) + +#endif + + +cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_timer _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref else: - raise IOError("event_add(fileno=%s) returned %s" % (self.fd, result)) - self._addref() + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 - def cancel(self): - """Remove event from the event queue.""" - cdef int result - if event_pending(&self.ev, EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE, NULL): - result = event_del(&self.ev) - if result < 0: - return result - self._delref() - return result + property callback: - def __repr__(self): - if self.pending: - pending = ' pending' + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_timer_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args, update=True): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + if update: + libev.ev_now_update(self.loop._ptr) + libev.ev_timer_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + + property pending: + + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): + if repeat < 0.0: + raise ValueError("repeat must be positive or zero: %r" % repeat) + libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + self.loop = loop + if ref: + self._flags = 0 else: - pending = '' - if self.events_str: - events_str = ' %s' % self.events_str + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + property at: + + def __get__(self): + return self._watcher.at + + # QQQ: add 'after' and 'repeat' properties? + + def again(self, object callback, *args, update=True): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + if update: + libev.ev_now_update(self.loop._ptr) + libev.ev_timer_again(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + +cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSignal_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_signal _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_signal_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_signal_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + + property pending: + + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + def __init__(self, loop loop, int signalnum, ref=True, priority=None): + if signalnum < 1 or signalnum >= signalmodule.NSIG: + raise ValueError('illegal signal number: %r' % signalnum) + # still possible to crash on one of libev's asserts: + # 1) "libev: ev_signal_start called with illegal signal number" + # EV_NSIG might be different from signal.NSIG on some platforms + # 2) "libev: a signal must not be attached to two different loops" + # we probably could check that in LIBEV_EMBED mode, but not in general + libev.ev_signal_init(&self._watcher, gevent_callback_signal, signalnum) + self.loop = loop + if ref: + self._flags = 0 else: - events_str = '' - return '<%s at %s%s fd=%s%s flags=%s cb=%s arg=%s>' % \ - (type(self).__name__, hex(id(self)), pending, self.fd, events_str, self.flags_str, self.callback, self.arg) + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + +cdef public class idle(watcher) [object PyGeventIdleObject, type PyGeventIdle_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_idle _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_idle_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_idle_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + + property pending: - def __str__(self): - if self.pending: - pending = ' pending' + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + + def __init__(self, loop loop , ref=True, priority=None): + libev.ev_idle_init(&self._watcher, gevent_callback_idle ) + self.loop = loop + if ref: + self._flags = 0 else: - pending = '' - if self.events_str: - events_str = ' %s' % self.events_str + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + +cdef public class prepare(watcher) [object PyGeventPrepareObject, type PyGeventPrepare_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_prepare _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_prepare_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_prepare_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + + property pending: + + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + + def __init__(self, loop loop , ref=True, priority=None): + libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) + self.loop = loop + if ref: + self._flags = 0 else: - events_str = '' - cb = str(self.callback).replace('\n', '\n' + ' ' * 8) - arg = pformat(self.arg, indent=2).replace('\n', '\n' + ' ' * 8) - return '%s%s fd=%s%s flags=%s\n cb = %s\n arg = %s' % \ - (type(self).__name__, pending, self.fd, events_str, self.flags_str, cb, arg) + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) - def __enter__(self): - return self - def __exit__(self, *exit_args): - self.cancel() +cdef public class fork(watcher) [object PyGeventForkObject, type PyGeventFork_Type]: + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_fork _watcher -cdef class read_event(event): - """Create a new scheduled event with evtype=EV_READ""" + property ref: - def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - cdef short evtype = EV_READ - if persist: - evtype = evtype | EV_PERSIST - event.__init__(self, evtype, handle, callback, arg) - self.add(timeout) + def __get__(self): + return False if self._flags & 4 else True + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 -cdef class write_event(event): - """Create a new scheduled event with evtype=EV_WRITE""" + property callback: - def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - cdef short evtype = EV_WRITE - if persist: - evtype = evtype | EV_PERSIST - event.__init__(self, evtype, handle, callback, arg) - self.add(timeout) + def __get__(self): + return self._callback + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_fork_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 -class readwrite_event(event): - """Create a new scheduled event with evtype=EV_READ|EV_WRITE""" + property priority: - def __init__(self, int handle, callback, timeout=None, arg=None, persist=False): - cdef short evtype = EV_READ|EV_WRITE - if persist: - evtype = evtype | EV_PERSIST - event.__init__(self, evtype, handle, callback, arg) - self.add(timeout) + def __get__(self): + return libev.ev_priority(&self._watcher) + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 -cdef void __simple_handler(int fd, short evtype, void *arg) with gil: - cdef event self = arg - try: - args, kwargs = self.arg - self.callback(*args, **kwargs) - except: - traceback.print_exc() - try: - sys.stderr.write('Failed to execute callback for %s\n\n' % (self, )) - except: - traceback.print_exc() - sys.exc_clear() - finally: - if not event_pending(&self.ev, EV_READ|EV_WRITE|EV_SIGNAL|EV_TIMEOUT, NULL): - self._delref() + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_fork_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + property pending: + + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + + def __init__(self, loop loop , ref=True, priority=None): + libev.ev_fork_init(&self._watcher, gevent_callback_fork ) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + +cdef public class async(watcher) [object PyGeventAsyncObject, type PyGeventAsync_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_async _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 -cdef class timer(event): - """Create a new scheduled timer""" + property callback: - def __init__(self, float seconds, callback, *args, **kwargs): + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_async_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') self.callback = callback - self.arg = (args, kwargs) - evtimer_set(&self.ev, __simple_handler, self) - self.add(seconds) + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_async_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + property pending: + + def __get__(self): + return True if libev.ev_async_pending(&self._watcher) else False + + + def __init__(self, loop loop , ref=True, priority=None): + libev.ev_async_init(&self._watcher, gevent_callback_async ) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) + + def send(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + libev.ev_async_send(self.loop._ptr, &self._watcher) + +#ifdef _WIN32 +#else + +cdef public class child(watcher) [object PyGeventChildObject, type PyGeventChild_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_child _watcher -cdef class signal(event): - """Create a new persistent signal event""" + property ref: - def __init__(self, int signalnum, callback, *args, **kwargs): + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_child_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 + + property priority: + + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') self.callback = callback - self.arg = (args, kwargs) - event_set(&self.ev, signalnum, EV_SIGNAL|EV_PERSIST, __simple_handler, self) - self.add() + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_child_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + + property active: + + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + + property pending: + + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + + def __init__(self, loop loop, int pid, bint trace=0, ref=True): + if not loop.default: + raise TypeError('child watchers are only available on the default loop') + libev.gevent_install_sigchld_handler() + libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + + def _format(self): + return ' pid=%r rstatus=%r' % (self.pid, self.rstatus) + + property pid: + + def __get__(self): + return self._watcher.pid + + property rpid: + + def __get__(self): + return self._watcher.rpid + + def __set__(self, int value): + self._watcher.rpid = value + + property rstatus: + + def __get__(self): + return self._watcher.rstatus + + def __set__(self, int value): + self._watcher.rstatus = value + +#endif + + +cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Type]: + + + cdef public loop loop + cdef object _callback + cdef public tuple args + cdef readonly int _flags + cdef libev.ev_stat _watcher + + property ref: + + def __get__(self): + return False if self._flags & 4 else True + + def __set__(self, object value): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if value: + if not self._flags & 4: + return # ref is already True + if self._flags & 2: # ev_unref was called, undo + libev.ev_ref(self.loop._ptr) + self._flags &= ~6 # do not want unref, no outstanding unref + else: + if self._flags & 4: + return # ref is already False + self._flags |= 4 + if not self._flags & 2 and libev.ev_is_active(&self._watcher): + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + + property callback: + def __get__(self): + return self._callback + + def __set__(self, object callback): + if not PyCallable_Check(callback) and callback is not None: + raise TypeError("Expected callable, not %r" % (callback, )) + self._callback = callback + + def stop(self): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if self._flags & 2: + libev.ev_ref(self.loop._ptr) + self._flags &= ~2 + libev.ev_stat_stop(self.loop._ptr, &self._watcher) + self._callback = None + self.args = None + if self._flags & 1: + Py_DECREF(self) + self._flags &= ~1 -cdef class active_event(event): - """An event that is scheduled to run in the current loop iteration""" + property priority: - def __init__(self, callback, *args, **kwargs): + def __get__(self): + return libev.ev_priority(&self._watcher) + + def __set__(self, int priority): + if libev.ev_is_active(&self._watcher): + raise AttributeError("Cannot set priority of an active watcher") + libev.ev_set_priority(&self._watcher, priority) + + def feed(self, int revents, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') self.callback = callback - self.arg = (args, kwargs) - evtimer_set(&self.ev, __simple_handler, self) - self._addref() - event_active(&self.ev, EV_TIMEOUT, 1) + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 - def add(self, timeout=None): - raise NotImplementedError + def start(self, object callback, *args): + + if not self.loop._ptr: + raise ValueError('operation on destroyed loop') + if callback is None: + raise TypeError('callback must be callable, not None') + self.callback = callback + self.args = args + if self._flags & 6 == 4: + libev.ev_unref(self.loop._ptr) + self._flags |= 2 + libev.ev_stat_start(self.loop._ptr, &self._watcher) + if not self._flags & 1: + Py_INCREF(self) + self._flags |= 1 + property active: -def init(): - """Initialize event queue.""" - event_init() + def __get__(self): + return True if libev.ev_is_active(&self._watcher) else False + + property pending: -def dispatch(): - """Dispatch all events on the event queue. - Returns 0 on success, and 1 if no events are registered. - May raise IOError. - """ - cdef int ret - with nogil: - ret = event_dispatch() - if ret < 0: - raise IOError(errno, strerror(errno)) - return ret + def __get__(self): + return True if libev.ev_is_pending(&self._watcher) else False + cdef readonly bytes path + def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): + self.path = path + libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + self.loop = loop + if ref: + self._flags = 0 + else: + self._flags = 4 + if priority is not None: + libev.ev_set_priority(&self._watcher, priority) -def loop(nonblock=False): - """Dispatch all pending events on queue in a single pass. - Returns 0 on success, and 1 if no events are registered. - May raise IOError. - """ - cdef int flags, ret - flags = EVLOOP_ONCE - if nonblock: - flags = EVLOOP_ONCE|EVLOOP_NONBLOCK - with nogil: - ret = event_loop(flags) - if ret < 0: - raise IOError(errno, strerror(errno)) - return ret + property attr: + def __get__(self): + if not self._watcher.attr.st_nlink: + return + return _pystat_fromstructstat(&self._watcher.attr) + + property prev: + + def __get__(self): + if not self._watcher.prev.st_nlink: + return + return _pystat_fromstructstat(&self._watcher.prev) -def get_version(): - """Wrapper for :meth:`event_get_version`""" - return event_get_version() + property interval: + def __get__(self): + return self._watcher.interval -def get_method(): - """Wrapper for :meth:`event_get_method`""" - return event_get_method() +__SYSERR_CALLBACK = None -cdef extern from *: - cdef void emit_ifdef "#if defined(_EVENT_VERSION) //" () - cdef void emit_else "#else //" () - cdef void emit_endif "#endif //" () +cdef void _syserr_cb(char* msg) with gil: + try: + __SYSERR_CALLBACK(msg, errno) + except: + set_syserr_cb(None) + print_exc = getattr(traceback, 'print_exc', None) + if print_exc is not None: + print_exc() -# _EVENT_VERSION is available since libevent 1.4.0-beta -def get_header_version(): - """Return _EVENT_VERSION""" - emit_ifdef() - return _EVENT_VERSION - emit_endif() - -# event_reinit is available since libevent 1.4.1-beta, -# but I cannot check for existence of a function here, can I? -# so I'm going to use _EVENT_VERSION as an indicator of event_reinit presence -# which will work in every version other than 1.4.0-beta - -def reinit(): - """Wrapper for :meth:`event_reinit`.""" - emit_ifdef() - return event_reinit(current_base) - emit_endif() - -include "evdns.pxi" - -# XXX - make sure event queue is always initialized. -init() - -if get_version() != get_header_version() and get_header_version() is not None and get_version() != '1.3.99-trunk': - import warnings - msg = "libevent version mismatch: system version is %r but this gevent is compiled against %r" % (get_version(), get_header_version()) - warnings.warn(msg, UserWarning, stacklevel=2) - -include "evbuffer.pxi" -include "evhttp.pxi" - -def set_exc_info(object type, object value): - cdef PyThreadState* tstate = PyThreadState_GET() - Py_XDECREF(tstate.exc_type) - Py_XDECREF(tstate.exc_value) - Py_XDECREF(tstate.exc_traceback) - if value is None: - tstate.exc_type = NULL - tstate.exc_value = NULL +cpdef set_syserr_cb(callback): + global __SYSERR_CALLBACK + if callback is None: + libev.ev_set_syserr_cb(NULL) + __SYSERR_CALLBACK = None + elif callable(callback): + libev.ev_set_syserr_cb(_syserr_cb) + __SYSERR_CALLBACK = callback else: - Py_INCREF(type) - Py_INCREF(value) - tstate.exc_type = type - tstate.exc_value = value - tstate.exc_traceback = NULL + raise TypeError('Expected callable or None, got %r' % (callback, )) + + +#ifdef LIBEV_EMBED +LIBEV_EMBED = True +EV_USE_FLOOR = libev.EV_USE_FLOOR +EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL +EV_USE_REALTIME = libev.EV_USE_REALTIME +EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC +EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP +EV_USE_INOTIFY = libev.EV_USE_INOTIFY +EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD +EV_USE_EVENTFD = libev.EV_USE_EVENTFD +EV_USE_4HEAP = libev.EV_USE_4HEAP +#else +LIBEV_EMBED = False +#endif diff -Nru python-gevent-0.13.7/gevent/coros.py python-gevent-1.0/gevent/coros.py --- python-gevent-0.13.7/gevent/coros.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/coros.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,234 +1,6 @@ -"""Locking primitives""" -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# This module definitely remains in 1.0.x, probably in versions after that too. +import warnings +warnings.warn('gevent.coros has been renamed to gevent.lock', DeprecationWarning, stacklevel=2) -import sys -import traceback -from gevent.core import active_event -from gevent.hub import get_hub, getcurrent -from gevent.timeout import Timeout - - -__all__ = ['Semaphore', 'DummySemaphore', 'BoundedSemaphore', 'RLock'] - - -class Semaphore(object): - """A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, - plus an initial value. The acquire() method blocks if necessary until it can return without making the counter - negative. - - If not given, value defaults to 1.""" - - def __init__(self, value=1): - if value < 0: - raise ValueError("semaphore initial value must be >= 0") - self._links = [] - self.counter = value - self._notifier = None - - def __str__(self): - params = (self.__class__.__name__, self.counter, len(self._links)) - return '<%s counter=%s _links[%s]>' % params - - def locked(self): - return self.counter <= 0 - - def release(self): - self.counter += 1 - if self._links and self.counter > 0 and self._notifier is None: - self._notifier = active_event(self._notify_links, list(self._links)) - - def _notify_links(self, links): - try: - for link in links: - if self.counter <= 0: - return - if link in self._links: - try: - link(self) - except: - traceback.print_exc() - try: - sys.stderr.write('Failed to notify link %r of %r\n\n' % (link, self)) - except: - traceback.print_exc() - finally: - self._notifier = None - - def rawlink(self, callback): - """Register a callback to call when a counter is more than zero. - - *callback* will be called in the :class:`Hub `, so it must not use blocking gevent API. - *callback* will be passed one argument: this instance. - """ - if not callable(callback): - raise TypeError('Expected callable: %r' % (callback, )) - self._links.append(callback) - if self.counter > 0 and self._notifier is None: - self._notifier = active_event(self._notify_links, list(self._links)) - - def unlink(self, callback): - """Remove the callback set by :meth:`rawlink`""" - try: - self._links.remove(callback) - except ValueError: - pass - - def wait(self, timeout=None): - if self.counter > 0: - return self.counter - else: - switch = getcurrent().switch - self.rawlink(switch) - try: - timer = Timeout.start_new(timeout) - try: - try: - result = get_hub().switch() - assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) - except Timeout, ex: - if ex is not timer: - raise - finally: - timer.cancel() - finally: - self.unlink(switch) - return self.counter - - def acquire(self, blocking=True, timeout=None): - if self.counter > 0: - self.counter -= 1 - return True - elif not blocking: - return False - else: - switch = getcurrent().switch - self.rawlink(switch) - try: - timer = Timeout.start_new(timeout) - try: - try: - result = get_hub().switch() - assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) - except Timeout, ex: - if ex is timer: - return False - raise - finally: - timer.cancel() - finally: - self.unlink(switch) - self.counter -= 1 - assert self.counter >= 0 - return True - - def __enter__(self): - self.acquire() - - def __exit__(self, typ, val, tb): - self.release() - - -class DummySemaphore(object): - """A Semaphore initialized with "infinite" initial value. Neither of its methods ever block.""" - - def __str__(self): - return '<%s>' % self.__class__.__name__ - - def locked(self): - return False - - def release(self): - pass - - def rawlink(self, callback): - pass - - def unlink(self, callback): - pass - - def wait(self, timeout=None): - pass - - def acquire(self, blocking=True, timeout=None): - pass - - def __enter__(self): - self.acquire() - - def __exit__(self, typ, val, tb): - self.release() - - -class BoundedSemaphore(Semaphore): - """A bounded semaphore checks to make sure its current value doesn't exceed its initial value. - If it does, ``ValueError`` is raised. In most situations semaphores are used to guard resources - with limited capacity. If the semaphore is released too many times it's a sign of a bug. - - If not given, *value* defaults to 1.""" - - def __init__(self, value=1): - Semaphore.__init__(self, value) - self._initial_value = value - - def release(self): - if self.counter >= self._initial_value: - raise ValueError("Semaphore released too many times") - return Semaphore.release(self) - - -class RLock(object): - - def __init__(self): - self._block = Semaphore(1) - self._owner = None - self._count = 0 - - def __repr__(self): - return "<%s(%s, %d)>" % ( - self.__class__.__name__, - self._owner, - self._count) - - def acquire(self, blocking=1): - me = getcurrent() - if self._owner is me: - self._count = self._count + 1 - return 1 - rc = self._block.acquire(blocking) - if rc: - self._owner = me - self._count = 1 - return rc - - def __enter__(self): - return self.acquire() - - def release(self): - if self._owner is not getcurrent(): - raise RuntimeError("cannot release un-aquired lock") - self._count = count = self._count - 1 - if not count: - self._owner = None - self._block.release() - - def __exit__(self, typ, value, tb): - self.release() - - # Internal methods used by condition variables - - def _acquire_restore(self, count_owner): - count, owner = count_owner - self._block.acquire() - self._count = count - self._owner = owner - - def _release_save(self): - count = self._count - self._count = 0 - owner = self._owner - self._owner = None - self._block.release() - return (count, owner) - - def _is_owned(self): - return self._owner is getcurrent() +from gevent.lock import * +from gevent.lock import __all__ diff -Nru python-gevent-0.13.7/gevent/dnshelper.c python-gevent-1.0/gevent/dnshelper.c --- python-gevent-0.13.7/gevent/dnshelper.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/dnshelper.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,150 @@ +/* Copyright (c) 2011 Denis Bilenko. See LICENSE for details. */ +#include "Python.h" +#ifdef CARES_EMBED +#include "ares_setup.h" +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#include "ares.h" + +#include "cares_ntop.h" +#include "cares_pton.h" + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytes_FromString PyString_FromString +#endif + + +static PyObject* _socket_error = 0; + +static PyObject* +get_socket_object(PyObject** pobject, const char* name) +{ + if (!*pobject) { + PyObject* _socket; + _socket = PyImport_ImportModule("_socket"); + if (_socket) { + *pobject = PyObject_GetAttrString(_socket, name); + if (!*pobject) { + PyErr_WriteUnraisable(Py_None); + } + Py_DECREF(_socket); + } + else { + PyErr_WriteUnraisable(Py_None); + } + if (!*pobject) { + *pobject = PyExc_IOError; + } + } + return *pobject; +} + + +static int +gevent_append_addr(PyObject* list, int family, void* src, char* tmpbuf, size_t tmpsize) { + int status = -1; + PyObject* tmp; + if (ares_inet_ntop(family, src, tmpbuf, tmpsize)) { + tmp = PyBytes_FromString(tmpbuf); + if (tmp) { + status = PyList_Append(list, tmp); + Py_DECREF(tmp); + } + } + return status; +} + + +static PyObject* +parse_h_aliases(struct hostent *h) +{ + char **pch; + PyObject *result = NULL; + PyObject *tmp; + + result = PyList_New(0); + + if (result && h->h_aliases) { + for (pch = h->h_aliases; *pch != NULL; pch++) { + if (*pch != h->h_name && strcmp(*pch, h->h_name)) { + int status; + tmp = PyBytes_FromString(*pch); + if (tmp == NULL) { + break; + } + + status = PyList_Append(result, tmp); + Py_DECREF(tmp); + + if (status) { + break; + } + } + } + } + + return result; +} + + +static PyObject * +parse_h_addr_list(struct hostent *h) +{ + char **pch; + PyObject *result = NULL; + + result = PyList_New(0); + + if (result) { + switch (h->h_addrtype) { + case AF_INET: + { + char tmpbuf[sizeof "255.255.255.255"]; + for (pch = h->h_addr_list; *pch != NULL; pch++) { + if (gevent_append_addr(result, AF_INET, *pch, tmpbuf, sizeof(tmpbuf))) { + break; + } + } + break; + } + case AF_INET6: + { + char tmpbuf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + for (pch = h->h_addr_list; *pch != NULL; pch++) { + if (gevent_append_addr(result, AF_INET6, *pch, tmpbuf, sizeof(tmpbuf))) { + break; + } + } + break; + } + default: + PyErr_SetString(get_socket_object(&_socket_error, "error"), "unsupported address family"); + Py_DECREF(result); + result = NULL; + } + } + + return result; +} + + +static int +gevent_make_sockaddr(char* hostp, int port, int flowinfo, int scope_id, struct sockaddr_in6* sa6) { + if ( ares_inet_pton(AF_INET, hostp, &((struct sockaddr_in*)sa6)->sin_addr.s_addr) > 0 ) { + ((struct sockaddr_in*)sa6)->sin_family = AF_INET; + ((struct sockaddr_in*)sa6)->sin_port = htons(port); + return sizeof(struct sockaddr_in); + } + else if ( ares_inet_pton(AF_INET6, hostp, &sa6->sin6_addr.s6_addr) > 0 ) { + sa6->sin6_family = AF_INET6; + sa6->sin6_port = htons(port); + sa6->sin6_flowinfo = flowinfo; + sa6->sin6_scope_id = scope_id; + return sizeof(struct sockaddr_in6); + } + return -1; +} diff -Nru python-gevent-0.13.7/gevent/dns.py python-gevent-1.0/gevent/dns.py --- python-gevent-0.13.7/gevent/dns.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/dns.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -# Copyright (c) 2010 Denis Bilenko. See LICENSE for details. -"""Libevent DNS API made synchronous. - -The functions in this module match those in libevent as closely as possible -yet they return the result instead of passing it to a callback. The calling -greenlet remains blocked until the result is ready. -""" - -from gevent import core -from gevent.hub import Waiter -from _socket import gaierror -from gevent.core import DNS_QUERY_NO_SEARCH as QUERY_NO_SEARCH - - -__all__ = ['DNSError', - 'resolve_ipv4', - 'resolve_ipv6', - 'resolve_reverse', - 'resolve_reverse_ipv6', - 'QUERY_NO_SEARCH'] - - -# move from here into Hub.__init__ (once event_init() is move here as well) -core.dns_init() - - -class DNSError(gaierror): - """A subclass of :class:`socket.gaierror` used by :mod:`evdns` functions to report errors. - - It uses evdns-specific error codes that are different from the standard socket errors. - - >>> resolve_ipv4('aaaaaaaaaaa') - Traceback (most recent call last): - ... - DNSError: [Errno 3] name does not exist - """ - - def __init__(self, *args): - if len(args) == 1: - code = args[0] - gaierror.__init__(self, code, core.dns_err_to_string(code)) - else: - gaierror.__init__(self, *args) - - -def resolve_ipv4(name, flags=0): - """Lookup an A record for a given *name*. - To disable searching for this query, set *flags* to ``QUERY_NO_SEARCH``. - - Returns (ttl, list of packed IPs). - - >>> resolve_ipv4('www.python.org') - (10000, ['R^\\xa4\\xa2']) - """ - waiter = Waiter() - core.dns_resolve_ipv4(name, flags, waiter.switch_args) - result, _type, ttl, addrs = waiter.get() - if result != core.DNS_ERR_NONE: - raise DNSError(result) - return ttl, addrs - - -def resolve_ipv6(name, flags=0): - """Lookup an AAAA record for a given *name*. - To disable searching for this query, set *flags* to ``QUERY_NO_SEARCH``. - - Returns (ttl, list of packed IPs). - """ - waiter = Waiter() - core.dns_resolve_ipv6(name, flags, waiter.switch_args) - result, _type, ttl, addrs = waiter.get() - if result != core.DNS_ERR_NONE: - raise DNSError(result) - return ttl, addrs - - -def resolve_reverse(packed_ip, flags=0): - """Lookup a PTR record for a given IP address. - To disable searching for this query, set *flags* to ``QUERY_NO_SEARCH``. - - >>> packed_ip = socket.inet_aton('82.94.164.162') - >>> resolve_reverse(packed_ip) - (10000, 'www.python.org') - """ - waiter = Waiter() - core.dns_resolve_reverse(packed_ip, flags, waiter.switch_args) - result, _type, ttl, addr = waiter.get() - if result != core.DNS_ERR_NONE: - raise DNSError(result) - return ttl, addr - - -def resolve_reverse_ipv6(packed_ip, flags=0): - """Lookup a PTR record for a given IPv6 address. - To disable searching for this query, set *flags* to ``QUERY_NO_SEARCH``. - """ - waiter = Waiter() - core.dns_resolve_reverse_ipv6(packed_ip, flags, waiter.switch_args) - result, _type, ttl, addrs = waiter.get() - if result != core.DNS_ERR_NONE: - raise DNSError(result) - return ttl, addrs diff -Nru python-gevent-0.13.7/gevent/evbuffer.pxi python-gevent-1.0/gevent/evbuffer.pxi --- python-gevent-0.13.7/gevent/evbuffer.pxi 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/evbuffer.pxi 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -__all__ += ['buffer'] - -cdef extern from "string.h": - void *memchr(void *s, int c, size_t n) - -cdef extern from "libevent.h": - struct evbuffer: - char *buf "buffer" - int off - - evbuffer *evbuffer_new() - int evbuffer_add(evbuffer *buf, char *p, int len) - char *evbuffer_readline(evbuffer *buf) - void evbuffer_free(evbuffer *buf) - size_t evbuffer_get_length(evbuffer *buffer) - unsigned char *EVBUFFER_PULLUP(evbuffer *buf, size_t size) - int EVBUFFER_DRAIN(evbuffer *buf, size_t len) - - -cdef class buffer: - """file-like wrapper for libevent's :class:`evbuffer` structure. - - Note, that the wrapper does not own the structure, libevent does. - """ - cdef evbuffer* __obj - - def __init__(self, size_t _obj): - self.__obj = _obj - - property _obj: - - def __get__(self): - return (self.__obj) - - def __len__(self): - if self.__obj: - return evbuffer_get_length(self.__obj) - else: - return 0 - - def __nonzero__(self): - if self.__obj: - return evbuffer_get_length(self.__obj) - - def detach(self): - self.__obj = NULL - - def __iter__(self): - return self - - def __next__(self): - line = self.readline() - if not line: - raise StopIteration - return line - - def read(self, long size=-1): - """Drain the first *size* bytes from the buffer (or what's left if there are less than *size* bytes). - - If *size* is negative, drain the whole buffer. - """ - if not self.__obj: - return '' - cdef long length = evbuffer_get_length(self.__obj) - if size < 0: - size = length - else: - size = min(size, length) - if size <= 0: - return '' - cdef char* data = EVBUFFER_PULLUP(self.__obj, size) - if not data: - return '' - cdef object result = PyString_FromStringAndSize(data, size) - cdef int res = EVBUFFER_DRAIN(self.__obj, size) - if res: - try: - sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, size, res)) - except: - traceback.print_exc() - return result - - def readline(self, size=None): - if not self.__obj: - return '' - cdef char* data = EVBUFFER_PULLUP(self.__obj, -1) - if not data: - return '' - - cdef long length = evbuffer_get_length(self.__obj) - cdef char *nl = memchr(data, 10, length) # search for "\n" - - if nl: - length = nl - data + 1 - - cdef object result = PyString_FromStringAndSize(data, length) - cdef int res = EVBUFFER_DRAIN(self.__obj, length) - if res: - try: - sys.stderr.write('evbuffer_drain(0x%x, %s) returned %s\n' % (self._obj, length, res)) - except: - traceback.print_exc() - return result - - def readlines(self, hint=-1): - return list(self) - - def write(self, bytes data): - cdef int result = evbuffer_add(self.__obj, data, len(data)) - if result < 0: - raise IOError("evbuffer_add() returned %s" % result) - return result diff -Nru python-gevent-0.13.7/gevent/evdns.pxi python-gevent-1.0/gevent/evdns.pxi --- python-gevent-0.13.7/gevent/evdns.pxi 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/evdns.pxi 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -__all__ += ['dns_init', 'dns_shutdown', 'dns_err_to_string', - 'dns_resolve_ipv4', 'dns_resolve_ipv6', - 'dns_resolve_reverse', 'dns_resolve_reverse_ipv6'] - -cdef extern from *: - ctypedef char* const_char_ptr "const char*" - -cdef extern from "libevent.h": - ctypedef void (*evdns_handler)(int result, char t, int count, int ttl, void *addrs, void *arg) - - int evdns_init() - const_char_ptr evdns_err_to_string(int err) - int evdns_resolve_ipv4(char *name, int flags, evdns_handler callback, void *arg) - int evdns_resolve_ipv6(char *name, int flags, evdns_handler callback, void *arg) - int evdns_resolve_reverse(void *ip, int flags, evdns_handler callback, void *arg) - int evdns_resolve_reverse_ipv6(void *ip, int flags, evdns_handler callback, void *arg) - void evdns_shutdown(int fail_requests) - -# Result codes -DNS_ERR_NONE = 0 -DNS_ERR_FORMAT = 1 -DNS_ERR_SERVERFAILED = 2 -DNS_ERR_NOTEXIST = 3 -DNS_ERR_NOTIMPL = 4 -DNS_ERR_REFUSED = 5 -DNS_ERR_TRUNCATED = 65 -DNS_ERR_UNKNOWN = 66 -DNS_ERR_TIMEOUT = 67 -DNS_ERR_SHUTDOWN = 68 - -# Types -DNS_IPv4_A = 1 -DNS_PTR = 2 -DNS_IPv6_AAAA = 3 - -# Flags -DNS_QUERY_NO_SEARCH = 1 - - -def dns_init(): - """Initialize async DNS resolver.""" - evdns_init() - - -def dns_shutdown(int fail_requests=0): - """Shutdown the async DNS resolver and terminate all active requests.""" - evdns_shutdown(fail_requests) - - -def dns_err_to_string(int err): - cdef const_char_ptr result = evdns_err_to_string(err) - if result: - return result - - -cdef void __evdns_callback(int code, char type, int count, int ttl, void *addrs, void *arg) with gil: - cdef int i - cdef object callback = arg - Py_DECREF(callback) - cdef object addr - cdef object result - - if type == DNS_IPv4_A: - result = [] - for i from 0 <= i < count: - addr = PyString_FromStringAndSize(&(addrs)[i*4], 4) - result.append(addr) - elif type == DNS_IPv6_AAAA: - result = [] - for i from 0 <= i < count: - addr = PyString_FromStringAndSize(&(addrs)[i*16], 16) - result.append(addr) - elif type == DNS_PTR and count == 1: # only 1 PTR possible - result = PyString_FromString((addrs)[0]) - else: - result = None - try: - callback(code, type, ttl, result) - except: - traceback.print_exc() - sys.exc_clear() - - -def dns_resolve_ipv4(char *name, int flags, object callback): - """Lookup an A record for a given name. - - - *name* -- DNS hostname - - *flags* -- either 0 or DNS_QUERY_NO_SEARCH - - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - """ - cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, callback) - if result: - raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, )) - Py_INCREF(callback) - - -def dns_resolve_ipv6(char *name, int flags, object callback): - """Lookup an AAAA record for a given name. - - - *name* -- DNS hostname - - *flags* -- either 0 or DNS_QUERY_NO_SEARCH - - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - """ - cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, callback) - if result: - raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, )) - Py_INCREF(callback) - - -def dns_resolve_reverse(char* packed_ip, int flags, object callback): - """Lookup a PTR record for a given IPv4 address. - - - *packed_ip* -- IPv4 address (as 4-byte binary string) - - *flags* -- either 0 or DNS_QUERY_NO_SEARCH - - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - """ - cdef int result = evdns_resolve_reverse(packed_ip, flags, __evdns_callback, callback) - if result: - raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, )) - Py_INCREF(callback) - - -def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback): - """Lookup a PTR record for a given IPv6 address. - - - *packed_ip* -- IPv6 address (as 16-byte binary string) - - *flags* -- either 0 or DNS_QUERY_NO_SEARCH - - *callback* -- callback with ``(result, type, ttl, addrs)`` prototype - """ - cdef int result = evdns_resolve_reverse_ipv6(packed_ip, flags, __evdns_callback, callback) - if result: - raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) - Py_INCREF(callback) diff -Nru python-gevent-0.13.7/gevent/event.py python-gevent-1.0/gevent/event.py --- python-gevent-0.13.7/gevent/event.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/event.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,11 +1,12 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2011 Denis Bilenko. See LICENSE for details. """Basic synchronization primitives: Event and AsyncResult""" import sys -import traceback -from gevent import core -from gevent.hub import get_hub, getcurrent, _NONE +from gevent.hub import get_hub, getcurrent, _NONE, PY3 from gevent.timeout import Timeout +from collections import deque +if PY3: + xrange = range __all__ = ['Event', 'AsyncResult'] @@ -20,11 +21,14 @@ """ def __init__(self): - self._links = [] + self._links = set() + self._todo = set() self._flag = False + self.hub = get_hub() + self._notifier = None def __str__(self): - return '<%s %s>' % (self.__class__.__name__, (self._flag and 'set') or 'clear') + return '<%s %s _links[%s]>' % (self.__class__.__name__, (self._flag and 'set') or 'clear', len(self._links)) def is_set(self): """Return true if and only if the internal flag is true.""" @@ -38,9 +42,9 @@ Greenlets that call :meth:`wait` once the flag is true will not block at all. """ self._flag = True - if self._links: - # schedule a job to notify the links already set - core.active_event(self._notify_links, list(self._links)) + self._todo.update(self._links) + if self._todo and not self._notifier: + self._notifier = self.hub.loop.run_callback(self._notify_links) def clear(self): """Reset the internal flag to false. @@ -61,7 +65,6 @@ Return the value of the internal flag (``True`` or ``False``). """ - if self._flag: return self._flag else: @@ -71,9 +74,10 @@ timer = Timeout.start_new(timeout) try: try: - result = get_hub().switch() + result = self.hub.switch() assert result is self, 'Invalid switch into Event.wait(): %r' % (result, ) - except Timeout, ex: + except Timeout: + ex = sys.exc_info()[1] if ex is not timer: raise finally: @@ -90,9 +94,10 @@ """ if not callable(callback): raise TypeError('Expected callable: %r' % (callback, )) - self._links.append(callback) - if self._flag: - core.active_event(self._notify_links, list(self._links)) # XXX just pass [callback] + self._links.add(callback) + if self._flag and not self._notifier: + self._todo.add(callback) + self._notifier = self.hub.loop.run_callback(self._notify_links) def unlink(self, callback): """Remove the callback set by :meth:`rawlink`""" @@ -101,18 +106,14 @@ except ValueError: pass - def _notify_links(self, links): - assert getcurrent() is get_hub() - for link in links: + def _notify_links(self): + while self._todo: + link = self._todo.pop() if link in self._links: # check that link was not notified yet and was not removed by the client try: link(self) except: - traceback.print_exc() - try: - sys.stderr.write('Failed to notify link %r of %r\n\n' % (link, self)) - except: - traceback.print_exc() + self.hub.handle_error((link, self), *sys.exc_info()) class AsyncResult(object): @@ -149,11 +150,22 @@ ZeroDivisionError: integer division or modulo by zero """ def __init__(self): - self._links = set() + self._links = deque() self.value = None self._exception = _NONE + self.hub = get_hub() self._notifier = None + def __str__(self): + result = '<%s ' % (self.__class__.__name__, ) + if self.value is not None or self._exception is not _NONE: + result += 'value=%r ' % self.value + if self._exception is not None and self._exception is not _NONE: + result += 'exception=%r ' % self._exception + if self._exception is _NONE: + result += 'unset ' + return result + ' _links[%s]>' % len(self._links) + def ready(self): """Return true if and only if it holds a value or an exception""" return self._exception is not _NONE @@ -177,8 +189,8 @@ """ self.value = value self._exception = None - if self._links and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + if self._links and not self._notifier: + self._notifier = self.hub.loop.run_callback(self._notify_links) def set_exception(self, exception): """Store the exception. Wake up the waiters. @@ -187,8 +199,8 @@ Sequential calls to :meth:`wait` and :meth:`get` will not block at all. """ self._exception = exception - if self._links and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + if self._links and not self._notifier: + self._notifier = self.hub.loop.run_callback(self._notify_links) def get(self, block=True, timeout=None): """Return the stored value or raise the exception. @@ -211,7 +223,7 @@ try: timer = Timeout.start_new(timeout) try: - result = get_hub().switch() + result = self.hub.switch() assert result is self, 'Invalid switch into AsyncResult.get(): %r' % (result, ) finally: timer.cancel() @@ -252,11 +264,12 @@ try: timer = Timeout.start_new(timeout) try: - result = get_hub().switch() + result = self.hub.switch() assert result is self, 'Invalid switch into AsyncResult.wait(): %r' % (result, ) finally: timer.cancel() - except Timeout, exc: + except Timeout: + exc = sys.exc_info()[1] self.unlink(switch) if exc is not timer: raise @@ -268,20 +281,12 @@ return self.value def _notify_links(self): - try: - assert getcurrent() is get_hub() - while self._links: - link = self._links.pop() - try: - link(self) - except: - traceback.print_exc() - try: - sys.stderr.write('Failed to notify link %r of %r\n\n' % (link, self)) - except: - traceback.print_exc() - finally: - self._notifier = None + while self._links: + link = self._links.popleft() + try: + link(self) + except: + self.hub.handle_error((link, self), *sys.exc_info()) def rawlink(self, callback): """Register a callback to call when a value or an exception is set. @@ -291,13 +296,16 @@ """ if not callable(callback): raise TypeError('Expected callable: %r' % (callback, )) - self._links.add(callback) - if self.ready() and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + self._links.append(callback) + if self.ready() and not self._notifier: + self._notifier = self.hub.loop.run_callback(self._notify_links) def unlink(self, callback): """Remove the callback set by :meth:`rawlink`""" - self._links.discard(callback) + try: + self._links.remove(callback) + except ValueError: + pass # link protocol def __call__(self, source): @@ -305,18 +313,3 @@ self.set(source.value) else: self.set_exception(source.exception) - - -def waitall(events): - # QQQ add timeout? - from gevent.queue import Queue - queue = Queue() - put = queue.put - try: - for event in events: - event.rawlink(put) - for _ in xrange(len(events)): - queue.get() - finally: - for event in events: - event.unlink(put) diff -Nru python-gevent-0.13.7/gevent/evhttp.pxi python-gevent-1.0/gevent/evhttp.pxi --- python-gevent-0.13.7/gevent/evhttp.pxi 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/evhttp.pxi 1970-01-01 00:00:00.000000000 +0000 @@ -1,699 +0,0 @@ -__all__ += ['http_request', 'http_connection', 'http'] - -cdef extern from *: - cdef void emit_ifdef_modern "#if defined(LIBEVENT_HTTP_MODERN) //" () - -EVHTTP_REQUEST = 0 -EVHTTP_RESPONSE = 1 - - -emit_ifdef_modern() - -EVHTTP_REQ_GET = 1 << 0 -EVHTTP_REQ_POST = 1 << 1 -EVHTTP_REQ_HEAD = 1 << 2 -EVHTTP_REQ_PUT = 1 << 3 -EVHTTP_REQ_DELETE = 1 << 4 -EVHTTP_REQ_OPTIONS = 1 << 5 -EVHTTP_REQ_TRACE = 1 << 6 -EVHTTP_REQ_CONNECT = 1 << 7 -EVHTTP_REQ_PATCH = 1 << 8 - -HTTP_method2name = { - EVHTTP_REQ_GET: "GET", - EVHTTP_REQ_POST: "POST", - EVHTTP_REQ_HEAD: "HEAD", - EVHTTP_REQ_PUT: "PUT", - EVHTTP_REQ_DELETE: "DELETE", - EVHTTP_REQ_OPTIONS: "OPTIONS", - EVHTTP_REQ_TRACE: "TRACE", - EVHTTP_REQ_CONNECT: "CONNECT", - EVHTTP_REQ_PATCH: "PATCH" -} - -emit_else() - -EVHTTP_REQ_GET = 0 -EVHTTP_REQ_POST = 1 -EVHTTP_REQ_HEAD = 2 - -HTTP_method2name = { - EVHTTP_REQ_GET: "GET", - EVHTTP_REQ_POST: "POST", - EVHTTP_REQ_HEAD: "HEAD", -} - -emit_endif() - - -cdef extern from *: - ctypedef char* const_char_ptr "const char*" - -cdef extern from "libevent.h": - - ctypedef unsigned short ev_uint16_t - - struct tailq_entry: - void* tqe_next - struct evkeyval: - tailq_entry next - char* key - char* value - struct evkeyvalq: - pass - evkeyval* TAILQ_FIRST(evkeyvalq* x) - evkeyval* TAILQ_GET_NEXT(evkeyval* x) - - # evhttp.h: - struct evhttp: - pass - struct evhttp_connection: - pass - struct evhttp_request: - evhttp_connection* evcon - evkeyvalq *input_headers - evkeyvalq *output_headers - char *remote_host - short remote_port - int kind - int type - char *uri - char major - char minor - int response_code - char *response_code_line - evbuffer *input_buffer - int chunked - evbuffer *output_buffer - - # evhttp - ctypedef void (*evhttp_handler)(evhttp_request *, void *arg) - - evhttp* evhttp_new(event_base *base) - int evhttp_bind_socket(evhttp *http, char* address, int port) - int evhttp_accept_socket(evhttp *http, int fd) - void evhttp_free(evhttp* http) - int EVHTTP_SET_CB(evhttp *http, char *uri, evhttp_handler handler, void *arg) - void evhttp_set_gencb(evhttp *http, evhttp_handler handler, void *arg) - void evhttp_del_cb(evhttp *http, char *uri) - - # request - ctypedef void (*evhttp_request_cb)(evhttp_request *r, void *arg) - - evhttp_request *evhttp_request_new(evhttp_request_cb reqcb, void *arg) - void evhttp_request_free(evhttp_request *r) - - void evhttp_send_reply(evhttp_request *req, int status, char* reason, evbuffer* buf) - void evhttp_send_reply_start(evhttp_request *req, int status, char *reason) - void evhttp_send_reply_chunk(evhttp_request *req, evbuffer *buf) - void evhttp_send_reply_end(evhttp_request *req) - void evhttp_send_error(evhttp_request *req, int error, char *reason) - - char* evhttp_find_header(evkeyvalq*, char*) - int evhttp_remove_header(evkeyvalq*, char*) - int evhttp_add_header(evkeyvalq*, char*, char*) - void evhttp_clear_headers(evkeyvalq*) - - # connection - ctypedef void (*conn_closecb)(evhttp_connection *c, void *arg) - - evhttp_connection *evhttp_connection_new(char *addr, short port) - evhttp_connection *evhttp_connection_base_new(void*, void*, char *addr, short port) - void evhttp_connection_free(evhttp_connection *c) - void evhttp_connection_set_local_address(evhttp_connection *c, char *addr) - void evhttp_connection_set_timeout(evhttp_connection *c, int secs) - void evhttp_connection_set_retries(evhttp_connection *c, int retry_max) - void evhttp_connection_set_closecb(evhttp_connection *c, conn_closecb closecb, void *arg) - void evhttp_connection_get_peer(evhttp_connection *evcon, char **address, ev_uint16_t *port) - - int evhttp_make_request(evhttp_connection *c, evhttp_request *req, int cmd_type, char *uri) - - -class ObjectDeleted(AttributeError): - pass - - -class HttpRequestDeleted(ObjectDeleted): - """Raised when an attribute is accessed of http_request instance whose _obj is 0""" - - -class HttpConnectionDeleted(ObjectDeleted): - """Raised when an attribute is accessed of http_connection instance whose _obj is 0""" - - -cdef class http_request_base: - """Wrapper around libevent's :class:`evhttp_request` structure.""" - - # It is possible to crash the process by using it directly. - # prefer gevent.http and gevent.wsgi which should be safe - - cdef object __weakref__ - cdef evhttp_request* __obj - cdef public object _input_buffer - cdef public object _output_buffer - - def __init__(self, size_t obj): - self.__obj = obj - - property _obj: - - def __get__(self): - return (self.__obj) - - def __nonzero__(self): - if self.__obj: - return True - else: - return False - - def detach(self): - self.__obj = NULL - if self._input_buffer is not None: - self._input_buffer.detach() - if self._output_buffer is not None: - self._output_buffer.detach() - - def _format(self): - args = (self.typestr, self.uri, self.major, self.minor, - self.remote_host, self.remote_port) - res = '"%s %s HTTP/%s.%s" %s:%s' % args - if self.response_code: - res += ' response=%s' % self.response_code - if self.input_buffer: - res += ' input=%s' % len(self.input_buffer) - if self.output_buffer: - res += ' output=%s' % len(self.output_buffer) - return res - - def __str__(self): - try: - info = self._format() - except HttpRequestDeleted: - info = 'deleted' - except Exception, ex: - info = str(ex) or repr(ex) or '' - return '<%s %s>' % (self.__class__.__name__, info) - - def __repr__(self): - try: - info = ' ' + self._format() - except HttpRequestDeleted: - info = '' - except Exception, ex: - info = ' ' + (str(ex) or repr(ex) or '') - return '<%s _obj=0x%x %s>' % (self.__class__.__name__, self._obj, info) - - def get_input_headers(self): - if not self.__obj: - raise HttpRequestDeleted - cdef evkeyvalq* headers = self.__obj.input_headers - cdef evkeyval* p = TAILQ_FIRST(headers) - cdef char *key, *value - result = [] - while p: - key = p.key - value = p.value - if key == NULL or value == NULL: - break - result.append((key.lower(), value)) - p = TAILQ_GET_NEXT(p) - return result - - property connection: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return http_connection(self.__obj.evcon) - - property remote_host: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - if self.__obj.remote_host: - return self.__obj.remote_host - - property remote_port: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.remote_port - - property remote: - - def __get__(self): - return (self.remote_host, self.remote_port) - - property kind: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.kind - - property type: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.type - - property typestr: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return HTTP_method2name.get(self.__obj.type) or str(self.__obj.type) - - property uri: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - if self.__obj.uri: - return self.__obj.uri - - property major: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.major - - property minor: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.minor - - property version: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return (self.__obj.major, self.__obj.minor) - - property response_code: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.response_code - - property response_code_line: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - if self.__obj.response_code_line: - return self.__obj.response_code_line - - property response: - - def __get__(self): - return (self.response_code, self.response_code_line) - - property chunked: - - def __get__(self): - if not self.__obj: - raise HttpRequestDeleted - return self.__obj.chunked - - property input_buffer: - - def __get__(self): - if self._input_buffer is not None: - return self._input_buffer - if not self.__obj: - raise HttpRequestDeleted - self._input_buffer = buffer(self.__obj.input_buffer) - return self._input_buffer - - property output_buffer: - - def __get__(self): - if self._output_buffer is not None: - return self._output_buffer - if not self.__obj: - raise HttpRequestDeleted - self._output_buffer = buffer(self.__obj.output_buffer) - return self._output_buffer - - def find_input_header(self, char* key): - if not self.__obj: - raise HttpRequestDeleted - cdef const_char_ptr val = evhttp_find_header(self.__obj.input_headers, key) - if val: - return val - - def find_output_header(self, char* key): - if not self.__obj: - raise HttpRequestDeleted - cdef const_char_ptr val = evhttp_find_header(self.__obj.output_headers, key) - if val: - return val - - def add_input_header(self, char* key, char* value): - if not self.__obj: - raise HttpRequestDeleted - if evhttp_add_header(self.__obj.input_headers, key, value): - raise RuntimeError('Internal error in evhttp_add_header') - - def add_output_header(self, char* key, char* value): - if not self.__obj: - raise HttpRequestDeleted - if evhttp_add_header(self.__obj.output_headers, key, value): - raise RuntimeError('Internal error in evhttp_add_header') - - def remove_input_header(self, char* key): - """Return True if header was found and removed""" - if not self.__obj: - raise HttpRequestDeleted - return True if 0 == evhttp_remove_header(self.__obj.input_headers, key) else False - - def remove_output_header(self, char* key): - """Return True if header was found and removed""" - if not self.__obj: - raise HttpRequestDeleted - return True if 0 == evhttp_remove_header(self.__obj.output_headers, key) else False - - def clear_input_headers(self): - if not self.__obj: - raise HttpRequestDeleted - evhttp_clear_headers(self.__obj.input_headers) - - def clear_output_headers(self): - if not self.__obj: - raise HttpRequestDeleted - evhttp_clear_headers(self.__obj.output_headers) - - -cdef class http_request(http_request_base): - """Wrapper around libevent's :class:`evhttp_request` structure.""" - - # It is possible to crash the process by using it directly. - # prefer gevent.http and gevent.wsgi which should be safe - - cdef public object default_response_headers - - def __init__(self, size_t obj, object default_response_headers=[]): - http_request_base.__init__(self, obj) - self.default_response_headers = default_response_headers - - def __dealloc__(self): - cdef evhttp_request* obj = self.__obj - if obj != NULL: - self.detach() - report_internal_error(obj) - - def _add_default_response_headers(self): - for key, value in self.default_response_headers: - if not self.find_output_header(key): - self.add_output_header(key, value) - - def send_reply(self, int code, char *reason, object buf): - if not self.__obj: - raise HttpRequestDeleted - cdef evbuffer* c_buf - if isinstance(buf, buffer): - self._add_default_response_headers() - evhttp_send_reply(self.__obj, code, reason, (buf).__obj) - elif isinstance(buf, str): - self._add_default_response_headers() - c_buf = evbuffer_new() - evbuffer_add(c_buf, buf, len(buf)) - evhttp_send_reply(self.__obj, code, reason, c_buf) - evbuffer_free(c_buf) - else: - raise TypeError('Expected str or buffer: %r' % (buf, )) - - def send_reply_start(self, int code, char *reason): - if not self.__obj: - raise HttpRequestDeleted - self._add_default_response_headers() - evhttp_send_reply_start(self.__obj, code, reason) - - def send_reply_chunk(self, object buf): - if not self.__obj: - raise HttpRequestDeleted - cdef evbuffer* c_buf - if isinstance(buf, buffer): - evhttp_send_reply_chunk(self.__obj, (buf).__obj) - elif isinstance(buf, str): - c_buf = evbuffer_new() - evbuffer_add(c_buf, buf, len(buf)) - evhttp_send_reply_chunk(self.__obj, c_buf) - evbuffer_free(c_buf) - else: - raise TypeError('Expected str or buffer: %r' % (buf, )) - - def send_reply_end(self): - if not self.__obj: - raise HttpRequestDeleted - evhttp_send_reply_end(self.__obj) - - def send_error(self, int code, char* reason): - if not self.__obj: - raise HttpRequestDeleted - self._add_default_response_headers() - evhttp_send_error(self.__obj, code, reason) - - -cdef class http_request_client(http_request_base): - """Wrapper around libevent's :class:`evhttp_request` structure.""" - - cdef public int _owned - cdef public callback - cdef int _incref - - def __init__(self, object callback=None, size_t obj=0): - self._incref = 0 - self.callback = callback - if obj: - self.__obj = obj - self._owned = 0 - else: - self.__obj = evhttp_request_new(_http_request_cb_handler, self) - if not self.__obj: - raise IOError('evhttp_request_new() failed') - self._owned = 1 - self._addref() - - cdef _addref(self): - if self._incref <= 0: - Py_INCREF(self) - self._incref += 1 - - cdef _delref(self): - if self._incref > 0: - Py_DECREF(self) - self._incref -= 1 - self.callback = None - - def __dealloc__(self): - cdef evhttp_request* obj = self.__obj - if obj != NULL: - self.detach() - if self._owned: - evhttp_request_free(obj) - - -cdef class http_connection: - - cdef evhttp_connection* __obj - cdef public int _owned - - def __init__(self, size_t obj, owned=0): - self.__obj = obj - self._owned = owned - - @classmethod - def new(cls, char* address, unsigned short port): - cdef void* ptr = evhttp_connection_new(address, port) - if ptr != NULL: - return cls(ptr, 1) - - def __dealloc__(self): - cdef evhttp_connection* obj = self.__obj - if obj != NULL: - self.__obj = NULL - if self._owned: - evhttp_connection_free(obj) - - property _obj: - - def __get__(self): - return (self.__obj) - - def __nonzero__(self): - if self.__obj: - return True - else: - return False - - def __str__(self): - try: - peer = self.peer - except HttpConnectionDeleted: - peer = 'deleted' - return '<%s %s>' % (self.__class__.__name__, peer) - - def __repr__(self): - try: - peer = ' %s' % (self.peer, ) - except HttpConnectionDeleted: - peer = '' - return '<%s _obj=0x%x%s>' % (self.__class__.__name__, self._obj, peer) - - property peer: - - def __get__(self): - if not self.__obj: - raise HttpConnectionDeleted - cdef char* address = NULL - cdef ev_uint16_t port = 0 - evhttp_connection_get_peer(self.__obj, &address, &port) - if address: - addr = address - else: - addr = None - return (addr, port) - - def set_local_address(self, char *addr): - if not self.__obj: - raise HttpConnectionDeleted - evhttp_connection_set_local_address(self.__obj, addr) - - def set_timeout(self, int secs): - if not self.__obj: - raise HttpConnectionDeleted - evhttp_connection_set_timeout(self.__obj, secs) - - def set_retries(self, int retry_max): - if not self.__obj: - raise HttpConnectionDeleted - evhttp_connection_set_retries(self.__obj, retry_max) - - def make_request(self, http_request_client req, int type, char* uri): - req._owned = 0 - cdef int result = evhttp_make_request(self.__obj, req.__obj, type, uri) - if result != 0: - req.detach() - return result - - -cdef void _http_request_cb_handler(evhttp_request* c_request, void *arg) with gil: - if arg == NULL: - return - cdef http_request_client obj = (arg) - try: - if obj.__obj != NULL: - if obj.__obj != c_request: - # sometimes this happens, don't know why - sys.stderr.write("Internal error in evhttp\n") - if obj.callback is not None: - # preferring c_request to obj.__obj because the latter sometimes causes crashes - obj.callback(http_request_client(obj=c_request)) - obj.detach() - except: - traceback.print_exc() - try: - sys.stderr.write('Failed to execute callback for evhttp request.\n') - except: - pass - finally: - obj._delref() - - -cdef void _http_cb_handler(evhttp_request* request, void *arg) with gil: - cdef http server = arg - cdef http_request req = http_request(request, server.default_response_headers) - cdef evhttp_connection* conn = request.evcon - cdef object requests - try: - evhttp_connection_set_closecb(conn, _http_closecb_handler, arg) - requests = server._requests.pop(conn, None) - if requests is None: - requests = weakref.WeakKeyDictionary() - server._requests[conn] = requests - requests[req] = True - server.handle(req) - except: - traceback.print_exc() - try: - sys.stderr.write('%s: Failed to handle request: %s\n\n' % (server, req, )) - except: - traceback.print_exc() - # without clearing exc_info a reference to the request is somehow leaked - sys.exc_clear() - - -cdef void _http_closecb_handler(evhttp_connection* connection, void *arg) with gil: - cdef http server = arg - cdef object requests - for request in server._requests.pop(connection, {}).keys(): - request.detach() - - -cdef void _http_cb_reply_error(evhttp_request* request, void *arg): - report_internal_error(request) - - -cdef void report_internal_error(evhttp_request* request): - cdef evbuffer* c_buf - if request != NULL and request.response_code == 0: - evhttp_add_header(request.output_headers, "Connection", "close") - evhttp_add_header(request.output_headers, "Content-type", "text/plain") - c_buf = evbuffer_new() - evhttp_add_header(request.output_headers, "Content-length", "21") - evbuffer_add(c_buf, "Internal Server Error", 21) - evhttp_send_reply(request, 500, "Internal Server Error", c_buf) - evbuffer_free(c_buf) - - -cdef class http: - cdef evhttp* __obj - cdef public object handle - cdef public object default_response_headers - cdef public dict _requests - - def __init__(self, object handle, object default_response_headers=None): - self.handle = handle - if default_response_headers is None: - self.default_response_headers = [] - else: - self.default_response_headers = default_response_headers - self._requests = {} # maps connection id to WeakKeyDictionary which holds requests - self.__obj = evhttp_new(current_base) - evhttp_set_gencb(self.__obj, _http_cb_handler, self) - - def __dealloc__(self): - if self.__obj != NULL: - evhttp_set_gencb(self.__obj, _http_cb_reply_error, NULL) - evhttp_free(self.__obj) - self.__obj = NULL - - property _obj: - - def __get__(self): - return (self.__obj) - - def __nonzero__(self): - if self.__obj: - return True - else: - return False - - def bind(self, char* address='127.0.0.1', int port=80): - cdef int res = evhttp_bind_socket(self.__obj, address, port) - if res: - raise RuntimeError('evhttp_bind_socket(%r, %r) returned %r' % (address, port, res)) - - def accept(self, int fd): - cdef res = evhttp_accept_socket(self.__obj, fd) - if res: - raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, res)) diff -Nru python-gevent-0.13.7/gevent/fileobject.py python-gevent-1.0/gevent/fileobject.py --- python-gevent-0.13.7/gevent/fileobject.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/fileobject.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,322 @@ +from __future__ import absolute_import, with_statement +import sys +import os +from gevent.hub import get_hub +from gevent.socket import EBADF +from gevent.os import _read, _write, ignored_errors +from gevent.lock import Semaphore, DummySemaphore + + +try: + from fcntl import fcntl, F_SETFL +except ImportError: + fcntl = None + + +__all__ = ['FileObjectPosix', + 'FileObjectThread', + 'FileObject'] + + +if fcntl is None: + + __all__.remove('FileObjectPosix') + +else: + + from gevent.socket import _fileobject, _get_memory + cancel_wait_ex = IOError(EBADF, 'File descriptor was closed in another greenlet') + from gevent.os import make_nonblocking + + try: + from gevent._util import SocketAdapter__del__, noop + except ImportError: + SocketAdapter__del__ = None + noop = None + + from types import UnboundMethodType + + class NA(object): + + def __repr__(self): + return 'N/A' + + NA = NA() + + class SocketAdapter(object): + """Socket-like API on top of a file descriptor. + + The main purpose of it is to re-use _fileobject to create proper cooperative file objects + from file descriptors on POSIX platforms. + """ + + def __init__(self, fileno, mode=None, close=True): + if not isinstance(fileno, (int, long)): + raise TypeError('fileno must be int: %r' % fileno) + self._fileno = fileno + self._mode = mode or 'rb' + self._close = close + self._translate = 'U' in self._mode + make_nonblocking(fileno) + self._eat_newline = False + self.hub = get_hub() + io = self.hub.loop.io + self._read_event = io(fileno, 1) + self._write_event = io(fileno, 2) + + def __repr__(self): + if self._fileno is None: + return '<%s at 0x%x closed>' % (self.__class__.__name__, id(self)) + else: + args = (self.__class__.__name__, id(self), getattr(self, '_fileno', NA), getattr(self, '_mode', NA)) + return '<%s at 0x%x (%r, %r)>' % args + + def makefile(self, *args, **kwargs): + return _fileobject(self, *args, **kwargs) + + def fileno(self): + result = self._fileno + if result is None: + raise IOError(EBADF, 'Bad file descriptor (%s object is closed)' % self.__class__.__name) + return result + + def detach(self): + x = self._fileno + self._fileno = None + return x + + def close(self): + self.hub.cancel_wait(self._read_event, cancel_wait_ex) + self.hub.cancel_wait(self._write_event, cancel_wait_ex) + fileno = self._fileno + if fileno is not None: + self._fileno = None + if self._close: + os.close(fileno) + + def sendall(self, data): + fileno = self.fileno() + bytes_total = len(data) + bytes_written = 0 + while True: + try: + bytes_written += _write(fileno, _get_memory(data, bytes_written)) + except (IOError, OSError): + code = sys.exc_info()[1].args[0] + if code not in ignored_errors: + raise + sys.exc_clear() + if bytes_written >= bytes_total: + return + self.hub.wait(self._write_event) + + def recv(self, size): + while True: + try: + data = _read(self.fileno(), size) + except (IOError, OSError): + code = sys.exc_info()[1].args[0] + if code not in ignored_errors: + raise + sys.exc_clear() + else: + if not self._translate or not data: + return data + if self._eat_newline: + self._eat_newline = False + if data.startswith('\n'): + data = data[1:] + if not data: + return self.recv(size) + if data.endswith('\r'): + self._eat_newline = True + return self._translate_newlines(data) + self.hub.wait(self._read_event) + + def _translate_newlines(self, data): + data = data.replace("\r\n", "\n") + data = data.replace("\r", "\n") + return data + + if not SocketAdapter__del__: + + def __del__(self, close=os.close): + fileno = self._fileno + if fileno is not None: + close(fileno) + + if SocketAdapter__del__: + SocketAdapter.__del__ = UnboundMethodType(SocketAdapter__del__, None, SocketAdapter) + + class FileObjectPosix(_fileobject): + + def __init__(self, fobj, mode='rb', bufsize=-1, close=True): + if isinstance(fobj, (int, long)): + fileno = fobj + fobj = None + else: + fileno = fobj.fileno() + sock = SocketAdapter(fileno, mode, close=close) + self._fobj = fobj + self._closed = False + _fileobject.__init__(self, sock, mode=mode, bufsize=bufsize, close=close) + + def __repr__(self): + if self._sock is None: + return '<%s closed>' % self.__class__.__name__ + elif self._fobj is None: + return '<%s %s>' % (self.__class__.__name__, self._sock) + else: + return '<%s %s _fobj=%r>' % (self.__class__.__name__, self._sock, self._fobj) + + def close(self): + if self._closed: + # make sure close() is only ran once when called concurrently + # cannot rely on self._sock for this because we need to keep that until flush() is done + return + self._closed = True + sock = self._sock + if sock is None: + return + try: + self.flush() + finally: + if self._fobj is not None or not self._close: + sock.detach() + self._sock = None + self._fobj = None + + def __getattr__(self, item): + assert item != '_fobj' + if self._fobj is None: + raise FileObjectClosed + return getattr(self._fobj, item) + + if not noop: + + def __del__(self): + # disable _fileobject's __del__ + pass + + if noop: + FileObjectPosix.__del__ = UnboundMethodType(FileObjectPosix, None, noop) + + +class FileObjectThread(object): + + def __init__(self, fobj, *args, **kwargs): + self._close = kwargs.pop('close', True) + self.threadpool = kwargs.pop('threadpool', None) + self.lock = kwargs.pop('lock', True) + if kwargs: + raise TypeError('Unexpected arguments: %r' % kwargs.keys()) + if self.lock is True: + self.lock = Semaphore() + elif not self.lock: + self.lock = DummySemaphore() + if not hasattr(self.lock, '__enter__'): + raise TypeError('Expected a Semaphore or boolean, got %r' % type(self.lock)) + if isinstance(fobj, (int, long)): + if not self._close: + # we cannot do this, since fdopen object will close the descriptor + raise TypeError('FileObjectThread does not support close=False') + fobj = os.fdopen(fobj, *args) + self._fobj = fobj + if self.threadpool is None: + self.threadpool = get_hub().threadpool + + def _apply(self, func, args=None, kwargs=None): + with self.lock: + return self.threadpool.apply_e(BaseException, func, args, kwargs) + + def close(self): + fobj = self._fobj + if fobj is None: + return + self._fobj = None + try: + self.flush(_fobj=fobj) + finally: + if self._close: + fobj.close() + + def flush(self, _fobj=None): + if _fobj is not None: + fobj = _fobj + else: + fobj = self._fobj + if fobj is None: + raise FileObjectClosed + return self._apply(fobj.flush) + + def __repr__(self): + return '<%s _fobj=%r threadpool=%r>' % (self.__class__.__name__, self._fobj, self.threadpool) + + def __getattr__(self, item): + assert item != '_fobj' + if self._fobj is None: + raise FileObjectClosed + return getattr(self._fobj, item) + + for method in ['read', 'readinto', 'readline', 'readlines', 'write', 'writelines', 'xreadlines']: + + exec '''def %s(self, *args, **kwargs): + fobj = self._fobj + if fobj is None: + raise FileObjectClosed + return self._apply(fobj.%s, args, kwargs) +''' % (method, method) + + def __iter__(self): + return self + + def next(self): + line = self.readline() + if line: + return line + raise StopIteration + + +FileObjectClosed = IOError(EBADF, 'Bad file descriptor (FileObject was closed)') + + +try: + FileObject = FileObjectPosix +except NameError: + FileObject = FileObjectThread + + +class FileObjectBlock(object): + + def __init__(self, fobj, *args, **kwargs): + self._close = kwargs.pop('close', True) + if kwargs: + raise TypeError('Unexpected arguments: %r' % kwargs.keys()) + if isinstance(fobj, (int, long)): + if not self._close: + # we cannot do this, since fdopen object will close the descriptor + raise TypeError('FileObjectBlock does not support close=False') + fobj = os.fdopen(fobj, *args) + self._fobj = fobj + + def __repr__(self): + return '<%s %r>' % (self._fobj, ) + + def __getattr__(self, item): + assert item != '_fobj' + if self._fobj is None: + raise FileObjectClosed + return getattr(self._fobj, item) + + +config = os.environ.get('GEVENT_FILE') +if config: + klass = {'thread': 'gevent.fileobject.FileObjectThread', + 'posix': 'gevent.fileobject.FileObjectPosix', + 'block': 'gevent.fileobject.FileObjectBlock'}.get(config, config) + if klass.startswith('gevent.fileobject.'): + FileObject = globals()[klass.split('.', 2)[-1]] + else: + from gevent.hub import _import + FileObject = _import(klass) + del klass diff -Nru python-gevent-0.13.7/gevent/gevent.ares.c python-gevent-1.0/gevent/gevent.ares.c --- python-gevent-0.13.7/gevent/gevent.ares.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent.ares.c 2013-11-26 16:26:18.000000000 +0000 @@ -0,0 +1,11414 @@ +/* Generated by Cython 0.19 on Tue Nov 26 17:26:18 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__gevent__ares +#define __PYX_HAVE_API__gevent__ares +#include "ares.h" +#include "cares_pton.h" +#include "frameobject.h" +#include "dnshelper.c" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "ares.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_6gevent_4ares_result; +struct PyGeventAresChannelObject; +struct __pyx_opt_args_6gevent_4ares__convert_cares_flags; + +/* "gevent/ares.pyx":127 + * + * + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): # <<<<<<<<<<<<<< + * if _cares_flag_map is None: + * _prepare_cares_flag_map() + */ +struct __pyx_opt_args_6gevent_4ares__convert_cares_flags { + int __pyx_n; + int __pyx_default; +}; + +/* "gevent/ares.pyx":154 + * + * + * cdef class result: # <<<<<<<<<<<<<< + * cdef public object value + * cdef public object exception + */ +struct __pyx_obj_6gevent_4ares_result { + PyObject_HEAD + PyObject *value; + PyObject *exception; +}; + + +/* "gevent/ares.pyx":235 + * + * + * cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresChannel_Type]: # <<<<<<<<<<<<<< + * + * cdef public object loop + */ +struct PyGeventAresChannelObject { + PyObject_HEAD + struct __pyx_vtabstruct_6gevent_4ares_channel *__pyx_vtab; + PyObject *loop; + struct ares_channeldata *channel; + PyObject *_watchers; + PyObject *_timer; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventAresChannel_Type; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventAresChannel_Type; + +struct __pyx_vtabstruct_6gevent_4ares_channel { + PyObject *(*_sock_state_callback)(struct PyGeventAresChannelObject *, int, int, int); + PyObject *(*_getnameinfo)(struct PyGeventAresChannelObject *, PyObject *, PyObject *, int, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6gevent_4ares_channel *__pyx_vtabptr_6gevent_4ares_channel; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ +#if CYTHON_COMPILING_IN_PYPY +#define __Pyx_PyObject_AsDouble(obj) \ +(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ + likely(PyInt_CheckExact(obj)) ? \ + PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) +#else +#define __Pyx_PyObject_AsDouble(obj) \ +((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +#endif + +#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0) + +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ + +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; + int flags; + PyObject *func_dict; + PyObject *func_weakreflist; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; /* No-args super() class cell */ + void *defaults; + int defaults_pyobjects; + PyObject *defaults_tuple; /* Const defaults tuple */ + PyObject *defaults_kwdict; /* Const kwonly defaults dict */ + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; /* function annotations dict */ +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, PyObject *module, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __Pyx_CyFunction_init(void); + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *qualname, PyObject *modname); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'gevent.cares' */ + +/* Module declarations from 'gevent.python' */ + +/* Module declarations from 'gevent.ares' */ +static PyTypeObject *__pyx_ptype_6gevent_4ares_result = 0; +static PyTypeObject *__pyx_ptype_6gevent_4ares_channel = 0; +static PyObject *__pyx_f_6gevent_4ares__prepare_cares_flag_map(void); /*proto*/ +static PyObject *__pyx_f_6gevent_4ares__convert_cares_flags(int, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_4ares__convert_cares_flags *__pyx_optional_args); /*proto*/ +static PyObject *__pyx_f_6gevent_4ares_strerror(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static void __pyx_f_6gevent_4ares_gevent_sock_state_callback(void *, int, int, int); /*proto*/ +static void __pyx_f_6gevent_4ares_gevent_ares_host_callback(void *, int, int, struct hostent *); /*proto*/ +static void __pyx_f_6gevent_4ares_gevent_ares_nameinfo_callback(void *, int, int, char *, char *); /*proto*/ +#define __Pyx_MODULE_NAME "gevent.ares" +int __pyx_module_is_main_gevent__ares = 0; + +/* Implementation of 'gevent.ares' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_id; +static PyObject *__pyx_builtin_MemoryError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_pf_6gevent_4ares__convert_cares_flags(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_flags, int __pyx_v_default); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_2strerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code); /* proto */ +static int __pyx_pf_6gevent_4ares_6result___init__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_exception); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_6result_2__repr__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_6result_4successful(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_6result_6get(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_6result_5value___get__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_6result_5value_2__set__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4ares_6result_5value_4__del__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_6result_9exception___get__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_6result_9exception_2__set__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4ares_6result_9exception_4__del__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_16ares_host_result___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_family, PyObject *__pyx_v_iterable); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_16ares_host_result_2__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel___init__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_loop, PyObject *__pyx_v_flags, PyObject *__pyx_v_timeout, PyObject *__pyx_v_tries, PyObject *__pyx_v_ndots, PyObject *__pyx_v_udp_port, PyObject *__pyx_v_tcp_port, PyObject *__pyx_v_servers); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_2__repr__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_4destroy(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static void __pyx_pf_6gevent_4ares_7channel_6__dealloc__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_8set_servers(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_servers); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_10_on_timer(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_12_process_fd(struct PyGeventAresChannelObject *__pyx_v_self, int __pyx_v_events, PyObject *__pyx_v_watcher); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_14gethostbyname(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, char *__pyx_v_name, int __pyx_v_family); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_16gethostbyaddr(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, char *__pyx_v_addr); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_18_getnameinfo(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_sockaddr, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_20getnameinfo(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_sockaddr, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_4loop___get__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_4loop_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_4loop_4__del__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_9_watchers___get__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_9_watchers_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_9_watchers_4__del__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4ares_7channel_6_timer___get__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_6_timer_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4ares_7channel_6_timer_4__del__(struct PyGeventAresChannelObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_tp_new_6gevent_4ares_result(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4ares_channel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_2[] = "Bad value for ai_flags: 0x%x"; +static char __pyx_k_3[] = "%s: %s"; +static char __pyx_k_4[] = "%s(%r)"; +static char __pyx_k_5[] = "%s(exception=%r)"; +static char __pyx_k_6[] = "%s(value=%r, exception=%r)"; +static char __pyx_k_7[] = "<%s at 0x%x _timer=%r _watchers[%s]>"; +static char __pyx_k_8[] = "this ares channel has been destroyed"; +static char __pyx_k_9[] = ","; +static char __pyx_k_12[] = "expected a tuple, got %r"; +static char __pyx_k_13[] = "si|ii"; +static char __pyx_k_14[] = "Invalid value for port: %r"; +static char __pyx_k_15[] = "ARES_ENOTINITIALIZED"; +static char __pyx_k_16[] = "ARES_EADDRGETNETWORKPARAMS"; +static char __pyx_k_17[] = "ARES_FLAG_NOCHECKRESP"; +static char __pyx_k_18[] = "gevent.ares"; +static char __pyx_k_21[] = "/tmp/gevent-make-dist/gevent/gevent/ares.pyx"; +static char __pyx_k_22[] = "ares_host_result.__new__"; +static char __pyx_k_25[] = "ares_host_result.__getnewargs__"; +static char __pyx_k__fd[] = "fd"; +static char __pyx_k__id[] = "id"; +static char __pyx_k__io[] = "io"; +static char __pyx_k__cls[] = "cls"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__pop[] = "pop"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__addr[] = "addr"; +static char __pyx_k__loop[] = "loop"; +static char __pyx_k__name[] = "name"; +static char __pyx_k__self[] = "self"; +static char __pyx_k__stop[] = "stop"; +static char __pyx_k__again[] = "again"; +static char __pyx_k__flags[] = "flags"; +static char __pyx_k__ndots[] = "ndots"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__timer[] = "timer"; +static char __pyx_k__tries[] = "tries"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__events[] = "events"; +static char __pyx_k__family[] = "family"; +static char __pyx_k__TIMEOUT[] = "TIMEOUT"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k____new__[] = "__new__"; +static char __pyx_k___socket[] = "_socket"; +static char __pyx_k__channel[] = "channel"; +static char __pyx_k__default[] = "default"; +static char __pyx_k__destroy[] = "destroy"; +static char __pyx_k__servers[] = "servers"; +static char __pyx_k__timeout[] = "timeout"; +static char __pyx_k__watcher[] = "watcher"; +static char __pyx_k__ARES_EOF[] = "ARES_EOF"; +static char __pyx_k__NI_DGRAM[] = "NI_DGRAM"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____name__[] = "__name__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__callback[] = "callback"; +static char __pyx_k__exc_info[] = "exc_info"; +static char __pyx_k__gaierror[] = "gaierror"; +static char __pyx_k__iterable[] = "iterable"; +static char __pyx_k__sockaddr[] = "sockaddr"; +static char __pyx_k__tcp_port[] = "tcp_port"; +static char __pyx_k__udp_port[] = "udp_port"; +static char __pyx_k__InvalidIP[] = "InvalidIP"; +static char __pyx_k__NI_NOFQDN[] = "NI_NOFQDN"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k____class__[] = "__class__"; +static char __pyx_k___on_timer[] = "_on_timer"; +static char __pyx_k__exception[] = "exception"; +static char __pyx_k__ARES_EFILE[] = "ARES_EFILE"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k____module__[] = "__module__"; +static char __pyx_k__ARES_ENOMEM[] = "ARES_ENOMEM"; +static char __pyx_k__MemoryError[] = "MemoryError"; +static char __pyx_k__NI_NAMEREQD[] = "NI_NAMEREQD"; +static char __pyx_k___process_fd[] = "_process_fd"; +static char __pyx_k__pass_events[] = "pass_events"; +static char __pyx_k__set_servers[] = "set_servers"; +static char __pyx_k__ARES_EBADSTR[] = "ARES_EBADSTR"; +static char __pyx_k__ARES_ENODATA[] = "ARES_ENODATA"; +static char __pyx_k__ARES_ENONAME[] = "ARES_ENONAME"; +static char __pyx_k__ARES_ENOTIMP[] = "ARES_ENOTIMP"; +static char __pyx_k__ARES_SUCCESS[] = "ARES_SUCCESS"; +static char __pyx_k____qualname__[] = "__qualname__"; +static char __pyx_k___ares_errors[] = "_ares_errors"; +static char __pyx_k___getnameinfo[] = "_getnameinfo"; +static char __pyx_k__handle_error[] = "handle_error"; +static char __pyx_k__ARES_EBADNAME[] = "ARES_EBADNAME"; +static char __pyx_k__ARES_EBADRESP[] = "ARES_EBADRESP"; +static char __pyx_k__ARES_EFORMERR[] = "ARES_EFORMERR"; +static char __pyx_k__ARES_EREFUSED[] = "ARES_EREFUSED"; +static char __pyx_k__ARES_ETIMEOUT[] = "ARES_ETIMEOUT"; +static char __pyx_k____metaclass__[] = "__metaclass__"; +static char __pyx_k__ARES_EBADFLAGS[] = "ARES_EBADFLAGS"; +static char __pyx_k__ARES_EBADHINTS[] = "ARES_EBADHINTS"; +static char __pyx_k__ARES_EBADQUERY[] = "ARES_EBADQUERY"; +static char __pyx_k__ARES_ENOTFOUND[] = "ARES_ENOTFOUND"; +static char __pyx_k__ARES_ESERVFAIL[] = "ARES_ESERVFAIL"; +static char __pyx_k__NI_NUMERICHOST[] = "NI_NUMERICHOST"; +static char __pyx_k__NI_NUMERICSERV[] = "NI_NUMERICSERV"; +static char __pyx_k____getnewargs__[] = "__getnewargs__"; +static char __pyx_k__ARES_EBADFAMILY[] = "ARES_EBADFAMILY"; +static char __pyx_k__ARES_ECANCELLED[] = "ARES_ECANCELLED"; +static char __pyx_k__ARES_FLAG_IGNTC[] = "ARES_FLAG_IGNTC"; +static char __pyx_k__ARES_FLAG_USEVC[] = "ARES_FLAG_USEVC"; +static char __pyx_k___cares_flag_map[] = "_cares_flag_map"; +static char __pyx_k__ares_host_result[] = "ares_host_result"; +static char __pyx_k__ARES_ECONNREFUSED[] = "ARES_ECONNREFUSED"; +static char __pyx_k__ARES_EDESTRUCTION[] = "ARES_EDESTRUCTION"; +static char __pyx_k__ARES_FLAG_PRIMARY[] = "ARES_FLAG_PRIMARY"; +static char __pyx_k__ARES_ELOADIPHLPAPI[] = "ARES_ELOADIPHLPAPI"; +static char __pyx_k__ARES_FLAG_NOSEARCH[] = "ARES_FLAG_NOSEARCH"; +static char __pyx_k__ARES_FLAG_STAYOPEN[] = "ARES_FLAG_STAYOPEN"; +static char __pyx_k__ARES_FLAG_NOALIASES[] = "ARES_FLAG_NOALIASES"; +static char __pyx_k__ARES_FLAG_NORECURSE[] = "ARES_FLAG_NORECURSE"; +static PyObject *__pyx_kp_s_12; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_n_s_15; +static PyObject *__pyx_n_s_16; +static PyObject *__pyx_n_s_17; +static PyObject *__pyx_n_s_18; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_21; +static PyObject *__pyx_n_s_22; +static PyObject *__pyx_n_s_25; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__ARES_EBADFAMILY; +static PyObject *__pyx_n_s__ARES_EBADFLAGS; +static PyObject *__pyx_n_s__ARES_EBADHINTS; +static PyObject *__pyx_n_s__ARES_EBADNAME; +static PyObject *__pyx_n_s__ARES_EBADQUERY; +static PyObject *__pyx_n_s__ARES_EBADRESP; +static PyObject *__pyx_n_s__ARES_EBADSTR; +static PyObject *__pyx_n_s__ARES_ECANCELLED; +static PyObject *__pyx_n_s__ARES_ECONNREFUSED; +static PyObject *__pyx_n_s__ARES_EDESTRUCTION; +static PyObject *__pyx_n_s__ARES_EFILE; +static PyObject *__pyx_n_s__ARES_EFORMERR; +static PyObject *__pyx_n_s__ARES_ELOADIPHLPAPI; +static PyObject *__pyx_n_s__ARES_ENODATA; +static PyObject *__pyx_n_s__ARES_ENOMEM; +static PyObject *__pyx_n_s__ARES_ENONAME; +static PyObject *__pyx_n_s__ARES_ENOTFOUND; +static PyObject *__pyx_n_s__ARES_ENOTIMP; +static PyObject *__pyx_n_s__ARES_EOF; +static PyObject *__pyx_n_s__ARES_EREFUSED; +static PyObject *__pyx_n_s__ARES_ESERVFAIL; +static PyObject *__pyx_n_s__ARES_ETIMEOUT; +static PyObject *__pyx_n_s__ARES_FLAG_IGNTC; +static PyObject *__pyx_n_s__ARES_FLAG_NOALIASES; +static PyObject *__pyx_n_s__ARES_FLAG_NORECURSE; +static PyObject *__pyx_n_s__ARES_FLAG_NOSEARCH; +static PyObject *__pyx_n_s__ARES_FLAG_PRIMARY; +static PyObject *__pyx_n_s__ARES_FLAG_STAYOPEN; +static PyObject *__pyx_n_s__ARES_FLAG_USEVC; +static PyObject *__pyx_n_s__ARES_SUCCESS; +static PyObject *__pyx_n_s__InvalidIP; +static PyObject *__pyx_n_s__MemoryError; +static PyObject *__pyx_n_s__NI_DGRAM; +static PyObject *__pyx_n_s__NI_NAMEREQD; +static PyObject *__pyx_n_s__NI_NOFQDN; +static PyObject *__pyx_n_s__NI_NUMERICHOST; +static PyObject *__pyx_n_s__NI_NUMERICSERV; +static PyObject *__pyx_n_s__TIMEOUT; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____getnewargs__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____metaclass__; +static PyObject *__pyx_n_s____module__; +static PyObject *__pyx_n_s____name__; +static PyObject *__pyx_n_s____new__; +static PyObject *__pyx_n_s____qualname__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___ares_errors; +static PyObject *__pyx_n_s___cares_flag_map; +static PyObject *__pyx_n_s___getnameinfo; +static PyObject *__pyx_n_s___on_timer; +static PyObject *__pyx_n_s___process_fd; +static PyObject *__pyx_n_s___socket; +static PyObject *__pyx_n_s__addr; +static PyObject *__pyx_n_s__again; +static PyObject *__pyx_n_s__ares_host_result; +static PyObject *__pyx_n_s__callback; +static PyObject *__pyx_n_s__channel; +static PyObject *__pyx_n_s__cls; +static PyObject *__pyx_n_s__default; +static PyObject *__pyx_n_s__destroy; +static PyObject *__pyx_n_s__events; +static PyObject *__pyx_n_s__exc_info; +static PyObject *__pyx_n_s__exception; +static PyObject *__pyx_n_s__family; +static PyObject *__pyx_n_s__fd; +static PyObject *__pyx_n_s__flags; +static PyObject *__pyx_n_s__gaierror; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__handle_error; +static PyObject *__pyx_n_s__id; +static PyObject *__pyx_n_s__io; +static PyObject *__pyx_n_s__iterable; +static PyObject *__pyx_n_s__loop; +static PyObject *__pyx_n_s__name; +static PyObject *__pyx_n_s__ndots; +static PyObject *__pyx_n_s__pass_events; +static PyObject *__pyx_n_s__pop; +static PyObject *__pyx_n_s__self; +static PyObject *__pyx_n_s__servers; +static PyObject *__pyx_n_s__set_servers; +static PyObject *__pyx_n_s__sockaddr; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__stop; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__tcp_port; +static PyObject *__pyx_n_s__timeout; +static PyObject *__pyx_n_s__timer; +static PyObject *__pyx_n_s__tries; +static PyObject *__pyx_n_s__udp_port; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__watcher; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_8; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_neg_8; +static PyObject *__pyx_int_16; +static int __pyx_k_1; +static int __pyx_k_11; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_24; + +/* "gevent/ares.pyx":116 + * + * + * cdef _prepare_cares_flag_map(): # <<<<<<<<<<<<<< + * global _cares_flag_map + * import _socket + */ + +static PyObject *__pyx_f_6gevent_4ares__prepare_cares_flag_map(void) { + PyObject *__pyx_v__socket = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_prepare_cares_flag_map", 0); + + /* "gevent/ares.pyx":118 + * cdef _prepare_cares_flag_map(): + * global _cares_flag_map + * import _socket # <<<<<<<<<<<<<< + * _cares_flag_map = [ + * (getattr(_socket, 'NI_NUMERICHOST', 1), cares.ARES_NI_NUMERICHOST), + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s___socket), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__socket = __pyx_t_1; + __pyx_t_1 = 0; + + /* "gevent/ares.pyx":120 + * import _socket + * _cares_flag_map = [ + * (getattr(_socket, 'NI_NUMERICHOST', 1), cares.ARES_NI_NUMERICHOST), # <<<<<<<<<<<<<< + * (getattr(_socket, 'NI_NUMERICSERV', 2), cares.ARES_NI_NUMERICSERV), + * (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v__socket, ((PyObject *)__pyx_n_s__NI_NUMERICHOST), __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(ARES_NI_NUMERICHOST); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":121 + * _cares_flag_map = [ + * (getattr(_socket, 'NI_NUMERICHOST', 1), cares.ARES_NI_NUMERICHOST), + * (getattr(_socket, 'NI_NUMERICSERV', 2), cares.ARES_NI_NUMERICSERV), # <<<<<<<<<<<<<< + * (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), + * (getattr(_socket, 'NI_NAMEREQD', 8), cares.ARES_NI_NAMEREQD), + */ + __pyx_t_2 = __Pyx_GetAttr3(__pyx_v__socket, ((PyObject *)__pyx_n_s__NI_NUMERICSERV), __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(ARES_NI_NUMERICSERV); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + + /* "gevent/ares.pyx":122 + * (getattr(_socket, 'NI_NUMERICHOST', 1), cares.ARES_NI_NUMERICHOST), + * (getattr(_socket, 'NI_NUMERICSERV', 2), cares.ARES_NI_NUMERICSERV), + * (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), # <<<<<<<<<<<<<< + * (getattr(_socket, 'NI_NAMEREQD', 8), cares.ARES_NI_NAMEREQD), + * (getattr(_socket, 'NI_DGRAM', 16), cares.ARES_NI_DGRAM)] + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v__socket, ((PyObject *)__pyx_n_s__NI_NOFQDN), __pyx_int_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(ARES_NI_NOFQDN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":123 + * (getattr(_socket, 'NI_NUMERICSERV', 2), cares.ARES_NI_NUMERICSERV), + * (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), + * (getattr(_socket, 'NI_NAMEREQD', 8), cares.ARES_NI_NAMEREQD), # <<<<<<<<<<<<<< + * (getattr(_socket, 'NI_DGRAM', 16), cares.ARES_NI_DGRAM)] + * + */ + __pyx_t_2 = __Pyx_GetAttr3(__pyx_v__socket, ((PyObject *)__pyx_n_s__NI_NAMEREQD), __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(ARES_NI_NAMEREQD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + + /* "gevent/ares.pyx":124 + * (getattr(_socket, 'NI_NOFQDN', 4), cares.ARES_NI_NOFQDN), + * (getattr(_socket, 'NI_NAMEREQD', 8), cares.ARES_NI_NAMEREQD), + * (getattr(_socket, 'NI_DGRAM', 16), cares.ARES_NI_DGRAM)] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v__socket, ((PyObject *)__pyx_n_s__NI_DGRAM), __pyx_int_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(ARES_NI_DGRAM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___cares_flag_map, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent.ares._prepare_cares_flag_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v__socket); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":127 + * + * + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): # <<<<<<<<<<<<<< + * if _cares_flag_map is None: + * _prepare_cares_flag_map() + */ + +static PyObject *__pyx_pw_6gevent_4ares_1_convert_cares_flags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6gevent_4ares__convert_cares_flags(int __pyx_v_flags, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_4ares__convert_cares_flags *__pyx_optional_args) { + int __pyx_v_default = __pyx_k_1; + PyObject *__pyx_v_socket_flag = NULL; + PyObject *__pyx_v_cares_flag = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_convert_cares_flags", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default = __pyx_optional_args->__pyx_default; + } + } + + /* "gevent/ares.pyx":128 + * + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): + * if _cares_flag_map is None: # <<<<<<<<<<<<<< + * _prepare_cares_flag_map() + * for socket_flag, cares_flag in _cares_flag_map: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___cares_flag_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "gevent/ares.pyx":129 + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): + * if _cares_flag_map is None: + * _prepare_cares_flag_map() # <<<<<<<<<<<<<< + * for socket_flag, cares_flag in _cares_flag_map: + * if socket_flag & flags: + */ + __pyx_t_1 = __pyx_f_6gevent_4ares__prepare_cares_flag_map(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":130 + * if _cares_flag_map is None: + * _prepare_cares_flag_map() + * for socket_flag, cares_flag in _cares_flag_map: # <<<<<<<<<<<<<< + * if socket_flag & flags: + * default |= cares_flag + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___cares_flag_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_socket_flag); + __pyx_v_socket_flag = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_cares_flag); + __pyx_v_cares_flag = __pyx_t_7; + __pyx_t_7 = 0; + + /* "gevent/ares.pyx":131 + * _prepare_cares_flag_map() + * for socket_flag, cares_flag in _cares_flag_map: + * if socket_flag & flags: # <<<<<<<<<<<<<< + * default |= cares_flag + * flags &= ~socket_flag + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyNumber_And(__pyx_v_socket_flag, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_2) { + + /* "gevent/ares.pyx":132 + * for socket_flag, cares_flag in _cares_flag_map: + * if socket_flag & flags: + * default |= cares_flag # <<<<<<<<<<<<<< + * flags &= ~socket_flag + * if not flags: + */ + __pyx_t_7 = PyInt_FromLong(__pyx_v_default); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyNumber_InPlaceOr(__pyx_t_7, __pyx_v_cares_flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_default = __pyx_t_10; + + /* "gevent/ares.pyx":133 + * if socket_flag & flags: + * default |= cares_flag + * flags &= ~socket_flag # <<<<<<<<<<<<<< + * if not flags: + * return default + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyNumber_Invert(__pyx_v_socket_flag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyNumber_InPlaceAnd(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_flags = __pyx_t_10; + goto __pyx_L8; + } + __pyx_L8:; + + /* "gevent/ares.pyx":134 + * default |= cares_flag + * flags &= ~socket_flag + * if not flags: # <<<<<<<<<<<<<< + * return default + * raise gaierror(-1, "Bad value for ai_flags: 0x%x" % flags) + */ + __pyx_t_2 = (!__pyx_v_flags); + if (__pyx_t_2) { + + /* "gevent/ares.pyx":135 + * flags &= ~socket_flag + * if not flags: + * return default # <<<<<<<<<<<<<< + * raise gaierror(-1, "Bad value for ai_flags: 0x%x" % flags) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyInt_FromLong(__pyx_v_default); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gevent/ares.pyx":136 + * if not flags: + * return default + * raise gaierror(-1, "Bad value for ai_flags: 0x%x" % flags) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("gevent.ares._convert_cares_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_socket_flag); + __Pyx_XDECREF(__pyx_v_cares_flag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_1_convert_cares_flags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_1_convert_cares_flags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_flags; + int __pyx_v_default; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_convert_cares_flags (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__default,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_convert_cares_flags") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_default = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_default == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_default = __pyx_k_1; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_convert_cares_flags", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares._convert_cares_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares__convert_cares_flags(__pyx_self, __pyx_v_flags, __pyx_v_default); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":127 + * + * + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): # <<<<<<<<<<<<<< + * if _cares_flag_map is None: + * _prepare_cares_flag_map() + */ + +static PyObject *__pyx_pf_6gevent_4ares__convert_cares_flags(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_flags, int __pyx_v_default) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_6gevent_4ares__convert_cares_flags __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_convert_cares_flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.__pyx_default = __pyx_v_default; + __pyx_t_1 = __pyx_f_6gevent_4ares__convert_cares_flags(__pyx_v_flags, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.ares._convert_cares_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":139 + * + * + * cpdef strerror(code): # <<<<<<<<<<<<<< + * return '%s: %s' % (_ares_errors.get(code) or code, cares.ares_strerror(code)) + * + */ + +static PyObject *__pyx_pw_6gevent_4ares_3strerror(PyObject *__pyx_self, PyObject *__pyx_v_code); /*proto*/ +static PyObject *__pyx_f_6gevent_4ares_strerror(PyObject *__pyx_v_code, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("strerror", 0); + + /* "gevent/ares.pyx":140 + * + * cpdef strerror(code): + * return '%s: %s' % (_ares_errors.get(code) or code, cares.ares_strerror(code)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___ares_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_code); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_code); + __Pyx_GIVEREF(__pyx_v_code); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_code); + __pyx_t_1 = __pyx_v_code; + } else { + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_code); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBytes_FromString(ares_strerror(__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.ares.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_3strerror(PyObject *__pyx_self, PyObject *__pyx_v_code); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_3strerror(PyObject *__pyx_self, PyObject *__pyx_v_code) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("strerror (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_2strerror(__pyx_self, ((PyObject *)__pyx_v_code)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":139 + * + * + * cpdef strerror(code): # <<<<<<<<<<<<<< + * return '%s: %s' % (_ares_errors.get(code) or code, cares.ares_strerror(code)) + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_2strerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("strerror", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4ares_strerror(__pyx_v_code, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.ares.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":147 + * + * + * cdef void gevent_sock_state_callback(void *data, int s, int read, int write): # <<<<<<<<<<<<<< + * if not data: + * return + */ + +static void __pyx_f_6gevent_4ares_gevent_sock_state_callback(void *__pyx_v_data, int __pyx_v_s, int __pyx_v_read, int __pyx_v_write) { + struct PyGeventAresChannelObject *__pyx_v_ch = 0; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gevent_sock_state_callback", 0); + + /* "gevent/ares.pyx":148 + * + * cdef void gevent_sock_state_callback(void *data, int s, int read, int write): + * if not data: # <<<<<<<<<<<<<< + * return + * cdef channel ch = data + */ + __pyx_t_1 = (!(__pyx_v_data != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":149 + * cdef void gevent_sock_state_callback(void *data, int s, int read, int write): + * if not data: + * return # <<<<<<<<<<<<<< + * cdef channel ch = data + * ch._sock_state_callback(s, read, write) + */ + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":150 + * if not data: + * return + * cdef channel ch = data # <<<<<<<<<<<<<< + * ch._sock_state_callback(s, read, write) + * + */ + __Pyx_INCREF(((PyObject *)((struct PyGeventAresChannelObject *)__pyx_v_data))); + __pyx_v_ch = ((struct PyGeventAresChannelObject *)__pyx_v_data); + + /* "gevent/ares.pyx":151 + * return + * cdef channel ch = data + * ch._sock_state_callback(s, read, write) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_4ares_channel *)__pyx_v_ch->__pyx_vtab)->_sock_state_callback(__pyx_v_ch, __pyx_v_s, __pyx_v_read, __pyx_v_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("gevent.ares.gevent_sock_state_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ch); + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_6result_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4ares_6result_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_exception = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__value,&__pyx_n_s__exception,0}; + PyObject* values[2] = {0,0}; + + /* "gevent/ares.pyx":158 + * cdef public object exception + * + * def __init__(self, object value=None, object exception=None): # <<<<<<<<<<<<<< + * self.value = value + * self.exception = exception + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exception); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_value = values[0]; + __pyx_v_exception = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.result.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_6result___init__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self), __pyx_v_value, __pyx_v_exception); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_6result___init__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_exception) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "gevent/ares.pyx":159 + * + * def __init__(self, object value=None, object exception=None): + * self.value = value # <<<<<<<<<<<<<< + * self.exception = exception + * + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->value); + __Pyx_DECREF(__pyx_v_self->value); + __pyx_v_self->value = __pyx_v_value; + + /* "gevent/ares.pyx":160 + * def __init__(self, object value=None, object exception=None): + * self.value = value + * self.exception = exception # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_INCREF(__pyx_v_exception); + __Pyx_GIVEREF(__pyx_v_exception); + __Pyx_GOTREF(__pyx_v_self->exception); + __Pyx_DECREF(__pyx_v_self->exception); + __pyx_v_self->exception = __pyx_v_exception; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_6result_3__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_6result_3__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_2__repr__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":162 + * self.exception = exception + * + * def __repr__(self): # <<<<<<<<<<<<<< + * if self.exception is None: + * return '%s(%r)' % (self.__class__.__name__, self.value) + */ + +static PyObject *__pyx_pf_6gevent_4ares_6result_2__repr__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "gevent/ares.pyx":163 + * + * def __repr__(self): + * if self.exception is None: # <<<<<<<<<<<<<< + * return '%s(%r)' % (self.__class__.__name__, self.value) + * elif self.value is None: + */ + __pyx_t_1 = (__pyx_v_self->exception == Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":164 + * def __repr__(self): + * if self.exception is None: + * return '%s(%r)' % (self.__class__.__name__, self.value) # <<<<<<<<<<<<<< + * elif self.value is None: + * return '%s(exception=%r)' % (self.__class__.__name__, self.exception) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_self->value); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->value); + __Pyx_GIVEREF(__pyx_v_self->value); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "gevent/ares.pyx":165 + * if self.exception is None: + * return '%s(%r)' % (self.__class__.__name__, self.value) + * elif self.value is None: # <<<<<<<<<<<<<< + * return '%s(exception=%r)' % (self.__class__.__name__, self.exception) + * else: + */ + __pyx_t_1 = (__pyx_v_self->value == Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":166 + * return '%s(%r)' % (self.__class__.__name__, self.value) + * elif self.value is None: + * return '%s(exception=%r)' % (self.__class__.__name__, self.exception) # <<<<<<<<<<<<<< + * else: + * return '%s(value=%r, exception=%r)' % (self.__class__.__name__, self.value, self.exception) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self->exception); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->exception); + __Pyx_GIVEREF(__pyx_v_self->exception); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "gevent/ares.pyx":168 + * return '%s(exception=%r)' % (self.__class__.__name__, self.exception) + * else: + * return '%s(value=%r, exception=%r)' % (self.__class__.__name__, self.value, self.exception) # <<<<<<<<<<<<<< + * # add repr_recursive precaution + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_self->value); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->value); + __Pyx_GIVEREF(__pyx_v_self->value); + __Pyx_INCREF(__pyx_v_self->exception); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->exception); + __Pyx_GIVEREF(__pyx_v_self->exception); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.ares.result.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_6result_5successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_6result_5successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("successful (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_4successful(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":171 + * # add repr_recursive precaution + * + * def successful(self): # <<<<<<<<<<<<<< + * return self.exception is None + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_6result_4successful(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("successful", 0); + + /* "gevent/ares.pyx":172 + * + * def successful(self): + * return self.exception is None # <<<<<<<<<<<<<< + * + * def get(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_self->exception == Py_None); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.ares.result.successful", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_6result_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_6result_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_6get(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":174 + * return self.exception is None + * + * def get(self): # <<<<<<<<<<<<<< + * if self.exception is not None: + * raise self.exception + */ + +static PyObject *__pyx_pf_6gevent_4ares_6result_6get(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get", 0); + + /* "gevent/ares.pyx":175 + * + * def get(self): + * if self.exception is not None: # <<<<<<<<<<<<<< + * raise self.exception + * return self.value + */ + __pyx_t_1 = (__pyx_v_self->exception != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":176 + * def get(self): + * if self.exception is not None: + * raise self.exception # <<<<<<<<<<<<<< + * return self.value + * + */ + __Pyx_Raise(__pyx_v_self->exception, 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":177 + * if self.exception is not None: + * raise self.exception + * return self.value # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->value); + __pyx_r = __pyx_v_self->value; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.ares.result.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_6result_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_6result_5value_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_5value___get__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":155 + * + * cdef class result: + * cdef public object value # <<<<<<<<<<<<<< + * cdef public object exception + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_6result_5value___get__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->value); + __pyx_r = __pyx_v_self->value; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_6result_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4ares_6result_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_5value_2__set__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_6result_5value_2__set__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->value); + __Pyx_DECREF(__pyx_v_self->value); + __pyx_v_self->value = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_6result_5value_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4ares_6result_5value_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_5value_4__del__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_6result_5value_4__del__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->value); + __Pyx_DECREF(__pyx_v_self->value); + __pyx_v_self->value = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_6result_9exception_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_6result_9exception_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_9exception___get__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":156 + * cdef class result: + * cdef public object value + * cdef public object exception # <<<<<<<<<<<<<< + * + * def __init__(self, object value=None, object exception=None): + */ + +static PyObject *__pyx_pf_6gevent_4ares_6result_9exception___get__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->exception); + __pyx_r = __pyx_v_self->exception; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_6result_9exception_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4ares_6result_9exception_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_9exception_2__set__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_6result_9exception_2__set__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->exception); + __Pyx_DECREF(__pyx_v_self->exception); + __pyx_v_self->exception = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_6result_9exception_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4ares_6result_9exception_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_6result_9exception_4__del__(((struct __pyx_obj_6gevent_4ares_result *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_6result_9exception_4__del__(struct __pyx_obj_6gevent_4ares_result *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->exception); + __Pyx_DECREF(__pyx_v_self->exception); + __pyx_v_self->exception = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_16ares_host_result_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4ares_16ares_host_result_1__new__ = {__Pyx_NAMESTR("__new__"), (PyCFunction)__pyx_pw_6gevent_4ares_16ares_host_result_1__new__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4ares_16ares_host_result_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_cls = 0; + PyObject *__pyx_v_family = 0; + PyObject *__pyx_v_iterable = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__new__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cls,&__pyx_n_s__family,&__pyx_n_s__iterable,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cls)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__family)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterable)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_cls = values[0]; + __pyx_v_family = values[1]; + __pyx_v_iterable = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.ares_host_result.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_16ares_host_result___new__(__pyx_self, __pyx_v_cls, __pyx_v_family, __pyx_v_iterable); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":182 + * class ares_host_result(tuple): + * + * def __new__(cls, family, iterable): # <<<<<<<<<<<<<< + * cdef object self = tuple.__new__(cls, iterable) + * self.family = family + */ + +static PyObject *__pyx_pf_6gevent_4ares_16ares_host_result___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_family, PyObject *__pyx_v_iterable) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__new__", 0); + + /* "gevent/ares.pyx":183 + * + * def __new__(cls, family, iterable): + * cdef object self = tuple.__new__(cls, iterable) # <<<<<<<<<<<<<< + * self.family = family + * return self + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_n_s____new__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_cls); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cls); + __Pyx_GIVEREF(__pyx_v_cls); + __Pyx_INCREF(__pyx_v_iterable); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_iterable); + __Pyx_GIVEREF(__pyx_v_iterable); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_self = __pyx_t_3; + __pyx_t_3 = 0; + + /* "gevent/ares.pyx":184 + * def __new__(cls, family, iterable): + * cdef object self = tuple.__new__(cls, iterable) + * self.family = family # <<<<<<<<<<<<<< + * return self + * + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__family, __pyx_v_family) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":185 + * cdef object self = tuple.__new__(cls, iterable) + * self.family = family + * return self # <<<<<<<<<<<<<< + * + * def __getnewargs__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.ares.ares_host_result.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_16ares_host_result_3__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4ares_16ares_host_result_3__getnewargs__ = {__Pyx_NAMESTR("__getnewargs__"), (PyCFunction)__pyx_pw_6gevent_4ares_16ares_host_result_3__getnewargs__, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4ares_16ares_host_result_3__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_16ares_host_result_2__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":187 + * return self + * + * def __getnewargs__(self): # <<<<<<<<<<<<<< + * return (self.family, tuple(self)) + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_16ares_host_result_2__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getnewargs__", 0); + + /* "gevent/ares.pyx":188 + * + * def __getnewargs__(self): + * return (self.family, tuple(self)) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__family); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.ares.ares_host_result.__getnewargs__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":191 + * + * + * cdef void gevent_ares_host_callback(void *arg, int status, int timeouts, hostent* host): # <<<<<<<<<<<<<< + * cdef channel channel + * cdef object callback + */ + +static void __pyx_f_6gevent_4ares_gevent_ares_host_callback(void *__pyx_v_arg, int __pyx_v_status, CYTHON_UNUSED int __pyx_v_timeouts, struct hostent *__pyx_v_host) { + struct PyGeventAresChannelObject *__pyx_v_channel = 0; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_host_result = 0; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gevent_ares_host_callback", 0); + + /* "gevent/ares.pyx":194 + * cdef channel channel + * cdef object callback + * channel, callback = arg # <<<<<<<<<<<<<< + * Py_DECREF(arg) + * cdef object host_result + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_arg)))) { + PyObject* sequence = ((PyObject *)__pyx_v_arg); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_arg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L4_unpacking_done:; + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_4ares_channel))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_channel = ((struct PyGeventAresChannelObject *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_v_callback = __pyx_t_2; + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":195 + * cdef object callback + * channel, callback = arg + * Py_DECREF(arg) # <<<<<<<<<<<<<< + * cdef object host_result + * try: + */ + Py_DECREF(((PyObject*)__pyx_v_arg)); + + /* "gevent/ares.pyx":197 + * Py_DECREF(arg) + * cdef object host_result + * try: # <<<<<<<<<<<<<< + * if status or not host: + * callback(result(None, gaierror(status, strerror(status)))) + */ + { + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + + /* "gevent/ares.pyx":198 + * cdef object host_result + * try: + * if status or not host: # <<<<<<<<<<<<<< + * callback(result(None, gaierror(status, strerror(status)))) + * else: + */ + if (!__pyx_v_status) { + __pyx_t_8 = (!(__pyx_v_host != 0)); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_v_status; + } + if (__pyx_t_9) { + + /* "gevent/ares.pyx":199 + * try: + * if status or not host: + * callback(result(None, gaierror(status, strerror(status)))) # <<<<<<<<<<<<<< + * else: + * try: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_status); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __pyx_f_6gevent_4ares_strerror(__pyx_t_3, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_1 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4ares_result)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L13; + } + /*else*/ { + + /* "gevent/ares.pyx":201 + * callback(result(None, gaierror(status, strerror(status)))) + * else: + * try: # <<<<<<<<<<<<<< + * host_result = ares_host_result(host.h_addrtype, (host.h_name, parse_h_aliases(host), parse_h_addr_list(host))) + * except: + */ + { + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { + + /* "gevent/ares.pyx":202 + * else: + * try: + * host_result = ares_host_result(host.h_addrtype, (host.h_name, parse_h_aliases(host), parse_h_addr_list(host))) # <<<<<<<<<<<<<< + * except: + * callback(result(None, sys.exc_info()[1])) + */ + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__ares_host_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyInt_FromLong(__pyx_v_host->h_addrtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_host->h_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = parse_h_aliases(__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = parse_h_addr_list(__pyx_v_host); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_14 = 0; + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + __pyx_t_3 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __pyx_v_host_result = __pyx_t_15; + __pyx_t_15 = 0; + } + /*else:*/ { + + /* "gevent/ares.pyx":206 + * callback(result(None, sys.exc_info()[1])) + * else: + * callback(result(host_result)) # <<<<<<<<<<<<<< + * except: + * channel.loop.handle_error(callback, *sys.exc_info()) + */ + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_host_result); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_host_result); + __Pyx_GIVEREF(__pyx_v_host_result); + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4ares_result)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L21_try_end; + __pyx_L14_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "gevent/ares.pyx":203 + * try: + * host_result = ares_host_result(host.h_addrtype, (host.h_name, parse_h_aliases(host), parse_h_addr_list(host))) + * except: # <<<<<<<<<<<<<< + * callback(result(None, sys.exc_info()[1])) + * else: + */ + /*except:*/ { + __Pyx_AddTraceback("gevent.ares.gevent_ares_host_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GOTREF(__pyx_t_10); + + /* "gevent/ares.pyx":204 + * host_result = ares_host_result(host.h_addrtype, (host.h_name, parse_h_aliases(host), parse_h_addr_list(host))) + * except: + * callback(result(None, sys.exc_info()[1])) # <<<<<<<<<<<<<< + * else: + * callback(result(host_result)) + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4ares_result)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L15_exception_handled; + } + __pyx_L16_except_error:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L5_error; + __pyx_L15_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + __pyx_L21_try_end:; + } + } + __pyx_L13:; + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "gevent/ares.pyx":207 + * else: + * callback(result(host_result)) + * except: # <<<<<<<<<<<<<< + * channel.loop.handle_error(callback, *sys.exc_info()) + * + */ + /*except:*/ { + __Pyx_AddTraceback("gevent.ares.gevent_ares_host_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_15, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GOTREF(__pyx_t_14); + + /* "gevent/ares.pyx":208 + * callback(result(host_result)) + * except: + * channel.loop.handle_error(callback, *sys.exc_info()) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_channel->loop, __pyx_n_s__handle_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_16)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_16)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L6_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L12_try_end:; + } + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_WriteUnraisable("gevent.ares.gevent_ares_host_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_channel); + __Pyx_XDECREF(__pyx_v_callback); + __Pyx_XDECREF(__pyx_v_host_result); + __Pyx_RefNannyFinishContext(); +} + +/* "gevent/ares.pyx":211 + * + * + * cdef void gevent_ares_nameinfo_callback(void *arg, int status, int timeouts, char *c_node, char *c_service): # <<<<<<<<<<<<<< + * cdef channel channel + * cdef object callback + */ + +static void __pyx_f_6gevent_4ares_gevent_ares_nameinfo_callback(void *__pyx_v_arg, int __pyx_v_status, CYTHON_UNUSED int __pyx_v_timeouts, char *__pyx_v_c_node, char *__pyx_v_c_service) { + struct PyGeventAresChannelObject *__pyx_v_channel = 0; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_node = 0; + PyObject *__pyx_v_service = 0; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gevent_ares_nameinfo_callback", 0); + + /* "gevent/ares.pyx":214 + * cdef channel channel + * cdef object callback + * channel, callback = arg # <<<<<<<<<<<<<< + * Py_DECREF(arg) + * cdef object node + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_arg)))) { + PyObject* sequence = ((PyObject *)__pyx_v_arg); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_arg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L4_unpacking_done:; + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_4ares_channel))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_channel = ((struct PyGeventAresChannelObject *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_v_callback = __pyx_t_2; + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":215 + * cdef object callback + * channel, callback = arg + * Py_DECREF(arg) # <<<<<<<<<<<<<< + * cdef object node + * cdef object service + */ + Py_DECREF(((PyObject*)__pyx_v_arg)); + + /* "gevent/ares.pyx":218 + * cdef object node + * cdef object service + * try: # <<<<<<<<<<<<<< + * if status: + * callback(result(None, gaierror(status, strerror(status)))) + */ + { + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + + /* "gevent/ares.pyx":219 + * cdef object service + * try: + * if status: # <<<<<<<<<<<<<< + * callback(result(None, gaierror(status, strerror(status)))) + * else: + */ + if (__pyx_v_status) { + + /* "gevent/ares.pyx":220 + * try: + * if status: + * callback(result(None, gaierror(status, strerror(status)))) # <<<<<<<<<<<<<< + * else: + * if c_node: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_status); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __pyx_f_6gevent_4ares_strerror(__pyx_t_3, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4ares_result)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L13; + } + /*else*/ { + + /* "gevent/ares.pyx":222 + * callback(result(None, gaierror(status, strerror(status)))) + * else: + * if c_node: # <<<<<<<<<<<<<< + * node = PyBytes_FromString(c_node) + * else: + */ + __pyx_t_9 = (__pyx_v_c_node != 0); + if (__pyx_t_9) { + + /* "gevent/ares.pyx":223 + * else: + * if c_node: + * node = PyBytes_FromString(c_node) # <<<<<<<<<<<<<< + * else: + * node = None + */ + __pyx_t_8 = PyBytes_FromString(__pyx_v_c_node); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_v_node = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L14; + } + /*else*/ { + + /* "gevent/ares.pyx":225 + * node = PyBytes_FromString(c_node) + * else: + * node = None # <<<<<<<<<<<<<< + * if c_service: + * service = PyBytes_FromString(c_service) + */ + __Pyx_INCREF(Py_None); + __pyx_v_node = Py_None; + } + __pyx_L14:; + + /* "gevent/ares.pyx":226 + * else: + * node = None + * if c_service: # <<<<<<<<<<<<<< + * service = PyBytes_FromString(c_service) + * else: + */ + __pyx_t_9 = (__pyx_v_c_service != 0); + if (__pyx_t_9) { + + /* "gevent/ares.pyx":227 + * node = None + * if c_service: + * service = PyBytes_FromString(c_service) # <<<<<<<<<<<<<< + * else: + * service = None + */ + __pyx_t_8 = PyBytes_FromString(__pyx_v_c_service); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_v_service = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L15; + } + /*else*/ { + + /* "gevent/ares.pyx":229 + * service = PyBytes_FromString(c_service) + * else: + * service = None # <<<<<<<<<<<<<< + * callback(result((node, service))) + * except: + */ + __Pyx_INCREF(Py_None); + __pyx_v_service = Py_None; + } + __pyx_L15:; + + /* "gevent/ares.pyx":230 + * else: + * service = None + * callback(result((node, service))) # <<<<<<<<<<<<<< + * except: + * channel.loop.handle_error(callback, *sys.exc_info()) + */ + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_node); + __Pyx_GIVEREF(__pyx_v_node); + __Pyx_INCREF(__pyx_v_service); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_service); + __Pyx_GIVEREF(__pyx_v_service); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4ares_result)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_v_callback, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_L13:; + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "gevent/ares.pyx":231 + * service = None + * callback(result((node, service))) + * except: # <<<<<<<<<<<<<< + * channel.loop.handle_error(callback, *sys.exc_info()) + * + */ + /*except:*/ { + __Pyx_AddTraceback("gevent.ares.gevent_ares_nameinfo_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + + /* "gevent/ares.pyx":232 + * callback(result((node, service))) + * except: + * channel.loop.handle_error(callback, *sys.exc_info()) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_channel->loop, __pyx_n_s__handle_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PySequence_Tuple(__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_Add(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L6_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L12_try_end:; + } + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_WriteUnraisable("gevent.ares.gevent_ares_nameinfo_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_channel); + __Pyx_XDECREF(__pyx_v_callback); + __Pyx_XDECREF(__pyx_v_node); + __Pyx_XDECREF(__pyx_v_service); + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_loop = 0; + PyObject *__pyx_v_flags = 0; + PyObject *__pyx_v_timeout = 0; + PyObject *__pyx_v_tries = 0; + PyObject *__pyx_v_ndots = 0; + PyObject *__pyx_v_udp_port = 0; + PyObject *__pyx_v_tcp_port = 0; + PyObject *__pyx_v_servers = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__flags,&__pyx_n_s__timeout,&__pyx_n_s__tries,&__pyx_n_s__ndots,&__pyx_n_s__udp_port,&__pyx_n_s__tcp_port,&__pyx_n_s__servers,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + + /* "gevent/ares.pyx":242 + * cdef public object _timer + * + * def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, # <<<<<<<<<<<<<< + * udp_port=None, tcp_port=None, servers=None): + * cdef ares_channeldata* channel = NULL + */ + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + + /* "gevent/ares.pyx":243 + * + * def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, + * udp_port=None, tcp_port=None, servers=None): # <<<<<<<<<<<<<< + * cdef ares_channeldata* channel = NULL + * cdef cares.ares_options options + */ + values[5] = ((PyObject *)Py_None); + values[6] = ((PyObject *)Py_None); + values[7] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tries); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ndots); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__udp_port); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tcp_port); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__servers); + if (value) { values[7] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = values[0]; + __pyx_v_flags = values[1]; + __pyx_v_timeout = values[2]; + __pyx_v_tries = values[3]; + __pyx_v_ndots = values[4]; + __pyx_v_udp_port = values[5]; + __pyx_v_tcp_port = values[6]; + __pyx_v_servers = values[7]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_7channel___init__(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_flags, __pyx_v_timeout, __pyx_v_tries, __pyx_v_ndots, __pyx_v_udp_port, __pyx_v_tcp_port, __pyx_v_servers); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":242 + * cdef public object _timer + * + * def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, # <<<<<<<<<<<<<< + * udp_port=None, tcp_port=None, servers=None): + * cdef ares_channeldata* channel = NULL + */ + +static int __pyx_pf_6gevent_4ares_7channel___init__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_loop, PyObject *__pyx_v_flags, PyObject *__pyx_v_timeout, PyObject *__pyx_v_tries, PyObject *__pyx_v_ndots, PyObject *__pyx_v_udp_port, PyObject *__pyx_v_tcp_port, PyObject *__pyx_v_servers) { + struct ares_channeldata *__pyx_v_channel; + struct ares_options __pyx_v_options; + int __pyx_v_optmask; + int __pyx_v_result; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + double __pyx_t_5; + unsigned short __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "gevent/ares.pyx":244 + * def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, + * udp_port=None, tcp_port=None, servers=None): + * cdef ares_channeldata* channel = NULL # <<<<<<<<<<<<<< + * cdef cares.ares_options options + * memset(&options, 0, sizeof(cares.ares_options)) + */ + __pyx_v_channel = NULL; + + /* "gevent/ares.pyx":246 + * cdef ares_channeldata* channel = NULL + * cdef cares.ares_options options + * memset(&options, 0, sizeof(cares.ares_options)) # <<<<<<<<<<<<<< + * cdef int optmask = cares.ARES_OPT_SOCK_STATE_CB + * options.sock_state_cb = gevent_sock_state_callback + */ + memset((&__pyx_v_options), 0, (sizeof(struct ares_options))); + + /* "gevent/ares.pyx":247 + * cdef cares.ares_options options + * memset(&options, 0, sizeof(cares.ares_options)) + * cdef int optmask = cares.ARES_OPT_SOCK_STATE_CB # <<<<<<<<<<<<<< + * options.sock_state_cb = gevent_sock_state_callback + * options.sock_state_cb_data = self + */ + __pyx_v_optmask = ARES_OPT_SOCK_STATE_CB; + + /* "gevent/ares.pyx":248 + * memset(&options, 0, sizeof(cares.ares_options)) + * cdef int optmask = cares.ARES_OPT_SOCK_STATE_CB + * options.sock_state_cb = gevent_sock_state_callback # <<<<<<<<<<<<<< + * options.sock_state_cb_data = self + * if flags is not None: + */ + __pyx_v_options.sock_state_cb = ((void *)__pyx_f_6gevent_4ares_gevent_sock_state_callback); + + /* "gevent/ares.pyx":249 + * cdef int optmask = cares.ARES_OPT_SOCK_STATE_CB + * options.sock_state_cb = gevent_sock_state_callback + * options.sock_state_cb_data = self # <<<<<<<<<<<<<< + * if flags is not None: + * options.flags = int(flags) + */ + __pyx_v_options.sock_state_cb_data = ((void *)__pyx_v_self); + + /* "gevent/ares.pyx":250 + * options.sock_state_cb = gevent_sock_state_callback + * options.sock_state_cb_data = self + * if flags is not None: # <<<<<<<<<<<<<< + * options.flags = int(flags) + * optmask |= cares.ARES_OPT_FLAGS + */ + __pyx_t_1 = (__pyx_v_flags != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":251 + * options.sock_state_cb_data = self + * if flags is not None: + * options.flags = int(flags) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_FLAGS + * if timeout is not None: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_flags); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_flags); + __Pyx_GIVEREF(__pyx_v_flags); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_options.flags = __pyx_t_4; + + /* "gevent/ares.pyx":252 + * if flags is not None: + * options.flags = int(flags) + * optmask |= cares.ARES_OPT_FLAGS # <<<<<<<<<<<<<< + * if timeout is not None: + * options.timeout = int(float(timeout) * 1000) + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_FLAGS); + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":253 + * options.flags = int(flags) + * optmask |= cares.ARES_OPT_FLAGS + * if timeout is not None: # <<<<<<<<<<<<<< + * options.timeout = int(float(timeout) * 1000) + * optmask |= cares.ARES_OPT_TIMEOUTMS + */ + __pyx_t_1 = (__pyx_v_timeout != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":254 + * optmask |= cares.ARES_OPT_FLAGS + * if timeout is not None: + * options.timeout = int(float(timeout) * 1000) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_TIMEOUTMS + * if tries is not None: + */ + __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_timeout); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_options.timeout = ((int)(__pyx_t_5 * 1000.0)); + + /* "gevent/ares.pyx":255 + * if timeout is not None: + * options.timeout = int(float(timeout) * 1000) + * optmask |= cares.ARES_OPT_TIMEOUTMS # <<<<<<<<<<<<<< + * if tries is not None: + * options.tries = int(tries) + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_TIMEOUTMS); + goto __pyx_L4; + } + __pyx_L4:; + + /* "gevent/ares.pyx":256 + * options.timeout = int(float(timeout) * 1000) + * optmask |= cares.ARES_OPT_TIMEOUTMS + * if tries is not None: # <<<<<<<<<<<<<< + * options.tries = int(tries) + * optmask |= cares.ARES_OPT_TRIES + */ + __pyx_t_1 = (__pyx_v_tries != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":257 + * optmask |= cares.ARES_OPT_TIMEOUTMS + * if tries is not None: + * options.tries = int(tries) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_TRIES + * if ndots is not None: + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_tries); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tries); + __Pyx_GIVEREF(__pyx_v_tries); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_options.tries = __pyx_t_4; + + /* "gevent/ares.pyx":258 + * if tries is not None: + * options.tries = int(tries) + * optmask |= cares.ARES_OPT_TRIES # <<<<<<<<<<<<<< + * if ndots is not None: + * options.ndots = int(ndots) + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_TRIES); + goto __pyx_L5; + } + __pyx_L5:; + + /* "gevent/ares.pyx":259 + * options.tries = int(tries) + * optmask |= cares.ARES_OPT_TRIES + * if ndots is not None: # <<<<<<<<<<<<<< + * options.ndots = int(ndots) + * optmask |= cares.ARES_OPT_NDOTS + */ + __pyx_t_1 = (__pyx_v_ndots != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":260 + * optmask |= cares.ARES_OPT_TRIES + * if ndots is not None: + * options.ndots = int(ndots) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_NDOTS + * if udp_port is not None: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ndots); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ndots); + __Pyx_GIVEREF(__pyx_v_ndots); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_options.ndots = __pyx_t_4; + + /* "gevent/ares.pyx":261 + * if ndots is not None: + * options.ndots = int(ndots) + * optmask |= cares.ARES_OPT_NDOTS # <<<<<<<<<<<<<< + * if udp_port is not None: + * options.udp_port = int(udp_port) + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_NDOTS); + goto __pyx_L6; + } + __pyx_L6:; + + /* "gevent/ares.pyx":262 + * options.ndots = int(ndots) + * optmask |= cares.ARES_OPT_NDOTS + * if udp_port is not None: # <<<<<<<<<<<<<< + * options.udp_port = int(udp_port) + * optmask |= cares.ARES_OPT_UDP_PORT + */ + __pyx_t_1 = (__pyx_v_udp_port != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":263 + * optmask |= cares.ARES_OPT_NDOTS + * if udp_port is not None: + * options.udp_port = int(udp_port) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_UDP_PORT + * if tcp_port is not None: + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_udp_port); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_udp_port); + __Pyx_GIVEREF(__pyx_v_udp_port); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_options.udp_port = __pyx_t_6; + + /* "gevent/ares.pyx":264 + * if udp_port is not None: + * options.udp_port = int(udp_port) + * optmask |= cares.ARES_OPT_UDP_PORT # <<<<<<<<<<<<<< + * if tcp_port is not None: + * options.tcp_port = int(tcp_port) + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_UDP_PORT); + goto __pyx_L7; + } + __pyx_L7:; + + /* "gevent/ares.pyx":265 + * options.udp_port = int(udp_port) + * optmask |= cares.ARES_OPT_UDP_PORT + * if tcp_port is not None: # <<<<<<<<<<<<<< + * options.tcp_port = int(tcp_port) + * optmask |= cares.ARES_OPT_TCP_PORT + */ + __pyx_t_1 = (__pyx_v_tcp_port != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":266 + * optmask |= cares.ARES_OPT_UDP_PORT + * if tcp_port is not None: + * options.tcp_port = int(tcp_port) # <<<<<<<<<<<<<< + * optmask |= cares.ARES_OPT_TCP_PORT + * cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_tcp_port); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tcp_port); + __Pyx_GIVEREF(__pyx_v_tcp_port); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_options.tcp_port = __pyx_t_6; + + /* "gevent/ares.pyx":267 + * if tcp_port is not None: + * options.tcp_port = int(tcp_port) + * optmask |= cares.ARES_OPT_TCP_PORT # <<<<<<<<<<<<<< + * cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? + * if result: + */ + __pyx_v_optmask = (__pyx_v_optmask | ARES_OPT_TCP_PORT); + goto __pyx_L8; + } + __pyx_L8:; + + /* "gevent/ares.pyx":268 + * options.tcp_port = int(tcp_port) + * optmask |= cares.ARES_OPT_TCP_PORT + * cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? # <<<<<<<<<<<<<< + * if result: + * raise gaierror(result, strerror(result)) + */ + __pyx_v_result = ares_library_init(ARES_LIB_INIT_ALL); + + /* "gevent/ares.pyx":269 + * optmask |= cares.ARES_OPT_TCP_PORT + * cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? + * if result: # <<<<<<<<<<<<<< + * raise gaierror(result, strerror(result)) + * result = cares.ares_init_options(&channel, &options, optmask) + */ + if (__pyx_v_result) { + + /* "gevent/ares.pyx":270 + * cdef int result = cares.ares_library_init(cares.ARES_LIB_INIT_ALL) # ARES_LIB_INIT_WIN32 -DUSE_WINSOCK? + * if result: + * raise gaierror(result, strerror(result)) # <<<<<<<<<<<<<< + * result = cares.ares_init_options(&channel, &options, optmask) + * if result: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_f_6gevent_4ares_strerror(__pyx_t_7, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_2 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "gevent/ares.pyx":271 + * if result: + * raise gaierror(result, strerror(result)) + * result = cares.ares_init_options(&channel, &options, optmask) # <<<<<<<<<<<<<< + * if result: + * raise gaierror(result, strerror(result)) + */ + __pyx_v_result = ares_init_options((&__pyx_v_channel), (&__pyx_v_options), __pyx_v_optmask); + + /* "gevent/ares.pyx":272 + * raise gaierror(result, strerror(result)) + * result = cares.ares_init_options(&channel, &options, optmask) + * if result: # <<<<<<<<<<<<<< + * raise gaierror(result, strerror(result)) + * self._timer = loop.timer(TIMEOUT, TIMEOUT) + */ + if (__pyx_v_result) { + + /* "gevent/ares.pyx":273 + * result = cares.ares_init_options(&channel, &options, optmask) + * if result: + * raise gaierror(result, strerror(result)) # <<<<<<<<<<<<<< + * self._timer = loop.timer(TIMEOUT, TIMEOUT) + * self._watchers = {} + */ + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_f_6gevent_4ares_strerror(__pyx_t_3, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_7 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "gevent/ares.pyx":274 + * if result: + * raise gaierror(result, strerror(result)) + * self._timer = loop.timer(TIMEOUT, TIMEOUT) # <<<<<<<<<<<<<< + * self._watchers = {} + * self.channel = channel + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s__timer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__TIMEOUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__TIMEOUT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_v_self->_timer); + __Pyx_DECREF(__pyx_v_self->_timer); + __pyx_v_self->_timer = __pyx_t_8; + __pyx_t_8 = 0; + + /* "gevent/ares.pyx":275 + * raise gaierror(result, strerror(result)) + * self._timer = loop.timer(TIMEOUT, TIMEOUT) + * self._watchers = {} # <<<<<<<<<<<<<< + * self.channel = channel + * try: + */ + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __Pyx_GOTREF(__pyx_v_self->_watchers); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_watchers)); + __pyx_v_self->_watchers = ((PyObject*)__pyx_t_8); + __pyx_t_8 = 0; + + /* "gevent/ares.pyx":276 + * self._timer = loop.timer(TIMEOUT, TIMEOUT) + * self._watchers = {} + * self.channel = channel # <<<<<<<<<<<<<< + * try: + * if servers is not None: + */ + __pyx_v_self->channel = __pyx_v_channel; + + /* "gevent/ares.pyx":277 + * self._watchers = {} + * self.channel = channel + * try: # <<<<<<<<<<<<<< + * if servers is not None: + * self.set_servers(servers) + */ + { + __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + /*try:*/ { + + /* "gevent/ares.pyx":278 + * self.channel = channel + * try: + * if servers is not None: # <<<<<<<<<<<<<< + * self.set_servers(servers) + * self.loop = loop + */ + __pyx_t_1 = (__pyx_v_servers != Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":279 + * try: + * if servers is not None: + * self.set_servers(servers) # <<<<<<<<<<<<<< + * self.loop = loop + * except: + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_servers); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L11_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L11_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_servers); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_servers); + __Pyx_GIVEREF(__pyx_v_servers); + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L11_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L19; + } + __pyx_L19:; + + /* "gevent/ares.pyx":280 + * if servers is not None: + * self.set_servers(servers) + * self.loop = loop # <<<<<<<<<<<<<< + * except: + * self.destroy() + */ + __Pyx_INCREF(__pyx_v_loop); + __Pyx_GIVEREF(__pyx_v_loop); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(__pyx_v_self->loop); + __pyx_v_self->loop = __pyx_v_loop; + } + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L18_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":281 + * self.set_servers(servers) + * self.loop = loop + * except: # <<<<<<<<<<<<<< + * self.destroy() + * raise + */ + /*except:*/ { + __Pyx_AddTraceback("gevent.ares.channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "gevent/ares.pyx":282 + * self.loop = loop + * except: + * self.destroy() # <<<<<<<<<<<<<< + * raise + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__destroy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "gevent/ares.pyx":283 + * except: + * self.destroy() + * raise # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_7, __pyx_t_8); + __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L12_exception_handled; + } + __pyx_L13_except_error:; + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + goto __pyx_L1_error; + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_L18_try_end:; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("gevent.ares.channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_3__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_3__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_2__repr__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":285 + * raise + * + * def __repr__(self): # <<<<<<<<<<<<<< + * args = (self.__class__.__name__, id(self), self._timer, len(self._watchers)) + * return '<%s at 0x%x _timer=%r _watchers[%s]>' % args + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_2__repr__(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_v_args = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "gevent/ares.pyx":286 + * + * def __repr__(self): + * args = (self.__class__.__name__, id(self), self._timer, len(self._watchers)) # <<<<<<<<<<<<<< + * return '<%s at 0x%x _timer=%r _watchers[%s]>' % args + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = ((PyObject *)__pyx_v_self->_watchers); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyDict_Size(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_self->_timer); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->_timer); + __Pyx_GIVEREF(__pyx_v_self->_timer); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_v_args = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "gevent/ares.pyx":287 + * def __repr__(self): + * args = (self.__class__.__name__, id(self), self._timer, len(self._watchers)) + * return '<%s at 0x%x _timer=%r _watchers[%s]>' % args # <<<<<<<<<<<<<< + * + * def destroy(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.ares.channel.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_5destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_5destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("destroy (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_4destroy(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":289 + * return '<%s at 0x%x _timer=%r _watchers[%s]>' % args + * + * def destroy(self): # <<<<<<<<<<<<<< + * if self.channel: + * # XXX ares_library_cleanup? + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_4destroy(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("destroy", 0); + + /* "gevent/ares.pyx":290 + * + * def destroy(self): + * if self.channel: # <<<<<<<<<<<<<< + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) + */ + __pyx_t_1 = (__pyx_v_self->channel != 0); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":292 + * if self.channel: + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) # <<<<<<<<<<<<<< + * self.channel = NULL + * self._watchers.clear() + */ + ares_destroy(__pyx_v_self->channel); + + /* "gevent/ares.pyx":293 + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) + * self.channel = NULL # <<<<<<<<<<<<<< + * self._watchers.clear() + * self._timer.stop() + */ + __pyx_v_self->channel = NULL; + + /* "gevent/ares.pyx":294 + * cares.ares_destroy(self.channel) + * self.channel = NULL + * self._watchers.clear() # <<<<<<<<<<<<<< + * self._timer.stop() + * self.loop = None + */ + if (unlikely(((PyObject *)__pyx_v_self->_watchers) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyDict_Clear(__pyx_v_self->_watchers); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":295 + * self.channel = NULL + * self._watchers.clear() + * self._timer.stop() # <<<<<<<<<<<<<< + * self.loop = None + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_timer, __pyx_n_s__stop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "gevent/ares.pyx":296 + * self._watchers.clear() + * self._timer.stop() + * self.loop = None # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(__pyx_v_self->loop); + __pyx_v_self->loop = Py_None; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.ares.channel.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_6gevent_4ares_7channel_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6gevent_4ares_7channel_7__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6gevent_4ares_7channel_6__dealloc__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "gevent/ares.pyx":298 + * self.loop = None + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.channel: + * # XXX ares_library_cleanup? + */ + +static void __pyx_pf_6gevent_4ares_7channel_6__dealloc__(struct PyGeventAresChannelObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "gevent/ares.pyx":299 + * + * def __dealloc__(self): + * if self.channel: # <<<<<<<<<<<<<< + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) + */ + __pyx_t_1 = (__pyx_v_self->channel != 0); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":301 + * if self.channel: + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) # <<<<<<<<<<<<<< + * self.channel = NULL + * + */ + ares_destroy(__pyx_v_self->channel); + + /* "gevent/ares.pyx":302 + * # XXX ares_library_cleanup? + * cares.ares_destroy(self.channel) + * self.channel = NULL # <<<<<<<<<<<<<< + * + * def set_servers(self, servers=None): + */ + __pyx_v_self->channel = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_9set_servers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_9set_servers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_servers = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_servers (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__servers,0}; + PyObject* values[1] = {0}; + + /* "gevent/ares.pyx":304 + * self.channel = NULL + * + * def set_servers(self, servers=None): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__servers); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_servers") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_servers = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_servers", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel.set_servers", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_7channel_8set_servers(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_servers); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4ares_7channel_8set_servers(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_servers) { + int __pyx_v_length; + CYTHON_UNUSED int __pyx_v_result; + int __pyx_v_index; + char *__pyx_v_string; + struct ares_addr_node *__pyx_v_c_servers; + PyObject *__pyx_v_server = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + char *__pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_servers", 0); + __Pyx_INCREF(__pyx_v_servers); + + /* "gevent/ares.pyx":305 + * + * def set_servers(self, servers=None): + * if not self.channel: # <<<<<<<<<<<<<< + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * if not servers: + */ + __pyx_t_1 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":306 + * def set_servers(self, servers=None): + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') # <<<<<<<<<<<<<< + * if not servers: + * servers = [] + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":307 + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * if not servers: # <<<<<<<<<<<<<< + * servers = [] + * if isinstance(servers, basestring): + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_servers); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_1); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":308 + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * if not servers: + * servers = [] # <<<<<<<<<<<<<< + * if isinstance(servers, basestring): + * servers = servers.split(',') + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_servers); + __pyx_v_servers = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "gevent/ares.pyx":309 + * if not servers: + * servers = [] + * if isinstance(servers, basestring): # <<<<<<<<<<<<<< + * servers = servers.split(',') + * cdef int length = len(servers) + */ + __pyx_t_5 = __Pyx_PyBaseString_Check(__pyx_v_servers); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":310 + * servers = [] + * if isinstance(servers, basestring): + * servers = servers.split(',') # <<<<<<<<<<<<<< + * cdef int length = len(servers) + * cdef int result, index + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_servers, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_servers); + __pyx_v_servers = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "gevent/ares.pyx":311 + * if isinstance(servers, basestring): + * servers = servers.split(',') + * cdef int length = len(servers) # <<<<<<<<<<<<<< + * cdef int result, index + * cdef char* string + */ + __pyx_t_6 = PyObject_Length(__pyx_v_servers); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_length = __pyx_t_6; + + /* "gevent/ares.pyx":315 + * cdef char* string + * cdef cares.ares_addr_node* c_servers + * if length <= 0: # <<<<<<<<<<<<<< + * result = cares.ares_set_servers(self.channel, NULL) + * else: + */ + __pyx_t_5 = (__pyx_v_length <= 0); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":316 + * cdef cares.ares_addr_node* c_servers + * if length <= 0: + * result = cares.ares_set_servers(self.channel, NULL) # <<<<<<<<<<<<<< + * else: + * c_servers = malloc(sizeof(cares.ares_addr_node) * length) + */ + __pyx_v_result = ares_set_servers(__pyx_v_self->channel, NULL); + goto __pyx_L6; + } + /*else*/ { + + /* "gevent/ares.pyx":318 + * result = cares.ares_set_servers(self.channel, NULL) + * else: + * c_servers = malloc(sizeof(cares.ares_addr_node) * length) # <<<<<<<<<<<<<< + * if not c_servers: + * raise MemoryError + */ + __pyx_v_c_servers = ((struct ares_addr_node *)malloc(((sizeof(struct ares_addr_node)) * __pyx_v_length))); + + /* "gevent/ares.pyx":319 + * else: + * c_servers = malloc(sizeof(cares.ares_addr_node) * length) + * if not c_servers: # <<<<<<<<<<<<<< + * raise MemoryError + * try: + */ + __pyx_t_5 = (!(__pyx_v_c_servers != 0)); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":320 + * c_servers = malloc(sizeof(cares.ares_addr_node) * length) + * if not c_servers: + * raise MemoryError # <<<<<<<<<<<<<< + * try: + * index = 0 + */ + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "gevent/ares.pyx":321 + * if not c_servers: + * raise MemoryError + * try: # <<<<<<<<<<<<<< + * index = 0 + * for server in servers: + */ + /*try:*/ { + + /* "gevent/ares.pyx":322 + * raise MemoryError + * try: + * index = 0 # <<<<<<<<<<<<<< + * for server in servers: + * string = server + */ + __pyx_v_index = 0; + + /* "gevent/ares.pyx":323 + * try: + * index = 0 + * for server in servers: # <<<<<<<<<<<<<< + * string = server + * if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: + */ + if (PyList_CheckExact(__pyx_v_servers) || PyTuple_CheckExact(__pyx_v_servers)) { + __pyx_t_4 = __pyx_v_servers; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_servers); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + #endif + } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + #endif + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L9;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_server); + __pyx_v_server = __pyx_t_3; + __pyx_t_3 = 0; + + /* "gevent/ares.pyx":324 + * index = 0 + * for server in servers: + * string = server # <<<<<<<<<<<<<< + * if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: + * c_servers[index].family = AF_INET + */ + __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_server); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L9;} + __pyx_v_string = ((char *)__pyx_t_8); + + /* "gevent/ares.pyx":325 + * for server in servers: + * string = server + * if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: # <<<<<<<<<<<<<< + * c_servers[index].family = AF_INET + * elif cares.ares_inet_pton(AF_INET6, string, &c_servers[index].addr) > 0: + */ + __pyx_t_5 = (ares_inet_pton(AF_INET, __pyx_v_string, (&(__pyx_v_c_servers[__pyx_v_index]).addr)) > 0); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":326 + * string = server + * if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: + * c_servers[index].family = AF_INET # <<<<<<<<<<<<<< + * elif cares.ares_inet_pton(AF_INET6, string, &c_servers[index].addr) > 0: + * c_servers[index].family = AF_INET6 + */ + (__pyx_v_c_servers[__pyx_v_index]).family = AF_INET; + goto __pyx_L13; + } + + /* "gevent/ares.pyx":327 + * if cares.ares_inet_pton(AF_INET, string, &c_servers[index].addr) > 0: + * c_servers[index].family = AF_INET + * elif cares.ares_inet_pton(AF_INET6, string, &c_servers[index].addr) > 0: # <<<<<<<<<<<<<< + * c_servers[index].family = AF_INET6 + * else: + */ + __pyx_t_5 = (ares_inet_pton(AF_INET6, __pyx_v_string, (&(__pyx_v_c_servers[__pyx_v_index]).addr)) > 0); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":328 + * c_servers[index].family = AF_INET + * elif cares.ares_inet_pton(AF_INET6, string, &c_servers[index].addr) > 0: + * c_servers[index].family = AF_INET6 # <<<<<<<<<<<<<< + * else: + * raise InvalidIP(repr(string)) + */ + (__pyx_v_c_servers[__pyx_v_index]).family = AF_INET6; + goto __pyx_L13; + } + /*else*/ { + + /* "gevent/ares.pyx":330 + * c_servers[index].family = AF_INET6 + * else: + * raise InvalidIP(repr(string)) # <<<<<<<<<<<<<< + * c_servers[index].next = &c_servers[index] + 1 + * index += 1 + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__InvalidIP); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_9 = PyObject_Repr(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L9;} + } + __pyx_L13:; + + /* "gevent/ares.pyx":331 + * else: + * raise InvalidIP(repr(string)) + * c_servers[index].next = &c_servers[index] + 1 # <<<<<<<<<<<<<< + * index += 1 + * if index >= length: + */ + (__pyx_v_c_servers[__pyx_v_index]).next = ((&(__pyx_v_c_servers[__pyx_v_index])) + 1); + + /* "gevent/ares.pyx":332 + * raise InvalidIP(repr(string)) + * c_servers[index].next = &c_servers[index] + 1 + * index += 1 # <<<<<<<<<<<<<< + * if index >= length: + * break + */ + __pyx_v_index = (__pyx_v_index + 1); + + /* "gevent/ares.pyx":333 + * c_servers[index].next = &c_servers[index] + 1 + * index += 1 + * if index >= length: # <<<<<<<<<<<<<< + * break + * c_servers[length - 1].next = NULL + */ + __pyx_t_5 = (__pyx_v_index >= __pyx_v_length); + if (__pyx_t_5) { + + /* "gevent/ares.pyx":334 + * index += 1 + * if index >= length: + * break # <<<<<<<<<<<<<< + * c_servers[length - 1].next = NULL + * index = cares.ares_set_servers(self.channel, c_servers) + */ + goto __pyx_L12_break; + goto __pyx_L14; + } + __pyx_L14:; + } + __pyx_L12_break:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "gevent/ares.pyx":335 + * if index >= length: + * break + * c_servers[length - 1].next = NULL # <<<<<<<<<<<<<< + * index = cares.ares_set_servers(self.channel, c_servers) + * if index: + */ + (__pyx_v_c_servers[(__pyx_v_length - 1)]).next = NULL; + + /* "gevent/ares.pyx":336 + * break + * c_servers[length - 1].next = NULL + * index = cares.ares_set_servers(self.channel, c_servers) # <<<<<<<<<<<<<< + * if index: + * raise ValueError(strerror(index)) + */ + __pyx_v_index = ares_set_servers(__pyx_v_self->channel, __pyx_v_c_servers); + + /* "gevent/ares.pyx":337 + * c_servers[length - 1].next = NULL + * index = cares.ares_set_servers(self.channel, c_servers) + * if index: # <<<<<<<<<<<<<< + * raise ValueError(strerror(index)) + * finally: + */ + if (__pyx_v_index) { + + /* "gevent/ares.pyx":338 + * index = cares.ares_set_servers(self.channel, c_servers) + * if index: + * raise ValueError(strerror(index)) # <<<<<<<<<<<<<< + * finally: + * free(c_servers) + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __pyx_f_6gevent_4ares_strerror(__pyx_t_4, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L9;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L9;} + goto __pyx_L15; + } + __pyx_L15:; + } + + /* "gevent/ares.pyx":340 + * raise ValueError(strerror(index)) + * finally: + * free(c_servers) # <<<<<<<<<<<<<< + * + * # this crashes c-ares + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L10; + __pyx_L9: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L10; + } + __pyx_L10:; + free(__pyx_v_c_servers); + switch (__pyx_why) { + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("gevent.ares.channel.set_servers", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_server); + __Pyx_XDECREF(__pyx_v_servers); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":346 + * # cares.ares_cancel(self.channel) + * + * cdef _sock_state_callback(self, int socket, int read, int write): # <<<<<<<<<<<<<< + * if not self.channel: + * return + */ + +static PyObject *__pyx_f_6gevent_4ares_7channel__sock_state_callback(struct PyGeventAresChannelObject *__pyx_v_self, int __pyx_v_socket, int __pyx_v_read, int __pyx_v_write) { + PyObject *__pyx_v_watcher = 0; + int __pyx_v_events; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_sock_state_callback", 0); + + /* "gevent/ares.pyx":347 + * + * cdef _sock_state_callback(self, int socket, int read, int write): + * if not self.channel: # <<<<<<<<<<<<<< + * return + * cdef object watcher = self._watchers.get(socket) + */ + __pyx_t_1 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":348 + * cdef _sock_state_callback(self, int socket, int read, int write): + * if not self.channel: + * return # <<<<<<<<<<<<<< + * cdef object watcher = self._watchers.get(socket) + * cdef int events = 0 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":349 + * if not self.channel: + * return + * cdef object watcher = self._watchers.get(socket) # <<<<<<<<<<<<<< + * cdef int events = 0 + * if read: + */ + if (unlikely(((PyObject *)__pyx_v_self->_watchers) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyInt_FromLong(__pyx_v_socket); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_self->_watchers), __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_watcher = __pyx_t_3; + __pyx_t_3 = 0; + + /* "gevent/ares.pyx":350 + * return + * cdef object watcher = self._watchers.get(socket) + * cdef int events = 0 # <<<<<<<<<<<<<< + * if read: + * events |= EV_READ + */ + __pyx_v_events = 0; + + /* "gevent/ares.pyx":351 + * cdef object watcher = self._watchers.get(socket) + * cdef int events = 0 + * if read: # <<<<<<<<<<<<<< + * events |= EV_READ + * if write: + */ + if (__pyx_v_read) { + + /* "gevent/ares.pyx":352 + * cdef int events = 0 + * if read: + * events |= EV_READ # <<<<<<<<<<<<<< + * if write: + * events |= EV_WRITE + */ + __pyx_v_events = (__pyx_v_events | 1); + goto __pyx_L4; + } + __pyx_L4:; + + /* "gevent/ares.pyx":353 + * if read: + * events |= EV_READ + * if write: # <<<<<<<<<<<<<< + * events |= EV_WRITE + * if watcher is None: + */ + if (__pyx_v_write) { + + /* "gevent/ares.pyx":354 + * events |= EV_READ + * if write: + * events |= EV_WRITE # <<<<<<<<<<<<<< + * if watcher is None: + * if not events: + */ + __pyx_v_events = (__pyx_v_events | 2); + goto __pyx_L5; + } + __pyx_L5:; + + /* "gevent/ares.pyx":355 + * if write: + * events |= EV_WRITE + * if watcher is None: # <<<<<<<<<<<<<< + * if not events: + * return + */ + __pyx_t_1 = (__pyx_v_watcher == Py_None); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":356 + * events |= EV_WRITE + * if watcher is None: + * if not events: # <<<<<<<<<<<<<< + * return + * watcher = self.loop.io(socket, events) + */ + __pyx_t_1 = (!__pyx_v_events); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":357 + * if watcher is None: + * if not events: + * return # <<<<<<<<<<<<<< + * watcher = self.loop.io(socket, events) + * self._watchers[socket] = watcher + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "gevent/ares.pyx":358 + * if not events: + * return + * watcher = self.loop.io(socket, events) # <<<<<<<<<<<<<< + * self._watchers[socket] = watcher + * elif events: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->loop, __pyx_n_s__io); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_v_socket); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_watcher); + __pyx_v_watcher = __pyx_t_4; + __pyx_t_4 = 0; + + /* "gevent/ares.pyx":359 + * return + * watcher = self.loop.io(socket, events) + * self._watchers[socket] = watcher # <<<<<<<<<<<<<< + * elif events: + * if watcher.events == events: + */ + if (unlikely(((PyObject *)__pyx_v_self->_watchers) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->_watchers), __pyx_v_socket, __pyx_v_watcher, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + + /* "gevent/ares.pyx":360 + * watcher = self.loop.io(socket, events) + * self._watchers[socket] = watcher + * elif events: # <<<<<<<<<<<<<< + * if watcher.events == events: + * return + */ + if (__pyx_v_events) { + + /* "gevent/ares.pyx":361 + * self._watchers[socket] = watcher + * elif events: + * if watcher.events == events: # <<<<<<<<<<<<<< + * return + * watcher.stop() + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s__events); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "gevent/ares.pyx":362 + * elif events: + * if watcher.events == events: + * return # <<<<<<<<<<<<<< + * watcher.stop() + * watcher.events = events + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "gevent/ares.pyx":363 + * if watcher.events == events: + * return + * watcher.stop() # <<<<<<<<<<<<<< + * watcher.events = events + * else: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s__stop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "gevent/ares.pyx":364 + * return + * watcher.stop() + * watcher.events = events # <<<<<<<<<<<<<< + * else: + * watcher.stop() + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_watcher, __pyx_n_s__events, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "gevent/ares.pyx":366 + * watcher.events = events + * else: + * watcher.stop() # <<<<<<<<<<<<<< + * self._watchers.pop(socket, None) + * if not self._watchers: + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s__stop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gevent/ares.pyx":367 + * else: + * watcher.stop() + * self._watchers.pop(socket, None) # <<<<<<<<<<<<<< + * if not self._watchers: + * self._timer.stop() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_watchers), __pyx_n_s__pop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyInt_FromLong(__pyx_v_socket); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "gevent/ares.pyx":368 + * watcher.stop() + * self._watchers.pop(socket, None) + * if not self._watchers: # <<<<<<<<<<<<<< + * self._timer.stop() + * return + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_watchers)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (!__pyx_t_1); + if (__pyx_t_6) { + + /* "gevent/ares.pyx":369 + * self._watchers.pop(socket, None) + * if not self._watchers: + * self._timer.stop() # <<<<<<<<<<<<<< + * return + * watcher.start(self._process_fd, watcher, pass_events=True) + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_timer, __pyx_n_s__stop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "gevent/ares.pyx":370 + * if not self._watchers: + * self._timer.stop() + * return # <<<<<<<<<<<<<< + * watcher.start(self._process_fd, watcher, pass_events=True) + * self._timer.again(self._on_timer) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + } + __pyx_L6:; + + /* "gevent/ares.pyx":371 + * self._timer.stop() + * return + * watcher.start(self._process_fd, watcher, pass_events=True) # <<<<<<<<<<<<<< + * self._timer.again(self._on_timer) + * + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s__start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___process_fd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_watcher); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_watcher); + __Pyx_GIVEREF(__pyx_v_watcher); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__pass_events), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":372 + * return + * watcher.start(self._process_fd, watcher, pass_events=True) + * self._timer.again(self._on_timer) # <<<<<<<<<<<<<< + * + * def _on_timer(self): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_timer, __pyx_n_s__again); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___on_timer); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.ares.channel._sock_state_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_watcher); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_11_on_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_11_on_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_on_timer (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_10_on_timer(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":374 + * self._timer.again(self._on_timer) + * + * def _on_timer(self): # <<<<<<<<<<<<<< + * cares.ares_process_fd(self.channel, cares.ARES_SOCKET_BAD, cares.ARES_SOCKET_BAD) + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_10_on_timer(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_on_timer", 0); + + /* "gevent/ares.pyx":375 + * + * def _on_timer(self): + * cares.ares_process_fd(self.channel, cares.ARES_SOCKET_BAD, cares.ARES_SOCKET_BAD) # <<<<<<<<<<<<<< + * + * def _process_fd(self, int events, object watcher): + */ + ares_process_fd(__pyx_v_self->channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_13_process_fd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_13_process_fd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_events; + PyObject *__pyx_v_watcher = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_process_fd (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__events,&__pyx_n_s__watcher,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__watcher)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_process_fd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_process_fd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_events = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_watcher = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_process_fd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel._process_fd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_7channel_12_process_fd(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_events, __pyx_v_watcher); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":377 + * cares.ares_process_fd(self.channel, cares.ARES_SOCKET_BAD, cares.ARES_SOCKET_BAD) + * + * def _process_fd(self, int events, object watcher): # <<<<<<<<<<<<<< + * if not self.channel: + * return + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_12_process_fd(struct PyGeventAresChannelObject *__pyx_v_self, int __pyx_v_events, PyObject *__pyx_v_watcher) { + int __pyx_v_read_fd; + int __pyx_v_write_fd; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_process_fd", 0); + + /* "gevent/ares.pyx":378 + * + * def _process_fd(self, int events, object watcher): + * if not self.channel: # <<<<<<<<<<<<<< + * return + * cdef int read_fd = watcher.fd + */ + __pyx_t_1 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":379 + * def _process_fd(self, int events, object watcher): + * if not self.channel: + * return # <<<<<<<<<<<<<< + * cdef int read_fd = watcher.fd + * cdef int write_fd = read_fd + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":380 + * if not self.channel: + * return + * cdef int read_fd = watcher.fd # <<<<<<<<<<<<<< + * cdef int write_fd = read_fd + * if not (events & EV_READ): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s__fd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_read_fd = __pyx_t_3; + + /* "gevent/ares.pyx":381 + * return + * cdef int read_fd = watcher.fd + * cdef int write_fd = read_fd # <<<<<<<<<<<<<< + * if not (events & EV_READ): + * read_fd = cares.ARES_SOCKET_BAD + */ + __pyx_v_write_fd = __pyx_v_read_fd; + + /* "gevent/ares.pyx":382 + * cdef int read_fd = watcher.fd + * cdef int write_fd = read_fd + * if not (events & EV_READ): # <<<<<<<<<<<<<< + * read_fd = cares.ARES_SOCKET_BAD + * if not (events & EV_WRITE): + */ + __pyx_t_1 = (!(__pyx_v_events & 1)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":383 + * cdef int write_fd = read_fd + * if not (events & EV_READ): + * read_fd = cares.ARES_SOCKET_BAD # <<<<<<<<<<<<<< + * if not (events & EV_WRITE): + * write_fd = cares.ARES_SOCKET_BAD + */ + __pyx_v_read_fd = ARES_SOCKET_BAD; + goto __pyx_L4; + } + __pyx_L4:; + + /* "gevent/ares.pyx":384 + * if not (events & EV_READ): + * read_fd = cares.ARES_SOCKET_BAD + * if not (events & EV_WRITE): # <<<<<<<<<<<<<< + * write_fd = cares.ARES_SOCKET_BAD + * cares.ares_process_fd(self.channel, read_fd, write_fd) + */ + __pyx_t_1 = (!(__pyx_v_events & 2)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":385 + * read_fd = cares.ARES_SOCKET_BAD + * if not (events & EV_WRITE): + * write_fd = cares.ARES_SOCKET_BAD # <<<<<<<<<<<<<< + * cares.ares_process_fd(self.channel, read_fd, write_fd) + * + */ + __pyx_v_write_fd = ARES_SOCKET_BAD; + goto __pyx_L5; + } + __pyx_L5:; + + /* "gevent/ares.pyx":386 + * if not (events & EV_WRITE): + * write_fd = cares.ARES_SOCKET_BAD + * cares.ares_process_fd(self.channel, read_fd, write_fd) # <<<<<<<<<<<<<< + * + * def gethostbyname(self, object callback, char* name, int family=AF_INET): + */ + ares_process_fd(__pyx_v_self->channel, __pyx_v_read_fd, __pyx_v_write_fd); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.ares.channel._process_fd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_15gethostbyname(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_15gethostbyname(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + char *__pyx_v_name; + int __pyx_v_family; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gethostbyname (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__name,&__pyx_n_s__family,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gethostbyname", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__family); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gethostbyname") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_callback = values[0]; + __pyx_v_name = __Pyx_PyObject_AsString(values[1]); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[2]) { + __pyx_v_family = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_family == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_family = __pyx_k_11; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("gethostbyname", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel.gethostbyname", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_7channel_14gethostbyname(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_name, __pyx_v_family); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":388 + * cares.ares_process_fd(self.channel, read_fd, write_fd) + * + * def gethostbyname(self, object callback, char* name, int family=AF_INET): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_14gethostbyname(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, char *__pyx_v_name, int __pyx_v_family) { + PyObject *__pyx_v_arg = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gethostbyname", 0); + + /* "gevent/ares.pyx":389 + * + * def gethostbyname(self, object callback, char* name, int family=AF_INET): + * if not self.channel: # <<<<<<<<<<<<<< + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * # note that for file lookups still AF_INET can be returned for AF_INET6 request + */ + __pyx_t_1 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":390 + * def gethostbyname(self, object callback, char* name, int family=AF_INET): + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') # <<<<<<<<<<<<<< + * # note that for file lookups still AF_INET can be returned for AF_INET6 request + * cdef object arg = (self, callback) + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":392 + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * # note that for file lookups still AF_INET can be returned for AF_INET6 request + * cdef object arg = (self, callback) # <<<<<<<<<<<<<< + * Py_INCREF(arg) + * cares.ares_gethostbyname(self.channel, name, family, gevent_ares_host_callback, arg) + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_v_arg = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "gevent/ares.pyx":393 + * # note that for file lookups still AF_INET can be returned for AF_INET6 request + * cdef object arg = (self, callback) + * Py_INCREF(arg) # <<<<<<<<<<<<<< + * cares.ares_gethostbyname(self.channel, name, family, gevent_ares_host_callback, arg) + * + */ + Py_INCREF(((PyObject*)__pyx_v_arg)); + + /* "gevent/ares.pyx":394 + * cdef object arg = (self, callback) + * Py_INCREF(arg) + * cares.ares_gethostbyname(self.channel, name, family, gevent_ares_host_callback, arg) # <<<<<<<<<<<<<< + * + * def gethostbyaddr(self, object callback, char* addr): + */ + ares_gethostbyname(__pyx_v_self->channel, __pyx_v_name, __pyx_v_family, ((void *)__pyx_f_6gevent_4ares_gevent_ares_host_callback), ((void *)__pyx_v_arg)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.ares.channel.gethostbyname", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arg); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_17gethostbyaddr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_17gethostbyaddr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + char *__pyx_v_addr; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gethostbyaddr (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__addr,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gethostbyaddr", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gethostbyaddr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_callback = values[0]; + __pyx_v_addr = __Pyx_PyObject_AsString(values[1]); if (unlikely((!__pyx_v_addr) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("gethostbyaddr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel.gethostbyaddr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4ares_7channel_16gethostbyaddr(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_addr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":396 + * cares.ares_gethostbyname(self.channel, name, family, gevent_ares_host_callback, arg) + * + * def gethostbyaddr(self, object callback, char* addr): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_16gethostbyaddr(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, char *__pyx_v_addr) { + char __pyx_v_addr_packed[16]; + int __pyx_v_family; + int __pyx_v_length; + PyObject *__pyx_v_arg = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gethostbyaddr", 0); + + /* "gevent/ares.pyx":397 + * + * def gethostbyaddr(self, object callback, char* addr): + * if not self.channel: # <<<<<<<<<<<<<< + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * # will guess the family + */ + __pyx_t_1 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":398 + * def gethostbyaddr(self, object callback, char* addr): + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') # <<<<<<<<<<<<<< + * # will guess the family + * cdef char addr_packed[16] + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":403 + * cdef int family + * cdef int length + * if cares.ares_inet_pton(AF_INET, addr, addr_packed) > 0: # <<<<<<<<<<<<<< + * family = AF_INET + * length = 4 + */ + __pyx_t_1 = (ares_inet_pton(AF_INET, __pyx_v_addr, __pyx_v_addr_packed) > 0); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":404 + * cdef int length + * if cares.ares_inet_pton(AF_INET, addr, addr_packed) > 0: + * family = AF_INET # <<<<<<<<<<<<<< + * length = 4 + * elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: + */ + __pyx_v_family = AF_INET; + + /* "gevent/ares.pyx":405 + * if cares.ares_inet_pton(AF_INET, addr, addr_packed) > 0: + * family = AF_INET + * length = 4 # <<<<<<<<<<<<<< + * elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: + * family = AF_INET6 + */ + __pyx_v_length = 4; + goto __pyx_L4; + } + + /* "gevent/ares.pyx":406 + * family = AF_INET + * length = 4 + * elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: # <<<<<<<<<<<<<< + * family = AF_INET6 + * length = 16 + */ + __pyx_t_1 = (ares_inet_pton(AF_INET6, __pyx_v_addr, __pyx_v_addr_packed) > 0); + if (__pyx_t_1) { + + /* "gevent/ares.pyx":407 + * length = 4 + * elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: + * family = AF_INET6 # <<<<<<<<<<<<<< + * length = 16 + * else: + */ + __pyx_v_family = AF_INET6; + + /* "gevent/ares.pyx":408 + * elif cares.ares_inet_pton(AF_INET6, addr, addr_packed) > 0: + * family = AF_INET6 + * length = 16 # <<<<<<<<<<<<<< + * else: + * raise InvalidIP(repr(addr)) + */ + __pyx_v_length = 16; + goto __pyx_L4; + } + /*else*/ { + + /* "gevent/ares.pyx":410 + * length = 16 + * else: + * raise InvalidIP(repr(addr)) # <<<<<<<<<<<<<< + * cdef object arg = (self, callback) + * Py_INCREF(arg) + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__InvalidIP); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyObject_Repr(((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "gevent/ares.pyx":411 + * else: + * raise InvalidIP(repr(addr)) + * cdef object arg = (self, callback) # <<<<<<<<<<<<<< + * Py_INCREF(arg) + * cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_v_arg = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":412 + * raise InvalidIP(repr(addr)) + * cdef object arg = (self, callback) + * Py_INCREF(arg) # <<<<<<<<<<<<<< + * cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) + * + */ + Py_INCREF(((PyObject*)__pyx_v_arg)); + + /* "gevent/ares.pyx":413 + * cdef object arg = (self, callback) + * Py_INCREF(arg) + * cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) # <<<<<<<<<<<<<< + * + * cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): + */ + ares_gethostbyaddr(__pyx_v_self->channel, __pyx_v_addr_packed, __pyx_v_length, __pyx_v_family, ((void *)__pyx_f_6gevent_4ares_gevent_ares_host_callback), ((void *)__pyx_v_arg)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.ares.channel.gethostbyaddr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arg); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":415 + * cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) + * + * cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + +static PyObject *__pyx_pw_6gevent_4ares_7channel_19_getnameinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6gevent_4ares_7channel__getnameinfo(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_sockaddr, int __pyx_v_flags, int __pyx_skip_dispatch) { + char *__pyx_v_hostp; + int __pyx_v_port; + int __pyx_v_flowinfo; + int __pyx_v_scope_id; + struct sockaddr_in6 __pyx_v_sa6; + int __pyx_v_length; + PyObject *__pyx_v_arg = 0; + struct sockaddr *__pyx_v_x; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getnameinfo", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getnameinfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6gevent_4ares_7channel_19_getnameinfo)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_INCREF(((PyObject *)__pyx_v_sockaddr)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_sockaddr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sockaddr)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "gevent/ares.pyx":416 + * + * cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): + * if not self.channel: # <<<<<<<<<<<<<< + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * cdef char* hostp = NULL + */ + __pyx_t_4 = (!(__pyx_v_self->channel != 0)); + if (__pyx_t_4) { + + /* "gevent/ares.pyx":417 + * cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') # <<<<<<<<<<<<<< + * cdef char* hostp = NULL + * cdef int port = 0 + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/ares.pyx":418 + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * cdef char* hostp = NULL # <<<<<<<<<<<<<< + * cdef int port = 0 + * cdef int flowinfo = 0 + */ + __pyx_v_hostp = NULL; + + /* "gevent/ares.pyx":419 + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + * cdef char* hostp = NULL + * cdef int port = 0 # <<<<<<<<<<<<<< + * cdef int flowinfo = 0 + * cdef int scope_id = 0 + */ + __pyx_v_port = 0; + + /* "gevent/ares.pyx":420 + * cdef char* hostp = NULL + * cdef int port = 0 + * cdef int flowinfo = 0 # <<<<<<<<<<<<<< + * cdef int scope_id = 0 + * cdef sockaddr_in6 sa6 + */ + __pyx_v_flowinfo = 0; + + /* "gevent/ares.pyx":421 + * cdef int port = 0 + * cdef int flowinfo = 0 + * cdef int scope_id = 0 # <<<<<<<<<<<<<< + * cdef sockaddr_in6 sa6 + * if not PyTuple_Check(sockaddr): + */ + __pyx_v_scope_id = 0; + + /* "gevent/ares.pyx":423 + * cdef int scope_id = 0 + * cdef sockaddr_in6 sa6 + * if not PyTuple_Check(sockaddr): # <<<<<<<<<<<<<< + * raise TypeError('expected a tuple, got %r' % (sockaddr, )) + * PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) + */ + __pyx_t_4 = (!PyTuple_Check(((PyObject *)__pyx_v_sockaddr))); + if (__pyx_t_4) { + + /* "gevent/ares.pyx":424 + * cdef sockaddr_in6 sa6 + * if not PyTuple_Check(sockaddr): + * raise TypeError('expected a tuple, got %r' % (sockaddr, )) # <<<<<<<<<<<<<< + * PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) + * if port < 0 or port > 65535: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_sockaddr)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_sockaddr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sockaddr)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "gevent/ares.pyx":425 + * if not PyTuple_Check(sockaddr): + * raise TypeError('expected a tuple, got %r' % (sockaddr, )) + * PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) # <<<<<<<<<<<<<< + * if port < 0 or port > 65535: + * raise gaierror(-8, 'Invalid value for port: %r' % port) + */ + __pyx_t_5 = PyArg_ParseTuple(((PyObject *)__pyx_v_sockaddr), __pyx_k_13, (&__pyx_v_hostp), (&__pyx_v_port), (&__pyx_v_flowinfo), (&__pyx_v_scope_id)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":426 + * raise TypeError('expected a tuple, got %r' % (sockaddr, )) + * PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) + * if port < 0 or port > 65535: # <<<<<<<<<<<<<< + * raise gaierror(-8, 'Invalid value for port: %r' % port) + * cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) + */ + __pyx_t_4 = (__pyx_v_port < 0); + if (!__pyx_t_4) { + __pyx_t_6 = (__pyx_v_port > 65535); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_4; + } + if (__pyx_t_7) { + + /* "gevent/ares.pyx":427 + * PyArg_ParseTuple(sockaddr, "si|ii", &hostp, &port, &flowinfo, &scope_id) + * if port < 0 or port > 65535: + * raise gaierror(-8, 'Invalid value for port: %r' % port) # <<<<<<<<<<<<<< + * cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) + * if length <= 0: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gaierror); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_v_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_neg_8); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_8); + __Pyx_GIVEREF(__pyx_int_neg_8); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "gevent/ares.pyx":428 + * if port < 0 or port > 65535: + * raise gaierror(-8, 'Invalid value for port: %r' % port) + * cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) # <<<<<<<<<<<<<< + * if length <= 0: + * raise InvalidIP(repr(hostp)) + */ + __pyx_v_length = gevent_make_sockaddr(__pyx_v_hostp, __pyx_v_port, __pyx_v_flowinfo, __pyx_v_scope_id, (&__pyx_v_sa6)); + + /* "gevent/ares.pyx":429 + * raise gaierror(-8, 'Invalid value for port: %r' % port) + * cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) + * if length <= 0: # <<<<<<<<<<<<<< + * raise InvalidIP(repr(hostp)) + * cdef object arg = (self, callback) + */ + __pyx_t_7 = (__pyx_v_length <= 0); + if (__pyx_t_7) { + + /* "gevent/ares.pyx":430 + * cdef int length = gevent_make_sockaddr(hostp, port, flowinfo, scope_id, &sa6) + * if length <= 0: + * raise InvalidIP(repr(hostp)) # <<<<<<<<<<<<<< + * cdef object arg = (self, callback) + * Py_INCREF(arg) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__InvalidIP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_hostp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "gevent/ares.pyx":431 + * if length <= 0: + * raise InvalidIP(repr(hostp)) + * cdef object arg = (self, callback) # <<<<<<<<<<<<<< + * Py_INCREF(arg) + * cdef sockaddr_t* x = &sa6 + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_v_arg = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "gevent/ares.pyx":432 + * raise InvalidIP(repr(hostp)) + * cdef object arg = (self, callback) + * Py_INCREF(arg) # <<<<<<<<<<<<<< + * cdef sockaddr_t* x = &sa6 + * cares.ares_getnameinfo(self.channel, x, length, flags, gevent_ares_nameinfo_callback, arg) + */ + Py_INCREF(((PyObject*)__pyx_v_arg)); + + /* "gevent/ares.pyx":433 + * cdef object arg = (self, callback) + * Py_INCREF(arg) + * cdef sockaddr_t* x = &sa6 # <<<<<<<<<<<<<< + * cares.ares_getnameinfo(self.channel, x, length, flags, gevent_ares_nameinfo_callback, arg) + * + */ + __pyx_v_x = ((struct sockaddr *)(&__pyx_v_sa6)); + + /* "gevent/ares.pyx":434 + * Py_INCREF(arg) + * cdef sockaddr_t* x = &sa6 + * cares.ares_getnameinfo(self.channel, x, length, flags, gevent_ares_nameinfo_callback, arg) # <<<<<<<<<<<<<< + * + * def getnameinfo(self, object callback, tuple sockaddr, int flags): + */ + ares_getnameinfo(__pyx_v_self->channel, __pyx_v_x, __pyx_v_length, __pyx_v_flags, ((void *)__pyx_f_6gevent_4ares_gevent_ares_nameinfo_callback), ((void *)__pyx_v_arg)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.ares.channel._getnameinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arg); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_19_getnameinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_19_getnameinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_sockaddr = 0; + int __pyx_v_flags; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getnameinfo (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__sockaddr,&__pyx_n_s__flags,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sockaddr)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_getnameinfo", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_getnameinfo", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_getnameinfo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_callback = values[0]; + __pyx_v_sockaddr = ((PyObject*)values[1]); + __pyx_v_flags = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_getnameinfo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel._getnameinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sockaddr), (&PyTuple_Type), 1, "sockaddr", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4ares_7channel_18_getnameinfo(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_sockaddr, __pyx_v_flags); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":415 + * cares.ares_gethostbyaddr(self.channel, addr_packed, length, family, gevent_ares_host_callback, arg) + * + * cpdef _getnameinfo(self, object callback, tuple sockaddr, int flags): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_18_getnameinfo(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_sockaddr, int __pyx_v_flags) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getnameinfo", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_4ares_channel *)__pyx_v_self->__pyx_vtab)->_getnameinfo(__pyx_v_self, __pyx_v_callback, __pyx_v_sockaddr, __pyx_v_flags, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.ares.channel._getnameinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_21getnameinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_21getnameinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_sockaddr = 0; + int __pyx_v_flags; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getnameinfo (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__sockaddr,&__pyx_n_s__flags,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sockaddr)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("getnameinfo", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("getnameinfo", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getnameinfo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_callback = values[0]; + __pyx_v_sockaddr = ((PyObject*)values[1]); + __pyx_v_flags = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getnameinfo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.ares.channel.getnameinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sockaddr), (&PyTuple_Type), 1, "sockaddr", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4ares_7channel_20getnameinfo(((struct PyGeventAresChannelObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_sockaddr, __pyx_v_flags); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":436 + * cares.ares_getnameinfo(self.channel, x, length, flags, gevent_ares_nameinfo_callback, arg) + * + * def getnameinfo(self, object callback, tuple sockaddr, int flags): # <<<<<<<<<<<<<< + * return self._getnameinfo(callback, sockaddr, _convert_cares_flags(flags)) + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_20getnameinfo(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_sockaddr, int __pyx_v_flags) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getnameinfo", 0); + + /* "gevent/ares.pyx":437 + * + * def getnameinfo(self, object callback, tuple sockaddr, int flags): + * return self._getnameinfo(callback, sockaddr, _convert_cares_flags(flags)) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4ares__convert_cares_flags(__pyx_v_flags, 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_4ares_channel *)__pyx_v_self->__pyx_vtab)->_getnameinfo(__pyx_v_self, __pyx_v_callback, __pyx_v_sockaddr, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.ares.channel.getnameinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_4loop___get__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":237 + * cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresChannel_Type]: + * + * cdef public object loop # <<<<<<<<<<<<<< + * cdef ares_channeldata* channel + * cdef public dict _watchers + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_4loop___get__(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->loop); + __pyx_r = __pyx_v_self->loop; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_4loop_2__set__(((struct PyGeventAresChannelObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_4loop_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(__pyx_v_self->loop); + __pyx_v_self->loop = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_4loop_4__del__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_4loop_4__del__(struct PyGeventAresChannelObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(__pyx_v_self->loop); + __pyx_v_self->loop = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_9_watchers_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_9_watchers_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_9_watchers___get__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":239 + * cdef public object loop + * cdef ares_channeldata* channel + * cdef public dict _watchers # <<<<<<<<<<<<<< + * cdef public object _timer + * + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_9_watchers___get__(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->_watchers)); + __pyx_r = ((PyObject *)__pyx_v_self->_watchers); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_9_watchers_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_9_watchers_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_9_watchers_2__set__(((struct PyGeventAresChannelObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_9_watchers_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_watchers); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_watchers)); + __pyx_v_self->_watchers = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.ares.channel._watchers.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_9_watchers_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_9_watchers_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_9_watchers_4__del__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_9_watchers_4__del__(struct PyGeventAresChannelObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_watchers); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_watchers)); + __pyx_v_self->_watchers = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4ares_7channel_6_timer_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4ares_7channel_6_timer_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_6_timer___get__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/ares.pyx":240 + * cdef ares_channeldata* channel + * cdef public dict _watchers + * cdef public object _timer # <<<<<<<<<<<<<< + * + * def __init__(self, object loop, flags=None, timeout=None, tries=None, ndots=None, + */ + +static PyObject *__pyx_pf_6gevent_4ares_7channel_6_timer___get__(struct PyGeventAresChannelObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_timer); + __pyx_r = __pyx_v_self->_timer; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_6_timer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_6_timer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_6_timer_2__set__(((struct PyGeventAresChannelObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_6_timer_2__set__(struct PyGeventAresChannelObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_timer); + __Pyx_DECREF(__pyx_v_self->_timer); + __pyx_v_self->_timer = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4ares_7channel_6_timer_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4ares_7channel_6_timer_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4ares_7channel_6_timer_4__del__(((struct PyGeventAresChannelObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4ares_7channel_6_timer_4__del__(struct PyGeventAresChannelObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_timer); + __Pyx_DECREF(__pyx_v_self->_timer); + __pyx_v_self->_timer = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_6gevent_4ares_result(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6gevent_4ares_result *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6gevent_4ares_result *)o); + p->value = Py_None; Py_INCREF(Py_None); + p->exception = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4ares_result(PyObject *o) { + struct __pyx_obj_6gevent_4ares_result *p = (struct __pyx_obj_6gevent_4ares_result *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->value); + Py_CLEAR(p->exception); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6gevent_4ares_result(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6gevent_4ares_result *p = (struct __pyx_obj_6gevent_4ares_result *)o; + if (p->value) { + e = (*v)(p->value, a); if (e) return e; + } + if (p->exception) { + e = (*v)(p->exception, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4ares_result(PyObject *o) { + struct __pyx_obj_6gevent_4ares_result *p = (struct __pyx_obj_6gevent_4ares_result *)o; + PyObject* tmp; + tmp = ((PyObject*)p->value); + p->value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->exception); + p->exception = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4ares_6result_value(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4ares_6result_5value_1__get__(o); +} + +static int __pyx_setprop_6gevent_4ares_6result_value(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4ares_6result_5value_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4ares_6result_5value_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4ares_6result_exception(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4ares_6result_9exception_1__get__(o); +} + +static int __pyx_setprop_6gevent_4ares_6result_exception(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4ares_6result_9exception_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4ares_6result_9exception_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6gevent_4ares_result[] = { + {__Pyx_NAMESTR("successful"), (PyCFunction)__pyx_pw_6gevent_4ares_6result_5successful, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_6gevent_4ares_6result_7get, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4ares_result[] = { + {(char *)"value", __pyx_getprop_6gevent_4ares_6result_value, __pyx_setprop_6gevent_4ares_6result_value, 0, 0}, + {(char *)"exception", __pyx_getprop_6gevent_4ares_6result_exception, __pyx_setprop_6gevent_4ares_6result_exception, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_result = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_result = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_result = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_result = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6gevent_4ares_result = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.ares.result"), /*tp_name*/ + sizeof(struct __pyx_obj_6gevent_4ares_result), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4ares_result, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4ares_6result_3__repr__, /*tp_repr*/ + &__pyx_tp_as_number_result, /*tp_as_number*/ + &__pyx_tp_as_sequence_result, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_result, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_result, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4ares_result, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4ares_result, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4ares_result, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4ares_result, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4ares_6result_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4ares_result, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6gevent_4ares_channel __pyx_vtable_6gevent_4ares_channel; + +static PyObject *__pyx_tp_new_6gevent_4ares_channel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct PyGeventAresChannelObject *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct PyGeventAresChannelObject *)o); + p->__pyx_vtab = __pyx_vtabptr_6gevent_4ares_channel; + p->loop = Py_None; Py_INCREF(Py_None); + p->_watchers = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_timer = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4ares_channel(PyObject *o) { + struct PyGeventAresChannelObject *p = (struct PyGeventAresChannelObject *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6gevent_4ares_7channel_7__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->loop); + Py_CLEAR(p->_watchers); + Py_CLEAR(p->_timer); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6gevent_4ares_channel(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventAresChannelObject *p = (struct PyGeventAresChannelObject *)o; + if (p->loop) { + e = (*v)(p->loop, a); if (e) return e; + } + if (p->_watchers) { + e = (*v)(p->_watchers, a); if (e) return e; + } + if (p->_timer) { + e = (*v)(p->_timer, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4ares_channel(PyObject *o) { + struct PyGeventAresChannelObject *p = (struct PyGeventAresChannelObject *)o; + PyObject* tmp; + tmp = ((PyObject*)p->loop); + p->loop = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_watchers); + p->_watchers = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_timer); + p->_timer = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4ares_7channel_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4ares_7channel_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4ares_7channel_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4ares_7channel_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4ares_7channel_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4ares_7channel__watchers(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4ares_7channel_9_watchers_1__get__(o); +} + +static int __pyx_setprop_6gevent_4ares_7channel__watchers(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4ares_7channel_9_watchers_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4ares_7channel_9_watchers_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4ares_7channel__timer(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4ares_7channel_6_timer_1__get__(o); +} + +static int __pyx_setprop_6gevent_4ares_7channel__timer(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4ares_7channel_6_timer_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4ares_7channel_6_timer_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6gevent_4ares_channel[] = { + {__Pyx_NAMESTR("destroy"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_5destroy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_servers"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_9set_servers, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_on_timer"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_11_on_timer, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_process_fd"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_13_process_fd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gethostbyname"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_15gethostbyname, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gethostbyaddr"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_17gethostbyaddr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getnameinfo"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_19_getnameinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getnameinfo"), (PyCFunction)__pyx_pw_6gevent_4ares_7channel_21getnameinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4ares_channel[] = { + {(char *)"loop", __pyx_getprop_6gevent_4ares_7channel_loop, __pyx_setprop_6gevent_4ares_7channel_loop, 0, 0}, + {(char *)"_watchers", __pyx_getprop_6gevent_4ares_7channel__watchers, __pyx_setprop_6gevent_4ares_7channel__watchers, 0, 0}, + {(char *)"_timer", __pyx_getprop_6gevent_4ares_7channel__timer, __pyx_setprop_6gevent_4ares_7channel__timer, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_channel = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_channel = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_channel = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_channel = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventAresChannel_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.ares.channel"), /*tp_name*/ + sizeof(struct PyGeventAresChannelObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4ares_channel, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4ares_7channel_3__repr__, /*tp_repr*/ + &__pyx_tp_as_number_channel, /*tp_as_number*/ + &__pyx_tp_as_sequence_channel, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_channel, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_channel, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4ares_channel, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4ares_channel, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4ares_channel, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4ares_channel, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4ares_7channel_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4ares_channel, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("_convert_cares_flags"), (PyCFunction)__pyx_pw_6gevent_4ares_1_convert_cares_flags, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("strerror"), (PyCFunction)__pyx_pw_6gevent_4ares_3strerror, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("ares"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, + {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1}, + {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, + {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__ARES_EBADFAMILY, __pyx_k__ARES_EBADFAMILY, sizeof(__pyx_k__ARES_EBADFAMILY), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADFLAGS, __pyx_k__ARES_EBADFLAGS, sizeof(__pyx_k__ARES_EBADFLAGS), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADHINTS, __pyx_k__ARES_EBADHINTS, sizeof(__pyx_k__ARES_EBADHINTS), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADNAME, __pyx_k__ARES_EBADNAME, sizeof(__pyx_k__ARES_EBADNAME), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADQUERY, __pyx_k__ARES_EBADQUERY, sizeof(__pyx_k__ARES_EBADQUERY), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADRESP, __pyx_k__ARES_EBADRESP, sizeof(__pyx_k__ARES_EBADRESP), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EBADSTR, __pyx_k__ARES_EBADSTR, sizeof(__pyx_k__ARES_EBADSTR), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ECANCELLED, __pyx_k__ARES_ECANCELLED, sizeof(__pyx_k__ARES_ECANCELLED), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ECONNREFUSED, __pyx_k__ARES_ECONNREFUSED, sizeof(__pyx_k__ARES_ECONNREFUSED), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EDESTRUCTION, __pyx_k__ARES_EDESTRUCTION, sizeof(__pyx_k__ARES_EDESTRUCTION), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EFILE, __pyx_k__ARES_EFILE, sizeof(__pyx_k__ARES_EFILE), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EFORMERR, __pyx_k__ARES_EFORMERR, sizeof(__pyx_k__ARES_EFORMERR), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ELOADIPHLPAPI, __pyx_k__ARES_ELOADIPHLPAPI, sizeof(__pyx_k__ARES_ELOADIPHLPAPI), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ENODATA, __pyx_k__ARES_ENODATA, sizeof(__pyx_k__ARES_ENODATA), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ENOMEM, __pyx_k__ARES_ENOMEM, sizeof(__pyx_k__ARES_ENOMEM), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ENONAME, __pyx_k__ARES_ENONAME, sizeof(__pyx_k__ARES_ENONAME), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ENOTFOUND, __pyx_k__ARES_ENOTFOUND, sizeof(__pyx_k__ARES_ENOTFOUND), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ENOTIMP, __pyx_k__ARES_ENOTIMP, sizeof(__pyx_k__ARES_ENOTIMP), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EOF, __pyx_k__ARES_EOF, sizeof(__pyx_k__ARES_EOF), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_EREFUSED, __pyx_k__ARES_EREFUSED, sizeof(__pyx_k__ARES_EREFUSED), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ESERVFAIL, __pyx_k__ARES_ESERVFAIL, sizeof(__pyx_k__ARES_ESERVFAIL), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_ETIMEOUT, __pyx_k__ARES_ETIMEOUT, sizeof(__pyx_k__ARES_ETIMEOUT), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_IGNTC, __pyx_k__ARES_FLAG_IGNTC, sizeof(__pyx_k__ARES_FLAG_IGNTC), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_NOALIASES, __pyx_k__ARES_FLAG_NOALIASES, sizeof(__pyx_k__ARES_FLAG_NOALIASES), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_NORECURSE, __pyx_k__ARES_FLAG_NORECURSE, sizeof(__pyx_k__ARES_FLAG_NORECURSE), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_NOSEARCH, __pyx_k__ARES_FLAG_NOSEARCH, sizeof(__pyx_k__ARES_FLAG_NOSEARCH), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_PRIMARY, __pyx_k__ARES_FLAG_PRIMARY, sizeof(__pyx_k__ARES_FLAG_PRIMARY), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_STAYOPEN, __pyx_k__ARES_FLAG_STAYOPEN, sizeof(__pyx_k__ARES_FLAG_STAYOPEN), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_FLAG_USEVC, __pyx_k__ARES_FLAG_USEVC, sizeof(__pyx_k__ARES_FLAG_USEVC), 0, 0, 1, 1}, + {&__pyx_n_s__ARES_SUCCESS, __pyx_k__ARES_SUCCESS, sizeof(__pyx_k__ARES_SUCCESS), 0, 0, 1, 1}, + {&__pyx_n_s__InvalidIP, __pyx_k__InvalidIP, sizeof(__pyx_k__InvalidIP), 0, 0, 1, 1}, + {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s__NI_DGRAM, __pyx_k__NI_DGRAM, sizeof(__pyx_k__NI_DGRAM), 0, 0, 1, 1}, + {&__pyx_n_s__NI_NAMEREQD, __pyx_k__NI_NAMEREQD, sizeof(__pyx_k__NI_NAMEREQD), 0, 0, 1, 1}, + {&__pyx_n_s__NI_NOFQDN, __pyx_k__NI_NOFQDN, sizeof(__pyx_k__NI_NOFQDN), 0, 0, 1, 1}, + {&__pyx_n_s__NI_NUMERICHOST, __pyx_k__NI_NUMERICHOST, sizeof(__pyx_k__NI_NUMERICHOST), 0, 0, 1, 1}, + {&__pyx_n_s__NI_NUMERICSERV, __pyx_k__NI_NUMERICSERV, sizeof(__pyx_k__NI_NUMERICSERV), 0, 0, 1, 1}, + {&__pyx_n_s__TIMEOUT, __pyx_k__TIMEOUT, sizeof(__pyx_k__TIMEOUT), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____getnewargs__, __pyx_k____getnewargs__, sizeof(__pyx_k____getnewargs__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1}, + {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1}, + {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, + {&__pyx_n_s____new__, __pyx_k____new__, sizeof(__pyx_k____new__), 0, 0, 1, 1}, + {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___ares_errors, __pyx_k___ares_errors, sizeof(__pyx_k___ares_errors), 0, 0, 1, 1}, + {&__pyx_n_s___cares_flag_map, __pyx_k___cares_flag_map, sizeof(__pyx_k___cares_flag_map), 0, 0, 1, 1}, + {&__pyx_n_s___getnameinfo, __pyx_k___getnameinfo, sizeof(__pyx_k___getnameinfo), 0, 0, 1, 1}, + {&__pyx_n_s___on_timer, __pyx_k___on_timer, sizeof(__pyx_k___on_timer), 0, 0, 1, 1}, + {&__pyx_n_s___process_fd, __pyx_k___process_fd, sizeof(__pyx_k___process_fd), 0, 0, 1, 1}, + {&__pyx_n_s___socket, __pyx_k___socket, sizeof(__pyx_k___socket), 0, 0, 1, 1}, + {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1}, + {&__pyx_n_s__again, __pyx_k__again, sizeof(__pyx_k__again), 0, 0, 1, 1}, + {&__pyx_n_s__ares_host_result, __pyx_k__ares_host_result, sizeof(__pyx_k__ares_host_result), 0, 0, 1, 1}, + {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, + {&__pyx_n_s__channel, __pyx_k__channel, sizeof(__pyx_k__channel), 0, 0, 1, 1}, + {&__pyx_n_s__cls, __pyx_k__cls, sizeof(__pyx_k__cls), 0, 0, 1, 1}, + {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1}, + {&__pyx_n_s__destroy, __pyx_k__destroy, sizeof(__pyx_k__destroy), 0, 0, 1, 1}, + {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1}, + {&__pyx_n_s__exc_info, __pyx_k__exc_info, sizeof(__pyx_k__exc_info), 0, 0, 1, 1}, + {&__pyx_n_s__exception, __pyx_k__exception, sizeof(__pyx_k__exception), 0, 0, 1, 1}, + {&__pyx_n_s__family, __pyx_k__family, sizeof(__pyx_k__family), 0, 0, 1, 1}, + {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1}, + {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, + {&__pyx_n_s__gaierror, __pyx_k__gaierror, sizeof(__pyx_k__gaierror), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__handle_error, __pyx_k__handle_error, sizeof(__pyx_k__handle_error), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__io, __pyx_k__io, sizeof(__pyx_k__io), 0, 0, 1, 1}, + {&__pyx_n_s__iterable, __pyx_k__iterable, sizeof(__pyx_k__iterable), 0, 0, 1, 1}, + {&__pyx_n_s__loop, __pyx_k__loop, sizeof(__pyx_k__loop), 0, 0, 1, 1}, + {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, + {&__pyx_n_s__ndots, __pyx_k__ndots, sizeof(__pyx_k__ndots), 0, 0, 1, 1}, + {&__pyx_n_s__pass_events, __pyx_k__pass_events, sizeof(__pyx_k__pass_events), 0, 0, 1, 1}, + {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {&__pyx_n_s__servers, __pyx_k__servers, sizeof(__pyx_k__servers), 0, 0, 1, 1}, + {&__pyx_n_s__set_servers, __pyx_k__set_servers, sizeof(__pyx_k__set_servers), 0, 0, 1, 1}, + {&__pyx_n_s__sockaddr, __pyx_k__sockaddr, sizeof(__pyx_k__sockaddr), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__tcp_port, __pyx_k__tcp_port, sizeof(__pyx_k__tcp_port), 0, 0, 1, 1}, + {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1}, + {&__pyx_n_s__timer, __pyx_k__timer, sizeof(__pyx_k__timer), 0, 0, 1, 1}, + {&__pyx_n_s__tries, __pyx_k__tries, sizeof(__pyx_k__tries), 0, 0, 1, 1}, + {&__pyx_n_s__udp_port, __pyx_k__udp_port, sizeof(__pyx_k__udp_port), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__watcher, __pyx_k__watcher, sizeof(__pyx_k__watcher), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "gevent/ares.pyx":310 + * servers = [] + * if isinstance(servers, basestring): + * servers = servers.split(',') # <<<<<<<<<<<<<< + * cdef int length = len(servers) + * cdef int result, index + */ + __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "gevent/ares.pyx":182 + * class ares_host_result(tuple): + * + * def __new__(cls, family, iterable): # <<<<<<<<<<<<<< + * cdef object self = tuple.__new__(cls, iterable) + * self.family = family + */ + __pyx_k_tuple_19 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__cls), ((PyObject *)__pyx_n_s__family), ((PyObject *)__pyx_n_s__iterable), ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s____new__, 182, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":187 + * return self + * + * def __getnewargs__(self): # <<<<<<<<<<<<<< + * return (self.family, tuple(self)) + * + */ + __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s____getnewargs__, 187, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initares(void); /*proto*/ +PyMODINIT_FUNC initares(void) +#else +PyMODINIT_FUNC PyInit_ares(void); /*proto*/ +PyMODINIT_FUNC PyInit_ares(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ares(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ares"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "gevent.ares")) { + if (unlikely(PyDict_SetItemString(modules, "gevent.ares", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main_gevent__ares) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_6gevent_4ares_result) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "result", (PyObject *)&__pyx_type_6gevent_4ares_result) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4ares_result = &__pyx_type_6gevent_4ares_result; + __pyx_vtabptr_6gevent_4ares_channel = &__pyx_vtable_6gevent_4ares_channel; + __pyx_vtable_6gevent_4ares_channel._sock_state_callback = (PyObject *(*)(struct PyGeventAresChannelObject *, int, int, int))__pyx_f_6gevent_4ares_7channel__sock_state_callback; + __pyx_vtable_6gevent_4ares_channel._getnameinfo = (PyObject *(*)(struct PyGeventAresChannelObject *, PyObject *, PyObject *, int, int __pyx_skip_dispatch))__pyx_f_6gevent_4ares_7channel__getnameinfo; + if (PyType_Ready(&PyGeventAresChannel_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(PyGeventAresChannel_Type.tp_dict, __pyx_vtabptr_6gevent_4ares_channel) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "channel", (PyObject *)&PyGeventAresChannel_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4ares_channel = &PyGeventAresChannel_Type; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "gevent/ares.pyx":3 + * # Copyright (c) 2011-2012 Denis Bilenko. See LICENSE for details. + * cimport cares + * import sys # <<<<<<<<<<<<<< + * from python cimport * + * from _socket import gaierror + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/ares.pyx":5 + * import sys + * from python cimport * + * from _socket import gaierror # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__gaierror)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__gaierror)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gaierror)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s___socket), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__gaierror); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__gaierror, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":8 + * + * + * __all__ = ['channel'] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__channel)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__channel)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__channel)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":11 + * + * + * TIMEOUT = 1 # <<<<<<<<<<<<<< + * + * DEF EV_READ = 1 + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s__TIMEOUT, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":48 + * + * + * ARES_SUCCESS = cares.ARES_SUCCESS # <<<<<<<<<<<<<< + * ARES_ENODATA = cares.ARES_ENODATA + * ARES_EFORMERR = cares.ARES_EFORMERR + */ + __pyx_t_2 = PyInt_FromLong(ARES_SUCCESS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_SUCCESS, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":49 + * + * ARES_SUCCESS = cares.ARES_SUCCESS + * ARES_ENODATA = cares.ARES_ENODATA # <<<<<<<<<<<<<< + * ARES_EFORMERR = cares.ARES_EFORMERR + * ARES_ESERVFAIL = cares.ARES_ESERVFAIL + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENODATA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ENODATA, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":50 + * ARES_SUCCESS = cares.ARES_SUCCESS + * ARES_ENODATA = cares.ARES_ENODATA + * ARES_EFORMERR = cares.ARES_EFORMERR # <<<<<<<<<<<<<< + * ARES_ESERVFAIL = cares.ARES_ESERVFAIL + * ARES_ENOTFOUND = cares.ARES_ENOTFOUND + */ + __pyx_t_2 = PyInt_FromLong(ARES_EFORMERR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EFORMERR, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":51 + * ARES_ENODATA = cares.ARES_ENODATA + * ARES_EFORMERR = cares.ARES_EFORMERR + * ARES_ESERVFAIL = cares.ARES_ESERVFAIL # <<<<<<<<<<<<<< + * ARES_ENOTFOUND = cares.ARES_ENOTFOUND + * ARES_ENOTIMP = cares.ARES_ENOTIMP + */ + __pyx_t_2 = PyInt_FromLong(ARES_ESERVFAIL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ESERVFAIL, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":52 + * ARES_EFORMERR = cares.ARES_EFORMERR + * ARES_ESERVFAIL = cares.ARES_ESERVFAIL + * ARES_ENOTFOUND = cares.ARES_ENOTFOUND # <<<<<<<<<<<<<< + * ARES_ENOTIMP = cares.ARES_ENOTIMP + * ARES_EREFUSED = cares.ARES_EREFUSED + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTFOUND); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ENOTFOUND, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":53 + * ARES_ESERVFAIL = cares.ARES_ESERVFAIL + * ARES_ENOTFOUND = cares.ARES_ENOTFOUND + * ARES_ENOTIMP = cares.ARES_ENOTIMP # <<<<<<<<<<<<<< + * ARES_EREFUSED = cares.ARES_EREFUSED + * ARES_EBADQUERY = cares.ARES_EBADQUERY + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTIMP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ENOTIMP, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":54 + * ARES_ENOTFOUND = cares.ARES_ENOTFOUND + * ARES_ENOTIMP = cares.ARES_ENOTIMP + * ARES_EREFUSED = cares.ARES_EREFUSED # <<<<<<<<<<<<<< + * ARES_EBADQUERY = cares.ARES_EBADQUERY + * ARES_EBADNAME = cares.ARES_EBADNAME + */ + __pyx_t_2 = PyInt_FromLong(ARES_EREFUSED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EREFUSED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":55 + * ARES_ENOTIMP = cares.ARES_ENOTIMP + * ARES_EREFUSED = cares.ARES_EREFUSED + * ARES_EBADQUERY = cares.ARES_EBADQUERY # <<<<<<<<<<<<<< + * ARES_EBADNAME = cares.ARES_EBADNAME + * ARES_EBADFAMILY = cares.ARES_EBADFAMILY + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADQUERY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADQUERY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":56 + * ARES_EREFUSED = cares.ARES_EREFUSED + * ARES_EBADQUERY = cares.ARES_EBADQUERY + * ARES_EBADNAME = cares.ARES_EBADNAME # <<<<<<<<<<<<<< + * ARES_EBADFAMILY = cares.ARES_EBADFAMILY + * ARES_EBADRESP = cares.ARES_EBADRESP + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADNAME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADNAME, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":57 + * ARES_EBADQUERY = cares.ARES_EBADQUERY + * ARES_EBADNAME = cares.ARES_EBADNAME + * ARES_EBADFAMILY = cares.ARES_EBADFAMILY # <<<<<<<<<<<<<< + * ARES_EBADRESP = cares.ARES_EBADRESP + * ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADFAMILY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADFAMILY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":58 + * ARES_EBADNAME = cares.ARES_EBADNAME + * ARES_EBADFAMILY = cares.ARES_EBADFAMILY + * ARES_EBADRESP = cares.ARES_EBADRESP # <<<<<<<<<<<<<< + * ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED + * ARES_ETIMEOUT = cares.ARES_ETIMEOUT + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADRESP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADRESP, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":59 + * ARES_EBADFAMILY = cares.ARES_EBADFAMILY + * ARES_EBADRESP = cares.ARES_EBADRESP + * ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED # <<<<<<<<<<<<<< + * ARES_ETIMEOUT = cares.ARES_ETIMEOUT + * ARES_EOF = cares.ARES_EOF + */ + __pyx_t_2 = PyInt_FromLong(ARES_ECONNREFUSED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ECONNREFUSED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":60 + * ARES_EBADRESP = cares.ARES_EBADRESP + * ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED + * ARES_ETIMEOUT = cares.ARES_ETIMEOUT # <<<<<<<<<<<<<< + * ARES_EOF = cares.ARES_EOF + * ARES_EFILE = cares.ARES_EFILE + */ + __pyx_t_2 = PyInt_FromLong(ARES_ETIMEOUT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ETIMEOUT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":61 + * ARES_ECONNREFUSED = cares.ARES_ECONNREFUSED + * ARES_ETIMEOUT = cares.ARES_ETIMEOUT + * ARES_EOF = cares.ARES_EOF # <<<<<<<<<<<<<< + * ARES_EFILE = cares.ARES_EFILE + * ARES_ENOMEM = cares.ARES_ENOMEM + */ + __pyx_t_2 = PyInt_FromLong(ARES_EOF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EOF, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":62 + * ARES_ETIMEOUT = cares.ARES_ETIMEOUT + * ARES_EOF = cares.ARES_EOF + * ARES_EFILE = cares.ARES_EFILE # <<<<<<<<<<<<<< + * ARES_ENOMEM = cares.ARES_ENOMEM + * ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION + */ + __pyx_t_2 = PyInt_FromLong(ARES_EFILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EFILE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":63 + * ARES_EOF = cares.ARES_EOF + * ARES_EFILE = cares.ARES_EFILE + * ARES_ENOMEM = cares.ARES_ENOMEM # <<<<<<<<<<<<<< + * ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION + * ARES_EBADSTR = cares.ARES_EBADSTR + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOMEM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ENOMEM, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":64 + * ARES_EFILE = cares.ARES_EFILE + * ARES_ENOMEM = cares.ARES_ENOMEM + * ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION # <<<<<<<<<<<<<< + * ARES_EBADSTR = cares.ARES_EBADSTR + * ARES_EBADFLAGS = cares.ARES_EBADFLAGS + */ + __pyx_t_2 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EDESTRUCTION, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":65 + * ARES_ENOMEM = cares.ARES_ENOMEM + * ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION + * ARES_EBADSTR = cares.ARES_EBADSTR # <<<<<<<<<<<<<< + * ARES_EBADFLAGS = cares.ARES_EBADFLAGS + * ARES_ENONAME = cares.ARES_ENONAME + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADSTR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADSTR, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":66 + * ARES_EDESTRUCTION = cares.ARES_EDESTRUCTION + * ARES_EBADSTR = cares.ARES_EBADSTR + * ARES_EBADFLAGS = cares.ARES_EBADFLAGS # <<<<<<<<<<<<<< + * ARES_ENONAME = cares.ARES_ENONAME + * ARES_EBADHINTS = cares.ARES_EBADHINTS + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADFLAGS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADFLAGS, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":67 + * ARES_EBADSTR = cares.ARES_EBADSTR + * ARES_EBADFLAGS = cares.ARES_EBADFLAGS + * ARES_ENONAME = cares.ARES_ENONAME # <<<<<<<<<<<<<< + * ARES_EBADHINTS = cares.ARES_EBADHINTS + * ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENONAME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ENONAME, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":68 + * ARES_EBADFLAGS = cares.ARES_EBADFLAGS + * ARES_ENONAME = cares.ARES_ENONAME + * ARES_EBADHINTS = cares.ARES_EBADHINTS # <<<<<<<<<<<<<< + * ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED + * ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADHINTS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_EBADHINTS, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":69 + * ARES_ENONAME = cares.ARES_ENONAME + * ARES_EBADHINTS = cares.ARES_EBADHINTS + * ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED # <<<<<<<<<<<<<< + * ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI + * ARES_EADDRGETNETWORKPARAMS = cares.ARES_EADDRGETNETWORKPARAMS + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTINITIALIZED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_15, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":70 + * ARES_EBADHINTS = cares.ARES_EBADHINTS + * ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED + * ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI # <<<<<<<<<<<<<< + * ARES_EADDRGETNETWORKPARAMS = cares.ARES_EADDRGETNETWORKPARAMS + * ARES_ECANCELLED = cares.ARES_ECANCELLED + */ + __pyx_t_2 = PyInt_FromLong(ARES_ELOADIPHLPAPI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ELOADIPHLPAPI, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":71 + * ARES_ENOTINITIALIZED = cares.ARES_ENOTINITIALIZED + * ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI + * ARES_EADDRGETNETWORKPARAMS = cares.ARES_EADDRGETNETWORKPARAMS # <<<<<<<<<<<<<< + * ARES_ECANCELLED = cares.ARES_ECANCELLED + * + */ + __pyx_t_2 = PyInt_FromLong(ARES_EADDRGETNETWORKPARAMS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_16, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":72 + * ARES_ELOADIPHLPAPI = cares.ARES_ELOADIPHLPAPI + * ARES_EADDRGETNETWORKPARAMS = cares.ARES_EADDRGETNETWORKPARAMS + * ARES_ECANCELLED = cares.ARES_ECANCELLED # <<<<<<<<<<<<<< + * + * ARES_FLAG_USEVC = cares.ARES_FLAG_USEVC + */ + __pyx_t_2 = PyInt_FromLong(ARES_ECANCELLED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_ECANCELLED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":74 + * ARES_ECANCELLED = cares.ARES_ECANCELLED + * + * ARES_FLAG_USEVC = cares.ARES_FLAG_USEVC # <<<<<<<<<<<<<< + * ARES_FLAG_PRIMARY = cares.ARES_FLAG_PRIMARY + * ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_USEVC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_USEVC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":75 + * + * ARES_FLAG_USEVC = cares.ARES_FLAG_USEVC + * ARES_FLAG_PRIMARY = cares.ARES_FLAG_PRIMARY # <<<<<<<<<<<<<< + * ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC + * ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_PRIMARY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_PRIMARY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":76 + * ARES_FLAG_USEVC = cares.ARES_FLAG_USEVC + * ARES_FLAG_PRIMARY = cares.ARES_FLAG_PRIMARY + * ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC # <<<<<<<<<<<<<< + * ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE + * ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_IGNTC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_IGNTC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":77 + * ARES_FLAG_PRIMARY = cares.ARES_FLAG_PRIMARY + * ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC + * ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE # <<<<<<<<<<<<<< + * ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN + * ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_NORECURSE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_NORECURSE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":78 + * ARES_FLAG_IGNTC = cares.ARES_FLAG_IGNTC + * ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE + * ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN # <<<<<<<<<<<<<< + * ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH + * ARES_FLAG_NOALIASES = cares.ARES_FLAG_NOALIASES + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_STAYOPEN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_STAYOPEN, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":79 + * ARES_FLAG_NORECURSE = cares.ARES_FLAG_NORECURSE + * ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN + * ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH # <<<<<<<<<<<<<< + * ARES_FLAG_NOALIASES = cares.ARES_FLAG_NOALIASES + * ARES_FLAG_NOCHECKRESP = cares.ARES_FLAG_NOCHECKRESP + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_NOSEARCH); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_NOSEARCH, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":80 + * ARES_FLAG_STAYOPEN = cares.ARES_FLAG_STAYOPEN + * ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH + * ARES_FLAG_NOALIASES = cares.ARES_FLAG_NOALIASES # <<<<<<<<<<<<<< + * ARES_FLAG_NOCHECKRESP = cares.ARES_FLAG_NOCHECKRESP + * + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_NOALIASES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ARES_FLAG_NOALIASES, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":81 + * ARES_FLAG_NOSEARCH = cares.ARES_FLAG_NOSEARCH + * ARES_FLAG_NOALIASES = cares.ARES_FLAG_NOALIASES + * ARES_FLAG_NOCHECKRESP = cares.ARES_FLAG_NOCHECKRESP # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(ARES_FLAG_NOCHECKRESP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_17, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":85 + * + * _ares_errors = dict([ + * (cares.ARES_SUCCESS, 'ARES_SUCCESS'), # <<<<<<<<<<<<<< + * (cares.ARES_ENODATA, 'ARES_ENODATA'), + * (cares.ARES_EFORMERR, 'ARES_EFORMERR'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_SUCCESS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_SUCCESS)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__ARES_SUCCESS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_SUCCESS)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":86 + * _ares_errors = dict([ + * (cares.ARES_SUCCESS, 'ARES_SUCCESS'), + * (cares.ARES_ENODATA, 'ARES_ENODATA'), # <<<<<<<<<<<<<< + * (cares.ARES_EFORMERR, 'ARES_EFORMERR'), + * (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENODATA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ENODATA)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__ARES_ENODATA)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ENODATA)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":87 + * (cares.ARES_SUCCESS, 'ARES_SUCCESS'), + * (cares.ARES_ENODATA, 'ARES_ENODATA'), + * (cares.ARES_EFORMERR, 'ARES_EFORMERR'), # <<<<<<<<<<<<<< + * (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), + * (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EFORMERR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EFORMERR)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__ARES_EFORMERR)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EFORMERR)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":88 + * (cares.ARES_ENODATA, 'ARES_ENODATA'), + * (cares.ARES_EFORMERR, 'ARES_EFORMERR'), + * (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), # <<<<<<<<<<<<<< + * (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), + * (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ESERVFAIL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ESERVFAIL)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__ARES_ESERVFAIL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ESERVFAIL)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":89 + * (cares.ARES_EFORMERR, 'ARES_EFORMERR'), + * (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), + * (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), # <<<<<<<<<<<<<< + * (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), + * (cares.ARES_EREFUSED, 'ARES_EREFUSED'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTFOUND); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ENOTFOUND)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__ARES_ENOTFOUND)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ENOTFOUND)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":90 + * (cares.ARES_ESERVFAIL, 'ARES_ESERVFAIL'), + * (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), + * (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), # <<<<<<<<<<<<<< + * (cares.ARES_EREFUSED, 'ARES_EREFUSED'), + * (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTIMP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ENOTIMP)); + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__ARES_ENOTIMP)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ENOTIMP)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":91 + * (cares.ARES_ENOTFOUND, 'ARES_ENOTFOUND'), + * (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), + * (cares.ARES_EREFUSED, 'ARES_EREFUSED'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), + * (cares.ARES_EBADNAME, 'ARES_EBADNAME'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EREFUSED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EREFUSED)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_n_s__ARES_EREFUSED)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EREFUSED)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":92 + * (cares.ARES_ENOTIMP, 'ARES_ENOTIMP'), + * (cares.ARES_EREFUSED, 'ARES_EREFUSED'), + * (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADNAME, 'ARES_EBADNAME'), + * (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADQUERY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADQUERY)); + PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_n_s__ARES_EBADQUERY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADQUERY)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":93 + * (cares.ARES_EREFUSED, 'ARES_EREFUSED'), + * (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), + * (cares.ARES_EBADNAME, 'ARES_EBADNAME'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), + * (cares.ARES_EBADRESP, 'ARES_EBADRESP'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADNAME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADNAME)); + PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_n_s__ARES_EBADNAME)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADNAME)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":94 + * (cares.ARES_EBADQUERY, 'ARES_EBADQUERY'), + * (cares.ARES_EBADNAME, 'ARES_EBADNAME'), + * (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADRESP, 'ARES_EBADRESP'), + * (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADFAMILY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADFAMILY)); + PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_n_s__ARES_EBADFAMILY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADFAMILY)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":95 + * (cares.ARES_EBADNAME, 'ARES_EBADNAME'), + * (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), + * (cares.ARES_EBADRESP, 'ARES_EBADRESP'), # <<<<<<<<<<<<<< + * (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), + * (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADRESP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADRESP)); + PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_n_s__ARES_EBADRESP)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADRESP)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":96 + * (cares.ARES_EBADFAMILY, 'ARES_EBADFAMILY'), + * (cares.ARES_EBADRESP, 'ARES_EBADRESP'), + * (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), # <<<<<<<<<<<<<< + * (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), + * (cares.ARES_EOF, 'ARES_EOF'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ECONNREFUSED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ECONNREFUSED)); + PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_n_s__ARES_ECONNREFUSED)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ECONNREFUSED)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":97 + * (cares.ARES_EBADRESP, 'ARES_EBADRESP'), + * (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), + * (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), # <<<<<<<<<<<<<< + * (cares.ARES_EOF, 'ARES_EOF'), + * (cares.ARES_EFILE, 'ARES_EFILE'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ETIMEOUT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ETIMEOUT)); + PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_n_s__ARES_ETIMEOUT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ETIMEOUT)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":98 + * (cares.ARES_ECONNREFUSED, 'ARES_ECONNREFUSED'), + * (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), + * (cares.ARES_EOF, 'ARES_EOF'), # <<<<<<<<<<<<<< + * (cares.ARES_EFILE, 'ARES_EFILE'), + * (cares.ARES_ENOMEM, 'ARES_ENOMEM'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EOF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EOF)); + PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_n_s__ARES_EOF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EOF)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":99 + * (cares.ARES_ETIMEOUT, 'ARES_ETIMEOUT'), + * (cares.ARES_EOF, 'ARES_EOF'), + * (cares.ARES_EFILE, 'ARES_EFILE'), # <<<<<<<<<<<<<< + * (cares.ARES_ENOMEM, 'ARES_ENOMEM'), + * (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EFILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EFILE)); + PyTuple_SET_ITEM(__pyx_t_16, 1, ((PyObject *)__pyx_n_s__ARES_EFILE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EFILE)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":100 + * (cares.ARES_EOF, 'ARES_EOF'), + * (cares.ARES_EFILE, 'ARES_EFILE'), + * (cares.ARES_ENOMEM, 'ARES_ENOMEM'), # <<<<<<<<<<<<<< + * (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), + * (cares.ARES_EBADSTR, 'ARES_EBADSTR'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOMEM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ENOMEM)); + PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)__pyx_n_s__ARES_ENOMEM)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ENOMEM)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":101 + * (cares.ARES_EFILE, 'ARES_EFILE'), + * (cares.ARES_ENOMEM, 'ARES_ENOMEM'), + * (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADSTR, 'ARES_EBADSTR'), + * (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EDESTRUCTION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EDESTRUCTION)); + PyTuple_SET_ITEM(__pyx_t_18, 1, ((PyObject *)__pyx_n_s__ARES_EDESTRUCTION)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EDESTRUCTION)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":102 + * (cares.ARES_ENOMEM, 'ARES_ENOMEM'), + * (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), + * (cares.ARES_EBADSTR, 'ARES_EBADSTR'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), + * (cares.ARES_ENONAME, 'ARES_ENONAME'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADSTR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADSTR)); + PyTuple_SET_ITEM(__pyx_t_19, 1, ((PyObject *)__pyx_n_s__ARES_EBADSTR)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADSTR)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":103 + * (cares.ARES_EDESTRUCTION, 'ARES_EDESTRUCTION'), + * (cares.ARES_EBADSTR, 'ARES_EBADSTR'), + * (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), # <<<<<<<<<<<<<< + * (cares.ARES_ENONAME, 'ARES_ENONAME'), + * (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADFLAGS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADFLAGS)); + PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_n_s__ARES_EBADFLAGS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADFLAGS)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":104 + * (cares.ARES_EBADSTR, 'ARES_EBADSTR'), + * (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), + * (cares.ARES_ENONAME, 'ARES_ENONAME'), # <<<<<<<<<<<<<< + * (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), + * (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENONAME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ENONAME)); + PyTuple_SET_ITEM(__pyx_t_21, 1, ((PyObject *)__pyx_n_s__ARES_ENONAME)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ENONAME)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":105 + * (cares.ARES_EBADFLAGS, 'ARES_EBADFLAGS'), + * (cares.ARES_ENONAME, 'ARES_ENONAME'), + * (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), # <<<<<<<<<<<<<< + * (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), + * (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_EBADHINTS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_EBADHINTS)); + PyTuple_SET_ITEM(__pyx_t_22, 1, ((PyObject *)__pyx_n_s__ARES_EBADHINTS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_EBADHINTS)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":106 + * (cares.ARES_ENONAME, 'ARES_ENONAME'), + * (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), + * (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), # <<<<<<<<<<<<<< + * (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), + * (cares.ARES_EADDRGETNETWORKPARAMS, 'ARES_EADDRGETNETWORKPARAMS'), + */ + __pyx_t_2 = PyInt_FromLong(ARES_ENOTINITIALIZED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s_15)); + PyTuple_SET_ITEM(__pyx_t_23, 1, ((PyObject *)__pyx_n_s_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_15)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":107 + * (cares.ARES_EBADHINTS, 'ARES_EBADHINTS'), + * (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), + * (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), # <<<<<<<<<<<<<< + * (cares.ARES_EADDRGETNETWORKPARAMS, 'ARES_EADDRGETNETWORKPARAMS'), + * (cares.ARES_ECANCELLED, 'ARES_ECANCELLED')]) + */ + __pyx_t_2 = PyInt_FromLong(ARES_ELOADIPHLPAPI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ELOADIPHLPAPI)); + PyTuple_SET_ITEM(__pyx_t_24, 1, ((PyObject *)__pyx_n_s__ARES_ELOADIPHLPAPI)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ELOADIPHLPAPI)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":108 + * (cares.ARES_ENOTINITIALIZED, 'ARES_ENOTINITIALIZED'), + * (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), + * (cares.ARES_EADDRGETNETWORKPARAMS, 'ARES_EADDRGETNETWORKPARAMS'), # <<<<<<<<<<<<<< + * (cares.ARES_ECANCELLED, 'ARES_ECANCELLED')]) + * + */ + __pyx_t_2 = PyInt_FromLong(ARES_EADDRGETNETWORKPARAMS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s_16)); + PyTuple_SET_ITEM(__pyx_t_25, 1, ((PyObject *)__pyx_n_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_16)); + __pyx_t_2 = 0; + + /* "gevent/ares.pyx":109 + * (cares.ARES_ELOADIPHLPAPI, 'ARES_ELOADIPHLPAPI'), + * (cares.ARES_EADDRGETNETWORKPARAMS, 'ARES_EADDRGETNETWORKPARAMS'), + * (cares.ARES_ECANCELLED, 'ARES_ECANCELLED')]) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(ARES_ECANCELLED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ARES_ECANCELLED)); + PyTuple_SET_ITEM(__pyx_t_26, 1, ((PyObject *)__pyx_n_s__ARES_ECANCELLED)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ARES_ECANCELLED)); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyList_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + PyList_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyList_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + PyList_SET_ITEM(__pyx_t_2, 10, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + PyList_SET_ITEM(__pyx_t_2, 11, ((PyObject *)__pyx_t_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); + PyList_SET_ITEM(__pyx_t_2, 12, ((PyObject *)__pyx_t_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_14)); + PyList_SET_ITEM(__pyx_t_2, 13, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + PyList_SET_ITEM(__pyx_t_2, 14, ((PyObject *)__pyx_t_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_16)); + PyList_SET_ITEM(__pyx_t_2, 15, ((PyObject *)__pyx_t_17)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_17)); + PyList_SET_ITEM(__pyx_t_2, 16, ((PyObject *)__pyx_t_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + PyList_SET_ITEM(__pyx_t_2, 17, ((PyObject *)__pyx_t_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_19)); + PyList_SET_ITEM(__pyx_t_2, 18, ((PyObject *)__pyx_t_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_20)); + PyList_SET_ITEM(__pyx_t_2, 19, ((PyObject *)__pyx_t_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_21)); + PyList_SET_ITEM(__pyx_t_2, 20, ((PyObject *)__pyx_t_22)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_22)); + PyList_SET_ITEM(__pyx_t_2, 21, ((PyObject *)__pyx_t_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_23)); + PyList_SET_ITEM(__pyx_t_2, 22, ((PyObject *)__pyx_t_24)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_24)); + PyList_SET_ITEM(__pyx_t_2, 23, ((PyObject *)__pyx_t_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_25)); + PyList_SET_ITEM(__pyx_t_2, 24, ((PyObject *)__pyx_t_26)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_26)); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_18 = 0; + __pyx_t_19 = 0; + __pyx_t_20 = 0; + __pyx_t_21 = 0; + __pyx_t_22 = 0; + __pyx_t_23 = 0; + __pyx_t_24 = 0; + __pyx_t_25 = 0; + __pyx_t_26 = 0; + __pyx_t_26 = PyTuple_New(1); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + PyTuple_SET_ITEM(__pyx_t_26, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_26)); __pyx_t_26 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___ares_errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":113 + * + * # maps c-ares flag to _socket module flag + * _cares_flag_map = None # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s___cares_flag_map, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/ares.pyx":127 + * + * + * cpdef _convert_cares_flags(int flags, int default=cares.ARES_NI_LOOKUPHOST|cares.ARES_NI_LOOKUPSERVICE): # <<<<<<<<<<<<<< + * if _cares_flag_map is None: + * _prepare_cares_flag_map() + */ + __pyx_k_1 = (ARES_NI_LOOKUPHOST | ARES_NI_LOOKUPSERVICE); + + /* "gevent/ares.pyx":143 + * + * + * class InvalidIP(ValueError): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_26 = PyTuple_New(1); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + __Pyx_INCREF(__pyx_builtin_ValueError); + PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_builtin_ValueError); + __Pyx_GIVEREF(__pyx_builtin_ValueError); + __pyx_t_25 = __Pyx_CreateClass(((PyObject *)__pyx_t_26), ((PyObject *)__pyx_t_2), __pyx_n_s__InvalidIP, __pyx_n_s__InvalidIP, __pyx_n_s_18); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(((PyObject *)__pyx_t_26)); __pyx_t_26 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__InvalidIP, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":180 + * + * + * class ares_host_result(tuple): # <<<<<<<<<<<<<< + * + * def __new__(cls, family, iterable): + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "gevent/ares.pyx":182 + * class ares_host_result(tuple): + * + * def __new__(cls, family, iterable): # <<<<<<<<<<<<<< + * cdef object self = tuple.__new__(cls, iterable) + * self.family = family + */ + __pyx_t_25 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_4ares_16ares_host_result_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_22, NULL, __pyx_n_s_18, ((PyObject *)__pyx_k_codeobj_20)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____new__, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + + /* "gevent/ares.pyx":187 + * return self + * + * def __getnewargs__(self): # <<<<<<<<<<<<<< + * return (self.family, tuple(self)) + * + */ + __pyx_t_25 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_4ares_16ares_host_result_3__getnewargs__, 0, __pyx_n_s_25, NULL, __pyx_n_s_18, ((PyObject *)__pyx_k_codeobj_24)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____getnewargs__, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + + /* "gevent/ares.pyx":180 + * + * + * class ares_host_result(tuple): # <<<<<<<<<<<<<< + * + * def __new__(cls, family, iterable): + */ + __pyx_t_25 = PyTuple_New(1); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyTuple_Type)))); + PyTuple_SET_ITEM(__pyx_t_25, 0, ((PyObject *)((PyObject*)(&PyTuple_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyTuple_Type)))); + __pyx_t_26 = __Pyx_CreateClass(((PyObject *)__pyx_t_25), ((PyObject *)__pyx_t_2), __pyx_n_s__ares_host_result, __pyx_n_s__ares_host_result, __pyx_n_s_18); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(((PyObject *)__pyx_t_25)); __pyx_t_25 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ares_host_result, __pyx_t_26) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "gevent/ares.pyx":388 + * cares.ares_process_fd(self.channel, read_fd, write_fd) + * + * def gethostbyname(self, object callback, char* name, int family=AF_INET): # <<<<<<<<<<<<<< + * if not self.channel: + * raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') + */ + __pyx_k_11 = AF_INET; + + /* "gevent/ares.pyx":1 + * # Copyright (c) 2011-2012 Denis Bilenko. See LICENSE for details. # <<<<<<<<<<<<<< + * cimport cares + * import sys + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); + __Pyx_XDECREF(__pyx_t_24); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_XDECREF(__pyx_t_26); + if (__pyx_m) { + __Pyx_AddTraceback("init gevent.ares", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init gevent.ares"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_COMPILING_IN_CPYTHON +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + if (!r) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + goto bad; + PyErr_Clear(); + r = d; + Py_INCREF(d); + } + return r; +bad: + return NULL; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (DECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else + PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; + if (likely(nb) && likely(nb->nb_float)) { + float_value = nb->nb_float(obj); + if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) { + PyErr_Format(PyExc_TypeError, + "__float__ returned non-float (type %.200s)", + Py_TYPE(float_value)->tp_name); + Py_DECREF(float_value); + goto bad; + } + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } +#endif + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } else { + if (default_value == Py_None) + default_value = NULL; + value = PyObject_CallMethodObjArgs( + d, __pyx_n_s__get, key, default_value, NULL); + } +#endif + return value; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return -1; + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { +#else + if (is_list || PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) + value = Py_None; /* Mark as deleted */ + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + PyObject* dict = PyModule_GetDict(__pyx_m); + Py_XINCREF(dict); + return dict; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + Py_DECREF(res); + return 0; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */ +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + op->func_weakreflist = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (m->func_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return PyMethod_New(func, + type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +#if CYTHON_COMPILING_IN_PYPY +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + Py_ssize_t size; + switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + case METH_VARARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 0) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 1) + return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +#else +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return PyCFunction_Call(func, arg, kw); +} +#endif +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ + sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __Pyx_CyFunction_Call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/ + (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_CyFunction_methods, /*tp_methods*/ + __pyx_CyFunction_members, /*tp_members*/ + __pyx_CyFunction_getsets, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + __Pyx_CyFunction_descr_get, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static int __Pyx_CyFunction_init(void) { +#if !CYTHON_COMPILING_IN_PYPY + __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; +#endif + if (PyType_Ready(&__pyx_CyFunctionType_type) < 0) + return -1; + __pyx_CyFunctionType = &__pyx_CyFunctionType_type; + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { + PyObject *metaclass; +#if PY_MAJOR_VERSION < 3 + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__); + if (!metaclass) { + PyErr_Clear(); + metaclass = (PyObject*) Py_TYPE(base); + } + } else { + metaclass = (PyObject *) &PyClass_Type; + } +#else + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = (PyObject*) Py_TYPE(base); + } else { + metaclass = (PyObject *) &PyType_Type; + } +#endif + Py_INCREF(metaclass); + return metaclass; +} + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *qualname, PyObject *modname) { + PyObject *result; + PyObject *metaclass; + if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0) + return NULL; + if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0) + return NULL; + metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__); + if (metaclass) { + Py_INCREF(metaclass); + } else { + metaclass = __Pyx_FindPy2Metaclass(bases); + } + result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); + Py_DECREF(metaclass); + return result; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff -Nru python-gevent-0.13.7/gevent/gevent.ares.h python-gevent-1.0/gevent/gevent.ares.h --- python-gevent-0.13.7/gevent/gevent.ares.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent.ares.h 2013-11-26 16:26:18.000000000 +0000 @@ -0,0 +1,42 @@ +#ifndef __PYX_HAVE__gevent__ares +#define __PYX_HAVE__gevent__ares + +struct PyGeventAresChannelObject; + +/* "gevent/ares.pyx":235 + * + * + * cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresChannel_Type]: # <<<<<<<<<<<<<< + * + * cdef public object loop + */ +struct PyGeventAresChannelObject { + PyObject_HEAD + struct __pyx_vtabstruct_6gevent_4ares_channel *__pyx_vtab; + PyObject *loop; + struct ares_channeldata *channel; + PyObject *_watchers; + PyObject *_timer; +}; + +#ifndef __PYX_HAVE_API__gevent__ares + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventAresChannel_Type; + +#endif /* !__PYX_HAVE_API__gevent__ares */ + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initares(void); +#else +PyMODINIT_FUNC PyInit_ares(void); +#endif + +#endif /* !__PYX_HAVE__gevent__ares */ diff -Nru python-gevent-0.13.7/gevent/gevent.core.c python-gevent-1.0/gevent/gevent.core.c --- python-gevent-0.13.7/gevent/gevent.core.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent.core.c 2013-11-26 16:26:18.000000000 +0000 @@ -0,0 +1,45523 @@ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +/* Generated by cythonpp.py on 2013-11-26 17:25:45 */ +/* Generated by Cython 0.19 */ +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { +/* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__gevent__core +#define __PYX_HAVE_API__gevent__core +#include "libev_vfd.h" +#include "libev.h" +#include "frameobject.h" +#include "callbacks.h" +#include "stathelper.c" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "core.pyx", +}; + +/*--- Type declarations ---*/ +struct PyGeventWatcherObject; +struct PyGeventTimerObject; +struct PyGeventSignalObject; +struct PyGeventForkObject; +struct PyGeventStatObject; +struct PyGeventLoopObject; +struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr; +struct PyGeventIdleObject; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +struct PyGeventChildObject; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +struct PyGeventPrepareObject; +struct PyGeventCallbackObject; +struct PyGeventIOObject; +struct PyGeventAsyncObject; +struct __pyx_obj_6gevent_4core__EVENTSType; + +/* "gevent/core.pyx":664 + * + * + * cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Type]: # <<<<<<<<<<<<<< + * """Abstract base class for all the watchers""" + * + */ +struct PyGeventWatcherObject { + PyObject_HEAD +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventWatcher_Type; + +/* "gevent/core.pyx":874 + * + * + * cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventTimerObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_timer _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventTimer_Type; + +/* "gevent/core.pyx":1019 + * + * + * cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSignal_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventSignalObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_signal _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventSignal_Type; + +/* "gevent/core.pyx":1382 + * + * + * cdef public class fork(watcher) [object PyGeventForkObject, type PyGeventFork_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventForkObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_fork _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventFork_Type; + +/* "gevent/core.pyx":1772 + * + * + * cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventStatObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_stat _watcher; + PyObject *path; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventStat_Type; + +/* "gevent/core.pyx":229 + * + * + * cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: # <<<<<<<<<<<<<< + * cdef libev.ev_loop* _ptr + * cdef public object error_handler + */ +struct PyGeventLoopObject { + PyObject_HEAD + struct __pyx_vtabstruct_6gevent_4core_loop *__pyx_vtab; + struct ev_loop *_ptr; + PyObject *error_handler; + struct ev_prepare _prepare; + PyObject *_callbacks; + struct ev_timer _timer0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + struct ev_timer _periodic_signal_checker; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventLoop_Type; + +/* "gevent/core.pyx":111 + * + * + * _flags_str2int = dict((string, flag) for (flag, string) in _flags) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr { + PyObject_HEAD + PyObject *__pyx_v_flag; + PyObject *__pyx_v_string; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "gevent/core.pyx":1144 + * + * + * cdef public class idle(watcher) [object PyGeventIdleObject, type PyGeventIdle_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventIdleObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_idle _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventIdle_Type; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + +/* "gevent/core.pyx":1627 + * + * + * cdef public class child(watcher) [object PyGeventChildObject, type PyGeventChild_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventChildObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_child _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventChild_Type; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1263 + * + * + * cdef public class prepare(watcher) [object PyGeventPrepareObject, type PyGeventPrepare_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventPrepareObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_prepare _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventPrepare_Type; + +/* "gevent/core.pyx":596 + * + * + * cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: # <<<<<<<<<<<<<< + * cdef public object callback + * cdef public tuple args + */ +struct PyGeventCallbackObject { + PyObject_HEAD + PyObject *callback; + PyObject *args; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventCallback_Type; + +/* "gevent/core.pyx":689 + * + * + * cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventIOObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_io _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventIO_Type; + +/* "gevent/core.pyx":1501 + * + * + * cdef public class async(watcher) [object PyGeventAsyncObject, type PyGeventAsync_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventAsyncObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_async _watcher; +}; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventAsync_Type; + +/* "gevent/core.pyx":80 + * + * @cython.internal + * cdef class _EVENTSType: # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ +struct __pyx_obj_6gevent_4core__EVENTSType { + PyObject_HEAD +}; + + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyGeventLoop_Type; + +/* "gevent/core.pyx":229 + * + * + * cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: # <<<<<<<<<<<<<< + * cdef libev.ev_loop* _ptr + * cdef public object error_handler + */ + +struct __pyx_vtabstruct_6gevent_4core_loop { + PyObject *(*_run_callbacks)(struct PyGeventLoopObject *); + PyObject *(*handle_error)(struct PyGeventLoopObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*_default_handle_error)(struct PyGeventLoopObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6gevent_4core_loop *__pyx_vtabptr_6gevent_4core_loop; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) +#else +#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) +#endif + +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); + +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); + +#include + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) { + PyObject *method, *result = NULL; + if (unlikely(!args)) return NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; + result = PyObject_Call(method, args, NULL); + Py_DECREF(method); +bad: + Py_DECREF(args); + return result; +} +#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3)) +#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2)) +#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1)) +#define __Pyx_PyObject_CallMethod0(obj, name) \ + __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple)) + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#define __Pyx_Generator_USED +#include +#include +typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); +typedef struct { + PyObject_HEAD + __pyx_generator_body_t body; + PyObject *closure; + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + int resume_label; + char is_running; // using T_BOOL for property below requires char value +} __pyx_GeneratorObject; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure); +static int __pyx_Generator_init(void); +static int __Pyx_Generator_clear(PyObject* self); +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) +#endif + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cython' */ + +/* Module declarations from 'gevent.libev' */ + +/* Module declarations from 'gevent.python' */ + +/* Module declarations from 'gevent.core' */ +static PyTypeObject *__pyx_ptype_6gevent_4core__EVENTSType = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_loop = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_callback = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_watcher = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_io = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_timer = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_signal = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_idle = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_prepare = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_fork = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core_async = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyTypeObject *__pyx_ptype_6gevent_4core_child = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyTypeObject *__pyx_ptype_6gevent_4core_stat = 0; +static PyTypeObject *__pyx_ptype_6gevent_4core___pyx_scope_struct__genexpr = 0; +__PYX_EXTERN_C DL_EXPORT(PyObject) *GEVENT_CORE_EVENTS; +static int __pyx_v_6gevent_4core__default_loop_destroyed; +static PyObject *__pyx_f_6gevent_4core__flags_to_list(unsigned int, int __pyx_skip_dispatch); /*proto*/ +static unsigned int __pyx_f_6gevent_4core__flags_to_int(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__str_hex(PyObject *); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__check_flags(unsigned int, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__events_to_str(int, int __pyx_skip_dispatch); /*proto*/ +static void __pyx_f_6gevent_4core__syserr_cb(char *); /*proto*/ +static PyObject *__pyx_f_6gevent_4core_set_syserr_cb(PyObject *, int __pyx_skip_dispatch); /*proto*/ +#define __Pyx_MODULE_NAME "gevent.core" +int __pyx_module_is_main_gevent__core = 0; + +/* Implementation of 'gevent.core' */ +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_KeyError; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_sorted; +static PyObject *__pyx_builtin_hex; +static PyObject *__pyx_builtin_SystemError; +static PyObject *__pyx_builtin_id; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_builtin_AttributeError; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_builtin_TypeError; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_builtin_AttributeError; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_pf_6gevent_4core_22genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_11_EVENTSType___repr__(CYTHON_UNUSED struct __pyx_obj_6gevent_4core__EVENTSType *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_get_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2get_header_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4_flags_to_list(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6_flags_to_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8_check_flags(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_10_events_to_str(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_events); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_12supported_backends(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_14recommended_backends(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_16embeddable_backends(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_18time(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static int __pyx_pf_6gevent_4core_4loop___init__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_flags, PyObject *__pyx_v_default, size_t __pyx_v_ptr); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_2_stop_watchers(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_4destroy(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static void __pyx_pf_6gevent_4core_4loop_6__dealloc__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_3ptr___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_11WatcherType___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_6MAXPRI___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_6MINPRI___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_8_handle_syserr(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errno); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_10handle_error(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_12_default_handle_error(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_14run(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_nowait, PyObject *__pyx_v_once); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_16reinit(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_18ref(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_20unref(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_22break_(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_how); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_24verify(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_26now(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_28update(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_30__repr__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_7default___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_9iteration___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_5depth___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_11backend_int___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_7backend___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_10pendingcnt___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_32io(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_34timer(struct PyGeventLoopObject *__pyx_v_self, double __pyx_v_after, double __pyx_v_repeat, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_36signal(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_signum, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_38idle(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_40prepare(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_42fork(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_44async(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_46child(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_pid, int __pyx_v_trace, PyObject *__pyx_v_ref); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_48install_sigchld(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_50stat(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_52run_callback(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_54_format(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_46stat(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_48run_callback(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_50_format(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_56_format_details(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_58fileno(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_52_format_details(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_54fileno(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_pf_6gevent_4core_4loop_9activecnt___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_11sig_pending___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_pf_6gevent_4core_4loop_5sigfd___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_pf_6gevent_4core_4loop_9origflags___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_13origflags_int___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_pf_6gevent_4core_4loop_13error_handler___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4loop_13error_handler_2__set__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4loop_13error_handler_4__del__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4loop_10_callbacks___get__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4loop_10_callbacks_2__set__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4loop_10_callbacks_4__del__(struct PyGeventLoopObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_8callback___init__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_2stop(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_8callback_4__nonzero__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_7pending___get__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_6__repr__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_8_format(CYTHON_UNUSED struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_8callback___get__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_8callback_8callback_2__set__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_8callback_8callback_4__del__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_8callback_4args___get__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_8callback_4args_2__set__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_8callback_4args_4__del__(struct PyGeventCallbackObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7watcher___repr__(struct PyGeventWatcherObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7watcher_2_format(CYTHON_UNUSED struct PyGeventWatcherObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_3ref___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_3ref_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_8callback___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_8callback_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_stop(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_8priority___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_8priority_2__set__(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_2feed(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_4start(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_pass_events, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_6active___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_7pending___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static int __pyx_pf_6gevent_4core_2io_6__init__(struct PyGeventIOObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static int __pyx_pf_6gevent_4core_2io_6__init__(struct PyGeventIOObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, long __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_pf_6gevent_4core_2io_2fd___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_2fd_2__set__(struct PyGeventIOObject *__pyx_v_self, long __pyx_v_fd); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_6events___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_6events_2__set__(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_events); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_10events_str___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_8_format(struct PyGeventIOObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static int __pyx_pf_6gevent_4core_2io_10__cinit__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static void __pyx_pf_6gevent_4core_2io_12__dealloc__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_pf_6gevent_4core_2io_4loop___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_4loop_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_2io_4loop_4__del__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_4args___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_2io_4args_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_2io_4args_4__del__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_2io_6_flags___get__(struct PyGeventIOObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_3ref___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_3ref_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_8callback___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_8callback_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_stop(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_8priority___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_8priority_2__set__(struct PyGeventTimerObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_2feed(struct PyGeventTimerObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_4start(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_update, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_6active___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_7pending___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_6__init__(struct PyGeventTimerObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, double __pyx_v_after, double __pyx_v_repeat, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_2at___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_8again(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_update, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_4loop___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_4loop_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_4loop_4__del__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_4args___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_4args_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5timer_4args_4__del__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5timer_6_flags___get__(struct PyGeventTimerObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_3ref___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_3ref_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_8callback___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_8callback_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_stop(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_8priority___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_8priority_2__set__(struct PyGeventSignalObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_2feed(struct PyGeventSignalObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_4start(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_6active___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_7pending___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_6__init__(struct PyGeventSignalObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_signalnum, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_4loop___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_4loop_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_4loop_4__del__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_4args___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_4args_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_6signal_4args_4__del__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_6signal_6_flags___get__(struct PyGeventSignalObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_3ref___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_3ref_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_8callback___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_8callback_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_stop(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_8priority___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_8priority_2__set__(struct PyGeventIdleObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_2feed(struct PyGeventIdleObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_4start(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_6active___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_7pending___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_6__init__(struct PyGeventIdleObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_4loop___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_4loop_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_4loop_4__del__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_4args___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_4args_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4idle_4args_4__del__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4idle_6_flags___get__(struct PyGeventIdleObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_3ref___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_3ref_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_8callback___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_8callback_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_stop(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_8priority___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_8priority_2__set__(struct PyGeventPrepareObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_2feed(struct PyGeventPrepareObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_4start(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_6active___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_7pending___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_6__init__(struct PyGeventPrepareObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_4loop___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_4loop_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_4loop_4__del__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_4args___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_4args_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_7prepare_4args_4__del__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_7prepare_6_flags___get__(struct PyGeventPrepareObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_3ref___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_3ref_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_8callback___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_8callback_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_stop(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_8priority___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_8priority_2__set__(struct PyGeventForkObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_2feed(struct PyGeventForkObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_4start(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_6active___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_7pending___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_6__init__(struct PyGeventForkObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_4loop___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_4loop_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_4loop_4__del__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_4args___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_4args_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4fork_4args_4__del__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4fork_6_flags___get__(struct PyGeventForkObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_3ref___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_3ref_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_8callback___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_8callback_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_stop(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_8priority___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_8priority_2__set__(struct PyGeventAsyncObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_2feed(struct PyGeventAsyncObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_4start(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_6active___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_7pending___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_6__init__(struct PyGeventAsyncObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_8send(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_4loop___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_4loop_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5async_4loop_4__del__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_4args___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5async_4args_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5async_4args_4__del__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5async_6_flags___get__(struct PyGeventAsyncObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_5child_3ref___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_3ref_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_8callback___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_8callback_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_stop(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_8priority___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_8priority_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_2feed(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_4start(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_6active___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_7pending___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_6__init__(struct PyGeventChildObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_pid, int __pyx_v_trace, PyObject *__pyx_v_ref); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_8_format(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_3pid___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_4rpid___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_4rpid_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_7rstatus___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_7rstatus_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_4loop___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_4loop_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5child_4loop_4__del__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_4args___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_5child_4args_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_5child_4args_4__del__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_5child_6_flags___get__(struct PyGeventChildObject *__pyx_v_self); /* proto */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_pf_6gevent_4core_4stat_3ref___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_3ref_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_8callback___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_8callback_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_stop(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_8priority___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_8priority_2__set__(struct PyGeventStatObject *__pyx_v_self, int __pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_2feed(struct PyGeventStatObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4start(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_6active___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_7pending___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_6__init__(struct PyGeventStatObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4attr___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4prev___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_8interval___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4loop___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_4loop_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_4loop_4__del__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4args___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_4args_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6gevent_4core_4stat_4args_4__del__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_6_flags___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_4stat_4path___get__(struct PyGeventStatObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_4core_20set_syserr_cb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_tp_new_6gevent_4core__EVENTSType(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_loop(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_callback(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_watcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_io(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_timer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_signal(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_idle(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_prepare(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_fork(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core_async(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_tp_new_6gevent_4core_child(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_tp_new_6gevent_4core_stat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6gevent_4core___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_1[] = "gevent.core.EVENTS"; +static char __pyx_k_2[] = "libev-%d.%02d"; +static char __pyx_k_3[] = ","; +static char __pyx_k_5[] = "Invalid backend or flag: %s\nPossible values: %s"; +static char __pyx_k_6[] = ", "; +static char __pyx_k_7[] = "Invalid value for backend: 0x%x"; +static char __pyx_k_8[] = "Unsupported backend: %s"; +static char __pyx_k_9[] = "|"; +static char __pyx_k_10[] = "ev_default_loop(%s) failed"; +static char __pyx_k_11[] = "ev_loop_new(%s) failed"; +static char __pyx_k_12[] = ": "; +static char __pyx_k_13[] = "_default_handle_error"; +static char __pyx_k_16[] = "operation on destroyed loop"; +static char __pyx_k_25[] = "<%s at 0x%x %s>"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static char __pyx_k_42[] = " default"; +static char __pyx_k_43[] = " pending=%s"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static char __pyx_k_44[] = "<...>"; +static char __pyx_k_45[] = "<%s at 0x%x%s"; +static char __pyx_k_46[] = " pending"; +static char __pyx_k_47[] = " callback=%r"; +static char __pyx_k_48[] = " args=%r"; +static char __pyx_k_49[] = " stopped"; +static char __pyx_k_50[] = ">"; +static char __pyx_k_51[] = ""; +static char __pyx_k_52[] = " active"; +static char __pyx_k_54[] = "Expected callable, not %r"; +static char __pyx_k_56[] = "Cannot set priority of an active watcher"; +static char __pyx_k_61[] = "callback must be callable, not None"; +static char __pyx_k_64[] = "fd must be non-negative: %r"; +static char __pyx_k_65[] = "illegal event mask: %r"; +static char __pyx_k_66[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_68[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_70[] = " fd=%s events=%s"; +static char __pyx_k_79[] = "repeat must be positive or zero: %r"; +static char __pyx_k_89[] = "illegal signal number: %r"; +static char __pyx_k_126[] = "child watchers are only available on the default loop"; +static char __pyx_k_128[] = " pid=%r rstatus=%r"; +static char __pyx_k_136[] = "Expected callable or None, got %r"; +static char __pyx_k_138[] = "recommended_backends"; +static char __pyx_k_140[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_141[] = "gevent.core"; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static char __pyx_k_41[] = " default"; +static char __pyx_k_42[] = " pending=%s"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static char __pyx_k_43[] = "<...>"; +static char __pyx_k_44[] = "<%s at 0x%x%s"; +static char __pyx_k_45[] = " pending"; +static char __pyx_k_46[] = " callback=%r"; +static char __pyx_k_47[] = " args=%r"; +static char __pyx_k_48[] = " stopped"; +static char __pyx_k_49[] = ">"; +static char __pyx_k_50[] = ""; +static char __pyx_k_51[] = " active"; +static char __pyx_k_53[] = "Expected callable, not %r"; +static char __pyx_k_55[] = "Cannot set priority of an active watcher"; +static char __pyx_k_60[] = "callback must be callable, not None"; +static char __pyx_k_63[] = "illegal event mask: %r"; +static char __pyx_k_64[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_66[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_68[] = " fd=%s events=%s"; +static char __pyx_k_77[] = "repeat must be positive or zero: %r"; +static char __pyx_k_87[] = "illegal signal number: %r"; +static char __pyx_k_124[] = "Expected callable or None, got %r"; +static char __pyx_k_126[] = "recommended_backends"; +static char __pyx_k_128[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_129[] = "gevent.core"; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static char __pyx_k_44[] = ""; +static char __pyx_k_45[] = " ref="; +static char __pyx_k_46[] = " fileno="; +static char __pyx_k_47[] = " sigfd="; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static char __pyx_k_43[] = ""; +static char __pyx_k_44[] = " ref="; +static char __pyx_k_45[] = " fileno="; +static char __pyx_k_46[] = " sigfd="; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static char __pyx_k_52[] = "<...>"; +static char __pyx_k_53[] = "<%s at 0x%x%s"; +static char __pyx_k_54[] = " pending"; +static char __pyx_k_55[] = " callback=%r"; +static char __pyx_k_56[] = " args=%r"; +static char __pyx_k_57[] = " stopped"; +static char __pyx_k_58[] = ">"; +static char __pyx_k_59[] = " active"; +static char __pyx_k_61[] = "Expected callable, not %r"; +static char __pyx_k_63[] = "Cannot set priority of an active watcher"; +static char __pyx_k_68[] = "callback must be callable, not None"; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static char __pyx_k_71[] = "fd must be non-negative: %r"; +static char __pyx_k_72[] = "illegal event mask: %r"; +static char __pyx_k_73[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_75[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_77[] = " fd=%s events=%s"; +static char __pyx_k_86[] = "repeat must be positive or zero: %r"; +static char __pyx_k_96[] = "illegal signal number: %r"; +static char __pyx_k_133[] = "child watchers are only available on the default loop"; +static char __pyx_k_135[] = " pid=%r rstatus=%r"; +static char __pyx_k_143[] = "Expected callable or None, got %r"; +static char __pyx_k_145[] = "recommended_backends"; +static char __pyx_k_147[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_148[] = "gevent.core"; +static char __pyx_k_154[] = "EV_USE_CLOCK_SYSCALL"; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static char __pyx_k_43[] = ""; +static char __pyx_k_44[] = " ref="; +static char __pyx_k_45[] = " fileno="; +static char __pyx_k_46[] = " sigfd="; +static char __pyx_k_51[] = "<...>"; +static char __pyx_k_52[] = "<%s at 0x%x%s"; +static char __pyx_k_53[] = " pending"; +static char __pyx_k_54[] = " callback=%r"; +static char __pyx_k_55[] = " args=%r"; +static char __pyx_k_56[] = " stopped"; +static char __pyx_k_57[] = ">"; +static char __pyx_k_58[] = " active"; +static char __pyx_k_60[] = "Expected callable, not %r"; +static char __pyx_k_62[] = "Cannot set priority of an active watcher"; +static char __pyx_k_67[] = "callback must be callable, not None"; +static char __pyx_k_70[] = "illegal event mask: %r"; +static char __pyx_k_71[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_73[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_75[] = " fd=%s events=%s"; +static char __pyx_k_84[] = "repeat must be positive or zero: %r"; +static char __pyx_k_94[] = "illegal signal number: %r"; +static char __pyx_k_131[] = "Expected callable or None, got %r"; +static char __pyx_k_133[] = "recommended_backends"; +static char __pyx_k_135[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_136[] = "gevent.core"; +static char __pyx_k_142[] = "EV_USE_CLOCK_SYSCALL"; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static char __pyx_k_53[] = "<...>"; +static char __pyx_k_54[] = "<%s at 0x%x%s"; +static char __pyx_k_55[] = " pending"; +static char __pyx_k_56[] = " callback=%r"; +static char __pyx_k_57[] = " args=%r"; +static char __pyx_k_58[] = " stopped"; +static char __pyx_k_59[] = ">"; +static char __pyx_k_60[] = " active"; +static char __pyx_k_62[] = "Expected callable, not %r"; +static char __pyx_k_64[] = "Cannot set priority of an active watcher"; +static char __pyx_k_69[] = "callback must be callable, not None"; +static char __pyx_k_72[] = "fd must be non-negative: %r"; +static char __pyx_k_73[] = "illegal event mask: %r"; +static char __pyx_k_74[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_76[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_78[] = " fd=%s events=%s"; +static char __pyx_k_87[] = "repeat must be positive or zero: %r"; +static char __pyx_k_97[] = "illegal signal number: %r"; +static char __pyx_k_134[] = "child watchers are only available on the default loop"; +static char __pyx_k_136[] = " pid=%r rstatus=%r"; +static char __pyx_k_144[] = "Expected callable or None, got %r"; +static char __pyx_k_146[] = "recommended_backends"; +static char __pyx_k_148[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_149[] = "gevent.core"; +static char __pyx_k_155[] = "EV_USE_CLOCK_SYSCALL"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static char __pyx_k_71[] = "illegal event mask: %r"; +static char __pyx_k_72[] = "'io' watcher attribute 'fd' is read-only while watcher is active"; +static char __pyx_k_74[] = "'io' watcher attribute 'events' is read-only while watcher is active"; +static char __pyx_k_76[] = " fd=%s events=%s"; +static char __pyx_k_85[] = "repeat must be positive or zero: %r"; +static char __pyx_k_95[] = "illegal signal number: %r"; +static char __pyx_k_132[] = "Expected callable or None, got %r"; +static char __pyx_k_134[] = "recommended_backends"; +static char __pyx_k_136[] = "/tmp/gevent-make-dist/gevent/gevent/core.pyx"; +static char __pyx_k_137[] = "gevent.core"; +static char __pyx_k_143[] = "EV_USE_CLOCK_SYSCALL"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__fd[] = "fd"; +static char __pyx_k__id[] = "id"; +static char __pyx_k__os[] = "os"; +static char __pyx_k__tb[] = "tb"; +static char __pyx_k__hex[] = "hex"; +static char __pyx_k__how[] = "how"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static char __pyx_k__pid[] = "pid"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__ptr[] = "ptr"; +static char __pyx_k__ref[] = "ref"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__FORK[] = "FORK"; +static char __pyx_k__IDLE[] = "IDLE"; +static char __pyx_k__NONE[] = "NONE"; +static char __pyx_k__NSIG[] = "NSIG"; +static char __pyx_k__READ[] = "READ"; +static char __pyx_k__STAT[] = "STAT"; +static char __pyx_k__args[] = "args"; +static char __pyx_k__func[] = "func"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__keys[] = "keys"; +static char __pyx_k__loop[] = "loop"; +static char __pyx_k__once[] = "once"; +static char __pyx_k__path[] = "path"; +static char __pyx_k__poll[] = "poll"; +static char __pyx_k__port[] = "port"; +static char __pyx_k__send[] = "send"; +static char __pyx_k__time[] = "time"; +static char __pyx_k__type[] = "type"; +static char __pyx_k__ASYNC[] = "ASYNC"; +static char __pyx_k__CHECK[] = "CHECK"; +static char __pyx_k__CHILD[] = "CHILD"; +static char __pyx_k__EMBED[] = "EMBED"; +static char __pyx_k__ERROR[] = "ERROR"; +static char __pyx_k__TIMER[] = "TIMER"; +static char __pyx_k__UNDEF[] = "UNDEF"; +static char __pyx_k__WRITE[] = "WRITE"; +static char __pyx_k__after[] = "after"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__epoll[] = "epoll"; +static char __pyx_k__errno[] = "errno"; +static char __pyx_k__flags[] = "flags"; +static char __pyx_k__level[] = "level"; +static char __pyx_k__lower[] = "lower"; +static char __pyx_k__noenv[] = "noenv"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__sigfd[] = "sigfd"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__split[] = "split"; +static char __pyx_k__strip[] = "strip"; +static char __pyx_k__throw[] = "throw"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static char __pyx_k__trace[] = "trace"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__value[] = "value"; +static char __pyx_k__CUSTOM[] = "CUSTOM"; +static char __pyx_k__EVENTS[] = "EVENTS"; +static char __pyx_k__MAXPRI[] = "MAXPRI"; +static char __pyx_k__MINPRI[] = "MINPRI"; +static char __pyx_k__SIGNAL[] = "SIGNAL"; +static char __pyx_k___flags[] = "_flags"; +static char __pyx_k__active[] = "active"; +static char __pyx_k__events[] = "events"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__fileno[] = "fileno"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__kqueue[] = "kqueue"; +static char __pyx_k__nowait[] = "nowait"; +static char __pyx_k__repeat[] = "repeat"; +static char __pyx_k__select[] = "select"; +static char __pyx_k__signal[] = "signal"; +static char __pyx_k__signum[] = "signum"; +static char __pyx_k__sorted[] = "sorted"; +static char __pyx_k__update[] = "update"; +static char __pyx_k__CLEANUP[] = "CLEANUP"; +static char __pyx_k__PREPARE[] = "PREPARE"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k___events[] = "_events"; +static char __pyx_k___format[] = "_format"; +static char __pyx_k__backend[] = "backend"; +static char __pyx_k__context[] = "context"; +static char __pyx_k__default[] = "default"; +static char __pyx_k__message[] = "message"; +static char __pyx_k__pending[] = "pending"; +static char __pyx_k__revents[] = "revents"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static char __pyx_k__rstatus[] = "rstatus"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__KeyError[] = "KeyError"; +static char __pyx_k__PERIODIC[] = "PERIODIC"; +static char __pyx_k__SIGNALFD[] = "SIGNALFD"; +static char __pyx_k___IOFDSET[] = "_IOFDSET"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____name__[] = "__name__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__callback[] = "callback"; +static char __pyx_k__interval[] = "interval"; +static char __pyx_k__priority[] = "priority"; +static char __pyx_k__signalfd[] = "signalfd"; +static char __pyx_k__strerror[] = "strerror"; +static char __pyx_k__FORKCHECK[] = "FORKCHECK"; +static char __pyx_k__NOINOTIFY[] = "NOINOTIFY"; +static char __pyx_k__NOSIGMASK[] = "NOSIGMASK"; +static char __pyx_k__READWRITE[] = "READWRITE"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k____class__[] = "__class__"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__activecnt[] = "activecnt"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__destroyed[] = "destroyed"; +static char __pyx_k__forkcheck[] = "forkcheck"; +static char __pyx_k__noinotify[] = "noinotify"; +static char __pyx_k__nosigmask[] = "nosigmask"; +static char __pyx_k__print_exc[] = "print_exc"; +static char __pyx_k__signalnum[] = "signalnum"; +static char __pyx_k__traceback[] = "traceback"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__basestring[] = "basestring"; +static char __pyx_k__events_str[] = "events_str"; +static char __pyx_k__pendingcnt[] = "pendingcnt"; +static char __pyx_k__LIBEV_EMBED[] = "LIBEV_EMBED"; +static char __pyx_k__SystemError[] = "SystemError"; +static char __pyx_k__get_version[] = "get_version"; +static char __pyx_k__pass_events[] = "pass_events"; +static char __pyx_k__BACKEND_POLL[] = "BACKEND_POLL"; +static char __pyx_k__BACKEND_PORT[] = "BACKEND_PORT"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__EV_USE_4HEAP[] = "EV_USE_4HEAP"; +static char __pyx_k__EV_USE_FLOOR[] = "EV_USE_FLOOR"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k____builtins__[] = "__builtins__"; +static char __pyx_k__handle_error[] = "handle_error"; +static char __pyx_k__signalmodule[] = "signalmodule"; +static char __pyx_k__version_info[] = "version_info"; +static char __pyx_k__BACKEND_EPOLL[] = "BACKEND_EPOLL"; +static char __pyx_k__AttributeError[] = "AttributeError"; +static char __pyx_k__BACKEND_KQUEUE[] = "BACKEND_KQUEUE"; +static char __pyx_k__BACKEND_SELECT[] = "BACKEND_SELECT"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__EV_USE_EVENTFD[] = "EV_USE_EVENTFD"; +static char __pyx_k__EV_USE_INOTIFY[] = "EV_USE_INOTIFY"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k___flags_str2int[] = "_flags_str2int"; +static char __pyx_k___handle_syserr[] = "_handle_syserr"; +static char __pyx_k___stop_watchers[] = "_stop_watchers"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__EV_USE_REALTIME[] = "EV_USE_REALTIME"; +static char __pyx_k__EV_USE_SIGNALFD[] = "EV_USE_SIGNALFD"; +static char __pyx_k___format_details[] = "_format_details"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k__print_exception[] = "print_exception"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static char __pyx_k__EV_USE_MONOTONIC[] = "EV_USE_MONOTONIC"; +static char __pyx_k__EV_USE_NANOSLEEP[] = "EV_USE_NANOSLEEP"; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static char __pyx_k____SYSERR_CALLBACK[] = "__SYSERR_CALLBACK"; +static char __pyx_k__get_header_version[] = "get_header_version"; +static char __pyx_k__supported_backends[] = "supported_backends"; +static char __pyx_k__embeddable_backends[] = "embeddable_backends"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_kp_s_12; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_126; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_124; +static PyObject *__pyx_n_s_126; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_128; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_n_s_129; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s_13; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_134; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_132; +static PyObject *__pyx_n_s_134; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_136; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_n_s_138; +static PyObject *__pyx_kp_s_140; +static PyObject *__pyx_n_s_141; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_133; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_131; +static PyObject *__pyx_n_s_133; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_135; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_143; +static PyObject *__pyx_n_s_145; +static PyObject *__pyx_kp_s_147; +static PyObject *__pyx_n_s_148; +static PyObject *__pyx_n_s_154; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_n_s_136; +static PyObject *__pyx_n_s_142; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_144; +static PyObject *__pyx_n_s_146; +static PyObject *__pyx_kp_s_148; +static PyObject *__pyx_n_s_149; +static PyObject *__pyx_n_s_155; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_n_s_137; +static PyObject *__pyx_n_s_143; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_25; +static PyObject *__pyx_kp_s_3; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_kp_s_41; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_42; +static PyObject *__pyx_kp_s_43; +static PyObject *__pyx_kp_s_44; +static PyObject *__pyx_kp_s_45; +static PyObject *__pyx_kp_s_46; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_47; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_48; +static PyObject *__pyx_kp_s_49; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_5; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_50; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_51; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_52; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_53; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_54; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_55; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_56; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_53; +static PyObject *__pyx_kp_s_55; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_57; +static PyObject *__pyx_kp_s_58; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_59; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_6; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_kp_s_61; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_kp_s_60; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_63; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_62; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_64; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_65; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_66; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_68; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_62; +static PyObject *__pyx_kp_s_67; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_69; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_7; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_70; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_79; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_71; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_72; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_73; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_75; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_77; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_kp_s_74; +static PyObject *__pyx_kp_s_76; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_78; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_8; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_89; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_87; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_86; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_84; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_85; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_kp_s_9; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_96; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_94; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_kp_s_97; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_kp_s_95; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__ASYNC; +static PyObject *__pyx_n_s__AttributeError; +static PyObject *__pyx_n_s__BACKEND_EPOLL; +static PyObject *__pyx_n_s__BACKEND_KQUEUE; +static PyObject *__pyx_n_s__BACKEND_POLL; +static PyObject *__pyx_n_s__BACKEND_PORT; +static PyObject *__pyx_n_s__BACKEND_SELECT; +static PyObject *__pyx_n_s__CHECK; +static PyObject *__pyx_n_s__CHILD; +static PyObject *__pyx_n_s__CLEANUP; +static PyObject *__pyx_n_s__CUSTOM; +static PyObject *__pyx_n_s__EMBED; +static PyObject *__pyx_n_s__ERROR; +static PyObject *__pyx_n_s__EVENTS; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_n_s__EV_USE_4HEAP; +static PyObject *__pyx_n_s__EV_USE_EVENTFD; +static PyObject *__pyx_n_s__EV_USE_FLOOR; +static PyObject *__pyx_n_s__EV_USE_INOTIFY; +static PyObject *__pyx_n_s__EV_USE_MONOTONIC; +static PyObject *__pyx_n_s__EV_USE_NANOSLEEP; +static PyObject *__pyx_n_s__EV_USE_REALTIME; +static PyObject *__pyx_n_s__EV_USE_SIGNALFD; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__FORK; +static PyObject *__pyx_n_s__FORKCHECK; +static PyObject *__pyx_n_s__IDLE; +static PyObject *__pyx_n_s__KeyError; +static PyObject *__pyx_n_s__LIBEV_EMBED; +static PyObject *__pyx_n_s__MAXPRI; +static PyObject *__pyx_n_s__MINPRI; +static PyObject *__pyx_n_s__NOINOTIFY; +static PyObject *__pyx_n_s__NONE; +static PyObject *__pyx_n_s__NOSIGMASK; +static PyObject *__pyx_n_s__NSIG; +static PyObject *__pyx_n_s__PERIODIC; +static PyObject *__pyx_n_s__PREPARE; +static PyObject *__pyx_n_s__READ; +static PyObject *__pyx_n_s__READWRITE; +static PyObject *__pyx_n_s__SIGNAL; +static PyObject *__pyx_n_s__SIGNALFD; +static PyObject *__pyx_n_s__STAT; +static PyObject *__pyx_n_s__SystemError; +static PyObject *__pyx_n_s__TIMER; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__UNDEF; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__WRITE; +static PyObject *__pyx_n_s___IOFDSET; +static PyObject *__pyx_n_s____SYSERR_CALLBACK; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____builtins__; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____name__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___events; +static PyObject *__pyx_n_s___flags; +static PyObject *__pyx_n_s___flags_str2int; +static PyObject *__pyx_n_s___format; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_n_s___format_details; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s___handle_syserr; +static PyObject *__pyx_n_s___stop_watchers; +static PyObject *__pyx_n_s__active; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_n_s__activecnt; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__after; +static PyObject *__pyx_n_s__args; +static PyObject *__pyx_n_s__backend; +static PyObject *__pyx_n_s__basestring; +static PyObject *__pyx_n_s__callback; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__context; +static PyObject *__pyx_n_s__default; +static PyObject *__pyx_n_s__destroyed; +static PyObject *__pyx_n_s__embeddable_backends; +static PyObject *__pyx_n_s__epoll; +static PyObject *__pyx_n_s__errno; +static PyObject *__pyx_n_s__events; +static PyObject *__pyx_n_s__events_str; +static PyObject *__pyx_n_s__fd; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_n_s__fileno; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__flags; +static PyObject *__pyx_n_s__forkcheck; +static PyObject *__pyx_n_s__func; +static PyObject *__pyx_n_s__get_header_version; +static PyObject *__pyx_n_s__get_version; +static PyObject *__pyx_n_s__handle_error; +static PyObject *__pyx_n_s__hex; +static PyObject *__pyx_n_s__how; +static PyObject *__pyx_n_s__id; +static PyObject *__pyx_n_s__interval; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__keys; +static PyObject *__pyx_n_s__kqueue; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__loop; +static PyObject *__pyx_n_s__lower; +static PyObject *__pyx_n_s__message; +static PyObject *__pyx_n_s__noenv; +static PyObject *__pyx_n_s__noinotify; +static PyObject *__pyx_n_s__nosigmask; +static PyObject *__pyx_n_s__nowait; +static PyObject *__pyx_n_s__once; +static PyObject *__pyx_n_s__os; +static PyObject *__pyx_n_s__pass_events; +static PyObject *__pyx_n_s__path; +static PyObject *__pyx_n_s__pending; +static PyObject *__pyx_n_s__pendingcnt; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_n_s__pid; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__poll; +static PyObject *__pyx_n_s__port; +static PyObject *__pyx_n_s__print_exc; +static PyObject *__pyx_n_s__print_exception; +static PyObject *__pyx_n_s__priority; +static PyObject *__pyx_n_s__ptr; +static PyObject *__pyx_n_s__ref; +static PyObject *__pyx_n_s__repeat; +static PyObject *__pyx_n_s__revents; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_n_s__rstatus; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__select; +static PyObject *__pyx_n_s__send; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_n_s__sigfd; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__signal; +static PyObject *__pyx_n_s__signalfd; +static PyObject *__pyx_n_s__signalmodule; +static PyObject *__pyx_n_s__signalnum; +static PyObject *__pyx_n_s__signum; +static PyObject *__pyx_n_s__sorted; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__strerror; +static PyObject *__pyx_n_s__strip; +static PyObject *__pyx_n_s__supported_backends; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__tb; +static PyObject *__pyx_n_s__throw; +static PyObject *__pyx_n_s__time; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_n_s__trace; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_n_s__traceback; +static PyObject *__pyx_n_s__type; +static PyObject *__pyx_n_s__update; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__version_info; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_3; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_int_neg_1; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_14; +static PyObject *__pyx_k_15; +static int __pyx_k_20; +static PyObject *__pyx_k_32; +static PyObject *__pyx_k_33; +static PyObject *__pyx_k_34; +static PyObject *__pyx_k_35; +static PyObject *__pyx_k_36; +static PyObject *__pyx_k_37; +static PyObject *__pyx_k_38; +static PyObject *__pyx_k_39; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_40; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_59; +static PyObject *__pyx_k_63; +static PyObject *__pyx_k_75; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_58; +static PyObject *__pyx_k_62; +static PyObject *__pyx_k_73; +static PyObject *__pyx_k_76; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_78; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_65; +static PyObject *__pyx_k_69; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_80; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_67; +static PyObject *__pyx_k_71; +static PyObject *__pyx_k_83; +static PyObject *__pyx_k_86; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_88; +static PyObject *__pyx_k_96; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_66; +static PyObject *__pyx_k_70; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_82; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_83; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_85; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_87; +static PyObject *__pyx_k_95; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_103; +static PyObject *__pyx_k_110; +static PyObject *__pyx_k_117; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_104; +static PyObject *__pyx_k_111; +static PyObject *__pyx_k_118; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_125; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_135; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_81; +static PyObject *__pyx_k_84; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_86; +static PyObject *__pyx_k_94; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_93; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_101; +static PyObject *__pyx_k_108; +static PyObject *__pyx_k_115; +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_102; +static PyObject *__pyx_k_109; +static PyObject *__pyx_k_116; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_123; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_124; +static PyObject *__pyx_k_132; +static PyObject *__pyx_k_142; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_122; +static PyObject *__pyx_k_130; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_133; +static PyObject *__pyx_k_143; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_131; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_31; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_41; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_55; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_tuple_40; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_52; +static PyObject *__pyx_k_tuple_54; +static PyObject *__pyx_k_tuple_56; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_57; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_58; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_47; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_48; +static PyObject *__pyx_k_tuple_49; +static PyObject *__pyx_k_tuple_50; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_51; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_60; +static PyObject *__pyx_k_tuple_62; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_tuple_59; +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_52; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_tuple_61; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_63; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_64; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_65; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_67; +static PyObject *__pyx_k_tuple_69; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_70; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_71; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_66; +static PyObject *__pyx_k_tuple_68; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_72; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_73; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_74; +#endif /* (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_76; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_70; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_75; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_77; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_75; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_78; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_79; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_80; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_81; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_82; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_83; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_84; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_85; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_86; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_87; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_tuple_88; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_89; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_90; +static PyObject *__pyx_k_tuple_91; +static PyObject *__pyx_k_tuple_92; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_93; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_94; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_95; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_k_tuple_96; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_97; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_98; +static PyObject *__pyx_k_tuple_99; +static PyObject *__pyx_k_tuple_100; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_101; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_102; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_103; +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_104; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_105; +static PyObject *__pyx_k_tuple_106; +static PyObject *__pyx_k_tuple_107; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_108; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_109; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_110; +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_111; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_112; +static PyObject *__pyx_k_tuple_113; +static PyObject *__pyx_k_tuple_114; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_115; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_116; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_117; +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_118; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_k_tuple_119; +static PyObject *__pyx_k_tuple_120; +static PyObject *__pyx_k_tuple_121; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_122; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_123; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_124; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_125; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_126; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_127; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_128; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_129; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_k_tuple_130; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_131; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_132; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_133; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_134; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_136; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_135; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_137; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_134; +static PyObject *__pyx_k_codeobj_137; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_135; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_138; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_139; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_codeobj_142; +static PyObject *__pyx_k_codeobj_143; +static PyObject *__pyx_k_codeobj_144; +static PyObject *__pyx_k_codeobj_145; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_138; +static PyObject *__pyx_k_tuple_139; +static PyObject *__pyx_k_tuple_140; +static PyObject *__pyx_k_tuple_141; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_144; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_k_codeobj_146; +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_tuple_125; +static PyObject *__pyx_k_codeobj_127; +static PyObject *__pyx_k_codeobj_130; +static PyObject *__pyx_k_codeobj_131; +static PyObject *__pyx_k_codeobj_132; +static PyObject *__pyx_k_codeobj_133; +static PyObject *__pyx_k_codeobj_134; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_codeobj_149; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_tuple_142; +static PyObject *__pyx_k_tuple_145; +static PyObject *__pyx_k_codeobj_147; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_codeobj_150; +static PyObject *__pyx_k_codeobj_151; +static PyObject *__pyx_k_codeobj_152; +static PyObject *__pyx_k_codeobj_153; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_140; +static PyObject *__pyx_k_codeobj_141; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_k_codeobj_154; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_k_codeobj_142; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_gb_6gevent_4core_24generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "gevent/core.pyx":111 + * + * + * _flags_str2int = dict((string, flag) for (flag, string) in _flags) # <<<<<<<<<<<<<< + * + * + */ + +static PyObject *__pyx_pf_6gevent_4core_22genexpr(CYTHON_UNUSED PyObject *__pyx_self) { + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)__pyx_tp_new_6gevent_4core___pyx_scope_struct__genexpr(__pyx_ptype_6gevent_4core___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_6gevent_4core_24generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_6gevent_4core_24generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L8_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_flag); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_flag); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_flag = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_string); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_string); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_string = __pyx_t_6; + __pyx_t_6 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_string); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_string); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_string); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_flag); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_flag); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_flag); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L8_resume_from_yield:; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} +PyObject *GEVENT_CORE_EVENTS = 0; + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_11_EVENTSType_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_11_EVENTSType_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_11_EVENTSType___repr__(((struct __pyx_obj_6gevent_4core__EVENTSType *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":82 + * cdef class _EVENTSType: + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return 'gevent.core.EVENTS' + * + */ + +static PyObject *__pyx_pf_6gevent_4core_11_EVENTSType___repr__(CYTHON_UNUSED struct __pyx_obj_6gevent_4core__EVENTSType *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + +/* "gevent/core.pyx":83 + * + * def __repr__(self): + * return 'gevent.core.EVENTS' # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __pyx_r = ((PyObject *)__pyx_kp_s_1); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_1get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_1get_version = {__Pyx_NAMESTR("get_version"), (PyCFunction)__pyx_pw_6gevent_4core_1get_version, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_1get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_version (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_get_version(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":90 + * + * + * def get_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_get_version(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_version", 0); + +/* "gevent/core.pyx":91 + * + * def get_version(): + * return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_version_major()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(ev_version_minor()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.get_version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_3get_header_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_3get_header_version = {__Pyx_NAMESTR("get_header_version"), (PyCFunction)__pyx_pw_6gevent_4core_3get_header_version, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_3get_header_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_header_version (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2get_header_version(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":94 + * + * + * def get_header_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2get_header_version(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_header_version", 0); + +/* "gevent/core.pyx":95 + * + * def get_header_version(): + * return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(EV_VERSION_MAJOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(EV_VERSION_MINOR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.get_header_version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":132 + * + * + * cpdef _flags_to_list(unsigned int flags): # <<<<<<<<<<<<<< + * cdef list result = [] + * for code, value in _flags: + */ + +static PyObject *__pyx_pw_6gevent_4core_5_flags_to_list(PyObject *__pyx_self, PyObject *__pyx_arg_flags); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__flags_to_list(unsigned int __pyx_v_flags, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_result = 0; + PyObject *__pyx_v_code = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + int __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flags_to_list", 0); + +/* "gevent/core.pyx":133 + * + * cpdef _flags_to_list(unsigned int flags): + * cdef list result = [] # <<<<<<<<<<<<<< + * for code, value in _flags: + * if flags & code: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + +/* "gevent/core.pyx":134 + * cpdef _flags_to_list(unsigned int flags): + * cdef list result = [] + * for code, value in _flags: # <<<<<<<<<<<<<< + * if flags & code: + * result.append(value) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_code); + __pyx_v_code = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + +/* "gevent/core.pyx":135 + * cdef list result = [] + * for code, value in _flags: + * if flags & code: # <<<<<<<<<<<<<< + * result.append(value) + * flags &= ~code + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_And(__pyx_t_1, __pyx_v_code); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_9) { + +/* "gevent/core.pyx":136 + * for code, value in _flags: + * if flags & code: + * result.append(value) # <<<<<<<<<<<<<< + * flags &= ~code + * if not flags: + */ + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_value); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":137 + * if flags & code: + * result.append(value) + * flags &= ~code # <<<<<<<<<<<<<< + * if not flags: + * break + */ + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Invert(__pyx_v_code); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyNumber_InPlaceAnd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_5); if (unlikely((__pyx_t_11 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_flags = __pyx_t_11; + +/* "gevent/core.pyx":138 + * result.append(value) + * flags &= ~code + * if not flags: # <<<<<<<<<<<<<< + * break + * if flags: + */ + __pyx_t_9 = (!__pyx_v_flags); + if (__pyx_t_9) { + +/* "gevent/core.pyx":139 + * flags &= ~code + * if not flags: + * break # <<<<<<<<<<<<<< + * if flags: + * result.append(flags) + */ + goto __pyx_L4_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":140 + * if not flags: + * break + * if flags: # <<<<<<<<<<<<<< + * result.append(flags) + * return result + */ + if (__pyx_v_flags) { + +/* "gevent/core.pyx":141 + * break + * if flags: + * result.append(flags) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9; + } + __pyx_L9:; + +/* "gevent/core.pyx":142 + * if flags: + * result.append(flags) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent.core._flags_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_code); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5_flags_to_list(PyObject *__pyx_self, PyObject *__pyx_arg_flags); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5_flags_to_list(PyObject *__pyx_self, PyObject *__pyx_arg_flags) { + unsigned int __pyx_v_flags; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_flags_to_list (wrapper)", 0); + assert(__pyx_arg_flags); { + __pyx_v_flags = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_flags); if (unlikely((__pyx_v_flags == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core._flags_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4_flags_to_list(__pyx_self, ((unsigned int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":132 + * + * + * cpdef _flags_to_list(unsigned int flags): # <<<<<<<<<<<<<< + * cdef list result = [] + * for code, value in _flags: + */ + +static PyObject *__pyx_pf_6gevent_4core_4_flags_to_list(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_flags) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flags_to_list", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_list(__pyx_v_flags, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core._flags_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":151 + * + * + * cpdef unsigned int _flags_to_int(object flags) except? -1: # <<<<<<<<<<<<<< + * # Note, that order does not matter, libev has its own predefined order + * if not flags: + */ + +static PyObject *__pyx_pw_6gevent_4core_7_flags_to_int(PyObject *__pyx_self, PyObject *__pyx_v_flags); /*proto*/ +static unsigned int __pyx_f_6gevent_4core__flags_to_int(PyObject *__pyx_v_flags, CYTHON_UNUSED int __pyx_skip_dispatch) { + unsigned int __pyx_v_result; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_ex = NULL; + unsigned int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + unsigned int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flags_to_int", 0); + __Pyx_INCREF(__pyx_v_flags); + +/* "gevent/core.pyx":153 + * cpdef unsigned int _flags_to_int(object flags) except? -1: + * # Note, that order does not matter, libev has its own predefined order + * if not flags: # <<<<<<<<<<<<<< + * return 0 + * if isinstance(flags, (int, long)): + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flags); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + +/* "gevent/core.pyx":154 + * # Note, that order does not matter, libev has its own predefined order + * if not flags: + * return 0 # <<<<<<<<<<<<<< + * if isinstance(flags, (int, long)): + * return flags + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":155 + * if not flags: + * return 0 + * if isinstance(flags, (int, long)): # <<<<<<<<<<<<<< + * return flags + * cdef unsigned int result = 0 + */ + __Pyx_INCREF(__pyx_v_flags); + __pyx_t_3 = __pyx_v_flags; + __pyx_t_2 = PyInt_Check(__pyx_t_3); + if (!__pyx_t_2) { + __pyx_t_1 = PyLong_Check(__pyx_t_3); + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + +/* "gevent/core.pyx":156 + * return 0 + * if isinstance(flags, (int, long)): + * return flags # <<<<<<<<<<<<<< + * cdef unsigned int result = 0 + * try: + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_flags); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_5; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":157 + * if isinstance(flags, (int, long)): + * return flags + * cdef unsigned int result = 0 # <<<<<<<<<<<<<< + * try: + * if isinstance(flags, basestring): + */ + __pyx_v_result = 0; + +/* "gevent/core.pyx":158 + * return flags + * cdef unsigned int result = 0 + * try: # <<<<<<<<<<<<<< + * if isinstance(flags, basestring): + * flags = flags.split(',') + */ + { + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { + +/* "gevent/core.pyx":159 + * cdef unsigned int result = 0 + * try: + * if isinstance(flags, basestring): # <<<<<<<<<<<<<< + * flags = flags.split(',') + * for value in flags: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__basestring); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_IsInstance(__pyx_v_flags, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + +/* "gevent/core.pyx":160 + * try: + * if isinstance(flags, basestring): + * flags = flags.split(',') # <<<<<<<<<<<<<< + * for value in flags: + * value = value.strip().lower() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_flags, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_flags); + __pyx_v_flags = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L13; + } + __pyx_L13:; + +/* "gevent/core.pyx":161 + * if isinstance(flags, basestring): + * flags = flags.split(',') + * for value in flags: # <<<<<<<<<<<<<< + * value = value.strip().lower() + * if value: + */ + if (PyList_CheckExact(__pyx_v_flags) || PyTuple_CheckExact(__pyx_v_flags)) { + __pyx_t_9 = __pyx_v_flags; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_flags); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext; + } + for (;;) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_9)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_11(__pyx_t_9); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + +/* "gevent/core.pyx":162 + * flags = flags.split(',') + * for value in flags: + * value = value.strip().lower() # <<<<<<<<<<<<<< + * if value: + * result |= _flags_str2int[value] + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__lower); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_12; + __pyx_t_12 = 0; + +/* "gevent/core.pyx":163 + * for value in flags: + * value = value.strip().lower() + * if value: # <<<<<<<<<<<<<< + * result |= _flags_str2int[value] + * except KeyError, ex: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + if (__pyx_t_4) { + +/* "gevent/core.pyx":164 + * value = value.strip().lower() + * if value: + * result |= _flags_str2int[value] # <<<<<<<<<<<<<< + * except KeyError, ex: + * raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) + */ + __pyx_t_12 = PyLong_FromUnsignedLong(__pyx_v_result); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s___flags_str2int); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = PyObject_GetItem(__pyx_t_3, __pyx_v_value); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_InPlaceOr(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = __pyx_t_5; + goto __pyx_L16; + } + __pyx_L16:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + +/* "gevent/core.pyx":165 + * if value: + * result |= _flags_str2int[value] + * except KeyError, ex: # <<<<<<<<<<<<<< + * raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) + * return result + */ + __pyx_t_14 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_14) { + __Pyx_AddTraceback("gevent.core._flags_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_3, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_ex = __pyx_t_3; + +/* "gevent/core.pyx":166 + * result |= _flags_str2int[value] + * except KeyError, ex: + * raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s___flags_str2int); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__keys); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_16)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __Pyx_Raise(__pyx_t_15, 0, 0, 0); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L6_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_L12_try_end:; + } + +/* "gevent/core.pyx":167 + * except KeyError, ex: + * raise ValueError('Invalid backend or flag: %s\nPossible values: %s' % (ex, ', '.join(sorted(_flags_str2int.keys())))) + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("gevent.core._flags_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XDECREF(__pyx_v_flags); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7_flags_to_int(PyObject *__pyx_self, PyObject *__pyx_v_flags); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7_flags_to_int(PyObject *__pyx_self, PyObject *__pyx_v_flags) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_flags_to_int (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6_flags_to_int(__pyx_self, ((PyObject *)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":151 + * + * + * cpdef unsigned int _flags_to_int(object flags) except? -1: # <<<<<<<<<<<<<< + * # Note, that order does not matter, libev has its own predefined order + * if not flags: + */ + +static PyObject *__pyx_pf_6gevent_4core_6_flags_to_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_flags) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + unsigned int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flags_to_int", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_int(__pyx_v_flags, 0); if (unlikely(__pyx_t_1 == -1 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core._flags_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":170 + * + * + * cdef str _str_hex(object flag): # <<<<<<<<<<<<<< + * if isinstance(flag, (int, long)): + * return hex(flag) + */ + +static PyObject *__pyx_f_6gevent_4core__str_hex(PyObject *__pyx_v_flag) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_str_hex", 0); + +/* "gevent/core.pyx":171 + * + * cdef str _str_hex(object flag): + * if isinstance(flag, (int, long)): # <<<<<<<<<<<<<< + * return hex(flag) + * return str(flag) + */ + __Pyx_INCREF(__pyx_v_flag); + __pyx_t_1 = __pyx_v_flag; + __pyx_t_2 = PyInt_Check(__pyx_t_1); + if (!__pyx_t_2) { + __pyx_t_3 = PyLong_Check(__pyx_t_1); + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + +/* "gevent/core.pyx":172 + * cdef str _str_hex(object flag): + * if isinstance(flag, (int, long)): + * return hex(flag) # <<<<<<<<<<<<<< + * return str(flag) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_flag); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flag); + __Pyx_GIVEREF(__pyx_v_flag); + __pyx_t_5 = PyObject_Call(__pyx_builtin_hex, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":173 + * if isinstance(flag, (int, long)): + * return hex(flag) + * return str(flag) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_flag); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_flag); + __Pyx_GIVEREF(__pyx_v_flag); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core._str_hex", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":176 + * + * + * cpdef _check_flags(unsigned int flags): # <<<<<<<<<<<<<< + * cdef list as_list + * flags &= libev.EVBACKEND_MASK + */ + +static PyObject *__pyx_pw_6gevent_4core_9_check_flags(PyObject *__pyx_self, PyObject *__pyx_arg_flags); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__check_flags(unsigned int __pyx_v_flags, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_as_list = 0; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_flags", 0); + +/* "gevent/core.pyx":178 + * cpdef _check_flags(unsigned int flags): + * cdef list as_list + * flags &= libev.EVBACKEND_MASK # <<<<<<<<<<<<<< + * if not flags: + * return + */ + __pyx_v_flags = (__pyx_v_flags & EVBACKEND_MASK); + +/* "gevent/core.pyx":179 + * cdef list as_list + * flags &= libev.EVBACKEND_MASK + * if not flags: # <<<<<<<<<<<<<< + * return + * if not (flags & libev.EVBACKEND_ALL): + */ + __pyx_t_1 = (!__pyx_v_flags); + if (__pyx_t_1) { + +/* "gevent/core.pyx":180 + * flags &= libev.EVBACKEND_MASK + * if not flags: + * return # <<<<<<<<<<<<<< + * if not (flags & libev.EVBACKEND_ALL): + * raise ValueError('Invalid value for backend: 0x%x' % flags) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":181 + * if not flags: + * return + * if not (flags & libev.EVBACKEND_ALL): # <<<<<<<<<<<<<< + * raise ValueError('Invalid value for backend: 0x%x' % flags) + * if not (flags & libev.ev_supported_backends()): + */ + __pyx_t_1 = (!(__pyx_v_flags & EVBACKEND_ALL)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":182 + * return + * if not (flags & libev.EVBACKEND_ALL): + * raise ValueError('Invalid value for backend: 0x%x' % flags) # <<<<<<<<<<<<<< + * if not (flags & libev.ev_supported_backends()): + * as_list = [_str_hex(x) for x in _flags_to_list(flags)] + */ + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":183 + * if not (flags & libev.EVBACKEND_ALL): + * raise ValueError('Invalid value for backend: 0x%x' % flags) + * if not (flags & libev.ev_supported_backends()): # <<<<<<<<<<<<<< + * as_list = [_str_hex(x) for x in _flags_to_list(flags)] + * raise ValueError('Unsupported backend: %s' % '|'.join(as_list)) + */ + __pyx_t_1 = (!(__pyx_v_flags & ev_supported_backends())); + if (__pyx_t_1) { + +/* "gevent/core.pyx":184 + * raise ValueError('Invalid value for backend: 0x%x' % flags) + * if not (flags & libev.ev_supported_backends()): + * as_list = [_str_hex(x) for x in _flags_to_list(flags)] # <<<<<<<<<<<<<< + * raise ValueError('Unsupported backend: %s' % '|'.join(as_list)) + * + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_f_6gevent_4core__flags_to_list(__pyx_v_flags, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_f_6gevent_4core__str_hex(__pyx_v_x)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_as_list = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + +/* "gevent/core.pyx":185 + * if not (flags & libev.ev_supported_backends()): + * as_list = [_str_hex(x) for x in _flags_to_list(flags)] + * raise ValueError('Unsupported backend: %s' % '|'.join(as_list)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_9), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_as_list)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_as_list)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_as_list)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core._check_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_as_list); + __Pyx_XDECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_9_check_flags(PyObject *__pyx_self, PyObject *__pyx_arg_flags); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_9_check_flags(PyObject *__pyx_self, PyObject *__pyx_arg_flags) { + unsigned int __pyx_v_flags; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_check_flags (wrapper)", 0); + assert(__pyx_arg_flags); { + __pyx_v_flags = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_flags); if (unlikely((__pyx_v_flags == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core._check_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_8_check_flags(__pyx_self, ((unsigned int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":176 + * + * + * cpdef _check_flags(unsigned int flags): # <<<<<<<<<<<<<< + * cdef list as_list + * flags &= libev.EVBACKEND_MASK + */ + +static PyObject *__pyx_pf_6gevent_4core_8_check_flags(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_flags) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_flags", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__check_flags(__pyx_v_flags, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core._check_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":188 + * + * + * cpdef _events_to_str(int events): # <<<<<<<<<<<<<< + * cdef list result = [] + * cdef int c_flag + */ + +static PyObject *__pyx_pw_6gevent_4core_11_events_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_events); /*proto*/ +static PyObject *__pyx_f_6gevent_4core__events_to_str(int __pyx_v_events, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_result = 0; + int __pyx_v_c_flag; + PyObject *__pyx_v_flag = NULL; + PyObject *__pyx_v_string = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_events_to_str", 0); + +/* "gevent/core.pyx":189 + * + * cpdef _events_to_str(int events): + * cdef list result = [] # <<<<<<<<<<<<<< + * cdef int c_flag + * for (flag, string) in _events: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + +/* "gevent/core.pyx":191 + * cdef list result = [] + * cdef int c_flag + * for (flag, string) in _events: # <<<<<<<<<<<<<< + * c_flag = flag + * if events & c_flag: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___events); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_flag); + __pyx_v_flag = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_string); + __pyx_v_string = __pyx_t_6; + __pyx_t_6 = 0; + +/* "gevent/core.pyx":192 + * cdef int c_flag + * for (flag, string) in _events: + * c_flag = flag # <<<<<<<<<<<<<< + * if events & c_flag: + * result.append(string) + */ + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_flag); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_flag = __pyx_t_9; + +/* "gevent/core.pyx":193 + * for (flag, string) in _events: + * c_flag = flag + * if events & c_flag: # <<<<<<<<<<<<<< + * result.append(string) + * events = events & (~c_flag) + */ + __pyx_t_9 = (__pyx_v_events & __pyx_v_c_flag); + if (__pyx_t_9) { + +/* "gevent/core.pyx":194 + * c_flag = flag + * if events & c_flag: + * result.append(string) # <<<<<<<<<<<<<< + * events = events & (~c_flag) + * if not events: + */ + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_string); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":195 + * if events & c_flag: + * result.append(string) + * events = events & (~c_flag) # <<<<<<<<<<<<<< + * if not events: + * break + */ + __pyx_v_events = (__pyx_v_events & (~__pyx_v_c_flag)); + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":196 + * result.append(string) + * events = events & (~c_flag) + * if not events: # <<<<<<<<<<<<<< + * break + * if events: + */ + __pyx_t_11 = (!__pyx_v_events); + if (__pyx_t_11) { + +/* "gevent/core.pyx":197 + * events = events & (~c_flag) + * if not events: + * break # <<<<<<<<<<<<<< + * if events: + * result.append(hex(events)) + */ + goto __pyx_L4_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":198 + * if not events: + * break + * if events: # <<<<<<<<<<<<<< + * result.append(hex(events)) + * return '|'.join(result) + */ + if (__pyx_v_events) { + +/* "gevent/core.pyx":199 + * break + * if events: + * result.append(hex(events)) # <<<<<<<<<<<<<< + * return '|'.join(result) + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_hex, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9; + } + __pyx_L9:; + +/* "gevent/core.pyx":200 + * if events: + * result.append(hex(events)) + * return '|'.join(result) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_9), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent.core._events_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_flag); + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_11_events_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_events); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_11_events_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_events) { + int __pyx_v_events; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_events_to_str (wrapper)", 0); + assert(__pyx_arg_events); { + __pyx_v_events = __Pyx_PyInt_AsInt(__pyx_arg_events); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core._events_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_10_events_to_str(__pyx_self, ((int)__pyx_v_events)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":188 + * + * + * cpdef _events_to_str(int events): # <<<<<<<<<<<<<< + * cdef list result = [] + * cdef int c_flag + */ + +static PyObject *__pyx_pf_6gevent_4core_10_events_to_str(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_events) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_events_to_str", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__events_to_str(__pyx_v_events, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core._events_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_13supported_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_13supported_backends = {__Pyx_NAMESTR("supported_backends"), (PyCFunction)__pyx_pw_6gevent_4core_13supported_backends, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_13supported_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("supported_backends (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_12supported_backends(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":203 + * + * + * def supported_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_supported_backends()) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_12supported_backends(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("supported_backends", 0); + +/* "gevent/core.pyx":204 + * + * def supported_backends(): + * return _flags_to_list(libev.ev_supported_backends()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_list(ev_supported_backends(), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.supported_backends", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_15recommended_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_15recommended_backends = {__Pyx_NAMESTR("recommended_backends"), (PyCFunction)__pyx_pw_6gevent_4core_15recommended_backends, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_15recommended_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("recommended_backends (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_14recommended_backends(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":207 + * + * + * def recommended_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_recommended_backends()) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_14recommended_backends(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("recommended_backends", 0); + +/* "gevent/core.pyx":208 + * + * def recommended_backends(): + * return _flags_to_list(libev.ev_recommended_backends()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_list(ev_recommended_backends(), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.recommended_backends", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_17embeddable_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_17embeddable_backends = {__Pyx_NAMESTR("embeddable_backends"), (PyCFunction)__pyx_pw_6gevent_4core_17embeddable_backends, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_17embeddable_backends(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("embeddable_backends (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_16embeddable_backends(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":211 + * + * + * def embeddable_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_embeddable_backends()) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_16embeddable_backends(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("embeddable_backends", 0); + +/* "gevent/core.pyx":212 + * + * def embeddable_backends(): + * return _flags_to_list(libev.ev_embeddable_backends()) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_list(ev_embeddable_backends(), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.embeddable_backends", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_19time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_4core_19time = {__Pyx_NAMESTR("time"), (PyCFunction)__pyx_pw_6gevent_4core_19time, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_4core_19time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("time (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_18time(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":215 + * + * + * def time(): # <<<<<<<<<<<<<< + * return libev.ev_time() + * + */ + +static PyObject *__pyx_pf_6gevent_4core_18time(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("time", 0); + +/* "gevent/core.pyx":216 + * + * def time(): + * return libev.ev_time() # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(ev_time()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.time", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4loop_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_4loop_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_flags = 0; + PyObject *__pyx_v_default = 0; + size_t __pyx_v_ptr; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__default,&__pyx_n_s__ptr,0}; + PyObject* values[3] = {0,0,0}; + +/* "gevent/core.pyx":239 + * + * + * def __init__(self, object flags=None, object default=None, size_t ptr=0): # <<<<<<<<<<<<<< + * cdef unsigned int c_flags + * cdef object old_handler = None + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ptr); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_flags = values[0]; + __pyx_v_default = values[1]; + if (values[2]) { + __pyx_v_ptr = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_ptr == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_ptr = ((size_t)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop___init__(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_flags, __pyx_v_default, __pyx_v_ptr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4loop___init__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_flags, PyObject *__pyx_v_default, size_t __pyx_v_ptr) { + unsigned int __pyx_v_c_flags; + CYTHON_UNUSED PyObject *__pyx_v_old_handler = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + unsigned int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_default); + +/* "gevent/core.pyx":241 + * def __init__(self, object flags=None, object default=None, size_t ptr=0): + * cdef unsigned int c_flags + * cdef object old_handler = None # <<<<<<<<<<<<<< + * libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) + * + */ + __Pyx_INCREF(Py_None); + __pyx_v_old_handler = Py_None; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":242 + * cdef unsigned int c_flags + * cdef object old_handler = None + * libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) # <<<<<<<<<<<<<< + * + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":242 + * cdef unsigned int c_flags + * cdef object old_handler = None + * libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) # <<<<<<<<<<<<<< + * + * libev.ev_timer_init(&self._periodic_signal_checker, gevent_periodic_signal_check, 0.3, 0.3) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + ev_prepare_init((&__pyx_v_self->_prepare), ((void *)gevent_run_callbacks)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":246 + * + * + * libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) # <<<<<<<<<<<<<< + * if ptr: + * self._ptr = ptr + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":244 + * libev.ev_prepare_init(&self._prepare, gevent_run_callbacks) + * + * libev.ev_timer_init(&self._periodic_signal_checker, gevent_periodic_signal_check, 0.3, 0.3) # <<<<<<<<<<<<<< + * + * libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) + */ + ev_timer_init((&__pyx_v_self->_periodic_signal_checker), ((void *)gevent_periodic_signal_check), 0.3, 0.3); + +/* "gevent/core.pyx":246 + * libev.ev_timer_init(&self._periodic_signal_checker, gevent_periodic_signal_check, 0.3, 0.3) + * + * libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) # <<<<<<<<<<<<<< + * if ptr: + * self._ptr = ptr + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + ev_timer_init((&__pyx_v_self->_timer0), ((void *)gevent_noop), 0.0, 0.0); + +/* "gevent/core.pyx":247 + * + * libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) + * if ptr: # <<<<<<<<<<<<<< + * self._ptr = ptr + * else: + */ + if (__pyx_v_ptr) { + +/* "gevent/core.pyx":248 + * libev.ev_timer_init(&self._timer0, gevent_noop, 0.0, 0.0) + * if ptr: + * self._ptr = ptr # <<<<<<<<<<<<<< + * else: + * c_flags = _flags_to_int(flags) + */ + __pyx_v_self->_ptr = ((struct ev_loop *)__pyx_v_ptr); + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":250 + * self._ptr = ptr + * else: + * c_flags = _flags_to_int(flags) # <<<<<<<<<<<<<< + * _check_flags(c_flags) + * c_flags |= libev.EVFLAG_NOENV + */ + __pyx_t_1 = __pyx_f_6gevent_4core__flags_to_int(__pyx_v_flags, 0); if (unlikely(__pyx_t_1 == -1 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_flags = __pyx_t_1; + +/* "gevent/core.pyx":251 + * else: + * c_flags = _flags_to_int(flags) + * _check_flags(c_flags) # <<<<<<<<<<<<<< + * c_flags |= libev.EVFLAG_NOENV + * if default is None: + */ + __pyx_t_2 = __pyx_f_6gevent_4core__check_flags(__pyx_v_c_flags, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":252 + * c_flags = _flags_to_int(flags) + * _check_flags(c_flags) + * c_flags |= libev.EVFLAG_NOENV # <<<<<<<<<<<<<< + * if default is None: + * default = True + */ + __pyx_v_c_flags = (__pyx_v_c_flags | EVFLAG_NOENV); + +/* "gevent/core.pyx":253 + * _check_flags(c_flags) + * c_flags |= libev.EVFLAG_NOENV + * if default is None: # <<<<<<<<<<<<<< + * default = True + * if _default_loop_destroyed: + */ + __pyx_t_3 = (__pyx_v_default == Py_None); + if (__pyx_t_3) { + +/* "gevent/core.pyx":254 + * c_flags |= libev.EVFLAG_NOENV + * if default is None: + * default = True # <<<<<<<<<<<<<< + * if _default_loop_destroyed: + * default = False + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_default); + __pyx_v_default = __pyx_t_2; + __pyx_t_2 = 0; + +/* "gevent/core.pyx":255 + * if default is None: + * default = True + * if _default_loop_destroyed: # <<<<<<<<<<<<<< + * default = False + * if default: + */ + if (__pyx_v_6gevent_4core__default_loop_destroyed) { + +/* "gevent/core.pyx":256 + * default = True + * if _default_loop_destroyed: + * default = False # <<<<<<<<<<<<<< + * if default: + * self._ptr = libev.gevent_ev_default_loop(c_flags) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_default); + __pyx_v_default = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":257 + * if _default_loop_destroyed: + * default = False + * if default: # <<<<<<<<<<<<<< + * self._ptr = libev.gevent_ev_default_loop(c_flags) + * if not self._ptr: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_default); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + +/* "gevent/core.pyx":258 + * default = False + * if default: + * self._ptr = libev.gevent_ev_default_loop(c_flags) # <<<<<<<<<<<<<< + * if not self._ptr: + * raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) + */ + __pyx_v_self->_ptr = gevent_ev_default_loop(__pyx_v_c_flags); + +/* "gevent/core.pyx":259 + * if default: + * self._ptr = libev.gevent_ev_default_loop(c_flags) + * if not self._ptr: # <<<<<<<<<<<<<< + * raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) + * + */ + __pyx_t_3 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_3) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":260 + * self._ptr = libev.gevent_ev_default_loop(c_flags) + * if not self._ptr: + * raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) # <<<<<<<<<<<<<< + * + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":260 + * self._ptr = libev.gevent_ev_default_loop(c_flags) + * if not self._ptr: + * raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) # <<<<<<<<<<<<<< + * + * libev.ev_timer_start(self._ptr, &self._periodic_signal_checker) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_c_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_SystemError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + +/* "gevent/core.pyx":262 + * raise SystemError("ev_default_loop(%s) failed" % (c_flags, )) + * + * libev.ev_timer_start(self._ptr, &self._periodic_signal_checker) # <<<<<<<<<<<<<< + * libev.ev_unref(self._ptr) + * + */ + ev_timer_start(__pyx_v_self->_ptr, (&__pyx_v_self->_periodic_signal_checker)); + +/* "gevent/core.pyx":263 + * + * libev.ev_timer_start(self._ptr, &self._periodic_signal_checker) + * libev.ev_unref(self._ptr) # <<<<<<<<<<<<<< + * + * else: + */ + ev_unref(__pyx_v_self->_ptr); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L6; + } + /*else*/ { + +/* "gevent/core.pyx":266 + * + * else: + * self._ptr = libev.ev_loop_new(c_flags) # <<<<<<<<<<<<<< + * if not self._ptr: + * raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + */ + __pyx_v_self->_ptr = ev_loop_new(__pyx_v_c_flags); + +/* "gevent/core.pyx":267 + * else: + * self._ptr = libev.ev_loop_new(c_flags) + * if not self._ptr: # <<<<<<<<<<<<<< + * raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + * if default or __SYSERR_CALLBACK is None: + */ + __pyx_t_3 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_3) { + +/* "gevent/core.pyx":268 + * self._ptr = libev.ev_loop_new(c_flags) + * if not self._ptr: + * raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) # <<<<<<<<<<<<<< + * if default or __SYSERR_CALLBACK is None: + * set_syserr_cb(self._handle_syserr) + */ + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_c_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_SystemError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L6:; + +/* "gevent/core.pyx":269 + * if not self._ptr: + * raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + * if default or __SYSERR_CALLBACK is None: # <<<<<<<<<<<<<< + * set_syserr_cb(self._handle_syserr) + * libev.ev_prepare_start(self._ptr, &self._prepare) + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_default); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_3) { + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s____SYSERR_CALLBACK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (__pyx_t_2 == Py_None); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + +/* "gevent/core.pyx":270 + * raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) + * if default or __SYSERR_CALLBACK is None: + * set_syserr_cb(self._handle_syserr) # <<<<<<<<<<<<<< + * libev.ev_prepare_start(self._ptr, &self._prepare) + * libev.ev_unref(self._ptr) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___handle_syserr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_f_6gevent_4core_set_syserr_cb(__pyx_t_2, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9; + } + __pyx_L9:; + +/* "gevent/core.pyx":271 + * if default or __SYSERR_CALLBACK is None: + * set_syserr_cb(self._handle_syserr) + * libev.ev_prepare_start(self._ptr, &self._prepare) # <<<<<<<<<<<<<< + * libev.ev_unref(self._ptr) + * self._callbacks = [] + */ + ev_prepare_start(__pyx_v_self->_ptr, (&__pyx_v_self->_prepare)); + +/* "gevent/core.pyx":272 + * set_syserr_cb(self._handle_syserr) + * libev.ev_prepare_start(self._ptr, &self._prepare) + * libev.ev_unref(self._ptr) # <<<<<<<<<<<<<< + * self._callbacks = [] + * + */ + ev_unref(__pyx_v_self->_ptr); + } + __pyx_L3:; + +/* "gevent/core.pyx":273 + * libev.ev_prepare_start(self._ptr, &self._prepare) + * libev.ev_unref(self._ptr) + * self._callbacks = [] # <<<<<<<<<<<<<< + * + * cdef _run_callbacks(self): + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_v_self->_callbacks); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_callbacks)); + __pyx_v_self->_callbacks = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.loop.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_old_handler); + __Pyx_XDECREF(__pyx_v_default); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":275 + * self._callbacks = [] + * + * cdef _run_callbacks(self): # <<<<<<<<<<<<<< + * cdef callback cb + * cdef object callbacks + */ + +static PyObject *__pyx_f_6gevent_4core_4loop__run_callbacks(struct PyGeventLoopObject *__pyx_v_self) { + struct PyGeventCallbackObject *__pyx_v_cb = 0; + PyObject *__pyx_v_callbacks = 0; + int __pyx_v_count; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_run_callbacks", 0); + +/* "gevent/core.pyx":278 + * cdef callback cb + * cdef object callbacks + * cdef int count = 1000 # <<<<<<<<<<<<<< + * libev.ev_timer_stop(self._ptr, &self._timer0) + * while self._callbacks and count > 0: + */ + __pyx_v_count = 1000; + +/* "gevent/core.pyx":279 + * cdef object callbacks + * cdef int count = 1000 + * libev.ev_timer_stop(self._ptr, &self._timer0) # <<<<<<<<<<<<<< + * while self._callbacks and count > 0: + * callbacks = self._callbacks + */ + ev_timer_stop(__pyx_v_self->_ptr, (&__pyx_v_self->_timer0)); + +/* "gevent/core.pyx":280 + * cdef int count = 1000 + * libev.ev_timer_stop(self._ptr, &self._timer0) + * while self._callbacks and count > 0: # <<<<<<<<<<<<<< + * callbacks = self._callbacks + * self._callbacks = [] + */ + while (1) { + __pyx_t_1 = (((PyObject *)__pyx_v_self->_callbacks) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_callbacks)) != 0); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_count > 0); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + +/* "gevent/core.pyx":281 + * libev.ev_timer_stop(self._ptr, &self._timer0) + * while self._callbacks and count > 0: + * callbacks = self._callbacks # <<<<<<<<<<<<<< + * self._callbacks = [] + * for cb in callbacks: + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->_callbacks); + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_v_callbacks); + __pyx_v_callbacks = __pyx_t_4; + __pyx_t_4 = 0; + +/* "gevent/core.pyx":282 + * while self._callbacks and count > 0: + * callbacks = self._callbacks + * self._callbacks = [] # <<<<<<<<<<<<<< + * for cb in callbacks: + * libev.ev_unref(self._ptr) + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_v_self->_callbacks); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_callbacks)); + __pyx_v_self->_callbacks = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + +/* "gevent/core.pyx":283 + * callbacks = self._callbacks + * self._callbacks = [] + * for cb in callbacks: # <<<<<<<<<<<<<< + * libev.ev_unref(self._ptr) + * gevent_call(self, cb) + */ + if (PyList_CheckExact(__pyx_v_callbacks) || PyTuple_CheckExact(__pyx_v_callbacks)) { + __pyx_t_4 = __pyx_v_callbacks; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_callbacks); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6gevent_4core_callback))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_cb)); + __pyx_v_cb = ((struct PyGeventCallbackObject *)__pyx_t_7); + __pyx_t_7 = 0; + +/* "gevent/core.pyx":284 + * self._callbacks = [] + * for cb in callbacks: + * libev.ev_unref(self._ptr) # <<<<<<<<<<<<<< + * gevent_call(self, cb) + * count -= 1 + */ + ev_unref(__pyx_v_self->_ptr); + +/* "gevent/core.pyx":285 + * for cb in callbacks: + * libev.ev_unref(self._ptr) + * gevent_call(self, cb) # <<<<<<<<<<<<<< + * count -= 1 + * if self._callbacks: + */ + gevent_call(__pyx_v_self, __pyx_v_cb); + +/* "gevent/core.pyx":286 + * libev.ev_unref(self._ptr) + * gevent_call(self, cb) + * count -= 1 # <<<<<<<<<<<<<< + * if self._callbacks: + * libev.ev_timer_start(self._ptr, &self._timer0) + */ + __pyx_v_count = (__pyx_v_count - 1); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + +/* "gevent/core.pyx":287 + * gevent_call(self, cb) + * count -= 1 + * if self._callbacks: # <<<<<<<<<<<<<< + * libev.ev_timer_start(self._ptr, &self._timer0) + * + */ + __pyx_t_3 = (((PyObject *)__pyx_v_self->_callbacks) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_callbacks)) != 0); + if (__pyx_t_3) { + +/* "gevent/core.pyx":288 + * count -= 1 + * if self._callbacks: + * libev.ev_timer_start(self._ptr, &self._timer0) # <<<<<<<<<<<<<< + * + * def _stop_watchers(self): + */ + ev_timer_start(__pyx_v_self->_ptr, (&__pyx_v_self->_timer0)); + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent.core.loop._run_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_cb); + __Pyx_XDECREF(__pyx_v_callbacks); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_3_stop_watchers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_3_stop_watchers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_stop_watchers (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_2_stop_watchers(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":290 + * libev.ev_timer_start(self._ptr, &self._timer0) + * + * def _stop_watchers(self): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._prepare): + * libev.ev_ref(self._ptr) + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_2_stop_watchers(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("_stop_watchers", 0); + +/* "gevent/core.pyx":291 + * + * def _stop_watchers(self): + * if libev.ev_is_active(&self._prepare): # <<<<<<<<<<<<<< + * libev.ev_ref(self._ptr) + * libev.ev_prepare_stop(self._ptr, &self._prepare) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_prepare)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":292 + * def _stop_watchers(self): + * if libev.ev_is_active(&self._prepare): + * libev.ev_ref(self._ptr) # <<<<<<<<<<<<<< + * libev.ev_prepare_stop(self._ptr, &self._prepare) + * + */ + ev_ref(__pyx_v_self->_ptr); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":293 + * if libev.ev_is_active(&self._prepare): + * libev.ev_ref(self._ptr) + * libev.ev_prepare_stop(self._ptr, &self._prepare) # <<<<<<<<<<<<<< + * + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":293 + * if libev.ev_is_active(&self._prepare): + * libev.ev_ref(self._ptr) + * libev.ev_prepare_stop(self._ptr, &self._prepare) # <<<<<<<<<<<<<< + * + * if libev.ev_is_active(&self._periodic_signal_checker): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + ev_prepare_stop(__pyx_v_self->_ptr, (&__pyx_v_self->_prepare)); + goto __pyx_L3; + } + __pyx_L3:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + +/* "gevent/core.pyx":295 + * libev.ev_prepare_stop(self._ptr, &self._prepare) + * + * if libev.ev_is_active(&self._periodic_signal_checker): # <<<<<<<<<<<<<< + * libev.ev_ref(self._ptr) + * libev.ev_timer_stop(self._ptr, &self._periodic_signal_checker) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_periodic_signal_checker)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":296 + * + * if libev.ev_is_active(&self._periodic_signal_checker): + * libev.ev_ref(self._ptr) # <<<<<<<<<<<<<< + * libev.ev_timer_stop(self._ptr, &self._periodic_signal_checker) + * + */ + ev_ref(__pyx_v_self->_ptr); + +/* "gevent/core.pyx":297 + * if libev.ev_is_active(&self._periodic_signal_checker): + * libev.ev_ref(self._ptr) + * libev.ev_timer_stop(self._ptr, &self._periodic_signal_checker) # <<<<<<<<<<<<<< + * + * + */ + ev_timer_stop(__pyx_v_self->_ptr, (&__pyx_v_self->_periodic_signal_checker)); + goto __pyx_L4; + } + __pyx_L4:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_5destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_5destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("destroy (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_4destroy(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":300 + * + * + * def destroy(self): # <<<<<<<<<<<<<< + * global _default_loop_destroyed + * if self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_4destroy(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("destroy", 0); + +/* "gevent/core.pyx":302 + * def destroy(self): + * global _default_loop_destroyed + * if self._ptr: # <<<<<<<<<<<<<< + * self._stop_watchers() + * if __SYSERR_CALLBACK == self._handle_syserr: + */ + __pyx_t_1 = (__pyx_v_self->_ptr != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":303 + * global _default_loop_destroyed + * if self._ptr: + * self._stop_watchers() # <<<<<<<<<<<<<< + * if __SYSERR_CALLBACK == self._handle_syserr: + * set_syserr_cb(None) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___stop_watchers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +/* "gevent/core.pyx":304 + * if self._ptr: + * self._stop_watchers() + * if __SYSERR_CALLBACK == self._handle_syserr: # <<<<<<<<<<<<<< + * set_syserr_cb(None) + * if libev.ev_is_default_loop(self._ptr): + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s____SYSERR_CALLBACK); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___handle_syserr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":305 + * self._stop_watchers() + * if __SYSERR_CALLBACK == self._handle_syserr: + * set_syserr_cb(None) # <<<<<<<<<<<<<< + * if libev.ev_is_default_loop(self._ptr): + * _default_loop_destroyed = True + */ + __pyx_t_4 = __pyx_f_6gevent_4core_set_syserr_cb(Py_None, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":306 + * if __SYSERR_CALLBACK == self._handle_syserr: + * set_syserr_cb(None) + * if libev.ev_is_default_loop(self._ptr): # <<<<<<<<<<<<<< + * _default_loop_destroyed = True + * libev.ev_loop_destroy(self._ptr) + */ + __pyx_t_5 = ev_is_default_loop(__pyx_v_self->_ptr); + if (__pyx_t_5) { + +/* "gevent/core.pyx":307 + * set_syserr_cb(None) + * if libev.ev_is_default_loop(self._ptr): + * _default_loop_destroyed = True # <<<<<<<<<<<<<< + * libev.ev_loop_destroy(self._ptr) + * self._ptr = NULL + */ + __pyx_v_6gevent_4core__default_loop_destroyed = 1; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":308 + * if libev.ev_is_default_loop(self._ptr): + * _default_loop_destroyed = True + * libev.ev_loop_destroy(self._ptr) # <<<<<<<<<<<<<< + * self._ptr = NULL + * + */ + ev_loop_destroy(__pyx_v_self->_ptr); + +/* "gevent/core.pyx":309 + * _default_loop_destroyed = True + * libev.ev_loop_destroy(self._ptr) + * self._ptr = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->_ptr = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.loop.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_6gevent_4core_4loop_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6gevent_4core_4loop_7__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6gevent_4core_4loop_6__dealloc__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "gevent/core.pyx":311 + * self._ptr = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._ptr: + * self._stop_watchers() + */ + +static void __pyx_pf_6gevent_4core_4loop_6__dealloc__(struct PyGeventLoopObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__dealloc__", 0); + +/* "gevent/core.pyx":312 + * + * def __dealloc__(self): + * if self._ptr: # <<<<<<<<<<<<<< + * self._stop_watchers() + * if not libev.ev_is_default_loop(self._ptr): + */ + __pyx_t_1 = (__pyx_v_self->_ptr != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":313 + * def __dealloc__(self): + * if self._ptr: + * self._stop_watchers() # <<<<<<<<<<<<<< + * if not libev.ev_is_default_loop(self._ptr): + * libev.ev_loop_destroy(self._ptr) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___stop_watchers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +/* "gevent/core.pyx":314 + * if self._ptr: + * self._stop_watchers() + * if not libev.ev_is_default_loop(self._ptr): # <<<<<<<<<<<<<< + * libev.ev_loop_destroy(self._ptr) + * self._ptr = NULL + */ + __pyx_t_1 = (!ev_is_default_loop(__pyx_v_self->_ptr)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":315 + * self._stop_watchers() + * if not libev.ev_is_default_loop(self._ptr): + * libev.ev_loop_destroy(self._ptr) # <<<<<<<<<<<<<< + * self._ptr = NULL + * + */ + ev_loop_destroy(__pyx_v_self->_ptr); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":316 + * if not libev.ev_is_default_loop(self._ptr): + * libev.ev_loop_destroy(self._ptr) + * self._ptr = NULL # <<<<<<<<<<<<<< + * + * property ptr: + */ + __pyx_v_self->_ptr = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_3ptr_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_3ptr_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_3ptr___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":320 + * property ptr: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._ptr + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_3ptr___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":321 + * + * def __get__(self): + * return self._ptr # <<<<<<<<<<<<<< + * + * property WatcherType: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.loop.ptr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_11WatcherType_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_11WatcherType_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_11WatcherType___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":325 + * property WatcherType: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_11WatcherType___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":326 + * + * def __get__(self): + * return watcher # <<<<<<<<<<<<<< + * + * property MAXPRI: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_watcher))); + __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_watcher)); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_6MAXPRI_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_6MAXPRI_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_6MAXPRI___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":330 + * property MAXPRI: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.EV_MAXPRI + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_6MAXPRI___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":331 + * + * def __get__(self): + * return libev.EV_MAXPRI # <<<<<<<<<<<<<< + * + * property MINPRI: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(EV_MAXPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.loop.MAXPRI.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_6MINPRI_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_6MINPRI_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_6MINPRI___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":335 + * property MINPRI: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.EV_MINPRI + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_6MINPRI___get__(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":336 + * + * def __get__(self): + * return libev.EV_MINPRI # <<<<<<<<<<<<<< + * + * def _handle_syserr(self, message, errno): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(EV_MINPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.loop.MINPRI.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_9_handle_syserr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_9_handle_syserr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_message = 0; + PyObject *__pyx_v_errno = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_handle_syserr (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__message,&__pyx_n_s__errno,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__message)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errno)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_handle_syserr", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_handle_syserr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_message = values[0]; + __pyx_v_errno = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_handle_syserr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop._handle_syserr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_8_handle_syserr(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_message, __pyx_v_errno); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":338 + * return libev.EV_MINPRI + * + * def _handle_syserr(self, message, errno): # <<<<<<<<<<<<<< + * self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_8_handle_syserr(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errno) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_handle_syserr", 0); + +/* "gevent/core.pyx":339 + * + * def _handle_syserr(self, message, errno): + * self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) # <<<<<<<<<<<<<< + * + * cpdef handle_error(self, context, type, value, tb): + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_message, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__strerror); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_errno); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_errno); + __Pyx_GIVEREF(__pyx_v_errno); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_SystemError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_4core_loop *)__pyx_v_self->__pyx_vtab)->handle_error(__pyx_v_self, Py_None, __pyx_builtin_SystemError, __pyx_t_2, Py_None, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.loop._handle_syserr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":341 + * self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) + * + * cpdef handle_error(self, context, type, value, tb): # <<<<<<<<<<<<<< + * cdef object handle_error + * cdef object error_handler = self.error_handler + */ + +static PyObject *__pyx_pw_6gevent_4core_4loop_11handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6gevent_4core_4loop_handle_error(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb, int __pyx_skip_dispatch) { + PyObject *__pyx_v_handle_error = 0; + PyObject *__pyx_v_error_handler = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_error", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__handle_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6gevent_4core_4loop_11handle_error)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_tb); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_tb); + __Pyx_GIVEREF(__pyx_v_tb); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + +/* "gevent/core.pyx":343 + * cpdef handle_error(self, context, type, value, tb): + * cdef object handle_error + * cdef object error_handler = self.error_handler # <<<<<<<<<<<<<< + * if error_handler is not None: + * # we do want to do getattr every time so that setting Hub.handle_error property just works + */ + __pyx_t_1 = __pyx_v_self->error_handler; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_error_handler = __pyx_t_1; + __pyx_t_1 = 0; + +/* "gevent/core.pyx":344 + * cdef object handle_error + * cdef object error_handler = self.error_handler + * if error_handler is not None: # <<<<<<<<<<<<<< + * # we do want to do getattr every time so that setting Hub.handle_error property just works + * handle_error = getattr(error_handler, 'handle_error', error_handler) + */ + __pyx_t_4 = (__pyx_v_error_handler != Py_None); + if (__pyx_t_4) { + +/* "gevent/core.pyx":346 + * if error_handler is not None: + * # we do want to do getattr every time so that setting Hub.handle_error property just works + * handle_error = getattr(error_handler, 'handle_error', error_handler) # <<<<<<<<<<<<<< + * handle_error(context, type, value, tb) + * else: + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_error_handler, ((PyObject *)__pyx_n_s__handle_error), __pyx_v_error_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_handle_error = __pyx_t_1; + __pyx_t_1 = 0; + +/* "gevent/core.pyx":347 + * # we do want to do getattr every time so that setting Hub.handle_error property just works + * handle_error = getattr(error_handler, 'handle_error', error_handler) + * handle_error(context, type, value, tb) # <<<<<<<<<<<<<< + * else: + * self._default_handle_error(context, type, value, tb) + */ + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_tb); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_tb); + __Pyx_GIVEREF(__pyx_v_tb); + __pyx_t_3 = PyObject_Call(__pyx_v_handle_error, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":349 + * handle_error(context, type, value, tb) + * else: + * self._default_handle_error(context, type, value, tb) # <<<<<<<<<<<<<< + * + * cpdef _default_handle_error(self, context, type, value, tb): + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_4core_loop *)__pyx_v_self->__pyx_vtab)->_default_handle_error(__pyx_v_self, __pyx_v_context, __pyx_v_type, __pyx_v_value, __pyx_v_tb, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_handle_error); + __Pyx_XDECREF(__pyx_v_error_handler); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_11handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_11handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_context = 0; + PyObject *__pyx_v_type = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_tb = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle_error (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__type,&__pyx_n_s__value,&__pyx_n_s__tb,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("handle_error", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("handle_error", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("handle_error", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "handle_error") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_context = values[0]; + __pyx_v_type = values[1]; + __pyx_v_value = values[2]; + __pyx_v_tb = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("handle_error", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_10handle_error(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_context, __pyx_v_type, __pyx_v_value, __pyx_v_tb); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":341 + * self.handle_error(None, SystemError, SystemError(message + ': ' + os.strerror(errno)), None) + * + * cpdef handle_error(self, context, type, value, tb): # <<<<<<<<<<<<<< + * cdef object handle_error + * cdef object error_handler = self.error_handler + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_10handle_error(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_error", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_4core_loop *)__pyx_v_self->__pyx_vtab)->handle_error(__pyx_v_self, __pyx_v_context, __pyx_v_type, __pyx_v_value, __pyx_v_tb, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.loop.handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":351 + * self._default_handle_error(context, type, value, tb) + * + * cpdef _default_handle_error(self, context, type, value, tb): # <<<<<<<<<<<<<< + * # note: Hub sets its own error handler so this is not used by gevent + * # this is here to make core.loop usable without the rest of gevent + */ + +static PyObject *__pyx_pw_6gevent_4core_4loop_13_default_handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6gevent_4core_4loop__default_handle_error(struct PyGeventLoopObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_default_handle_error", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6gevent_4core_4loop_13_default_handle_error)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_tb); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_tb); + __Pyx_GIVEREF(__pyx_v_tb); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + +/* "gevent/core.pyx":354 + * # note: Hub sets its own error handler so this is not used by gevent + * # this is here to make core.loop usable without the rest of gevent + * traceback.print_exception(type, value, tb) # <<<<<<<<<<<<<< + * if self._ptr: + * libev.ev_break(self._ptr, libev.EVBREAK_ONE) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__traceback); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__print_exception); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_tb); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_tb); + __Pyx_GIVEREF(__pyx_v_tb); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":355 + * # this is here to make core.loop usable without the rest of gevent + * traceback.print_exception(type, value, tb) + * if self._ptr: # <<<<<<<<<<<<<< + * libev.ev_break(self._ptr, libev.EVBREAK_ONE) + * + */ + __pyx_t_4 = (__pyx_v_self->_ptr != 0); + if (__pyx_t_4) { + +/* "gevent/core.pyx":356 + * traceback.print_exception(type, value, tb) + * if self._ptr: + * libev.ev_break(self._ptr, libev.EVBREAK_ONE) # <<<<<<<<<<<<<< + * + * def run(self, nowait=False, once=False): + */ + ev_break(__pyx_v_self->_ptr, EVBREAK_ONE); + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop._default_handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_13_default_handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_13_default_handle_error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_context = 0; + PyObject *__pyx_v_type = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_tb = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_default_handle_error (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__type,&__pyx_n_s__value,&__pyx_n_s__tb,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_default_handle_error", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_default_handle_error", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_default_handle_error", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_default_handle_error") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_context = values[0]; + __pyx_v_type = values[1]; + __pyx_v_value = values[2]; + __pyx_v_tb = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_default_handle_error", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop._default_handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_12_default_handle_error(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_context, __pyx_v_type, __pyx_v_value, __pyx_v_tb); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":351 + * self._default_handle_error(context, type, value, tb) + * + * cpdef _default_handle_error(self, context, type, value, tb): # <<<<<<<<<<<<<< + * # note: Hub sets its own error handler so this is not used by gevent + * # this is here to make core.loop usable without the rest of gevent + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_12_default_handle_error(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_tb) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_default_handle_error", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_4core_loop *)__pyx_v_self->__pyx_vtab)->_default_handle_error(__pyx_v_self, __pyx_v_context, __pyx_v_type, __pyx_v_value, __pyx_v_tb, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.loop._default_handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_15run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_15run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_nowait = 0; + PyObject *__pyx_v_once = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("run (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nowait,&__pyx_n_s__once,0}; + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_14; + values[1] = __pyx_k_15; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nowait); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__once); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_nowait = values[0]; + __pyx_v_once = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("run", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_14run(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_nowait, __pyx_v_once); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":358 + * libev.ev_break(self._ptr, libev.EVBREAK_ONE) + * + * def run(self, nowait=False, once=False): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_14run(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_nowait, PyObject *__pyx_v_once) { + unsigned int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run", 0); + +/* "gevent/core.pyx":360 + * def run(self, nowait=False, once=False): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * cdef unsigned int flags = 0 + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":361 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef unsigned int flags = 0 + * if nowait: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":362 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * cdef unsigned int flags = 0 # <<<<<<<<<<<<<< + * if nowait: + * flags |= libev.EVRUN_NOWAIT + */ + __pyx_v_flags = 0; + +/* "gevent/core.pyx":363 + * raise ValueError('operation on destroyed loop') + * cdef unsigned int flags = 0 + * if nowait: # <<<<<<<<<<<<<< + * flags |= libev.EVRUN_NOWAIT + * if once: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nowait); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":364 + * cdef unsigned int flags = 0 + * if nowait: + * flags |= libev.EVRUN_NOWAIT # <<<<<<<<<<<<<< + * if once: + * flags |= libev.EVRUN_ONCE + */ + __pyx_v_flags = (__pyx_v_flags | EVRUN_NOWAIT); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":365 + * if nowait: + * flags |= libev.EVRUN_NOWAIT + * if once: # <<<<<<<<<<<<<< + * flags |= libev.EVRUN_ONCE + * with nogil: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_once); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":366 + * flags |= libev.EVRUN_NOWAIT + * if once: + * flags |= libev.EVRUN_ONCE # <<<<<<<<<<<<<< + * with nogil: + * libev.ev_run(self._ptr, flags) + */ + __pyx_v_flags = (__pyx_v_flags | EVRUN_ONCE); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":367 + * if once: + * flags |= libev.EVRUN_ONCE + * with nogil: # <<<<<<<<<<<<<< + * libev.ev_run(self._ptr, flags) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + +/* "gevent/core.pyx":368 + * flags |= libev.EVRUN_ONCE + * with nogil: + * libev.ev_run(self._ptr, flags) # <<<<<<<<<<<<<< + * + * def reinit(self): + */ + ev_run(__pyx_v_self->_ptr, __pyx_v_flags); + } + +/* "gevent/core.pyx":367 + * if once: + * flags |= libev.EVRUN_ONCE + * with nogil: # <<<<<<<<<<<<<< + * libev.ev_run(self._ptr, flags) + * + */ + /*finally:*/ { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_17reinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_17reinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reinit (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_16reinit(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":370 + * libev.ev_run(self._ptr, flags) + * + * def reinit(self): # <<<<<<<<<<<<<< + * if self._ptr: + * libev.ev_loop_fork(self._ptr) + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_16reinit(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("reinit", 0); + +/* "gevent/core.pyx":371 + * + * def reinit(self): + * if self._ptr: # <<<<<<<<<<<<<< + * libev.ev_loop_fork(self._ptr) + * + */ + __pyx_t_1 = (__pyx_v_self->_ptr != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":372 + * def reinit(self): + * if self._ptr: + * libev.ev_loop_fork(self._ptr) # <<<<<<<<<<<<<< + * + * def ref(self): + */ + ev_loop_fork(__pyx_v_self->_ptr); + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_19ref(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_19ref(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ref (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_18ref(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":374 + * libev.ev_loop_fork(self._ptr) + * + * def ref(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_18ref(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ref", 0); + +/* "gevent/core.pyx":376 + * def ref(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_ref(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":377 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_ref(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":378 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_ref(self._ptr) # <<<<<<<<<<<<<< + * + * def unref(self): + */ + ev_ref(__pyx_v_self->_ptr); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.ref", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_21unref(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_21unref(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unref (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_20unref(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":380 + * libev.ev_ref(self._ptr) + * + * def unref(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_20unref(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unref", 0); + +/* "gevent/core.pyx":382 + * def unref(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_unref(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":383 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_unref(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":384 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_unref(self._ptr) # <<<<<<<<<<<<<< + * + * def break_(self, int how=libev.EVBREAK_ONE): + */ + ev_unref(__pyx_v_self->_ptr); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.unref", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_23break_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_23break_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_how; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("break_ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__how,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__how); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "break_") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_how = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_how == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_how = __pyx_k_20; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("break_", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.break_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_22break_(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_how); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":386 + * libev.ev_unref(self._ptr) + * + * def break_(self, int how=libev.EVBREAK_ONE): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_22break_(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_how) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("break_", 0); + +/* "gevent/core.pyx":388 + * def break_(self, int how=libev.EVBREAK_ONE): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_break(self._ptr, how) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":389 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_break(self._ptr, how) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":390 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_break(self._ptr, how) # <<<<<<<<<<<<<< + * + * def verify(self): + */ + ev_break(__pyx_v_self->_ptr, __pyx_v_how); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.break_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_25verify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_25verify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("verify (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_24verify(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":392 + * libev.ev_break(self._ptr, how) + * + * def verify(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_24verify(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("verify", 0); + +/* "gevent/core.pyx":394 + * def verify(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_verify(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":395 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_verify(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":396 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_verify(self._ptr) # <<<<<<<<<<<<<< + * + * def now(self): + */ + ev_verify(__pyx_v_self->_ptr); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.verify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_27now(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_27now(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("now (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_26now(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":398 + * libev.ev_verify(self._ptr) + * + * def now(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_26now(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("now", 0); + +/* "gevent/core.pyx":400 + * def now(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return libev.ev_now(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":401 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_now(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":402 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return libev.ev_now(self._ptr) # <<<<<<<<<<<<<< + * + * def update(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyFloat_FromDouble(ev_now(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.now", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_29update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_29update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_28update(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":404 + * return libev.ev_now(self._ptr) + * + * def update(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_28update(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update", 0); + +/* "gevent/core.pyx":406 + * def update(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_now_update(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":407 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_now_update(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":408 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_now_update(self._ptr) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + ev_now_update(__pyx_v_self->_ptr); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_31__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_31__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_30__repr__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":410 + * libev.ev_now_update(self._ptr) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), self._format()) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_30__repr__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + +/* "gevent/core.pyx":411 + * + * def __repr__(self): + * return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), self._format()) # <<<<<<<<<<<<<< + * + * property default: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.loop.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_7default_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_7default_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_7default___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":415 + * property default: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_7default___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":417 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return True if libev.ev_is_default_loop(self._ptr) else False + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":418 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return True if libev.ev_is_default_loop(self._ptr) else False + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":419 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return True if libev.ev_is_default_loop(self._ptr) else False # <<<<<<<<<<<<<< + * + * property iteration: + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_default_loop(__pyx_v_self->_ptr)) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.default.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_9iteration_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_9iteration_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_9iteration___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":423 + * property iteration: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_9iteration___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":425 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return libev.ev_iteration(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":426 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_iteration(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":427 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return libev.ev_iteration(self._ptr) # <<<<<<<<<<<<<< + * + * property depth: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyLong_FromUnsignedLong(ev_iteration(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.iteration.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_5depth_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_5depth_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_5depth___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":431 + * property depth: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_5depth___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":433 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return libev.ev_depth(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":434 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_depth(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":435 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return libev.ev_depth(self._ptr) # <<<<<<<<<<<<<< + * + * property backend_int: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyLong_FromUnsignedLong(ev_depth(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.depth.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_11backend_int_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_11backend_int_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_11backend_int___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":439 + * property backend_int: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_11backend_int___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":441 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return libev.ev_backend(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":442 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_backend(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":443 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return libev.ev_backend(self._ptr) # <<<<<<<<<<<<<< + * + * property backend: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyLong_FromUnsignedLong(ev_backend(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.backend_int.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_7backend_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_7backend_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_7backend___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":447 + * property backend: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_7backend___get__(struct PyGeventLoopObject *__pyx_v_self) { + unsigned int __pyx_v_backend; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":449 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * cdef unsigned int backend = libev.ev_backend(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":450 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef unsigned int backend = libev.ev_backend(self._ptr) + * for key, value in _flags: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":451 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * cdef unsigned int backend = libev.ev_backend(self._ptr) # <<<<<<<<<<<<<< + * for key, value in _flags: + * if key == backend: + */ + __pyx_v_backend = ev_backend(__pyx_v_self->_ptr); + +/* "gevent/core.pyx":452 + * raise ValueError('operation on destroyed loop') + * cdef unsigned int backend = libev.ev_backend(self._ptr) + * for key, value in _flags: # <<<<<<<<<<<<<< + * if key == backend: + * return value + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s___flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { + PyObject* sequence = __pyx_t_2; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_7; + __pyx_t_7 = 0; + +/* "gevent/core.pyx":453 + * cdef unsigned int backend = libev.ev_backend(self._ptr) + * for key, value in _flags: + * if key == backend: # <<<<<<<<<<<<<< + * return value + * return backend + */ + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_backend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_key, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":454 + * for key, value in _flags: + * if key == backend: + * return value # <<<<<<<<<<<<<< + * return backend + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_value); + __pyx_r = __pyx_v_value; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +/* "gevent/core.pyx":455 + * if key == backend: + * return value + * return backend # <<<<<<<<<<<<<< + * + * property pendingcnt: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_backend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("gevent.core.loop.backend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_10pendingcnt_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_10pendingcnt_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_10pendingcnt___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":459 + * property pendingcnt: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_10pendingcnt___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":461 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return libev.ev_pending_count(self._ptr) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":462 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_pending_count(self._ptr) + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":463 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return libev.ev_pending_count(self._ptr) # <<<<<<<<<<<<<< + * + * def io(self, int fd, int events, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyLong_FromUnsignedLong(ev_pending_count(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.pendingcnt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_33io(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_33io(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_fd; + int __pyx_v_events; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("io (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fd,&__pyx_n_s__events,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = __pyx_k_32; + +/* "gevent/core.pyx":465 + * return libev.ev_pending_count(self._ptr) + * + * def io(self, int fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * return io(self, fd, events, ref, priority) + * + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("io", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "io") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_fd = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_events = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ref = values[2]; + __pyx_v_priority = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("io", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.io", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_32io(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_fd, __pyx_v_events, __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_32io(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("io", 0); + +/* "gevent/core.pyx":466 + * + * def io(self, int fd, int events, ref=True, priority=None): + * return io(self, fd, events, ref, priority) # <<<<<<<<<<<<<< + * + * def timer(self, double after, double repeat=0.0, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_io)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.io", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_35timer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_35timer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_after; + double __pyx_v_repeat; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("timer (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__after,&__pyx_n_s__repeat,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = __pyx_k_33; + +/* "gevent/core.pyx":468 + * return io(self, fd, events, ref, priority) + * + * def timer(self, double after, double repeat=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * return timer(self, after, repeat, ref, priority) + * + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__after)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__repeat); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "timer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_after = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_after == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_repeat = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_repeat == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_repeat = ((double)0.0); + } + __pyx_v_ref = values[2]; + __pyx_v_priority = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("timer", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.timer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_34timer(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_after, __pyx_v_repeat, __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_34timer(struct PyGeventLoopObject *__pyx_v_self, double __pyx_v_after, double __pyx_v_repeat, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("timer", 0); + +/* "gevent/core.pyx":469 + * + * def timer(self, double after, double repeat=0.0, ref=True, priority=None): + * return timer(self, after, repeat, ref, priority) # <<<<<<<<<<<<<< + * + * def signal(self, int signum, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_after); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_repeat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_timer)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.timer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_37signal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_37signal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_signum; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("signal (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signum,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[3] = {0,0,0}; + values[1] = __pyx_k_34; + +/* "gevent/core.pyx":471 + * return timer(self, after, repeat, ref, priority) + * + * def signal(self, int signum, ref=True, priority=None): # <<<<<<<<<<<<<< + * return signal(self, signum, ref, priority) + * + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__signum)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "signal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_signum = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_signum == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ref = values[1]; + __pyx_v_priority = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("signal", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.signal", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_36signal(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_signum, __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_36signal(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_signum, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("signal", 0); + +/* "gevent/core.pyx":472 + * + * def signal(self, int signum, ref=True, priority=None): + * return signal(self, signum, ref, priority) # <<<<<<<<<<<<<< + * + * def idle(self, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_signum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_signal)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.signal", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_39idle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_39idle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("idle (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_35; + +/* "gevent/core.pyx":474 + * return signal(self, signum, ref, priority) + * + * def idle(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return idle(self, ref, priority) + * + */ + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ref = values[0]; + __pyx_v_priority = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("idle", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.idle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_38idle(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_38idle(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("idle", 0); + +/* "gevent/core.pyx":475 + * + * def idle(self, ref=True, priority=None): + * return idle(self, ref, priority) # <<<<<<<<<<<<<< + * + * def prepare(self, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_idle)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.idle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_41prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_41prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prepare (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_36; + +/* "gevent/core.pyx":477 + * return idle(self, ref, priority) + * + * def prepare(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return prepare(self, ref, priority) + * + */ + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ref = values[0]; + __pyx_v_priority = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("prepare", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_40prepare(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_40prepare(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prepare", 0); + +/* "gevent/core.pyx":478 + * + * def prepare(self, ref=True, priority=None): + * return prepare(self, ref, priority) # <<<<<<<<<<<<<< + * + * def fork(self, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_prepare)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_43fork(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_43fork(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fork (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_37; + +/* "gevent/core.pyx":480 + * return prepare(self, ref, priority) + * + * def fork(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return fork(self, ref, priority) + * + */ + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fork") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ref = values[0]; + __pyx_v_priority = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fork", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.fork", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_42fork(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_42fork(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fork", 0); + +/* "gevent/core.pyx":481 + * + * def fork(self, ref=True, priority=None): + * return fork(self, ref, priority) # <<<<<<<<<<<<<< + * + * def async(self, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_fork)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.fork", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_45async(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_45async(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_38; + +/* "gevent/core.pyx":483 + * return fork(self, ref, priority) + * + * def async(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return async(self, ref, priority) + * + */ + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "async") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ref = values[0]; + __pyx_v_priority = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("async", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.async", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_44async(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_ref, __pyx_v_priority); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_4core_4loop_44async(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("async", 0); + +/* "gevent/core.pyx":484 + * + * def async(self, ref=True, priority=None): + * return async(self, ref, priority) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_async)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.async", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_47child(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_47child(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_pid; + int __pyx_v_trace; + PyObject *__pyx_v_ref = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("child (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pid,&__pyx_n_s__trace,&__pyx_n_s__ref,0}; + PyObject* values[3] = {0,0,0}; + values[2] = __pyx_k_39; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pid)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__trace); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "child") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pid = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_pid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_trace = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_trace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_trace = ((int)0); + } + __pyx_v_ref = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("child", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4loop_46child(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_pid, __pyx_v_trace, __pyx_v_ref); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":489 + * + * + * def child(self, int pid, bint trace=0, ref=True): # <<<<<<<<<<<<<< + * return child(self, pid, trace, ref) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_46child(struct PyGeventLoopObject *__pyx_v_self, int __pyx_v_pid, int __pyx_v_trace, PyObject *__pyx_v_ref) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("child", 0); + +/* "gevent/core.pyx":490 + * + * def child(self, int pid, bint trace=0, ref=True): + * return child(self, pid, trace, ref) # <<<<<<<<<<<<<< + * + * def install_sigchld(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_pid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_trace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_child)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_49install_sigchld(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_49install_sigchld(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("install_sigchld (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_48install_sigchld(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":492 + * return child(self, pid, trace, ref) + * + * def install_sigchld(self): # <<<<<<<<<<<<<< + * libev.gevent_install_sigchld_handler() + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_48install_sigchld(CYTHON_UNUSED struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("install_sigchld", 0); + +/* "gevent/core.pyx":493 + * + * def install_sigchld(self): + * libev.gevent_install_sigchld_handler() # <<<<<<<<<<<<<< + * + * + */ + gevent_install_sigchld_handler(); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_51stat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_51stat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_47stat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_47stat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_v_path = 0; + float __pyx_v_interval; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stat (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__interval,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[4] = {0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + values[2] = __pyx_k_40; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + values[2] = __pyx_k_39; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":497 + * + * + * def stat(self, bytes path, float interval=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * return stat(self, path, interval, ref, priority) + * + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_path = ((PyObject*)values[0]); + if (values[1]) { + __pyx_v_interval = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_interval == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_interval = ((float)0.0); + } + __pyx_v_ref = values[2]; + __pyx_v_priority = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("stat", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.loop.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyBytes_Type), 1, "path", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_50stat(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_path, __pyx_v_interval, __pyx_v_ref, __pyx_v_priority); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_46stat(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_path, __pyx_v_interval, __pyx_v_ref, __pyx_v_priority); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_50stat(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_46stat(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stat", 0); + +/* "gevent/core.pyx":498 + * + * def stat(self, bytes path, float interval=0.0, ref=True, priority=None): + * return stat(self, path, interval, ref, priority) # <<<<<<<<<<<<<< + * + * def run_callback(self, func, *args): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_interval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(((PyObject *)__pyx_v_path)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_path)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __Pyx_INCREF(__pyx_v_priority); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_priority); + __Pyx_GIVEREF(__pyx_v_priority); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_stat)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_53run_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_53run_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_49run_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_49run_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_v_func = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("run_callback (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__func,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "run_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_func = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("run_callback", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.loop.run_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_52run_callback(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_func, __pyx_v_args); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_48run_callback(((struct PyGeventLoopObject *)__pyx_v_self), __pyx_v_func, __pyx_v_args); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":500 + * return stat(self, path, interval, ref, priority) + * + * def run_callback(self, func, *args): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_52run_callback(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_args) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_48run_callback(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_args) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + struct PyGeventCallbackObject *__pyx_v_cb = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run_callback", 0); + +/* "gevent/core.pyx":502 + * def run_callback(self, func, *args): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * cdef callback cb = callback(func, args) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":503 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef callback cb = callback(func, args) + * self._callbacks.append(cb) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":504 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * cdef callback cb = callback(func, args) # <<<<<<<<<<<<<< + * self._callbacks.append(cb) + * libev.ev_ref(self._ptr) + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_func); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_func); + __Pyx_GIVEREF(__pyx_v_func); + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core_callback)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_cb = ((struct PyGeventCallbackObject *)__pyx_t_3); + __pyx_t_3 = 0; + +/* "gevent/core.pyx":505 + * raise ValueError('operation on destroyed loop') + * cdef callback cb = callback(func, args) + * self._callbacks.append(cb) # <<<<<<<<<<<<<< + * libev.ev_ref(self._ptr) + * return cb + */ + if (unlikely(((PyObject *)__pyx_v_self->_callbacks) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_callbacks, ((PyObject *)__pyx_v_cb)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":506 + * cdef callback cb = callback(func, args) + * self._callbacks.append(cb) + * libev.ev_ref(self._ptr) # <<<<<<<<<<<<<< + * return cb + * + */ + ev_ref(__pyx_v_self->_ptr); + +/* "gevent/core.pyx":507 + * self._callbacks.append(cb) + * libev.ev_ref(self._ptr) + * return cb # <<<<<<<<<<<<<< + * + * def _format(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cb)); + __pyx_r = ((PyObject *)__pyx_v_cb); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.run_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_cb); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_55_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_55_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_51_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_51_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_54_format(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_50_format(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":509 + * return cb + * + * def _format(self): # <<<<<<<<<<<<<< + * if not self._ptr: + * return 'destroyed' + */ + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_54_format(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_50_format(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_v_msg = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_format", 0); + +/* "gevent/core.pyx":510 + * + * def _format(self): + * if not self._ptr: # <<<<<<<<<<<<<< + * return 'destroyed' + * cdef object msg = self.backend + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":511 + * def _format(self): + * if not self._ptr: + * return 'destroyed' # <<<<<<<<<<<<<< + * cdef object msg = self.backend + * if self.default: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_s__destroyed)); + __pyx_r = ((PyObject *)__pyx_n_s__destroyed); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":512 + * if not self._ptr: + * return 'destroyed' + * cdef object msg = self.backend # <<<<<<<<<<<<<< + * if self.default: + * msg += ' default' + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__backend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_msg = __pyx_t_2; + __pyx_t_2 = 0; + +/* "gevent/core.pyx":513 + * return 'destroyed' + * cdef object msg = self.backend + * if self.default: # <<<<<<<<<<<<<< + * msg += ' default' + * msg += ' pending=%s' % self.pendingcnt + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":514 + * cdef object msg = self.backend + * if self.default: + * msg += ' default' # <<<<<<<<<<<<<< + * msg += ' pending=%s' % self.pendingcnt + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_msg, ((PyObject *)__pyx_kp_s_42)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_msg, ((PyObject *)__pyx_kp_s_41)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_msg); + __pyx_v_msg = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":515 + * if self.default: + * msg += ' default' + * msg += ' pending=%s' % self.pendingcnt # <<<<<<<<<<<<<< + * + * + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +/* "gevent/core.pyx":515 + * if self.default: + * msg += ' default' + * msg += ' pending=%s' % self.pendingcnt # <<<<<<<<<<<<<< + * + * msg += self._format_details() + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__pendingcnt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_msg, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_msg); + __pyx_v_msg = __pyx_t_2; + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":519 + * + * + * return msg # <<<<<<<<<<<<<< + * + * + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +/* "gevent/core.pyx":517 + * msg += ' pending=%s' % self.pendingcnt + * + * msg += self._format_details() # <<<<<<<<<<<<<< + * + * return msg + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___format_details); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_msg); + __pyx_v_msg = __pyx_t_2; + __pyx_t_2 = 0; + +/* "gevent/core.pyx":519 + * msg += self._format_details() + * + * return msg # <<<<<<<<<<<<<< + * + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_msg); + __pyx_r = __pyx_v_msg; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop._format", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_msg); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_57_format_details(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_57_format_details(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_53_format_details(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_53_format_details(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format_details (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_56_format_details(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_52_format_details(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":523 + * + * + * def _format_details(self): # <<<<<<<<<<<<<< + * cdef str msg = '' + * cdef object fileno = self.fileno() + */ + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_56_format_details(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_52_format_details(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + PyObject *__pyx_v_msg = 0; + PyObject *__pyx_v_fileno = 0; + PyObject *__pyx_v_sigfd = 0; + PyObject *__pyx_v_activecnt = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_format_details", 0); + +/* "gevent/core.pyx":524 + * + * def _format_details(self): + * cdef str msg = '' # <<<<<<<<<<<<<< + * cdef object fileno = self.fileno() + * cdef object sigfd = None + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_44)); + __pyx_v_msg = __pyx_kp_s_44; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + __pyx_v_msg = __pyx_kp_s_43; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + +/* "gevent/core.pyx":525 + * def _format_details(self): + * cdef str msg = '' + * cdef object fileno = self.fileno() # <<<<<<<<<<<<<< + * cdef object sigfd = None + * cdef object activecnt = None + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_fileno = __pyx_t_2; + __pyx_t_2 = 0; + +/* "gevent/core.pyx":526 + * cdef str msg = '' + * cdef object fileno = self.fileno() + * cdef object sigfd = None # <<<<<<<<<<<<<< + * cdef object activecnt = None + * try: + */ + __Pyx_INCREF(Py_None); + __pyx_v_sigfd = Py_None; + +/* "gevent/core.pyx":527 + * cdef object fileno = self.fileno() + * cdef object sigfd = None + * cdef object activecnt = None # <<<<<<<<<<<<<< + * try: + * sigfd = self.sigfd + */ + __Pyx_INCREF(Py_None); + __pyx_v_activecnt = Py_None; + +/* "gevent/core.pyx":528 + * cdef object sigfd = None + * cdef object activecnt = None + * try: # <<<<<<<<<<<<<< + * sigfd = self.sigfd + * except AttributeError: + */ + { + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + +/* "gevent/core.pyx":529 + * cdef object activecnt = None + * try: + * sigfd = self.sigfd # <<<<<<<<<<<<<< + * except AttributeError: + * sigfd = None + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__sigfd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_sigfd); + __pyx_v_sigfd = __pyx_t_2; + __pyx_t_2 = 0; + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L10_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":530 + * try: + * sigfd = self.sigfd + * except AttributeError: # <<<<<<<<<<<<<< + * sigfd = None + * try: + */ + __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_6) { + __Pyx_AddTraceback("gevent.core.loop._format_details", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_7); + +/* "gevent/core.pyx":531 + * sigfd = self.sigfd + * except AttributeError: + * sigfd = None # <<<<<<<<<<<<<< + * try: + * activecnt = self.activecnt + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_sigfd); + __pyx_v_sigfd = Py_None; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L4_exception_handled; + } + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __pyx_L10_try_end:; + } + +/* "gevent/core.pyx":532 + * except AttributeError: + * sigfd = None + * try: # <<<<<<<<<<<<<< + * activecnt = self.activecnt + * except AttributeError: + */ + { + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + +/* "gevent/core.pyx":533 + * sigfd = None + * try: + * activecnt = self.activecnt # <<<<<<<<<<<<<< + * except AttributeError: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__activecnt); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_activecnt); + __pyx_v_activecnt = __pyx_t_7; + __pyx_t_7 = 0; + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L20_try_end; + __pyx_L13_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + +/* "gevent/core.pyx":534 + * try: + * activecnt = self.activecnt + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * if activecnt is not None: + */ + __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_6) { + PyErr_Restore(0,0,0); + goto __pyx_L14_exception_handled; + } + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L14_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + __pyx_L20_try_end:; + } + +/* "gevent/core.pyx":536 + * except AttributeError: + * pass + * if activecnt is not None: # <<<<<<<<<<<<<< + * msg += ' ref=' + repr(activecnt) + * if fileno is not None: + */ + __pyx_t_8 = (__pyx_v_activecnt != Py_None); + if (__pyx_t_8) { + +/* "gevent/core.pyx":537 + * pass + * if activecnt is not None: + * msg += ' ref=' + repr(activecnt) # <<<<<<<<<<<<<< + * if fileno is not None: + * msg += ' fileno=' + repr(fileno) + */ + __pyx_t_7 = PyObject_Repr(__pyx_v_activecnt); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_45), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_44), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_msg), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_msg)); + __pyx_v_msg = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L21; + } + __pyx_L21:; + +/* "gevent/core.pyx":538 + * if activecnt is not None: + * msg += ' ref=' + repr(activecnt) + * if fileno is not None: # <<<<<<<<<<<<<< + * msg += ' fileno=' + repr(fileno) + * if sigfd is not None and sigfd != -1: + */ + __pyx_t_8 = (__pyx_v_fileno != Py_None); + if (__pyx_t_8) { + +/* "gevent/core.pyx":539 + * msg += ' ref=' + repr(activecnt) + * if fileno is not None: + * msg += ' fileno=' + repr(fileno) # <<<<<<<<<<<<<< + * if sigfd is not None and sigfd != -1: + * msg += ' sigfd=' + repr(sigfd) + */ + __pyx_t_7 = PyObject_Repr(__pyx_v_fileno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_46), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_45), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_msg), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_msg)); + __pyx_v_msg = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L22; + } + __pyx_L22:; + +/* "gevent/core.pyx":540 + * if fileno is not None: + * msg += ' fileno=' + repr(fileno) + * if sigfd is not None and sigfd != -1: # <<<<<<<<<<<<<< + * msg += ' sigfd=' + repr(sigfd) + * return msg + */ + __pyx_t_8 = (__pyx_v_sigfd != Py_None); + if (__pyx_t_8) { + __pyx_t_7 = PyObject_RichCompare(__pyx_v_sigfd, __pyx_int_neg_1, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_8; + } + if (__pyx_t_10) { + +/* "gevent/core.pyx":541 + * msg += ' fileno=' + repr(fileno) + * if sigfd is not None and sigfd != -1: + * msg += ' sigfd=' + repr(sigfd) # <<<<<<<<<<<<<< + * return msg + * + */ + __pyx_t_7 = PyObject_Repr(__pyx_v_sigfd); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_47), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_46), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_msg), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_msg)); + __pyx_v_msg = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L23; + } + __pyx_L23:; + +/* "gevent/core.pyx":542 + * if sigfd is not None and sigfd != -1: + * msg += ' sigfd=' + repr(sigfd) + * return msg # <<<<<<<<<<<<<< + * + * def fileno(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_msg)); + __pyx_r = ((PyObject *)__pyx_v_msg); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent.core.loop._format_details", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_XDECREF(__pyx_v_fileno); + __Pyx_XDECREF(__pyx_v_sigfd); + __Pyx_XDECREF(__pyx_v_activecnt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_59fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_59fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4loop_55fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_55fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fileno (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_58fileno(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_54fileno(((struct PyGeventLoopObject *)__pyx_v_self)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":544 + * return msg + * + * def fileno(self): # <<<<<<<<<<<<<< + * cdef int fd + * if self._ptr: + */ + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_58fileno(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +static PyObject *__pyx_pf_6gevent_4core_4loop_54fileno(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + int __pyx_v_fd; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fileno", 0); + +/* "gevent/core.pyx":546 + * def fileno(self): + * cdef int fd + * if self._ptr: # <<<<<<<<<<<<<< + * fd = self._ptr.backend_fd + * if fd >= 0: + */ + __pyx_t_1 = (__pyx_v_self->_ptr != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":547 + * cdef int fd + * if self._ptr: + * fd = self._ptr.backend_fd # <<<<<<<<<<<<<< + * if fd >= 0: + * return fd + */ + __pyx_t_2 = __pyx_v_self->_ptr->backend_fd; + __pyx_v_fd = __pyx_t_2; + +/* "gevent/core.pyx":548 + * if self._ptr: + * fd = self._ptr.backend_fd + * if fd >= 0: # <<<<<<<<<<<<<< + * return fd + * + */ + __pyx_t_1 = (__pyx_v_fd >= 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":549 + * fd = self._ptr.backend_fd + * if fd >= 0: + * return fd # <<<<<<<<<<<<<< + * + * property activecnt: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(__pyx_v_fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.loop.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_9activecnt_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_9activecnt_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_9activecnt___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":553 + * property activecnt: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_9activecnt___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":555 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return self._ptr.activecnt + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":556 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.activecnt + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":557 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return self._ptr.activecnt # <<<<<<<<<<<<<< + * + * property sig_pending: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->_ptr->activecnt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.activecnt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_11sig_pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_11sig_pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_11sig_pending___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":561 + * property sig_pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_11sig_pending___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":563 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return self._ptr.sig_pending + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":564 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sig_pending + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":565 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return self._ptr.sig_pending # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->_ptr->sig_pending); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.sig_pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_pw_6gevent_4core_4loop_9origflags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_9origflags_1__get__(PyObject *__pyx_v_self) { +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_pw_6gevent_4core_4loop_5sigfd_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_5sigfd_1__get__(PyObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_9origflags___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":579 + * property origflags: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_9origflags___get__(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __pyx_r = __pyx_pf_6gevent_4core_4loop_5sigfd___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":570 + * property sigfd: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_5sigfd___get__(struct PyGeventLoopObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":572 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return self._ptr.sigfd + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":573 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sigfd + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":574 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return self._ptr.sigfd # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->_ptr->sigfd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.sigfd.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_9origflags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_9origflags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_9origflags___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":579 + * property origflags: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_9origflags___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +/* "gevent/core.pyx":581 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return _flags_to_list(self._ptr.origflags) + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":582 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return _flags_to_list(self._ptr.origflags) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":583 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return _flags_to_list(self._ptr.origflags) # <<<<<<<<<<<<<< + * + * property origflags_int: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_6gevent_4core__flags_to_list(__pyx_v_self->_ptr->origflags, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.origflags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_13origflags_int_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_13origflags_int_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_13origflags_int___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":587 + * property origflags_int: + * + * def __get__(self): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_13origflags_int___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":589 + * def __get__(self): + * + * if not self._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * return self._ptr.origflags + */ + __pyx_t_1 = (!(__pyx_v_self->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":590 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.origflags + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":591 + * if not self._ptr: + * raise ValueError('operation on destroyed loop') + * return self._ptr.origflags # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_self->_ptr->origflags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.loop.origflags_int.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_13error_handler_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_13error_handler_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_13error_handler___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":231 + * cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: + * cdef libev.ev_loop* _ptr + * cdef public object error_handler # <<<<<<<<<<<<<< + * cdef libev.ev_prepare _prepare + * cdef public list _callbacks + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_13error_handler___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->error_handler); + __pyx_r = __pyx_v_self->error_handler; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4loop_13error_handler_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4loop_13error_handler_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_13error_handler_2__set__(((struct PyGeventLoopObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4loop_13error_handler_2__set__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->error_handler); + __Pyx_DECREF(__pyx_v_self->error_handler); + __pyx_v_self->error_handler = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4loop_13error_handler_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4loop_13error_handler_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_13error_handler_4__del__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4loop_13error_handler_4__del__(struct PyGeventLoopObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->error_handler); + __Pyx_DECREF(__pyx_v_self->error_handler); + __pyx_v_self->error_handler = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4loop_10_callbacks_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4loop_10_callbacks_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_10_callbacks___get__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":233 + * cdef public object error_handler + * cdef libev.ev_prepare _prepare + * cdef public list _callbacks # <<<<<<<<<<<<<< + * cdef libev.ev_timer _timer0 + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4loop_10_callbacks___get__(struct PyGeventLoopObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->_callbacks)); + __pyx_r = ((PyObject *)__pyx_v_self->_callbacks); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4loop_10_callbacks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4loop_10_callbacks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_10_callbacks_2__set__(((struct PyGeventLoopObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4loop_10_callbacks_2__set__(struct PyGeventLoopObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_callbacks); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_callbacks)); + __pyx_v_self->_callbacks = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.loop._callbacks.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4loop_10_callbacks_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4loop_10_callbacks_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4loop_10_callbacks_4__del__(((struct PyGeventLoopObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4loop_10_callbacks_4__del__(struct PyGeventLoopObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callbacks); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_callbacks)); + __pyx_v_self->_callbacks = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__args,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_callback = values[0]; + __pyx_v_args = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.callback.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_8callback___init__(((struct PyGeventCallbackObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":600 + * cdef public tuple args + * + * def __init__(self, callback, args): # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + +static int __pyx_pf_6gevent_4core_8callback___init__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":601 + * + * def __init__(self, callback, args): + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->callback); + __Pyx_DECREF(__pyx_v_self->callback); + __pyx_v_self->callback = __pyx_v_callback; + +/* "gevent/core.pyx":602 + * def __init__(self, callback, args): + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * + * def stop(self): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_args)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_args); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.callback.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_3stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_3stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_2stop(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":604 + * self.args = args + * + * def stop(self): # <<<<<<<<<<<<<< + * self.callback = None + * self.args = None + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_2stop(struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":605 + * + * def stop(self): + * self.callback = None # <<<<<<<<<<<<<< + * self.args = None + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->callback); + __Pyx_DECREF(__pyx_v_self->callback); + __pyx_v_self->callback = Py_None; + +/* "gevent/core.pyx":606 + * def stop(self): + * self.callback = None + * self.args = None # <<<<<<<<<<<<<< + * + * # Note, that __nonzero__ and pending are different + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_5__nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_5__nonzero__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_4__nonzero__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":613 + * # 'pending' has the same meaning as libev watchers: it is cleared before entering callback + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * # it's nonzero if it's pending or currently executing + * return self.args is not None + */ + +static int __pyx_pf_6gevent_4core_8callback_4__nonzero__(struct PyGeventCallbackObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__nonzero__", 0); + +/* "gevent/core.pyx":615 + * def __nonzero__(self): + * # it's nonzero if it's pending or currently executing + * return self.args is not None # <<<<<<<<<<<<<< + * + * property pending: + */ + __pyx_t_1 = (__pyx_v_self->args != ((PyObject*)Py_None)); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_7pending___get__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":619 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self.callback is not None + * + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_7pending___get__(struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":620 + * + * def __get__(self): + * return self.callback is not None # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_self->callback != Py_None); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.callback.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_7__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_7__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_6__repr__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":622 + * return self.callback is not None + * + * def __repr__(self): # <<<<<<<<<<<<<< + * if Py_ReprEnter(self) != 0: + * return "<...>" + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_6__repr__(struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_v_format = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + +/* "gevent/core.pyx":623 + * + * def __repr__(self): + * if Py_ReprEnter(self) != 0: # <<<<<<<<<<<<<< + * return "<...>" + * try: + */ + __pyx_t_1 = (Py_ReprEnter(((PyObject*)__pyx_v_self)) != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":624 + * def __repr__(self): + * if Py_ReprEnter(self) != 0: + * return "<...>" # <<<<<<<<<<<<<< + * try: + * format = self._format() + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_44)); + __pyx_r = ((PyObject *)__pyx_kp_s_44); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + __pyx_r = ((PyObject *)__pyx_kp_s_43); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_52)); + __pyx_r = ((PyObject *)__pyx_kp_s_52); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_51)); + __pyx_r = ((PyObject *)__pyx_kp_s_51); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); + __pyx_r = ((PyObject *)__pyx_kp_s_53); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":625 + * if Py_ReprEnter(self) != 0: + * return "<...>" + * try: # <<<<<<<<<<<<<< + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + */ + /*try:*/ { + +/* "gevent/core.pyx":626 + * return "<...>" + * try: + * format = self._format() # <<<<<<<<<<<<<< + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.pending: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_format = __pyx_t_3; + __pyx_t_3 = 0; + +/* "gevent/core.pyx":627 + * try: + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) # <<<<<<<<<<<<<< + * if self.pending: + * result += " pending" + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_format); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_format); + __Pyx_GIVEREF(__pyx_v_format); + __pyx_t_2 = 0; + __pyx_t_4 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + +/* "gevent/core.pyx":628 + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.pending: # <<<<<<<<<<<<<< + * result += " pending" + * if self.callback is not None: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__pending); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":629 + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.pending: + * result += " pending" # <<<<<<<<<<<<<< + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_46)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":630 + * if self.pending: + * result += " pending" + * if self.callback is not None: # <<<<<<<<<<<<<< + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: + */ + __pyx_t_1 = (__pyx_v_self->callback != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":631 + * result += " pending" + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) # <<<<<<<<<<<<<< + * if self.args is not None: + * result += " args=%r" % (self.args, ) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_self->callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->callback); + __Pyx_GIVEREF(__pyx_v_self->callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + +/* "gevent/core.pyx":632 + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: # <<<<<<<<<<<<<< + * result += " args=%r" % (self.args, ) + * if self.callback is None and self.args is None: + */ + __pyx_t_1 = (__pyx_v_self->args != ((PyObject*)Py_None)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":633 + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: + * result += " args=%r" % (self.args, ) # <<<<<<<<<<<<<< + * if self.callback is None and self.args is None: + * result += " stopped" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->args)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L9; + } + __pyx_L9:; + +/* "gevent/core.pyx":634 + * if self.args is not None: + * result += " args=%r" % (self.args, ) + * if self.callback is None and self.args is None: # <<<<<<<<<<<<<< + * result += " stopped" + * return result + ">" + */ + __pyx_t_1 = (__pyx_v_self->callback == Py_None); + if (__pyx_t_1) { + __pyx_t_5 = (__pyx_v_self->args == ((PyObject*)Py_None)); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + +/* "gevent/core.pyx":635 + * result += " args=%r" % (self.args, ) + * if self.callback is None and self.args is None: + * result += " stopped" # <<<<<<<<<<<<<< + * return result + ">" + * finally: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L10; + } + __pyx_L10:; + +/* "gevent/core.pyx":636 + * if self.callback is None and self.args is None: + * result += " stopped" + * return result + ">" # <<<<<<<<<<<<<< + * finally: + * Py_ReprLeave(self) + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L4; + } + +/* "gevent/core.pyx":638 + * return result + ">" + * finally: + * Py_ReprLeave(self) # <<<<<<<<<<<<<< + * + * def _format(self): + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L6; + __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 3; goto __pyx_L6; + __pyx_L5: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L6; + } + __pyx_L6:; + Py_ReprLeave(((PyObject*)__pyx_v_self)); + switch (__pyx_why) { + case 3: goto __pyx_L0; + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.callback.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_8_format(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":640 + * Py_ReprLeave(self) + * + * def _format(self): # <<<<<<<<<<<<<< + * return '' + * + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_8_format(CYTHON_UNUSED struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format", 0); + +/* "gevent/core.pyx":641 + * + * def _format(self): + * return '' # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_51)); + __pyx_r = ((PyObject *)__pyx_kp_s_51); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); + __pyx_r = ((PyObject *)__pyx_kp_s_50); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_44)); + __pyx_r = ((PyObject *)__pyx_kp_s_44); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + __pyx_r = ((PyObject *)__pyx_kp_s_43); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_8callback___get__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":597 + * + * cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: + * cdef public object callback # <<<<<<<<<<<<<< + * cdef public tuple args + * + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_8callback___get__(struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->callback); + __pyx_r = __pyx_v_self->callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_8callback_2__set__(((struct PyGeventCallbackObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_8callback_8callback_2__set__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->callback); + __Pyx_DECREF(__pyx_v_self->callback); + __pyx_v_self->callback = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_8callback_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_8callback_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_8callback_4__del__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_8callback_8callback_4__del__(struct PyGeventCallbackObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->callback); + __Pyx_DECREF(__pyx_v_self->callback); + __pyx_v_self->callback = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_8callback_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_8callback_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_4args___get__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":598 + * cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: + * cdef public object callback + * cdef public tuple args # <<<<<<<<<<<<<< + * + * def __init__(self, callback, args): + */ + +static PyObject *__pyx_pf_6gevent_4core_8callback_4args___get__(struct PyGeventCallbackObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_4args_2__set__(((struct PyGeventCallbackObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_8callback_4args_2__set__(struct PyGeventCallbackObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.callback.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_8callback_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_8callback_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_8callback_4args_4__del__(((struct PyGeventCallbackObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_8callback_4args_4__del__(struct PyGeventCallbackObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7watcher_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7watcher_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7watcher___repr__(((struct PyGeventWatcherObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":667 + * """Abstract base class for all the watchers""" + * + * def __repr__(self): # <<<<<<<<<<<<<< + * if Py_ReprEnter(self) != 0: + * return "<...>" + */ + +static PyObject *__pyx_pf_6gevent_4core_7watcher___repr__(struct PyGeventWatcherObject *__pyx_v_self) { + PyObject *__pyx_v_format = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + +/* "gevent/core.pyx":668 + * + * def __repr__(self): + * if Py_ReprEnter(self) != 0: # <<<<<<<<<<<<<< + * return "<...>" + * try: + */ + __pyx_t_1 = (Py_ReprEnter(((PyObject*)__pyx_v_self)) != 0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":669 + * def __repr__(self): + * if Py_ReprEnter(self) != 0: + * return "<...>" # <<<<<<<<<<<<<< + * try: + * format = self._format() + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_44)); + __pyx_r = ((PyObject *)__pyx_kp_s_44); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + __pyx_r = ((PyObject *)__pyx_kp_s_43); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_52)); + __pyx_r = ((PyObject *)__pyx_kp_s_52); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_51)); + __pyx_r = ((PyObject *)__pyx_kp_s_51); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); + __pyx_r = ((PyObject *)__pyx_kp_s_53); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":670 + * if Py_ReprEnter(self) != 0: + * return "<...>" + * try: # <<<<<<<<<<<<<< + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + */ + /*try:*/ { + +/* "gevent/core.pyx":671 + * return "<...>" + * try: + * format = self._format() # <<<<<<<<<<<<<< + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.active: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_format = __pyx_t_3; + __pyx_t_3 = 0; + +/* "gevent/core.pyx":672 + * try: + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) # <<<<<<<<<<<<<< + * if self.active: + * result += " active" + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_format); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_format); + __Pyx_GIVEREF(__pyx_v_format); + __pyx_t_2 = 0; + __pyx_t_4 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + +/* "gevent/core.pyx":673 + * format = self._format() + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.active: # <<<<<<<<<<<<<< + * result += " active" + * if self.pending: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__active); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":674 + * result = "<%s at 0x%x%s" % (self.__class__.__name__, id(self), format) + * if self.active: + * result += " active" # <<<<<<<<<<<<<< + * if self.pending: + * result += " pending" + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_52)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_51)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":675 + * if self.active: + * result += " active" + * if self.pending: # <<<<<<<<<<<<<< + * result += " pending" + * if self.callback is not None: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__pending); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":676 + * result += " active" + * if self.pending: + * result += " pending" # <<<<<<<<<<<<<< + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_46)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + +/* "gevent/core.pyx":677 + * if self.pending: + * result += " pending" + * if self.callback is not None: # <<<<<<<<<<<<<< + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4 != Py_None); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":678 + * result += " pending" + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) # <<<<<<<<<<<<<< + * if self.args is not None: + * result += " args=%r" % (self.args, ) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L9; + } + __pyx_L9:; + +/* "gevent/core.pyx":679 + * if self.callback is not None: + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: # <<<<<<<<<<<<<< + * result += " args=%r" % (self.args, ) + * return result + ">" + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__pyx_t_3 != Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + +/* "gevent/core.pyx":680 + * result += " callback=%r" % (self.callback, ) + * if self.args is not None: + * result += " args=%r" % (self.args, ) # <<<<<<<<<<<<<< + * return result + ">" + * finally: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L10; + } + __pyx_L10:; + +/* "gevent/core.pyx":681 + * if self.args is not None: + * result += " args=%r" % (self.args, ) + * return result + ">" # <<<<<<<<<<<<<< + * finally: + * Py_ReprLeave(self) + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L5;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L4; + } + +/* "gevent/core.pyx":683 + * return result + ">" + * finally: + * Py_ReprLeave(self) # <<<<<<<<<<<<<< + * + * def _format(self): + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L6; + __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 3; goto __pyx_L6; + __pyx_L5: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L6; + } + __pyx_L6:; + Py_ReprLeave(((PyObject*)__pyx_v_self)); + switch (__pyx_why) { + case 3: goto __pyx_L0; + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.watcher.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7watcher_3_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7watcher_3_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7watcher_2_format(((struct PyGeventWatcherObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":685 + * Py_ReprLeave(self) + * + * def _format(self): # <<<<<<<<<<<<<< + * return '' + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7watcher_2_format(CYTHON_UNUSED struct PyGeventWatcherObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format", 0); + +/* "gevent/core.pyx":686 + * + * def _format(self): + * return '' # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_51)); + __pyx_r = ((PyObject *)__pyx_kp_s_51); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); + __pyx_r = ((PyObject *)__pyx_kp_s_50); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_44)); + __pyx_r = ((PyObject *)__pyx_kp_s_44); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + __pyx_r = ((PyObject *)__pyx_kp_s_43); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_3ref___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":700 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_3ref___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":701 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_3ref_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":703 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_2io_3ref_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":705 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":706 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":707 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":708 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":709 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":710 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":711 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":712 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":714 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":715 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":716 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":717 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":718 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":719 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_8callback___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":723 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_8callback___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":724 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_8callback_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":726 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_2io_8callback_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":727 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":728 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":729 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.io.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_stop(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":731 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_stop(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":733 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":734 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":735 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":736 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_io_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":737 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_io_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":738 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_io_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_io_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":739 + * self._flags &= ~2 + * libev.ev_io_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":740 + * libev.ev_io_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":741 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":742 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":743 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_8priority___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":747 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_8priority___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":748 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.io.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.io.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_2io_8priority_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":750 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_2io_8priority_2__set__(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":751 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":752 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":753 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.io.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_2io_2feed(((struct PyGeventIOObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":755 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_2feed(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":757 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":759 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":760 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":761 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":762 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":763 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":764 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":765 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":766 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":767 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args, pass_events=False): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_pass_events = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__pass_events,0}; + PyObject* values[2] = {0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_59; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_58; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_66; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_65; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_67; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (kw_args == 1) { + const Py_ssize_t index = 1; + PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]); + if (value) { values[index] = value; kw_args--; } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + __pyx_v_pass_events = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.io.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_2io_4start(((struct PyGeventIOObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_pass_events, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":769 + * self._flags |= 1 + * + * def start(self, object callback, *args, pass_events=False): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_4start(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_pass_events, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":771 + * def start(self, object callback, *args, pass_events=False): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":772 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":773 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":774 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * if pass_events: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":775 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * if pass_events: + * self.args = (GEVENT_CORE_EVENTS, ) + args + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":776 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * if pass_events: # <<<<<<<<<<<<<< + * self.args = (GEVENT_CORE_EVENTS, ) + args + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pass_events); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":777 + * self.callback = callback + * if pass_events: + * self.args = (GEVENT_CORE_EVENTS, ) + args # <<<<<<<<<<<<<< + * else: + * self.args = args + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(GEVENT_CORE_EVENTS); + PyTuple_SET_ITEM(__pyx_t_2, 0, GEVENT_CORE_EVENTS); + __Pyx_GIVEREF(GEVENT_CORE_EVENTS); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L5; + } + /*else*/ { + +/* "gevent/core.pyx":779 + * self.args = (GEVENT_CORE_EVENTS, ) + args + * else: + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + } + __pyx_L5:; + +/* "gevent/core.pyx":780 + * else: + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":781 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_io_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":782 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_io_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":783 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_io_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_io_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":784 + * self._flags |= 2 + * libev.ev_io_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":785 + * libev.ev_io_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":786 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.io.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_6active___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":790 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_6active___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":791 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_7pending___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":796 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_7pending___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":797 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + int __pyx_v_fd; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + long __pyx_v_fd; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_v_events; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__fd,&__pyx_n_s__events,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[5] = {0,0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_63; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_70; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_71; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + +/* "gevent/core.pyx":817 + * + * + * def __init__(self, loop loop, int fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * if fd < 0: + * raise ValueError('fd must be non-negative: %r' % fd) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_62; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_69; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + +/* "gevent/core.pyx":801 + * + * + * def __init__(self, loop loop, long fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd)) != 0)) kw_args--; + else { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events)) != 0)) kw_args--; + else { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_v_fd = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_v_fd = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_fd == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_v_ref = values[3]; + __pyx_v_priority = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.io.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_r = __pyx_pf_6gevent_4core_2io_6__init__(((struct PyGeventIOObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_fd, __pyx_v_events, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static int __pyx_pf_6gevent_4core_2io_6__init__(struct PyGeventIOObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static int __pyx_pf_6gevent_4core_2io_6__init__(struct PyGeventIOObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, long __pyx_v_fd, int __pyx_v_events, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_v_vfd; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":818 + * + * def __init__(self, loop loop, int fd, int events, ref=True, priority=None): + * if fd < 0: # <<<<<<<<<<<<<< + * raise ValueError('fd must be non-negative: %r' % fd) + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + */ + __pyx_t_1 = (__pyx_v_fd < 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":802 + * + * def __init__(self, loop loop, long fd, int events, ref=True, priority=None): + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): # <<<<<<<<<<<<<< + * raise ValueError('illegal event mask: %r' % events) + * cdef int vfd = libev.vfd_open(fd) + */ + __pyx_t_1 = (__pyx_v_events & (~((EV__IOFDSET | EV_READ) | EV_WRITE))); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + if (__pyx_t_1) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":819 + * def __init__(self, loop loop, int fd, int events, ref=True, priority=None): + * if fd < 0: + * raise ValueError('fd must be non-negative: %r' % fd) # <<<<<<<<<<<<<< + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_fd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":803 + * def __init__(self, loop loop, long fd, int events, ref=True, priority=None): + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) # <<<<<<<<<<<<<< + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_63), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_72), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L3; + } + __pyx_L3:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":820 + * if fd < 0: + * raise ValueError('fd must be non-negative: %r' % fd) + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): # <<<<<<<<<<<<<< + * raise ValueError('illegal event mask: %r' % events) + * libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + */ + __pyx_t_4 = (__pyx_v_events & (~((EV__IOFDSET | EV_READ) | EV_WRITE))); + if (__pyx_t_4) { + +/* "gevent/core.pyx":821 + * raise ValueError('fd must be non-negative: %r' % fd) + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + * self.loop = loop + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_events); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_65), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_72), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_73), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":822 + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) + * libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_io_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_io), __pyx_v_fd, __pyx_v_events); + +/* "gevent/core.pyx":823 + * raise ValueError('illegal event mask: %r' % events) + * libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":804 + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) + * cdef int vfd = libev.vfd_open(fd) # <<<<<<<<<<<<<< + * libev.vfd_free(self._watcher.fd) + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + */ + __pyx_t_1 = vfd_open(__pyx_v_fd); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_vfd = __pyx_t_1; + +/* "gevent/core.pyx":805 + * raise ValueError('illegal event mask: %r' % events) + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + * self.loop = loop + */ + vfd_free(__pyx_v_self->_watcher.fd); + +/* "gevent/core.pyx":806 + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_io_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_io), __pyx_v_vfd, __pyx_v_events); + +/* "gevent/core.pyx":807 + * libev.vfd_free(self._watcher.fd) + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":824 + * libev.ev_io_init(&self._watcher, gevent_callback_io, fd, events) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":825 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":808 + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, events) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + +/* "gevent/core.pyx":809 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_v_self->_flags = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":811 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L4:; + +/* "gevent/core.pyx":812 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_4 = (__pyx_v_priority != Py_None); + if (__pyx_t_4) { + +/* "gevent/core.pyx":813 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_1); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L5; + } +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + /*else*/ { + +/* "gevent/core.pyx":827 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_L5:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + +/* "gevent/core.pyx":828 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":829 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_4); + goto __pyx_L6; + } + __pyx_L6:; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.io.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_2fd_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_2fd_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_2fd___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":835 + * property fd: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.vfd_get(self._watcher.fd) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_2fd___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":836 + * + * def __get__(self): + * return libev.vfd_get(self._watcher.fd) # <<<<<<<<<<<<<< + * + * def __set__(self, long fd): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(vfd_get(__pyx_v_self->_watcher.fd)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.io.fd.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_2fd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_2fd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd) { + long __pyx_v_fd; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_fd); { + __pyx_v_fd = __Pyx_PyInt_AsLong(__pyx_arg_fd); if (unlikely((__pyx_v_fd == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.io.fd.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_2io_2fd_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((long)__pyx_v_fd)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":838 + * return libev.vfd_get(self._watcher.fd) + * + * def __set__(self, long fd): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + */ + +static int __pyx_pf_6gevent_4core_2io_2fd_2__set__(struct PyGeventIOObject *__pyx_v_self, long __pyx_v_fd) { + int __pyx_v_vfd; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":839 + * + * def __set__(self, long fd): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + * cdef int vfd = libev.vfd_open(fd) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":840 + * def __set__(self, long fd): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") # <<<<<<<<<<<<<< + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":841 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + * cdef int vfd = libev.vfd_open(fd) # <<<<<<<<<<<<<< + * libev.vfd_free(self._watcher.fd) + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, self._watcher.events) + */ + __pyx_t_1 = vfd_open(__pyx_v_fd); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_vfd = __pyx_t_1; + +/* "gevent/core.pyx":842 + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, self._watcher.events) + * + */ + vfd_free(__pyx_v_self->_watcher.fd); + +/* "gevent/core.pyx":843 + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + * libev.ev_io_init(&self._watcher, gevent_callback_io, vfd, self._watcher.events) # <<<<<<<<<<<<<< + * + * property events: + */ + ev_io_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_io), __pyx_v_vfd, __pyx_v_self->_watcher.events); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.fd.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_6events_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_6events_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_6events___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":847 + * property events: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.events + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_6events___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":848 + * + * def __get__(self): + * return self._watcher.events # <<<<<<<<<<<<<< + * + * def __set__(self, int events): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_watcher.events); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.io.events.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_6events_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_events); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_6events_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_events) { + int __pyx_v_events; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_events); { + __pyx_v_events = __Pyx_PyInt_AsInt(__pyx_arg_events); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.io.events.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_2io_6events_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((int)__pyx_v_events)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":850 + * return self._watcher.events + * + * def __set__(self, int events): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") + */ + +static int __pyx_pf_6gevent_4core_2io_6events_2__set__(struct PyGeventIOObject *__pyx_v_self, int __pyx_v_events) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":851 + * + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":853 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) # <<<<<<<<<<<<<< + * + * property events_str: + */ + ev_io_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_io), __pyx_v_self->_watcher.fd, __pyx_v_events); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.io.events.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_10events_str_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_10events_str_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_10events_str___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":857 + * property events_str: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return _events_to_str(self._watcher.events) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_10events_str___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":858 + * + * def __get__(self): + * return _events_to_str(self._watcher.events) # <<<<<<<<<<<<<< + * + * def _format(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core__events_to_str(__pyx_v_self->_watcher.events, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.io.events_str.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_8_format(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":860 + * return _events_to_str(self._watcher.events) + * + * def _format(self): # <<<<<<<<<<<<<< + * return ' fd=%s events=%s' % (self.fd, self.events_str) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_8_format(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_format", 0); + +/* "gevent/core.pyx":861 + * + * def _format(self): + * return ' fd=%s events=%s' % (self.fd, self.events_str) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__events_str); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_68), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_77), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_75), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_76), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.io._format", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_11__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_11__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_6gevent_4core_2io_10__cinit__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":865 + * + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self._watcher.fd = -1; + * + */ + +static int __pyx_pf_6gevent_4core_2io_10__cinit__(struct PyGeventIOObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + +/* "gevent/core.pyx":866 + * + * def __cinit__(self): + * self._watcher.fd = -1; # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->_watcher.fd = -1; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_6gevent_4core_2io_13__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6gevent_4core_2io_13__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6gevent_4core_2io_12__dealloc__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "gevent/core.pyx":868 + * self._watcher.fd = -1; + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * libev.vfd_free(self._watcher.fd) + * + */ + +static void __pyx_pf_6gevent_4core_2io_12__dealloc__(struct PyGeventIOObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + +/* "gevent/core.pyx":869 + * + * def __dealloc__(self): + * libev.vfd_free(self._watcher.fd) # <<<<<<<<<<<<<< + * + * + */ + vfd_free(__pyx_v_self->_watcher.fd); + + __Pyx_RefNannyFinishContext(); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4loop___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":692 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_4loop___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4loop_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_2io_4loop_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.io.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4loop_4__del__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_2io_4loop_4__del__(struct PyGeventIOObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4args___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":694 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_io _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_4args___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4args_2__set__(((struct PyGeventIOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_2io_4args_2__set__(struct PyGeventIOObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.io.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_2io_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_2io_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_4args_4__del__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_2io_4args_4__del__(struct PyGeventIOObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_2io_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_2io_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_2io_6_flags___get__(((struct PyGeventIOObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":695 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_io _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_2io_6_flags___get__(struct PyGeventIOObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.io._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_3ref___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":885 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_3ref___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":886 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_3ref_2__set__(((struct PyGeventTimerObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":888 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_5timer_3ref_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":890 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":891 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":892 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":893 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":894 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":895 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":896 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":897 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":899 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":900 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":901 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":902 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":903 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":904 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_8callback___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":908 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_8callback___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":909 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_8callback_2__set__(((struct PyGeventTimerObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":911 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_5timer_8callback_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":912 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":913 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":914 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.timer.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_stop(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":916 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_stop(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":918 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":920 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":921 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_timer_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":922 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_timer_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":923 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_timer_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_timer_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":924 + * self._flags &= ~2 + * libev.ev_timer_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":925 + * libev.ev_timer_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":926 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":927 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":928 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_8priority___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":932 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_8priority___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":933 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.timer.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.timer.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5timer_8priority_2__set__(((struct PyGeventTimerObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":935 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_5timer_8priority_2__set__(struct PyGeventTimerObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":936 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":938 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.timer.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5timer_2feed(((struct PyGeventTimerObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":940 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_2feed(struct PyGeventTimerObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":942 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":944 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":945 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":946 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":947 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":948 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":949 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":950 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":951 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":952 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args, update=True): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_update = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__update,0}; + PyObject* values[2] = {0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_75; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_73; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_82; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_80; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_83; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_81; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (kw_args == 1) { + const Py_ssize_t index = 1; + PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]); + if (value) { values[index] = value; kw_args--; } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + __pyx_v_update = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.timer.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5timer_4start(((struct PyGeventTimerObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_update, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":954 + * self._flags |= 1 + * + * def start(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_4start(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_update, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":956 + * def start(self, object callback, *args, update=True): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":957 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":958 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":960 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":961 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":962 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":963 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * if update: + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":964 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * if update: + * libev.ev_now_update(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":965 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * if update: # <<<<<<<<<<<<<< + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_start(self.loop._ptr, &self._watcher) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_update); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":966 + * self._flags |= 2 + * if update: + * libev.ev_now_update(self.loop._ptr) # <<<<<<<<<<<<<< + * libev.ev_timer_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + ev_now_update(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":967 + * if update: + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_timer_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":968 + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":969 + * libev.ev_timer_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":970 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_6active___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":974 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_6active___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":975 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_7pending___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":980 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_7pending___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":981 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + double __pyx_v_after; + double __pyx_v_repeat; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__after,&__pyx_n_s__repeat,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[5] = {0,0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_78; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_76; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_85; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_83; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_86; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_84; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":983 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * if repeat < 0.0: + * raise ValueError("repeat must be positive or zero: %r" % repeat) + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__after); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__repeat); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + if (values[1]) { + __pyx_v_after = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_after == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_after = ((double)0.0); + } + if (values[2]) { + __pyx_v_repeat = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_repeat == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_repeat = ((double)0.0); + } + __pyx_v_ref = values[3]; + __pyx_v_priority = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.timer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_5timer_6__init__(((struct PyGeventTimerObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_after, __pyx_v_repeat, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5timer_6__init__(struct PyGeventTimerObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, double __pyx_v_after, double __pyx_v_repeat, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":984 + * + * def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): + * if repeat < 0.0: # <<<<<<<<<<<<<< + * raise ValueError("repeat must be positive or zero: %r" % repeat) + * libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + */ + __pyx_t_1 = (__pyx_v_repeat < 0.0); + if (__pyx_t_1) { + +/* "gevent/core.pyx":985 + * def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): + * if repeat < 0.0: + * raise ValueError("repeat must be positive or zero: %r" % repeat) # <<<<<<<<<<<<<< + * libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + * self.loop = loop + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_repeat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_79), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_77), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_86), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_84), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_87), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_85), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":986 + * if repeat < 0.0: + * raise ValueError("repeat must be positive or zero: %r" % repeat) + * libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_timer_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_timer), __pyx_v_after, __pyx_v_repeat); + +/* "gevent/core.pyx":987 + * raise ValueError("repeat must be positive or zero: %r" % repeat) + * libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":988 + * libev.ev_timer_init(&self._watcher, gevent_callback_timer, after, repeat) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":989 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":991 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L4:; + +/* "gevent/core.pyx":992 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":993 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * property at: + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_4); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.timer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_2at_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_2at_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_2at___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":997 + * property at: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.at + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_2at___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":998 + * + * def __get__(self): + * return self._watcher.at # <<<<<<<<<<<<<< + * + * # QQQ: add 'after' and 'repeat' properties? + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_watcher.at); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.timer.at.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_9again(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_9again(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_update = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("again (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,&__pyx_n_s__update,0}; + PyObject* values[2] = {0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_80; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_78; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_87; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_85; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_88; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_86; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (kw_args == 1) { + const Py_ssize_t index = 1; + PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]); + if (value) { values[index] = value; kw_args--; } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "again") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + __pyx_v_update = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("again", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.timer.again", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5timer_8again(((struct PyGeventTimerObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_update, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1002 + * # QQQ: add 'after' and 'repeat' properties? + * + * def again(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_8again(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_update, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("again", 0); + +/* "gevent/core.pyx":1004 + * def again(self, object callback, *args, update=True): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1005 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1006 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1007 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1008 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1009 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * if update: + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1010 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * if update: + * libev.ev_now_update(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1011 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * if update: # <<<<<<<<<<<<<< + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_again(self.loop._ptr, &self._watcher) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_update); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1012 + * self._flags |= 2 + * if update: + * libev.ev_now_update(self.loop._ptr) # <<<<<<<<<<<<<< + * libev.ev_timer_again(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + ev_now_update(__pyx_v_self->loop->_ptr); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1013 + * if update: + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_again(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_timer_again(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1014 + * libev.ev_now_update(self.loop._ptr) + * libev.ev_timer_again(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1015 + * libev.ev_timer_again(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1016 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.timer.again", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4loop___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":877 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_4loop___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4loop_2__set__(((struct PyGeventTimerObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5timer_4loop_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.timer.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4loop_4__del__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5timer_4loop_4__del__(struct PyGeventTimerObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4args___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":879 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_timer _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_4args___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4args_2__set__(((struct PyGeventTimerObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5timer_4args_2__set__(struct PyGeventTimerObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.timer.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5timer_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5timer_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_4args_4__del__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5timer_4args_4__del__(struct PyGeventTimerObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5timer_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5timer_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5timer_6_flags___get__(((struct PyGeventTimerObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":880 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_timer _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5timer_6_flags___get__(struct PyGeventTimerObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.timer._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_3ref___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1030 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_3ref___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1031 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_3ref_2__set__(((struct PyGeventSignalObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1033 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_6signal_3ref_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1035 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1037 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1038 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1039 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1040 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1041 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1042 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1044 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1045 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1046 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1047 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1048 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1049 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_8callback___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1053 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_8callback___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1054 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_8callback_2__set__(((struct PyGeventSignalObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1056 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_6signal_8callback_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1057 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1058 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1059 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.signal.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_stop(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1061 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_stop(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1063 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1065 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1066 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_signal_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1067 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_signal_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1068 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_signal_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_signal_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1069 + * self._flags &= ~2 + * libev.ev_signal_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1070 + * libev.ev_signal_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1071 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1072 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1073 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_8priority___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1077 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_8priority___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1078 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.signal.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.signal.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_6signal_8priority_2__set__(((struct PyGeventSignalObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1080 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_6signal_8priority_2__set__(struct PyGeventSignalObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1081 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1083 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.signal.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_6signal_2feed(((struct PyGeventSignalObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1085 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_2feed(struct PyGeventSignalObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1087 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1089 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1090 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1091 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1092 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1093 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1094 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1095 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1096 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1097 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.signal.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_6signal_4start(((struct PyGeventSignalObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1099 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_4start(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1101 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1103 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1105 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1106 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1107 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1108 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_signal_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1109 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_signal_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1110 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_signal_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_signal_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1111 + * self._flags |= 2 + * libev.ev_signal_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1112 + * libev.ev_signal_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1113 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_6active___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1117 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_6active___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1118 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_7pending___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1123 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_7pending___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1124 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * def __init__(self, loop loop, int signalnum, ref=True, priority=None): + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.signal.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + int __pyx_v_signalnum; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__signalnum,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[4] = {0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[2] = __pyx_k_88; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[2] = __pyx_k_86; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[2] = __pyx_k_95; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[2] = __pyx_k_93; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[2] = __pyx_k_96; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[2] = __pyx_k_94; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1126 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, int signalnum, ref=True, priority=None): # <<<<<<<<<<<<<< + * if signalnum < 1 or signalnum >= signalmodule.NSIG: + * raise ValueError('illegal signal number: %r' % signalnum) + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__signalnum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_signalnum = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_signalnum == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ref = values[2]; + __pyx_v_priority = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.signal.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_6signal_6__init__(((struct PyGeventSignalObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_signalnum, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_6signal_6__init__(struct PyGeventSignalObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_signalnum, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1127 + * + * def __init__(self, loop loop, int signalnum, ref=True, priority=None): + * if signalnum < 1 or signalnum >= signalmodule.NSIG: # <<<<<<<<<<<<<< + * raise ValueError('illegal signal number: %r' % signalnum) + * # still possible to crash on one of libev's asserts: + */ + __pyx_t_1 = (__pyx_v_signalnum < 1); + if (!__pyx_t_1) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_signalnum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__signalmodule); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__NSIG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + +/* "gevent/core.pyx":1128 + * def __init__(self, loop loop, int signalnum, ref=True, priority=None): + * if signalnum < 1 or signalnum >= signalmodule.NSIG: + * raise ValueError('illegal signal number: %r' % signalnum) # <<<<<<<<<<<<<< + * # still possible to crash on one of libev's asserts: + * # 1) "libev: ev_signal_start called with illegal signal number" + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_signalnum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_89), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_87), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_96), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_94), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_95), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1134 + * # 2) "libev: a signal must not be attached to two different loops" + * # we probably could check that in LIBEV_EMBED mode, but not in general + * libev.ev_signal_init(&self._watcher, gevent_callback_signal, signalnum) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_signal_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_signal), __pyx_v_signalnum); + +/* "gevent/core.pyx":1135 + * # we probably could check that in LIBEV_EMBED mode, but not in general + * libev.ev_signal_init(&self._watcher, gevent_callback_signal, signalnum) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1136 + * libev.ev_signal_init(&self._watcher, gevent_callback_signal, signalnum) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + +/* "gevent/core.pyx":1137 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1139 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1140 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_6 = (__pyx_v_priority != Py_None); + if (__pyx_t_6) { + +/* "gevent/core.pyx":1141 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_7); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent.core.signal.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4loop___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1022 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_4loop___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4loop_2__set__(((struct PyGeventSignalObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_6signal_4loop_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.signal.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4loop_4__del__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_6signal_4loop_4__del__(struct PyGeventSignalObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4args___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1024 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_signal _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_4args___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4args_2__set__(((struct PyGeventSignalObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_6signal_4args_2__set__(struct PyGeventSignalObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.signal.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_6signal_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_6signal_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_4args_4__del__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_6signal_4args_4__del__(struct PyGeventSignalObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_6signal_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_6signal_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_6signal_6_flags___get__(((struct PyGeventSignalObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1025 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_signal _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_6signal_6_flags___get__(struct PyGeventSignalObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.signal._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_3ref___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1155 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_3ref___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1156 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_3ref_2__set__(((struct PyGeventIdleObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1158 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_4idle_3ref_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1160 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1161 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1162 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1163 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1164 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1165 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1166 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1167 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1169 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1170 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1171 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1172 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1173 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1174 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_8callback___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1178 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_8callback___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1179 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_8callback_2__set__(((struct PyGeventIdleObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1181 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_4idle_8callback_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1182 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1183 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1184 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.idle.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_stop(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1186 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_stop(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1188 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1190 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1191 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_idle_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1192 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_idle_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1193 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_idle_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_idle_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1194 + * self._flags &= ~2 + * libev.ev_idle_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1195 + * libev.ev_idle_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1196 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1197 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1198 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_8priority___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1202 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_8priority___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1203 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.idle.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.idle.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4idle_8priority_2__set__(((struct PyGeventIdleObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1205 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_4idle_8priority_2__set__(struct PyGeventIdleObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1206 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1208 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.idle.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4idle_2feed(((struct PyGeventIdleObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1210 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_2feed(struct PyGeventIdleObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1212 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1214 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1215 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1216 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1217 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1218 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1219 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1220 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1221 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1222 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.idle.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4idle_4start(((struct PyGeventIdleObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1224 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_4start(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1226 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1228 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1230 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1231 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1232 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1233 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_idle_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1234 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_idle_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1235 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_idle_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_idle_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1236 + * self._flags |= 2 + * libev.ev_idle_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1237 + * libev.ev_idle_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1238 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_6active___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1242 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_6active___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1243 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_7pending___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1248 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_7pending___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1249 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.idle.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[3] = {0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_96; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_94; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_103; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_101; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_104; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_102; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1252 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_idle_init(&self._watcher, gevent_callback_idle ) + * self.loop = loop + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_ref = values[1]; + __pyx_v_priority = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.idle.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_4idle_6__init__(((struct PyGeventIdleObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4idle_6__init__(struct PyGeventIdleObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1253 + * + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_idle_init(&self._watcher, gevent_callback_idle ) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_idle_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_idle)); + +/* "gevent/core.pyx":1254 + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_idle_init(&self._watcher, gevent_callback_idle ) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1255 + * libev.ev_idle_init(&self._watcher, gevent_callback_idle ) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1256 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1258 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L3:; + +/* "gevent/core.pyx":1259 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1260 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_2); + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.idle.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4loop___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1147 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_4loop___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4loop_2__set__(((struct PyGeventIdleObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4idle_4loop_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.idle.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4loop_4__del__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4idle_4loop_4__del__(struct PyGeventIdleObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4args___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1149 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_idle _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_4args___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4args_2__set__(((struct PyGeventIdleObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4idle_4args_2__set__(struct PyGeventIdleObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.idle.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4idle_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4idle_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_4args_4__del__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4idle_4args_4__del__(struct PyGeventIdleObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4idle_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4idle_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4idle_6_flags___get__(((struct PyGeventIdleObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1150 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_idle _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4idle_6_flags___get__(struct PyGeventIdleObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.idle._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_3ref___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1274 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_3ref___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1275 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_3ref_2__set__(((struct PyGeventPrepareObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1277 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_7prepare_3ref_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1279 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1280 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1281 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1282 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1283 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1284 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1285 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1286 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1288 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1289 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1290 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1291 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1292 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1293 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_8callback___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1297 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_8callback___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1298 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_8callback_2__set__(((struct PyGeventPrepareObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1300 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_7prepare_8callback_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1301 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1302 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1303 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.prepare.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_stop(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1305 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_stop(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1307 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1309 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1310 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_prepare_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1311 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_prepare_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1312 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_prepare_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_prepare_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1313 + * self._flags &= ~2 + * libev.ev_prepare_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1314 + * libev.ev_prepare_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1315 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1316 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1317 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_8priority___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1321 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_8priority___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1322 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.prepare.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.prepare.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_7prepare_8priority_2__set__(((struct PyGeventPrepareObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1324 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_7prepare_8priority_2__set__(struct PyGeventPrepareObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1325 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1327 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.prepare.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_7prepare_2feed(((struct PyGeventPrepareObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1329 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_2feed(struct PyGeventPrepareObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1331 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1333 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1334 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1335 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1336 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1337 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1338 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1339 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1340 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1341 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.prepare.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4start(((struct PyGeventPrepareObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1343 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_4start(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1345 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1347 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1349 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1350 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1351 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1352 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_prepare_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1353 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_prepare_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1354 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_prepare_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_prepare_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1355 + * self._flags |= 2 + * libev.ev_prepare_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1356 + * libev.ev_prepare_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1357 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_6active___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1361 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_6active___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1362 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_7pending___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1367 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_7pending___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1368 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.prepare.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[3] = {0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_103; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_101; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_110; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_108; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_111; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_109; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1371 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) + * self.loop = loop + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_ref = values[1]; + __pyx_v_priority = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.prepare.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_7prepare_6__init__(((struct PyGeventPrepareObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_7prepare_6__init__(struct PyGeventPrepareObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1372 + * + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_prepare_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_prepare)); + +/* "gevent/core.pyx":1373 + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1374 + * libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1375 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1377 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L3:; + +/* "gevent/core.pyx":1378 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1379 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_2); + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.prepare.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4loop___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1266 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_4loop___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4loop_2__set__(((struct PyGeventPrepareObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_7prepare_4loop_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.prepare.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4loop_4__del__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_7prepare_4loop_4__del__(struct PyGeventPrepareObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4args___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1268 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_prepare _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_4args___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4args_2__set__(((struct PyGeventPrepareObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_7prepare_4args_2__set__(struct PyGeventPrepareObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.prepare.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_7prepare_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_7prepare_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_4args_4__del__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_7prepare_4args_4__del__(struct PyGeventPrepareObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_7prepare_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_7prepare_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_7prepare_6_flags___get__(((struct PyGeventPrepareObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1269 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_prepare _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_7prepare_6_flags___get__(struct PyGeventPrepareObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.prepare._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_3ref___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1393 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_3ref___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1394 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_3ref_2__set__(((struct PyGeventForkObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1396 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_4fork_3ref_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1398 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1399 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1400 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1401 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1402 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1403 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1404 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1405 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1407 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1408 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1409 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1410 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1411 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1412 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_8callback___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1416 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_8callback___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1417 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_8callback_2__set__(((struct PyGeventForkObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1419 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_4fork_8callback_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1420 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1421 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1422 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.fork.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_stop(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1424 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_stop(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1426 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1428 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1429 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_fork_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1430 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_fork_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1431 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_fork_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_fork_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1432 + * self._flags &= ~2 + * libev.ev_fork_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1433 + * libev.ev_fork_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1434 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1435 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1436 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_8priority___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1440 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_8priority___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1441 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.fork.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.fork.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4fork_8priority_2__set__(((struct PyGeventForkObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1443 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_4fork_8priority_2__set__(struct PyGeventForkObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1444 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1446 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.fork.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4fork_2feed(((struct PyGeventForkObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1448 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_2feed(struct PyGeventForkObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1450 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1452 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1453 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1454 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1455 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1456 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1457 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1458 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1459 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1460 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.fork.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4fork_4start(((struct PyGeventForkObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1462 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_4start(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1464 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1466 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1468 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1469 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1470 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1471 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_fork_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1472 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_fork_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1473 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_fork_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_fork_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1474 + * self._flags |= 2 + * libev.ev_fork_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1475 + * libev.ev_fork_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1476 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_6active___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1480 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_6active___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1481 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_7pending___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1486 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_7pending___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1487 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.fork.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[3] = {0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_110; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_108; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_117; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_115; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_118; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_116; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1490 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_fork_init(&self._watcher, gevent_callback_fork ) + * self.loop = loop + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_ref = values[1]; + __pyx_v_priority = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.fork.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_4fork_6__init__(((struct PyGeventForkObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4fork_6__init__(struct PyGeventForkObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1491 + * + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_fork_init(&self._watcher, gevent_callback_fork ) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_fork_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_fork)); + +/* "gevent/core.pyx":1492 + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_fork_init(&self._watcher, gevent_callback_fork ) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1493 + * libev.ev_fork_init(&self._watcher, gevent_callback_fork ) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1494 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1496 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L3:; + +/* "gevent/core.pyx":1497 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1498 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_2); + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.fork.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4loop___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1385 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_4loop___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4loop_2__set__(((struct PyGeventForkObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4fork_4loop_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.fork.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4loop_4__del__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4fork_4loop_4__del__(struct PyGeventForkObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4args___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1387 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_fork _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_4args___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4args_2__set__(((struct PyGeventForkObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4fork_4args_2__set__(struct PyGeventForkObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.fork.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4fork_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4fork_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_4args_4__del__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4fork_4args_4__del__(struct PyGeventForkObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4fork_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4fork_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4fork_6_flags___get__(((struct PyGeventForkObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1388 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_fork _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4fork_6_flags___get__(struct PyGeventForkObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.fork._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_3ref___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1512 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_3ref___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1513 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_3ref_2__set__(((struct PyGeventAsyncObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1515 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_5async_3ref_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1517 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1518 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1519 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1520 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1521 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1522 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1523 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1524 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1526 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1527 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1528 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1529 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1530 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1531 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_8callback___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1535 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_8callback___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1536 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_8callback_2__set__(((struct PyGeventAsyncObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1538 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_5async_8callback_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1539 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1540 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1541 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.async.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_stop(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1543 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_stop(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1545 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1547 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1548 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_async_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1549 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_async_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1550 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_async_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_async_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1551 + * self._flags &= ~2 + * libev.ev_async_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1552 + * libev.ev_async_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1553 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1554 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1555 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_8priority___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1559 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_8priority___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1560 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.async.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.async.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5async_8priority_2__set__(((struct PyGeventAsyncObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1562 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_5async_8priority_2__set__(struct PyGeventAsyncObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1563 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1565 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.async.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5async_2feed(((struct PyGeventAsyncObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1567 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_2feed(struct PyGeventAsyncObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1569 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1571 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1572 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1573 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1574 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1575 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1576 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1577 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1578 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1579 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.async.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5async_4start(((struct PyGeventAsyncObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1581 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_4start(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1583 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1585 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1587 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1588 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1589 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1590 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_async_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1591 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_async_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1592 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_async_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_async_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1593 + * self._flags |= 2 + * libev.ev_async_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1594 + * libev.ev_async_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1595 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_6active___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1599 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_6active___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1600 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * property pending: + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_7pending___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1604 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_async_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_7pending___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1605 + * + * def __get__(self): + * return True if libev.ev_async_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_async_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[3] = {0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_117; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_115; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_124; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_122; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[1] = __pyx_k_125; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[1] = __pyx_k_123; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1608 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_async_init(&self._watcher, gevent_callback_async ) + * self.loop = loop + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_ref = values[1]; + __pyx_v_priority = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.async.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_5async_6__init__(((struct PyGeventAsyncObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5async_6__init__(struct PyGeventAsyncObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1609 + * + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_async_init(&self._watcher, gevent_callback_async ) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_async_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_async)); + +/* "gevent/core.pyx":1610 + * def __init__(self, loop loop , ref=True, priority=None): + * libev.ev_async_init(&self._watcher, gevent_callback_async ) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1611 + * libev.ev_async_init(&self._watcher, gevent_callback_async ) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1612 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1614 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L3:; + +/* "gevent/core.pyx":1615 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_1 = (__pyx_v_priority != Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1616 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def send(self): + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_2); + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.async.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_9send(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_9send(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("send (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_8send(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1618 + * libev.ev_set_priority(&self._watcher, priority) + * + * def send(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_8send(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("send", 0); + +/* "gevent/core.pyx":1620 + * def send(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * libev.ev_async_send(self.loop._ptr, &self._watcher) + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1621 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_async_send(self.loop._ptr, &self._watcher) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1622 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * libev.ev_async_send(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * + * + */ + ev_async_send(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.async.send", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4loop___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1504 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_4loop___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4loop_2__set__(((struct PyGeventAsyncObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5async_4loop_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.async.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4loop_4__del__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5async_4loop_4__del__(struct PyGeventAsyncObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4args___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1506 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_async _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_4args___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4args_2__set__(((struct PyGeventAsyncObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5async_4args_2__set__(struct PyGeventAsyncObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.async.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5async_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5async_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_4args_4__del__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5async_4args_4__del__(struct PyGeventAsyncObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5async_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5async_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5async_6_flags___get__(((struct PyGeventAsyncObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1507 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_async _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5async_6_flags___get__(struct PyGeventAsyncObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.async._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_5child_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_3ref_1__get__(PyObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4stat_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_3ref_1__get__(PyObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_5child_3ref___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1638 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_3ref___get__(struct PyGeventChildObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4stat_3ref___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1783 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_3ref___get__(struct PyGeventStatObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1639 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1784 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_AddTraceback("gevent.core.child.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_AddTraceback("gevent.core.stat.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static int __pyx_pw_6gevent_4core_5child_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static int __pyx_pw_6gevent_4core_4stat_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_5child_3ref_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1641 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_5child_3ref_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4stat_3ref_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1786 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_4stat_3ref_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1643 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1788 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1644 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + goto __pyx_L3; + } + __pyx_L3:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1645 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1790 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + if (__pyx_t_1) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1646 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1791 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1647 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1792 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1648 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1793 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1649 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1794 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1650 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1795 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1652 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1797 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1653 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1798 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1654 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1799 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1655 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1800 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1656 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1801 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + ev_unref(__pyx_v_self->loop->_ptr); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1657 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1802 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_AddTraceback("gevent.core.child.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_AddTraceback("gevent.core.stat.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_5child_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_8callback_1__get__(PyObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static PyObject *__pyx_pw_6gevent_4core_4stat_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_8callback_1__get__(PyObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_5child_8callback___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1661 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_8callback___get__(struct PyGeventChildObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4stat_8callback___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1806 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_8callback___get__(struct PyGeventStatObject *__pyx_v_self) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1662 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":1807 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static int __pyx_pw_6gevent_4core_5child_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static int __pyx_pw_6gevent_4core_4stat_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_5child_8callback_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1664 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_5child_8callback_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_callback) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_r = __pyx_pf_6gevent_4core_4stat_8callback_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1809 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_4stat_8callback_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_callback) { +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1665 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1666 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1667 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.child.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_stop(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1669 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_stop(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1671 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1672 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1673 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1674 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_child_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1675 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_child_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1676 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_child_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_child_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1677 + * self._flags &= ~2 + * libev.ev_child_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1678 + * libev.ev_child_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1679 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1680 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1681 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_8priority___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1685 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_8priority___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1686 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.child.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5child_8priority_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1688 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_5child_8priority_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1689 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1690 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1691 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.child.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5child_2feed(((struct PyGeventChildObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1693 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_2feed(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1695 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1696 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1697 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1698 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1699 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1700 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1701 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1702 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1703 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1704 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1705 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.child.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5child_4start(((struct PyGeventChildObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1707 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_4start(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1709 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1710 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1711 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1712 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_132), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1713 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1714 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1715 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1716 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_child_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1717 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_child_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1718 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_child_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_child_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1719 + * self._flags |= 2 + * libev.ev_child_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1720 + * libev.ev_child_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1721 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_6active___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1725 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_6active___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1726 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_7pending___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1731 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_7pending___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1732 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.child.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + int __pyx_v_pid; + int __pyx_v_trace; + PyObject *__pyx_v_ref = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__pid,&__pyx_n_s__trace,&__pyx_n_s__ref,0}; + PyObject* values[4] = {0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_125; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_132; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_133; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pid)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__trace); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_pid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_pid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[2]) { + __pyx_v_trace = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_trace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_trace = ((int)0); + } + __pyx_v_ref = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.child.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_5child_6__init__(((struct PyGeventChildObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_pid, __pyx_v_trace, __pyx_v_ref); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1734 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): # <<<<<<<<<<<<<< + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') + */ + +static int __pyx_pf_6gevent_4core_5child_6__init__(struct PyGeventChildObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, int __pyx_v_pid, int __pyx_v_trace, PyObject *__pyx_v_ref) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1735 + * + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): + * if not loop.default: # <<<<<<<<<<<<<< + * raise TypeError('child watchers are only available on the default loop') + * libev.gevent_install_sigchld_handler() + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_loop), __pyx_n_s__default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1736 + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') # <<<<<<<<<<<<<< + * libev.gevent_install_sigchld_handler() + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_135), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1737 + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') + * libev.gevent_install_sigchld_handler() # <<<<<<<<<<<<<< + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + * self.loop = loop + */ + gevent_install_sigchld_handler(); + +/* "gevent/core.pyx":1738 + * raise TypeError('child watchers are only available on the default loop') + * libev.gevent_install_sigchld_handler() + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + ev_child_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_child), __pyx_v_pid, __pyx_v_trace); + +/* "gevent/core.pyx":1739 + * libev.gevent_install_sigchld_handler() + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1740 + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + +/* "gevent/core.pyx":1741 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1743 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * + * def _format(self): + */ + __pyx_v_self->_flags = 4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_9_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_format (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_8_format(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1745 + * self._flags = 4 + * + * def _format(self): # <<<<<<<<<<<<<< + * return ' pid=%r rstatus=%r' % (self.pid, self.rstatus) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_8_format(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_format", 0); + +/* "gevent/core.pyx":1746 + * + * def _format(self): + * return ' pid=%r rstatus=%r' % (self.pid, self.rstatus) # <<<<<<<<<<<<<< + * + * property pid: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__pid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__rstatus); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_128), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_136), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.child._format", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_3pid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_3pid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_3pid___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1750 + * property pid: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.pid + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_3pid___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1751 + * + * def __get__(self): + * return self._watcher.pid # <<<<<<<<<<<<<< + * + * property rpid: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_watcher.pid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child.pid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_4rpid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_4rpid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4rpid___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1755 + * property rpid: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.rpid + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_4rpid___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1756 + * + * def __get__(self): + * return self._watcher.rpid # <<<<<<<<<<<<<< + * + * def __set__(self, int value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_watcher.rpid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child.rpid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_4rpid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_4rpid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + int __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_AsInt(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.child.rpid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5child_4rpid_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((int)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1758 + * return self._watcher.rpid + * + * def __set__(self, int value): # <<<<<<<<<<<<<< + * self._watcher.rpid = value + * + */ + +static int __pyx_pf_6gevent_4core_5child_4rpid_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1759 + * + * def __set__(self, int value): + * self._watcher.rpid = value # <<<<<<<<<<<<<< + * + * property rstatus: + */ + __pyx_v_self->_watcher.rpid = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_7rstatus_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_7rstatus_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_7rstatus___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1763 + * property rstatus: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.rstatus + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_7rstatus___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1764 + * + * def __get__(self): + * return self._watcher.rstatus # <<<<<<<<<<<<<< + * + * def __set__(self, int value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_watcher.rstatus); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child.rstatus.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_7rstatus_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_7rstatus_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + int __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_AsInt(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.child.rstatus.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_5child_7rstatus_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((int)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1766 + * return self._watcher.rstatus + * + * def __set__(self, int value): # <<<<<<<<<<<<<< + * self._watcher.rstatus = value + * + */ + +static int __pyx_pf_6gevent_4core_5child_7rstatus_2__set__(struct PyGeventChildObject *__pyx_v_self, int __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1767 + * + * def __set__(self, int value): + * self._watcher.rstatus = value # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->_watcher.rstatus = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4loop___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1630 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_4loop___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4loop_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5child_4loop_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.child.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4loop_4__del__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5child_4loop_4__del__(struct PyGeventChildObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4args___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1632 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_child _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_4args___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4args_2__set__(((struct PyGeventChildObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5child_4args_2__set__(struct PyGeventChildObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.child.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_5child_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_5child_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_4args_4__del__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_5child_4args_4__del__(struct PyGeventChildObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_5child_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_5child_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_5child_6_flags___get__(((struct PyGeventChildObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1633 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_child _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_5child_6_flags___get__(struct PyGeventChildObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.child._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_3ref_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_3ref___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1783 + * property ref: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return False if self._flags & 4 else True + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_3ref___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1784 + * + * def __get__(self): + * return False if self._flags & 4 else True # <<<<<<<<<<<<<< + * + * def __set__(self, object value): + */ + __Pyx_XDECREF(__pyx_r); + if ((__pyx_v_self->_flags & 4)) { + __pyx_t_1 = 0; + } else { + __pyx_t_1 = 1; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_3ref_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1786 + * return False if self._flags & 4 else True + * + * def __set__(self, object value): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static int __pyx_pf_6gevent_4core_4stat_3ref_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1788 + * def __set__(self, object value): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if value: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_136), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1790 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if value: # <<<<<<<<<<<<<< + * if not self._flags & 4: + * return # ref is already True + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1791 + * raise ValueError('operation on destroyed loop') + * if value: + * if not self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 4)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1792 + * if value: + * if not self._flags & 4: + * return # ref is already True # <<<<<<<<<<<<<< + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1793 + * if not self._flags & 4: + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1794 + * return # ref is already True + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + */ + ev_ref(__pyx_v_self->loop->_ptr); + goto __pyx_L6; + } + __pyx_L6:; + +/* "gevent/core.pyx":1795 + * if self._flags & 2: # ev_unref was called, undo + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~6 # do not want unref, no outstanding unref # <<<<<<<<<<<<<< + * else: + * if self._flags & 4: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~6)); + goto __pyx_L4; + } + /*else*/ { + +/* "gevent/core.pyx":1797 + * self._flags &= ~6 # do not want unref, no outstanding unref + * else: + * if self._flags & 4: # <<<<<<<<<<<<<< + * return # ref is already False + * self._flags |= 4 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 4); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1798 + * else: + * if self._flags & 4: + * return # ref is already False # <<<<<<<<<<<<<< + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + +/* "gevent/core.pyx":1799 + * if self._flags & 4: + * return # ref is already False + * self._flags |= 4 # <<<<<<<<<<<<<< + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 4); + +/* "gevent/core.pyx":1800 + * return # ref is already False + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 2)); + if (__pyx_t_1) { + __pyx_t_4 = ev_is_active((&__pyx_v_self->_watcher)); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + +/* "gevent/core.pyx":1801 + * self._flags |= 4 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1802 + * if not self._flags & 2 and libev.ev_is_active(&self._watcher): + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * + * property callback: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_8callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_8callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_8callback___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1806 + * property callback: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._callback + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_8callback___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1807 + * + * def __get__(self): + * return self._callback # <<<<<<<<<<<<<< + * + * def __set__(self, object callback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_callback); + __pyx_r = __pyx_v_self->_callback; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_8callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_8callback_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1809 + * return self._callback + * + * def __set__(self, object callback): # <<<<<<<<<<<<<< + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + */ + +static int __pyx_pf_6gevent_4core_4stat_8callback_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_callback) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +/* "gevent/core.pyx":1810 + * + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: # <<<<<<<<<<<<<< + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback + */ + __pyx_t_1 = (!PyCallable_Check(((PyObject*)__pyx_v_callback))); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_callback != Py_None); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + +/* "gevent/core.pyx":1811 + * def __set__(self, object callback): + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) # <<<<<<<<<<<<<< + * self._callback = callback + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1812 + * if not PyCallable_Check(callback) and callback is not None: + * raise TypeError("Expected callable, not %r" % (callback, )) + * self._callback = callback # <<<<<<<<<<<<<< + * + * def stop(self): + */ + __Pyx_INCREF(__pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = __pyx_v_callback; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent.core.stat.callback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_1stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_stop(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1814 + * self._callback = callback + * + * def stop(self): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_stop(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); + +/* "gevent/core.pyx":1816 + * def stop(self): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_138), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1818 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: # <<<<<<<<<<<<<< + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 2); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1819 + * raise ValueError('operation on destroyed loop') + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags &= ~2 + * libev.ev_stat_stop(self.loop._ptr, &self._watcher) + */ + ev_ref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1820 + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 # <<<<<<<<<<<<<< + * libev.ev_stat_stop(self.loop._ptr, &self._watcher) + * self._callback = None + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~2)); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1821 + * libev.ev_ref(self.loop._ptr) + * self._flags &= ~2 + * libev.ev_stat_stop(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * self._callback = None + * self.args = None + */ + ev_stat_stop(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1822 + * self._flags &= ~2 + * libev.ev_stat_stop(self.loop._ptr, &self._watcher) + * self._callback = None # <<<<<<<<<<<<<< + * self.args = None + * if self._flags & 1: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_callback); + __Pyx_DECREF(__pyx_v_self->_callback); + __pyx_v_self->_callback = Py_None; + +/* "gevent/core.pyx":1823 + * libev.ev_stat_stop(self.loop._ptr, &self._watcher) + * self._callback = None + * self.args = None # <<<<<<<<<<<<<< + * if self._flags & 1: + * Py_DECREF(self) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + +/* "gevent/core.pyx":1824 + * self._callback = None + * self.args = None + * if self._flags & 1: # <<<<<<<<<<<<<< + * Py_DECREF(self) + * self._flags &= ~1 + */ + __pyx_t_3 = (__pyx_v_self->_flags & 1); + if (__pyx_t_3) { + +/* "gevent/core.pyx":1825 + * self.args = None + * if self._flags & 1: + * Py_DECREF(self) # <<<<<<<<<<<<<< + * self._flags &= ~1 + * + */ + Py_DECREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1826 + * if self._flags & 1: + * Py_DECREF(self) + * self._flags &= ~1 # <<<<<<<<<<<<<< + * + * property priority: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags & (~1)); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_8priority_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_8priority_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_8priority___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1830 + * property priority: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return libev.ev_priority(&self._watcher) + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_8priority___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1831 + * + * def __get__(self): + * return libev.ev_priority(&self._watcher) # <<<<<<<<<<<<<< + * + * def __set__(self, int priority): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(ev_priority((&__pyx_v_self->_watcher))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.stat.priority.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_8priority_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_priority) { + int __pyx_v_priority; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_priority); { + __pyx_v_priority = __Pyx_PyInt_AsInt(__pyx_arg_priority); if (unlikely((__pyx_v_priority == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.stat.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4stat_8priority_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((int)__pyx_v_priority)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1833 + * return libev.ev_priority(&self._watcher) + * + * def __set__(self, int priority): # <<<<<<<<<<<<<< + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + */ + +static int __pyx_pf_6gevent_4core_4stat_8priority_2__set__(struct PyGeventStatObject *__pyx_v_self, int __pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + +/* "gevent/core.pyx":1834 + * + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): # <<<<<<<<<<<<<< + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_t_1 = ev_is_active((&__pyx_v_self->_watcher)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_138), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1836 + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * def feed(self, int revents, object callback, *args): + */ + ev_set_priority((&__pyx_v_self->_watcher), __pyx_v_priority); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.priority.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_3feed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_revents; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feed (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__revents,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__revents)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "feed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_revents = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_revents == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feed", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.stat.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4stat_2feed(((struct PyGeventStatObject *)__pyx_v_self), __pyx_v_revents, __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1838 + * libev.ev_set_priority(&self._watcher, priority) + * + * def feed(self, int revents, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_2feed(struct PyGeventStatObject *__pyx_v_self, int __pyx_v_revents, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed", 0); + +/* "gevent/core.pyx":1840 + * def feed(self, int revents, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * self.callback = callback + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_132), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1842 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1843 + * raise ValueError('operation on destroyed loop') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1844 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1845 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1846 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1847 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_feed_event(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher), __pyx_v_revents); + +/* "gevent/core.pyx":1848 + * self._flags |= 2 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1849 + * libev.ev_feed_event(self.loop._ptr, &self._watcher, revents) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1850 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * def start(self, object callback, *args): + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_5start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__callback,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_callback = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("start", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent.core.stat.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_4core_4stat_4start(((struct PyGeventStatObject *)__pyx_v_self), __pyx_v_callback, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1852 + * self._flags |= 1 + * + * def start(self, object callback, *args): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4start(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); + +/* "gevent/core.pyx":1854 + * def start(self, object callback, *args): + * + * if not self.loop._ptr: # <<<<<<<<<<<<<< + * raise ValueError('operation on destroyed loop') + * if callback is None: + */ + __pyx_t_1 = (!(__pyx_v_self->loop->_ptr != 0)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_133), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_141), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1856 + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') + * if callback is None: # <<<<<<<<<<<<<< + * raise TypeError('callback must be callable, not None') + * self.callback = callback + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_141), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + +/* "gevent/core.pyx":1858 + * if callback is None: + * raise TypeError('callback must be callable, not None') + * self.callback = callback # <<<<<<<<<<<<<< + * self.args = args + * if self._flags & 6 == 4: + */ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":1859 + * raise TypeError('callback must be callable, not None') + * self.callback = callback + * self.args = args # <<<<<<<<<<<<<< + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = __pyx_v_args; + +/* "gevent/core.pyx":1860 + * self.callback = callback + * self.args = args + * if self._flags & 6 == 4: # <<<<<<<<<<<<<< + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + */ + __pyx_t_1 = ((__pyx_v_self->_flags & 6) == 4); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1861 + * self.args = args + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) # <<<<<<<<<<<<<< + * self._flags |= 2 + * libev.ev_stat_start(self.loop._ptr, &self._watcher) + */ + ev_unref(__pyx_v_self->loop->_ptr); + +/* "gevent/core.pyx":1862 + * if self._flags & 6 == 4: + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 # <<<<<<<<<<<<<< + * libev.ev_stat_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 2); + goto __pyx_L5; + } + __pyx_L5:; + +/* "gevent/core.pyx":1863 + * libev.ev_unref(self.loop._ptr) + * self._flags |= 2 + * libev.ev_stat_start(self.loop._ptr, &self._watcher) # <<<<<<<<<<<<<< + * if not self._flags & 1: + * Py_INCREF(self) + */ + ev_stat_start(__pyx_v_self->loop->_ptr, (&__pyx_v_self->_watcher)); + +/* "gevent/core.pyx":1864 + * self._flags |= 2 + * libev.ev_stat_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: # <<<<<<<<<<<<<< + * Py_INCREF(self) + * self._flags |= 1 + */ + __pyx_t_1 = (!(__pyx_v_self->_flags & 1)); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1865 + * libev.ev_stat_start(self.loop._ptr, &self._watcher) + * if not self._flags & 1: + * Py_INCREF(self) # <<<<<<<<<<<<<< + * self._flags |= 1 + * + */ + Py_INCREF(((PyObject*)__pyx_v_self)); + +/* "gevent/core.pyx":1866 + * if not self._flags & 1: + * Py_INCREF(self) + * self._flags |= 1 # <<<<<<<<<<<<<< + * + * property active: + */ + __pyx_v_self->_flags = (__pyx_v_self->_flags | 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_6active_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_6active_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_6active___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1870 + * property active: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_active(&self._watcher) else False + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_6active___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1871 + * + * def __get__(self): + * return True if libev.ev_is_active(&self._watcher) else False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_active((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_7pending_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_7pending_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_7pending___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1876 + * property pending: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return True if libev.ev_is_pending(&self._watcher) else False + * cdef readonly bytes path + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_7pending___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1877 + * + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False # <<<<<<<<<<<<<< + * cdef readonly bytes path + * + */ + __Pyx_XDECREF(__pyx_r); + if (ev_is_pending((&__pyx_v_self->_watcher))) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.pending.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_7__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct PyGeventLoopObject *__pyx_v_loop = 0; + PyObject *__pyx_v_path = 0; + float __pyx_v_interval; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_v_priority = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loop,&__pyx_n_s__path,&__pyx_n_s__interval,&__pyx_n_s__ref,&__pyx_n_s__priority,0}; + PyObject* values[5] = {0,0,0,0,0}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_135; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_123; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_142; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_130; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + values[3] = __pyx_k_143; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + values[3] = __pyx_k_131; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":1880 + * cdef readonly bytes path + * + * def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * self.path = path + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loop)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__priority); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_loop = ((struct PyGeventLoopObject *)values[0]); + __pyx_v_path = ((PyObject*)values[1]); + if (values[2]) { + __pyx_v_interval = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_interval == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_interval = ((float)0.0); + } + __pyx_v_ref = values[3]; + __pyx_v_priority = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent.core.stat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop), __pyx_ptype_6gevent_4core_loop, 1, "loop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyBytes_Type), 1, "path", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6gevent_4core_4stat_6__init__(((struct PyGeventStatObject *)__pyx_v_self), __pyx_v_loop, __pyx_v_path, __pyx_v_interval, __pyx_v_ref, __pyx_v_priority); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4stat_6__init__(struct PyGeventStatObject *__pyx_v_self, struct PyGeventLoopObject *__pyx_v_loop, PyObject *__pyx_v_path, float __pyx_v_interval, PyObject *__pyx_v_ref, PyObject *__pyx_v_priority) { + int __pyx_r; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + +/* "gevent/core.pyx":1881 + * + * def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): + * self.path = path # <<<<<<<<<<<<<< + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + * self.loop = loop + */ + __Pyx_INCREF(((PyObject *)__pyx_v_path)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); + __Pyx_GOTREF(__pyx_v_self->path); + __Pyx_DECREF(((PyObject *)__pyx_v_self->path)); + __pyx_v_self->path = __pyx_v_path; + +/* "gevent/core.pyx":1882 + * def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): + * self.path = path + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) # <<<<<<<<<<<<<< + * self.loop = loop + * if ref: + */ + __pyx_t_1 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->path)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_stat_init((&__pyx_v_self->_watcher), ((void *)gevent_callback_stat), ((char *)__pyx_t_1), __pyx_v_interval); + +/* "gevent/core.pyx":1883 + * self.path = path + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + * self.loop = loop # <<<<<<<<<<<<<< + * if ref: + * self._flags = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_loop)); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = __pyx_v_loop; + +/* "gevent/core.pyx":1884 + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + * self.loop = loop + * if ref: # <<<<<<<<<<<<<< + * self._flags = 0 + * else: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ref); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + +/* "gevent/core.pyx":1885 + * self.loop = loop + * if ref: + * self._flags = 0 # <<<<<<<<<<<<<< + * else: + * self._flags = 4 + */ + __pyx_v_self->_flags = 0; + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1887 + * self._flags = 0 + * else: + * self._flags = 4 # <<<<<<<<<<<<<< + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) + */ + __pyx_v_self->_flags = 4; + } + __pyx_L3:; + +/* "gevent/core.pyx":1888 + * else: + * self._flags = 4 + * if priority is not None: # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_t_2 = (__pyx_v_priority != Py_None); + if (__pyx_t_2) { + +/* "gevent/core.pyx":1889 + * self._flags = 4 + * if priority is not None: + * libev.ev_set_priority(&self._watcher, priority) # <<<<<<<<<<<<<< + * + * property attr: + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_priority); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ev_set_priority((&__pyx_v_self->_watcher), __pyx_t_3); + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.stat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_4attr_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_4attr_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4attr___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1893 + * property attr: + * + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._watcher.attr.st_nlink: + * return + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4attr___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1894 + * + * def __get__(self): + * if not self._watcher.attr.st_nlink: # <<<<<<<<<<<<<< + * return + * return _pystat_fromstructstat(&self._watcher.attr) + */ + __pyx_t_1 = (!__pyx_v_self->_watcher.attr.st_nlink); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1895 + * def __get__(self): + * if not self._watcher.attr.st_nlink: + * return # <<<<<<<<<<<<<< + * return _pystat_fromstructstat(&self._watcher.attr) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1896 + * if not self._watcher.attr.st_nlink: + * return + * return _pystat_fromstructstat(&self._watcher.attr) # <<<<<<<<<<<<<< + * + * property prev: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = _pystat_fromstructstat((&__pyx_v_self->_watcher.attr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.attr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_4prev_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_4prev_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4prev___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1900 + * property prev: + * + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._watcher.prev.st_nlink: + * return + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4prev___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1901 + * + * def __get__(self): + * if not self._watcher.prev.st_nlink: # <<<<<<<<<<<<<< + * return + * return _pystat_fromstructstat(&self._watcher.prev) + */ + __pyx_t_1 = (!__pyx_v_self->_watcher.prev.st_nlink); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1902 + * def __get__(self): + * if not self._watcher.prev.st_nlink: + * return # <<<<<<<<<<<<<< + * return _pystat_fromstructstat(&self._watcher.prev) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + +/* "gevent/core.pyx":1903 + * if not self._watcher.prev.st_nlink: + * return + * return _pystat_fromstructstat(&self._watcher.prev) # <<<<<<<<<<<<<< + * + * property interval: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = _pystat_fromstructstat((&__pyx_v_self->_watcher.prev)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent.core.stat.prev.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_8interval_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_8interval_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_8interval___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1907 + * property interval: + * + * def __get__(self): # <<<<<<<<<<<<<< + * return self._watcher.interval + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_8interval___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + +/* "gevent/core.pyx":1908 + * + * def __get__(self): + * return self._watcher.interval # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_watcher.interval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.stat.interval.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_4loop_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4loop___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1775 + * + * + * cdef public loop loop # <<<<<<<<<<<<<< + * cdef object _callback + * cdef public tuple args + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4loop___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->loop)); + __pyx_r = ((PyObject *)__pyx_v_self->loop); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_4loop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4loop_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4stat_4loop_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_4core_loop))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.stat.loop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_4loop_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_4loop_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4loop_4__del__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4stat_4loop_4__del__(struct PyGeventStatObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->loop); + __Pyx_DECREF(((PyObject *)__pyx_v_self->loop)); + __pyx_v_self->loop = ((struct PyGeventLoopObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4args___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1777 + * cdef public loop loop + * cdef object _callback + * cdef public tuple args # <<<<<<<<<<<<<< + * cdef readonly int _flags + * cdef libev.ev_stat _watcher + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4args___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->args)); + __pyx_r = ((PyObject *)__pyx_v_self->args); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_4args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4args_2__set__(((struct PyGeventStatObject *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4stat_4args_2__set__(struct PyGeventStatObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("gevent.core.stat.args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6gevent_4core_4stat_4args_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6gevent_4core_4stat_4args_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4args_4__del__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6gevent_4core_4stat_4args_4__del__(struct PyGeventStatObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->args); + __Pyx_DECREF(((PyObject *)__pyx_v_self->args)); + __pyx_v_self->args = ((PyObject*)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_6_flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_6_flags_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_6_flags___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1778 + * cdef object _callback + * cdef public tuple args + * cdef readonly int _flags # <<<<<<<<<<<<<< + * cdef libev.ev_stat _watcher + * + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_6_flags___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.stat._flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_4stat_4path_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_4stat_4path_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_4stat_4path___get__(((struct PyGeventStatObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1878 + * def __get__(self): + * return True if libev.ev_is_pending(&self._watcher) else False + * cdef readonly bytes path # <<<<<<<<<<<<<< + * + * def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): + */ + +static PyObject *__pyx_pf_6gevent_4core_4stat_4path___get__(struct PyGeventStatObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->path)); + __pyx_r = ((PyObject *)__pyx_v_self->path); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1914 + * + * + * cdef void _syserr_cb(char* msg) with gil: # <<<<<<<<<<<<<< + * try: + * __SYSERR_CALLBACK(msg, errno) + */ + +static void __pyx_f_6gevent_4core__syserr_cb(char *__pyx_v_msg) { + PyObject *__pyx_v_print_exc = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_syserr_cb", 0); + +/* "gevent/core.pyx":1915 + * + * cdef void _syserr_cb(char* msg) with gil: + * try: # <<<<<<<<<<<<<< + * __SYSERR_CALLBACK(msg, errno) + * except: + */ + { + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + +/* "gevent/core.pyx":1916 + * cdef void _syserr_cb(char* msg) with gil: + * try: + * __SYSERR_CALLBACK(msg, errno) # <<<<<<<<<<<<<< + * except: + * set_syserr_cb(None) + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s____SYSERR_CALLBACK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_msg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L10_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + +/* "gevent/core.pyx":1917 + * try: + * __SYSERR_CALLBACK(msg, errno) + * except: # <<<<<<<<<<<<<< + * set_syserr_cb(None) + * print_exc = getattr(traceback, 'print_exc', None) + */ + /*except:*/ { + __Pyx_AddTraceback("gevent.core._syserr_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); + +/* "gevent/core.pyx":1918 + * __SYSERR_CALLBACK(msg, errno) + * except: + * set_syserr_cb(None) # <<<<<<<<<<<<<< + * print_exc = getattr(traceback, 'print_exc', None) + * if print_exc is not None: + */ + __pyx_t_5 = __pyx_f_6gevent_4core_set_syserr_cb(Py_None, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + +/* "gevent/core.pyx":1919 + * except: + * set_syserr_cb(None) + * print_exc = getattr(traceback, 'print_exc', None) # <<<<<<<<<<<<<< + * if print_exc is not None: + * print_exc() + */ + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__traceback); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_GetAttr3(__pyx_t_5, ((PyObject *)__pyx_n_s__print_exc), Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_print_exc = __pyx_t_8; + __pyx_t_8 = 0; + +/* "gevent/core.pyx":1920 + * set_syserr_cb(None) + * print_exc = getattr(traceback, 'print_exc', None) + * if print_exc is not None: # <<<<<<<<<<<<<< + * print_exc() + * + */ + __pyx_t_9 = (__pyx_v_print_exc != Py_None); + if (__pyx_t_9) { + +/* "gevent/core.pyx":1921 + * print_exc = getattr(traceback, 'print_exc', None) + * if print_exc is not None: + * print_exc() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_8 = PyObject_Call(__pyx_v_print_exc, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L13; + } + __pyx_L13:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L4_exception_handled; + } + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L10_try_end:; + } + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("gevent.core._syserr_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_print_exc); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif +} + +/* "gevent/core.pyx":1924 + * + * + * cpdef set_syserr_cb(callback): # <<<<<<<<<<<<<< + * global __SYSERR_CALLBACK + * if callback is None: + */ + +static PyObject *__pyx_pw_6gevent_4core_21set_syserr_cb(PyObject *__pyx_self, PyObject *__pyx_v_callback); /*proto*/ +static PyObject *__pyx_f_6gevent_4core_set_syserr_cb(PyObject *__pyx_v_callback, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_syserr_cb", 0); + +/* "gevent/core.pyx":1926 + * cpdef set_syserr_cb(callback): + * global __SYSERR_CALLBACK + * if callback is None: # <<<<<<<<<<<<<< + * libev.ev_set_syserr_cb(NULL) + * __SYSERR_CALLBACK = None + */ + __pyx_t_1 = (__pyx_v_callback == Py_None); + if (__pyx_t_1) { + +/* "gevent/core.pyx":1927 + * global __SYSERR_CALLBACK + * if callback is None: + * libev.ev_set_syserr_cb(NULL) # <<<<<<<<<<<<<< + * __SYSERR_CALLBACK = None + * elif callable(callback): + */ + ev_set_syserr_cb(NULL); + +/* "gevent/core.pyx":1928 + * if callback is None: + * libev.ev_set_syserr_cb(NULL) + * __SYSERR_CALLBACK = None # <<<<<<<<<<<<<< + * elif callable(callback): + * libev.ev_set_syserr_cb(_syserr_cb) + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s____SYSERR_CALLBACK, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + +/* "gevent/core.pyx":1929 + * libev.ev_set_syserr_cb(NULL) + * __SYSERR_CALLBACK = None + * elif callable(callback): # <<<<<<<<<<<<<< + * libev.ev_set_syserr_cb(_syserr_cb) + * __SYSERR_CALLBACK = callback + */ + __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + +/* "gevent/core.pyx":1930 + * __SYSERR_CALLBACK = None + * elif callable(callback): + * libev.ev_set_syserr_cb(_syserr_cb) # <<<<<<<<<<<<<< + * __SYSERR_CALLBACK = callback + * else: + */ + ev_set_syserr_cb(((void *)__pyx_f_6gevent_4core__syserr_cb)); + +/* "gevent/core.pyx":1931 + * elif callable(callback): + * libev.ev_set_syserr_cb(_syserr_cb) + * __SYSERR_CALLBACK = callback # <<<<<<<<<<<<<< + * else: + * raise TypeError('Expected callable or None, got %r' % (callback, )) + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s____SYSERR_CALLBACK, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + /*else*/ { + +/* "gevent/core.pyx":1933 + * __SYSERR_CALLBACK = callback + * else: + * raise TypeError('Expected callable or None, got %r' % (callback, )) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_136), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_124), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_143), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_131), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_144), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_132), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent.core.set_syserr_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_4core_21set_syserr_cb(PyObject *__pyx_self, PyObject *__pyx_v_callback); /*proto*/ +static PyObject *__pyx_pw_6gevent_4core_21set_syserr_cb(PyObject *__pyx_self, PyObject *__pyx_v_callback) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_syserr_cb (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_4core_20set_syserr_cb(__pyx_self, ((PyObject *)__pyx_v_callback)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/core.pyx":1924 + * + * + * cpdef set_syserr_cb(callback): # <<<<<<<<<<<<<< + * global __SYSERR_CALLBACK + * if callback is None: + */ + +static PyObject *__pyx_pf_6gevent_4core_20set_syserr_cb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_syserr_cb", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_6gevent_4core_set_syserr_cb(__pyx_v_callback, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent.core.set_syserr_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_6gevent_4core__EVENTSType(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core__EVENTSType(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core__EVENTSType[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number__EVENTSType = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__EVENTSType = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping__EVENTSType = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer__EVENTSType = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6gevent_4core__EVENTSType = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core._EVENTSType"), /*tp_name*/ + sizeof(struct __pyx_obj_6gevent_4core__EVENTSType), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core__EVENTSType, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4core_11_EVENTSType_1__repr__, /*tp_repr*/ + &__pyx_tp_as_number__EVENTSType, /*tp_as_number*/ + &__pyx_tp_as_sequence__EVENTSType, /*tp_as_sequence*/ + &__pyx_tp_as_mapping__EVENTSType, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer__EVENTSType, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core__EVENTSType, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core__EVENTSType, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6gevent_4core_loop __pyx_vtable_6gevent_4core_loop; + +static PyObject *__pyx_tp_new_6gevent_4core_loop(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct PyGeventLoopObject *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct PyGeventLoopObject *)o); + p->__pyx_vtab = __pyx_vtabptr_6gevent_4core_loop; + p->error_handler = Py_None; Py_INCREF(Py_None); + p->_callbacks = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_loop(PyObject *o) { + struct PyGeventLoopObject *p = (struct PyGeventLoopObject *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6gevent_4core_4loop_7__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->error_handler); + Py_CLEAR(p->_callbacks); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6gevent_4core_loop(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventLoopObject *p = (struct PyGeventLoopObject *)o; + if (p->error_handler) { + e = (*v)(p->error_handler, a); if (e) return e; + } + if (p->_callbacks) { + e = (*v)(p->_callbacks, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_loop(PyObject *o) { + struct PyGeventLoopObject *p = (struct PyGeventLoopObject *)o; + PyObject* tmp; + tmp = ((PyObject*)p->error_handler); + p->error_handler = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callbacks); + p->_callbacks = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_ptr(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_3ptr_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_WatcherType(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_11WatcherType_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_MAXPRI(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_6MAXPRI_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_MINPRI(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_6MINPRI_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_default(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_7default_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_iteration(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_9iteration_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_depth(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_5depth_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_backend_int(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_11backend_int_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_backend(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_7backend_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_pendingcnt(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_10pendingcnt_1__get__(o); +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_getprop_6gevent_4core_4loop_activecnt(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_9activecnt_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_sig_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_11sig_pending_1__get__(o); +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +static PyObject *__pyx_getprop_6gevent_4core_4loop_sigfd(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_5sigfd_1__get__(o); +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +static PyObject *__pyx_getprop_6gevent_4core_4loop_origflags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_9origflags_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop_origflags_int(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_13origflags_int_1__get__(o); +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_getprop_6gevent_4core_4loop_error_handler(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_13error_handler_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4loop_error_handler(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4loop_13error_handler_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4loop_13error_handler_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4loop__callbacks(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4loop_10_callbacks_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4loop__callbacks(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4loop_10_callbacks_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4loop_10_callbacks_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6gevent_4core_loop[] = { + {__Pyx_NAMESTR("_stop_watchers"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_3_stop_watchers, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("destroy"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_5destroy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_handle_syserr"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_9_handle_syserr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("handle_error"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_11handle_error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_default_handle_error"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_13_default_handle_error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_15run, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("reinit"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_17reinit, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ref"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_19ref, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("unref"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_21unref, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("break_"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_23break_, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("verify"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_25verify, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("now"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_27now, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_29update, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("io"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_33io, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("timer"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_35timer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("signal"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_37signal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("idle"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_39idle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("prepare"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_41prepare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fork"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_43fork, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("async"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_45async, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {__Pyx_NAMESTR("child"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_47child, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("install_sigchld"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_49install_sigchld, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_51stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("run_callback"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_53run_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_55_format, METH_NOARGS, __Pyx_DOCSTR(0)}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_47stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("run_callback"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_49run_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_51_format, METH_NOARGS, __Pyx_DOCSTR(0)}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + {__Pyx_NAMESTR("_format_details"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_57_format_details, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_59fileno, METH_NOARGS, __Pyx_DOCSTR(0)}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + {__Pyx_NAMESTR("_format_details"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_53_format_details, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pw_6gevent_4core_4loop_55fileno, METH_NOARGS, __Pyx_DOCSTR(0)}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_loop[] = { + {(char *)"ptr", __pyx_getprop_6gevent_4core_4loop_ptr, 0, 0, 0}, + {(char *)"WatcherType", __pyx_getprop_6gevent_4core_4loop_WatcherType, 0, 0, 0}, + {(char *)"MAXPRI", __pyx_getprop_6gevent_4core_4loop_MAXPRI, 0, 0, 0}, + {(char *)"MINPRI", __pyx_getprop_6gevent_4core_4loop_MINPRI, 0, 0, 0}, + {(char *)"default", __pyx_getprop_6gevent_4core_4loop_default, 0, 0, 0}, + {(char *)"iteration", __pyx_getprop_6gevent_4core_4loop_iteration, 0, 0, 0}, + {(char *)"depth", __pyx_getprop_6gevent_4core_4loop_depth, 0, 0, 0}, + {(char *)"backend_int", __pyx_getprop_6gevent_4core_4loop_backend_int, 0, 0, 0}, + {(char *)"backend", __pyx_getprop_6gevent_4core_4loop_backend, 0, 0, 0}, + {(char *)"pendingcnt", __pyx_getprop_6gevent_4core_4loop_pendingcnt, 0, 0, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {(char *)"activecnt", __pyx_getprop_6gevent_4core_4loop_activecnt, 0, 0, 0}, + {(char *)"sig_pending", __pyx_getprop_6gevent_4core_4loop_sig_pending, 0, 0, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {(char *)"sigfd", __pyx_getprop_6gevent_4core_4loop_sigfd, 0, 0, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {(char *)"origflags", __pyx_getprop_6gevent_4core_4loop_origflags, 0, 0, 0}, + {(char *)"origflags_int", __pyx_getprop_6gevent_4core_4loop_origflags_int, 0, 0, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {(char *)"error_handler", __pyx_getprop_6gevent_4core_4loop_error_handler, __pyx_setprop_6gevent_4core_4loop_error_handler, 0, 0}, + {(char *)"_callbacks", __pyx_getprop_6gevent_4core_4loop__callbacks, __pyx_setprop_6gevent_4core_4loop__callbacks, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_loop = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_loop = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_loop = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_loop = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventLoop_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.loop"), /*tp_name*/ + sizeof(struct PyGeventLoopObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_loop, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4core_4loop_31__repr__, /*tp_repr*/ + &__pyx_tp_as_number_loop, /*tp_as_number*/ + &__pyx_tp_as_sequence_loop, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_loop, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_loop, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_loop, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_loop, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_loop, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_loop, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_4loop_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_loop, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_callback(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct PyGeventCallbackObject *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct PyGeventCallbackObject *)o); + p->callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_callback(PyObject *o) { + struct PyGeventCallbackObject *p = (struct PyGeventCallbackObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->callback); + Py_CLEAR(p->args); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6gevent_4core_callback(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventCallbackObject *p = (struct PyGeventCallbackObject *)o; + if (p->callback) { + e = (*v)(p->callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_callback(PyObject *o) { + struct PyGeventCallbackObject *p = (struct PyGeventCallbackObject *)o; + PyObject* tmp; + tmp = ((PyObject*)p->callback); + p->callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_8callback_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_8callback_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_8callback_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_8callback_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_8callback_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_8callback_8callback_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_8callback_8callback_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_8callback_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_8callback_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_8callback_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_8callback_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_8callback_4args_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6gevent_4core_callback[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_8callback_3stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_8callback_9_format, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_callback[] = { + {(char *)"pending", __pyx_getprop_6gevent_4core_8callback_pending, 0, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_8callback_callback, __pyx_setprop_6gevent_4core_8callback_callback, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_8callback_args, __pyx_setprop_6gevent_4core_8callback_args, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_callback = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + __pyx_pw_6gevent_4core_8callback_5__nonzero__, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_callback = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_callback = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_callback = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventCallback_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.callback"), /*tp_name*/ + sizeof(struct PyGeventCallbackObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_callback, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4core_8callback_7__repr__, /*tp_repr*/ + &__pyx_tp_as_number_callback, /*tp_as_number*/ + &__pyx_tp_as_sequence_callback, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_callback, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_callback, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_callback, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_callback, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_callback, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_callback, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_8callback_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_callback, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_watcher(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_watcher(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_watcher[] = { + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_7watcher_3_format, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_watcher = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_watcher = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_watcher = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_watcher = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventWatcher_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.watcher"), /*tp_name*/ + sizeof(struct PyGeventWatcherObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_watcher, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + &__pyx_tp_as_number_watcher, /*tp_as_number*/ + &__pyx_tp_as_sequence_watcher, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_watcher, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_watcher, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Abstract base class for all the watchers"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_watcher, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_watcher, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_io(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventIOObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventIOObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + if (unlikely(__pyx_pw_6gevent_4core_2io_11__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_io(PyObject *o) { + struct PyGeventIOObject *p = (struct PyGeventIOObject *)o; + PyObject_GC_UnTrack(o); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6gevent_4core_2io_13__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_io(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventIOObject *p = (struct PyGeventIOObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_io)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_io(PyObject *o) { + struct PyGeventIOObject *p = (struct PyGeventIOObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_io); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_fd(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_2fd_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_fd(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_2fd_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_events(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_6events_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_events(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_6events_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_events_str(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_10events_str_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_2io_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_2io_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_2io_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_2io_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_2io__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_2io_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_io[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_2io_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_2io_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_2io_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_2io_9_format, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_io[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_2io_ref, __pyx_setprop_6gevent_4core_2io_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_2io_callback, __pyx_setprop_6gevent_4core_2io_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_2io_priority, __pyx_setprop_6gevent_4core_2io_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_2io_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_2io_pending, 0, 0, 0}, + {(char *)"fd", __pyx_getprop_6gevent_4core_2io_fd, __pyx_setprop_6gevent_4core_2io_fd, 0, 0}, + {(char *)"events", __pyx_getprop_6gevent_4core_2io_events, __pyx_setprop_6gevent_4core_2io_events, 0, 0}, + {(char *)"events_str", __pyx_getprop_6gevent_4core_2io_events_str, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_2io_loop, __pyx_setprop_6gevent_4core_2io_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_2io_args, __pyx_setprop_6gevent_4core_2io_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_2io__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_io = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_io = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_io = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_io = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventIO_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.io"), /*tp_name*/ + sizeof(struct PyGeventIOObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_io, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_io, /*tp_as_number*/ + &__pyx_tp_as_sequence_io, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_io, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_io, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_io, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_io, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_io, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_io, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_2io_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_io, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_timer(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventTimerObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventTimerObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_timer(PyObject *o) { + struct PyGeventTimerObject *p = (struct PyGeventTimerObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_timer(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventTimerObject *p = (struct PyGeventTimerObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_timer)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_timer(PyObject *o) { + struct PyGeventTimerObject *p = (struct PyGeventTimerObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_timer); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5timer_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5timer_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5timer_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5timer_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5timer_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5timer_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_at(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_2at_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5timer_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5timer_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5timer_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5timer_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5timer_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5timer_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5timer__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5timer_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_timer[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_5timer_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_5timer_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_5timer_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("again"), (PyCFunction)__pyx_pw_6gevent_4core_5timer_9again, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_timer[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_5timer_ref, __pyx_setprop_6gevent_4core_5timer_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_5timer_callback, __pyx_setprop_6gevent_4core_5timer_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_5timer_priority, __pyx_setprop_6gevent_4core_5timer_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_5timer_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_5timer_pending, 0, 0, 0}, + {(char *)"at", __pyx_getprop_6gevent_4core_5timer_at, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_5timer_loop, __pyx_setprop_6gevent_4core_5timer_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_5timer_args, __pyx_setprop_6gevent_4core_5timer_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_5timer__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_timer = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_timer = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_timer = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_timer = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventTimer_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.timer"), /*tp_name*/ + sizeof(struct PyGeventTimerObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_timer, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_timer, /*tp_as_number*/ + &__pyx_tp_as_sequence_timer, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_timer, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_timer, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_timer, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_timer, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_timer, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_timer, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_5timer_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_timer, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_signal(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventSignalObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventSignalObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_signal(PyObject *o) { + struct PyGeventSignalObject *p = (struct PyGeventSignalObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_signal(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventSignalObject *p = (struct PyGeventSignalObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_signal)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_signal(PyObject *o) { + struct PyGeventSignalObject *p = (struct PyGeventSignalObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_signal); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_6signal_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_6signal_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_6signal_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_6signal_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_6signal_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_6signal_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_6signal_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_6signal_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_6signal_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_6signal_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_6signal_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_6signal_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_6signal__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_6signal_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_signal[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_6signal_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_6signal_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_6signal_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_signal[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_6signal_ref, __pyx_setprop_6gevent_4core_6signal_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_6signal_callback, __pyx_setprop_6gevent_4core_6signal_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_6signal_priority, __pyx_setprop_6gevent_4core_6signal_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_6signal_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_6signal_pending, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_6signal_loop, __pyx_setprop_6gevent_4core_6signal_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_6signal_args, __pyx_setprop_6gevent_4core_6signal_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_6signal__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_signal = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_signal = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_signal = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_signal = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventSignal_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.signal"), /*tp_name*/ + sizeof(struct PyGeventSignalObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_signal, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_signal, /*tp_as_number*/ + &__pyx_tp_as_sequence_signal, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_signal, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_signal, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_signal, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_signal, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_signal, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_signal, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_6signal_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_signal, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_idle(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventIdleObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventIdleObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_idle(PyObject *o) { + struct PyGeventIdleObject *p = (struct PyGeventIdleObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_idle(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventIdleObject *p = (struct PyGeventIdleObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_idle)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_idle(PyObject *o) { + struct PyGeventIdleObject *p = (struct PyGeventIdleObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_idle); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4idle_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4idle_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4idle_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4idle_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4idle_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4idle_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4idle_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4idle_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4idle_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4idle_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4idle_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4idle_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4idle__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4idle_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_idle[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_4idle_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_4idle_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_4idle_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_idle[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_4idle_ref, __pyx_setprop_6gevent_4core_4idle_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_4idle_callback, __pyx_setprop_6gevent_4core_4idle_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_4idle_priority, __pyx_setprop_6gevent_4core_4idle_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_4idle_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_4idle_pending, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_4idle_loop, __pyx_setprop_6gevent_4core_4idle_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_4idle_args, __pyx_setprop_6gevent_4core_4idle_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_4idle__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_idle = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_idle = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_idle = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_idle = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventIdle_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.idle"), /*tp_name*/ + sizeof(struct PyGeventIdleObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_idle, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_idle, /*tp_as_number*/ + &__pyx_tp_as_sequence_idle, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_idle, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_idle, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_idle, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_idle, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_idle, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_idle, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_4idle_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_idle, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_prepare(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventPrepareObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventPrepareObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_prepare(PyObject *o) { + struct PyGeventPrepareObject *p = (struct PyGeventPrepareObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_prepare(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventPrepareObject *p = (struct PyGeventPrepareObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_prepare)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_prepare(PyObject *o) { + struct PyGeventPrepareObject *p = (struct PyGeventPrepareObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_prepare); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_7prepare_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_7prepare_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_7prepare_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_7prepare_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_7prepare_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_7prepare_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_7prepare_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_7prepare_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_7prepare_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_7prepare_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_7prepare_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_7prepare_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_7prepare__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_7prepare_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_prepare[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_7prepare_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_7prepare_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_7prepare_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_prepare[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_7prepare_ref, __pyx_setprop_6gevent_4core_7prepare_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_7prepare_callback, __pyx_setprop_6gevent_4core_7prepare_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_7prepare_priority, __pyx_setprop_6gevent_4core_7prepare_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_7prepare_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_7prepare_pending, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_7prepare_loop, __pyx_setprop_6gevent_4core_7prepare_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_7prepare_args, __pyx_setprop_6gevent_4core_7prepare_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_7prepare__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_prepare = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_prepare = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_prepare = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_prepare = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventPrepare_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.prepare"), /*tp_name*/ + sizeof(struct PyGeventPrepareObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_prepare, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_prepare, /*tp_as_number*/ + &__pyx_tp_as_sequence_prepare, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_prepare, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_prepare, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_prepare, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_prepare, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_prepare, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_prepare, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_7prepare_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_prepare, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_fork(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventForkObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventForkObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_fork(PyObject *o) { + struct PyGeventForkObject *p = (struct PyGeventForkObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_fork(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventForkObject *p = (struct PyGeventForkObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_fork)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_fork(PyObject *o) { + struct PyGeventForkObject *p = (struct PyGeventForkObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_fork); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4fork_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4fork_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4fork_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4fork_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4fork_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4fork_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4fork_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4fork_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4fork_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4fork_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4fork_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4fork_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4fork__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4fork_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_fork[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_4fork_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_4fork_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_4fork_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_fork[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_4fork_ref, __pyx_setprop_6gevent_4core_4fork_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_4fork_callback, __pyx_setprop_6gevent_4core_4fork_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_4fork_priority, __pyx_setprop_6gevent_4core_4fork_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_4fork_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_4fork_pending, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_4fork_loop, __pyx_setprop_6gevent_4core_4fork_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_4fork_args, __pyx_setprop_6gevent_4core_4fork_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_4fork__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_fork = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_fork = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_fork = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_fork = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventFork_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.fork"), /*tp_name*/ + sizeof(struct PyGeventForkObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_fork, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_fork, /*tp_as_number*/ + &__pyx_tp_as_sequence_fork, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_fork, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_fork, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_fork, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_fork, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_fork, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_fork, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_4fork_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_fork, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6gevent_4core_async(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventAsyncObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventAsyncObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_async(PyObject *o) { + struct PyGeventAsyncObject *p = (struct PyGeventAsyncObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_async(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventAsyncObject *p = (struct PyGeventAsyncObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_async)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_async(PyObject *o) { + struct PyGeventAsyncObject *p = (struct PyGeventAsyncObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_async); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5async_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5async_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5async_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5async_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5async_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5async_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5async_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5async_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5async_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5async_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5async_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5async_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5async_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5async__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5async_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_async[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_5async_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_5async_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_5async_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pw_6gevent_4core_5async_9send, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_async[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_5async_ref, __pyx_setprop_6gevent_4core_5async_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_5async_callback, __pyx_setprop_6gevent_4core_5async_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_5async_priority, __pyx_setprop_6gevent_4core_5async_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_5async_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_5async_pending, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_5async_loop, __pyx_setprop_6gevent_4core_5async_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_5async_args, __pyx_setprop_6gevent_4core_5async_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_5async__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_async = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_async = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_async = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_async = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventAsync_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.async"), /*tp_name*/ + sizeof(struct PyGeventAsyncObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_async, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_async, /*tp_as_number*/ + &__pyx_tp_as_sequence_async, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_async, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_async, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_async, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_async, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_async, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_async, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_5async_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_async, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +static PyObject *__pyx_tp_new_6gevent_4core_child(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventChildObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventChildObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_child(PyObject *o) { + struct PyGeventChildObject *p = (struct PyGeventChildObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_child(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventChildObject *p = (struct PyGeventChildObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_child)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_child(PyObject *o) { + struct PyGeventChildObject *p = (struct PyGeventChildObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_child); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_pid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_3pid_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_rpid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_4rpid_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_rpid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_4rpid_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_rstatus(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_7rstatus_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_rstatus(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_7rstatus_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5child_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_5child_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_5child_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_5child_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_5child__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_5child_6_flags_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_child[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_5child_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_5child_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_5child_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_format"), (PyCFunction)__pyx_pw_6gevent_4core_5child_9_format, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_child[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_5child_ref, __pyx_setprop_6gevent_4core_5child_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_5child_callback, __pyx_setprop_6gevent_4core_5child_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_5child_priority, __pyx_setprop_6gevent_4core_5child_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_5child_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_5child_pending, 0, 0, 0}, + {(char *)"pid", __pyx_getprop_6gevent_4core_5child_pid, 0, 0, 0}, + {(char *)"rpid", __pyx_getprop_6gevent_4core_5child_rpid, __pyx_setprop_6gevent_4core_5child_rpid, 0, 0}, + {(char *)"rstatus", __pyx_getprop_6gevent_4core_5child_rstatus, __pyx_setprop_6gevent_4core_5child_rstatus, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_5child_loop, __pyx_setprop_6gevent_4core_5child_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_5child_args, __pyx_setprop_6gevent_4core_5child_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_5child__flags, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_child = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_child = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_child = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_child = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventChild_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.child"), /*tp_name*/ + sizeof(struct PyGeventChildObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_child, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_child, /*tp_as_number*/ + &__pyx_tp_as_sequence_child, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_child, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_child, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_child, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_child, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_child, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_child, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_5child_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_child, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static PyObject *__pyx_tp_new_6gevent_4core_stat(PyTypeObject *t, PyObject *a, PyObject *k) { + struct PyGeventStatObject *p; + PyObject *o = __pyx_tp_new_6gevent_4core_watcher(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct PyGeventStatObject *)o); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + p->_callback = Py_None; Py_INCREF(Py_None); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->path = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core_stat(PyObject *o) { + struct PyGeventStatObject *p = (struct PyGeventStatObject *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->loop); + Py_CLEAR(p->_callback); + Py_CLEAR(p->args); + Py_CLEAR(p->path); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6gevent_4core_watcher(o); +} + +static int __pyx_tp_traverse_6gevent_4core_stat(PyObject *o, visitproc v, void *a) { + int e; + struct PyGeventStatObject *p = (struct PyGeventStatObject *)o; + e = ((likely(__pyx_ptype_6gevent_4core_watcher)) ? ((__pyx_ptype_6gevent_4core_watcher->tp_traverse) ? __pyx_ptype_6gevent_4core_watcher->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6gevent_4core_stat)); if (e) return e; + if (p->loop) { + e = (*v)(((PyObject*)p->loop), a); if (e) return e; + } + if (p->_callback) { + e = (*v)(p->_callback, a); if (e) return e; + } + if (p->args) { + e = (*v)(p->args, a); if (e) return e; + } + if (p->path) { + e = (*v)(p->path, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core_stat(PyObject *o) { + struct PyGeventStatObject *p = (struct PyGeventStatObject *)o; + PyObject* tmp; + if (likely(__pyx_ptype_6gevent_4core_watcher)) { if (__pyx_ptype_6gevent_4core_watcher->tp_clear) __pyx_ptype_6gevent_4core_watcher->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6gevent_4core_stat); + tmp = ((PyObject*)p->loop); + p->loop = ((struct PyGeventLoopObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_callback); + p->_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->args); + p->args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->path); + p->path = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_ref(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_3ref_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4stat_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4stat_3ref_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_8callback_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4stat_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4stat_8callback_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_priority(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_8priority_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4stat_priority(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4stat_8priority_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_active(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_6active_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_pending(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_7pending_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_attr(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_4attr_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_prev(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_4prev_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_interval(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_8interval_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_loop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_4loop_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4stat_loop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4stat_4loop_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4stat_4loop_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_4args_1__get__(o); +} + +static int __pyx_setprop_6gevent_4core_4stat_args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6gevent_4core_4stat_4args_3__set__(o, v); + } + else { + return __pyx_pw_6gevent_4core_4stat_4args_5__del__(o); + } +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat__flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_6_flags_1__get__(o); +} + +static PyObject *__pyx_getprop_6gevent_4core_4stat_path(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6gevent_4core_4stat_4path_1__get__(o); +} + +static PyMethodDef __pyx_methods_6gevent_4core_stat[] = { + {__Pyx_NAMESTR("stop"), (PyCFunction)__pyx_pw_6gevent_4core_4stat_1stop, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_6gevent_4core_4stat_3feed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_6gevent_4core_4stat_5start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6gevent_4core_stat[] = { + {(char *)"ref", __pyx_getprop_6gevent_4core_4stat_ref, __pyx_setprop_6gevent_4core_4stat_ref, 0, 0}, + {(char *)"callback", __pyx_getprop_6gevent_4core_4stat_callback, __pyx_setprop_6gevent_4core_4stat_callback, 0, 0}, + {(char *)"priority", __pyx_getprop_6gevent_4core_4stat_priority, __pyx_setprop_6gevent_4core_4stat_priority, 0, 0}, + {(char *)"active", __pyx_getprop_6gevent_4core_4stat_active, 0, 0, 0}, + {(char *)"pending", __pyx_getprop_6gevent_4core_4stat_pending, 0, 0, 0}, + {(char *)"attr", __pyx_getprop_6gevent_4core_4stat_attr, 0, 0, 0}, + {(char *)"prev", __pyx_getprop_6gevent_4core_4stat_prev, 0, 0, 0}, + {(char *)"interval", __pyx_getprop_6gevent_4core_4stat_interval, 0, 0, 0}, + {(char *)"loop", __pyx_getprop_6gevent_4core_4stat_loop, __pyx_setprop_6gevent_4core_4stat_loop, 0, 0}, + {(char *)"args", __pyx_getprop_6gevent_4core_4stat_args, __pyx_setprop_6gevent_4core_4stat_args, 0, 0}, + {(char *)"_flags", __pyx_getprop_6gevent_4core_4stat__flags, 0, 0, 0}, + {(char *)"path", __pyx_getprop_6gevent_4core_4stat_path, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_stat = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_stat = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_stat = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_stat = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +DL_EXPORT(PyTypeObject) PyGeventStat_Type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.stat"), /*tp_name*/ + sizeof(struct PyGeventStatObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core_stat, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6gevent_4core_7watcher_1__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + &__pyx_tp_as_number_stat, /*tp_as_number*/ + &__pyx_tp_as_sequence_stat, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_stat, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_stat, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core_stat, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core_stat, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core_stat, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6gevent_4core_stat, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6gevent_4core_4stat_7__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core_stat, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *__pyx_freelist_6gevent_4core___pyx_scope_struct__genexpr[8]; +static int __pyx_freecount_6gevent_4core___pyx_scope_struct__genexpr = 0; + +static PyObject *__pyx_tp_new_6gevent_4core___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *p; + PyObject *o; + if (likely((__pyx_freecount_6gevent_4core___pyx_scope_struct__genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr)))) { + o = (PyObject*)__pyx_freelist_6gevent_4core___pyx_scope_struct__genexpr[--__pyx_freecount_6gevent_4core___pyx_scope_struct__genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr)); + PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + p = ((struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)o); + p->__pyx_v_flag = 0; + p->__pyx_v_string = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_6gevent_4core___pyx_scope_struct__genexpr(PyObject *o) { + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *p = (struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_flag); + Py_CLEAR(p->__pyx_v_string); + Py_CLEAR(p->__pyx_t_0); + if ((__pyx_freecount_6gevent_4core___pyx_scope_struct__genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr))) { + __pyx_freelist_6gevent_4core___pyx_scope_struct__genexpr[__pyx_freecount_6gevent_4core___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_6gevent_4core___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *p = (struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)o; + if (p->__pyx_v_flag) { + e = (*v)(p->__pyx_v_flag, a); if (e) return e; + } + if (p->__pyx_v_string) { + e = (*v)(p->__pyx_v_string, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6gevent_4core___pyx_scope_struct__genexpr(PyObject *o) { + struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *p = (struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_flag); + p->__pyx_v_flag = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_string); + p->__pyx_v_string = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6gevent_4core___pyx_scope_struct__genexpr[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__genexpr = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__genexpr = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__genexpr = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__genexpr = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6gevent_4core___pyx_scope_struct__genexpr = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("gevent.core.__pyx_scope_struct__genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_6gevent_4core___pyx_scope_struct__genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6gevent_4core___pyx_scope_struct__genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct__genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct__genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct__genexpr, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct__genexpr, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6gevent_4core___pyx_scope_struct__genexpr, /*tp_traverse*/ + __pyx_tp_clear_6gevent_4core___pyx_scope_struct__genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6gevent_4core___pyx_scope_struct__genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6gevent_4core___pyx_scope_struct__genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("_flags_to_list"), (PyCFunction)__pyx_pw_6gevent_4core_5_flags_to_list, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_flags_to_int"), (PyCFunction)__pyx_pw_6gevent_4core_7_flags_to_int, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_check_flags"), (PyCFunction)__pyx_pw_6gevent_4core_9_check_flags, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_events_to_str"), (PyCFunction)__pyx_pw_6gevent_4core_11_events_to_str, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_syserr_cb"), (PyCFunction)__pyx_pw_6gevent_4core_21set_syserr_cb, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("core"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0}, + {&__pyx_n_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, + {&__pyx_n_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_n_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 1}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, + {&__pyx_n_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0}, + {&__pyx_n_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0}, + {&__pyx_n_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 1}, + {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0}, + {&__pyx_n_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 1}, + {&__pyx_n_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_n_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 1}, + {&__pyx_n_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 1}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_n_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 1}, + {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0}, + {&__pyx_n_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 1}, + {&__pyx_n_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_n_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 1}, + {&__pyx_n_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, + {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, + {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0}, + {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0}, + {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0}, + {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0}, + {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, + {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, + {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, + {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0}, +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__ASYNC, __pyx_k__ASYNC, sizeof(__pyx_k__ASYNC), 0, 0, 1, 1}, + {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1}, + {&__pyx_n_s__BACKEND_EPOLL, __pyx_k__BACKEND_EPOLL, sizeof(__pyx_k__BACKEND_EPOLL), 0, 0, 1, 1}, + {&__pyx_n_s__BACKEND_KQUEUE, __pyx_k__BACKEND_KQUEUE, sizeof(__pyx_k__BACKEND_KQUEUE), 0, 0, 1, 1}, + {&__pyx_n_s__BACKEND_POLL, __pyx_k__BACKEND_POLL, sizeof(__pyx_k__BACKEND_POLL), 0, 0, 1, 1}, + {&__pyx_n_s__BACKEND_PORT, __pyx_k__BACKEND_PORT, sizeof(__pyx_k__BACKEND_PORT), 0, 0, 1, 1}, + {&__pyx_n_s__BACKEND_SELECT, __pyx_k__BACKEND_SELECT, sizeof(__pyx_k__BACKEND_SELECT), 0, 0, 1, 1}, + {&__pyx_n_s__CHECK, __pyx_k__CHECK, sizeof(__pyx_k__CHECK), 0, 0, 1, 1}, + {&__pyx_n_s__CHILD, __pyx_k__CHILD, sizeof(__pyx_k__CHILD), 0, 0, 1, 1}, + {&__pyx_n_s__CLEANUP, __pyx_k__CLEANUP, sizeof(__pyx_k__CLEANUP), 0, 0, 1, 1}, + {&__pyx_n_s__CUSTOM, __pyx_k__CUSTOM, sizeof(__pyx_k__CUSTOM), 0, 0, 1, 1}, + {&__pyx_n_s__EMBED, __pyx_k__EMBED, sizeof(__pyx_k__EMBED), 0, 0, 1, 1}, + {&__pyx_n_s__ERROR, __pyx_k__ERROR, sizeof(__pyx_k__ERROR), 0, 0, 1, 1}, + {&__pyx_n_s__EVENTS, __pyx_k__EVENTS, sizeof(__pyx_k__EVENTS), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_n_s__EV_USE_4HEAP, __pyx_k__EV_USE_4HEAP, sizeof(__pyx_k__EV_USE_4HEAP), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_EVENTFD, __pyx_k__EV_USE_EVENTFD, sizeof(__pyx_k__EV_USE_EVENTFD), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_FLOOR, __pyx_k__EV_USE_FLOOR, sizeof(__pyx_k__EV_USE_FLOOR), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_INOTIFY, __pyx_k__EV_USE_INOTIFY, sizeof(__pyx_k__EV_USE_INOTIFY), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_MONOTONIC, __pyx_k__EV_USE_MONOTONIC, sizeof(__pyx_k__EV_USE_MONOTONIC), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_NANOSLEEP, __pyx_k__EV_USE_NANOSLEEP, sizeof(__pyx_k__EV_USE_NANOSLEEP), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_REALTIME, __pyx_k__EV_USE_REALTIME, sizeof(__pyx_k__EV_USE_REALTIME), 0, 0, 1, 1}, + {&__pyx_n_s__EV_USE_SIGNALFD, __pyx_k__EV_USE_SIGNALFD, sizeof(__pyx_k__EV_USE_SIGNALFD), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__FORK, __pyx_k__FORK, sizeof(__pyx_k__FORK), 0, 0, 1, 1}, + {&__pyx_n_s__FORKCHECK, __pyx_k__FORKCHECK, sizeof(__pyx_k__FORKCHECK), 0, 0, 1, 1}, + {&__pyx_n_s__IDLE, __pyx_k__IDLE, sizeof(__pyx_k__IDLE), 0, 0, 1, 1}, + {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, + {&__pyx_n_s__LIBEV_EMBED, __pyx_k__LIBEV_EMBED, sizeof(__pyx_k__LIBEV_EMBED), 0, 0, 1, 1}, + {&__pyx_n_s__MAXPRI, __pyx_k__MAXPRI, sizeof(__pyx_k__MAXPRI), 0, 0, 1, 1}, + {&__pyx_n_s__MINPRI, __pyx_k__MINPRI, sizeof(__pyx_k__MINPRI), 0, 0, 1, 1}, + {&__pyx_n_s__NOINOTIFY, __pyx_k__NOINOTIFY, sizeof(__pyx_k__NOINOTIFY), 0, 0, 1, 1}, + {&__pyx_n_s__NONE, __pyx_k__NONE, sizeof(__pyx_k__NONE), 0, 0, 1, 1}, + {&__pyx_n_s__NOSIGMASK, __pyx_k__NOSIGMASK, sizeof(__pyx_k__NOSIGMASK), 0, 0, 1, 1}, + {&__pyx_n_s__NSIG, __pyx_k__NSIG, sizeof(__pyx_k__NSIG), 0, 0, 1, 1}, + {&__pyx_n_s__PERIODIC, __pyx_k__PERIODIC, sizeof(__pyx_k__PERIODIC), 0, 0, 1, 1}, + {&__pyx_n_s__PREPARE, __pyx_k__PREPARE, sizeof(__pyx_k__PREPARE), 0, 0, 1, 1}, + {&__pyx_n_s__READ, __pyx_k__READ, sizeof(__pyx_k__READ), 0, 0, 1, 1}, + {&__pyx_n_s__READWRITE, __pyx_k__READWRITE, sizeof(__pyx_k__READWRITE), 0, 0, 1, 1}, + {&__pyx_n_s__SIGNAL, __pyx_k__SIGNAL, sizeof(__pyx_k__SIGNAL), 0, 0, 1, 1}, + {&__pyx_n_s__SIGNALFD, __pyx_k__SIGNALFD, sizeof(__pyx_k__SIGNALFD), 0, 0, 1, 1}, + {&__pyx_n_s__STAT, __pyx_k__STAT, sizeof(__pyx_k__STAT), 0, 0, 1, 1}, + {&__pyx_n_s__SystemError, __pyx_k__SystemError, sizeof(__pyx_k__SystemError), 0, 0, 1, 1}, + {&__pyx_n_s__TIMER, __pyx_k__TIMER, sizeof(__pyx_k__TIMER), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__UNDEF, __pyx_k__UNDEF, sizeof(__pyx_k__UNDEF), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__WRITE, __pyx_k__WRITE, sizeof(__pyx_k__WRITE), 0, 0, 1, 1}, + {&__pyx_n_s___IOFDSET, __pyx_k___IOFDSET, sizeof(__pyx_k___IOFDSET), 0, 0, 1, 1}, + {&__pyx_n_s____SYSERR_CALLBACK, __pyx_k____SYSERR_CALLBACK, sizeof(__pyx_k____SYSERR_CALLBACK), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____builtins__, __pyx_k____builtins__, sizeof(__pyx_k____builtins__), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___events, __pyx_k___events, sizeof(__pyx_k___events), 0, 0, 1, 1}, + {&__pyx_n_s___flags, __pyx_k___flags, sizeof(__pyx_k___flags), 0, 0, 1, 1}, + {&__pyx_n_s___flags_str2int, __pyx_k___flags_str2int, sizeof(__pyx_k___flags_str2int), 0, 0, 1, 1}, + {&__pyx_n_s___format, __pyx_k___format, sizeof(__pyx_k___format), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_n_s___format_details, __pyx_k___format_details, sizeof(__pyx_k___format_details), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s___handle_syserr, __pyx_k___handle_syserr, sizeof(__pyx_k___handle_syserr), 0, 0, 1, 1}, + {&__pyx_n_s___stop_watchers, __pyx_k___stop_watchers, sizeof(__pyx_k___stop_watchers), 0, 0, 1, 1}, + {&__pyx_n_s__active, __pyx_k__active, sizeof(__pyx_k__active), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_n_s__activecnt, __pyx_k__activecnt, sizeof(__pyx_k__activecnt), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__after, __pyx_k__after, sizeof(__pyx_k__after), 0, 0, 1, 1}, + {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1}, + {&__pyx_n_s__backend, __pyx_k__backend, sizeof(__pyx_k__backend), 0, 0, 1, 1}, + {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1}, + {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__context, __pyx_k__context, sizeof(__pyx_k__context), 0, 0, 1, 1}, + {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1}, + {&__pyx_n_s__destroyed, __pyx_k__destroyed, sizeof(__pyx_k__destroyed), 0, 0, 1, 1}, + {&__pyx_n_s__embeddable_backends, __pyx_k__embeddable_backends, sizeof(__pyx_k__embeddable_backends), 0, 0, 1, 1}, + {&__pyx_n_s__epoll, __pyx_k__epoll, sizeof(__pyx_k__epoll), 0, 0, 1, 1}, + {&__pyx_n_s__errno, __pyx_k__errno, sizeof(__pyx_k__errno), 0, 0, 1, 1}, + {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1}, + {&__pyx_n_s__events_str, __pyx_k__events_str, sizeof(__pyx_k__events_str), 0, 0, 1, 1}, + {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, + {&__pyx_n_s__forkcheck, __pyx_k__forkcheck, sizeof(__pyx_k__forkcheck), 0, 0, 1, 1}, + {&__pyx_n_s__func, __pyx_k__func, sizeof(__pyx_k__func), 0, 0, 1, 1}, + {&__pyx_n_s__get_header_version, __pyx_k__get_header_version, sizeof(__pyx_k__get_header_version), 0, 0, 1, 1}, + {&__pyx_n_s__get_version, __pyx_k__get_version, sizeof(__pyx_k__get_version), 0, 0, 1, 1}, + {&__pyx_n_s__handle_error, __pyx_k__handle_error, sizeof(__pyx_k__handle_error), 0, 0, 1, 1}, + {&__pyx_n_s__hex, __pyx_k__hex, sizeof(__pyx_k__hex), 0, 0, 1, 1}, + {&__pyx_n_s__how, __pyx_k__how, sizeof(__pyx_k__how), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__interval, __pyx_k__interval, sizeof(__pyx_k__interval), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1}, + {&__pyx_n_s__kqueue, __pyx_k__kqueue, sizeof(__pyx_k__kqueue), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__loop, __pyx_k__loop, sizeof(__pyx_k__loop), 0, 0, 1, 1}, + {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1}, + {&__pyx_n_s__message, __pyx_k__message, sizeof(__pyx_k__message), 0, 0, 1, 1}, + {&__pyx_n_s__noenv, __pyx_k__noenv, sizeof(__pyx_k__noenv), 0, 0, 1, 1}, + {&__pyx_n_s__noinotify, __pyx_k__noinotify, sizeof(__pyx_k__noinotify), 0, 0, 1, 1}, + {&__pyx_n_s__nosigmask, __pyx_k__nosigmask, sizeof(__pyx_k__nosigmask), 0, 0, 1, 1}, + {&__pyx_n_s__nowait, __pyx_k__nowait, sizeof(__pyx_k__nowait), 0, 0, 1, 1}, + {&__pyx_n_s__once, __pyx_k__once, sizeof(__pyx_k__once), 0, 0, 1, 1}, + {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, + {&__pyx_n_s__pass_events, __pyx_k__pass_events, sizeof(__pyx_k__pass_events), 0, 0, 1, 1}, + {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1}, + {&__pyx_n_s__pending, __pyx_k__pending, sizeof(__pyx_k__pending), 0, 0, 1, 1}, + {&__pyx_n_s__pendingcnt, __pyx_k__pendingcnt, sizeof(__pyx_k__pendingcnt), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {&__pyx_n_s__pid, __pyx_k__pid, sizeof(__pyx_k__pid), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__poll, __pyx_k__poll, sizeof(__pyx_k__poll), 0, 0, 1, 1}, + {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1}, + {&__pyx_n_s__print_exc, __pyx_k__print_exc, sizeof(__pyx_k__print_exc), 0, 0, 1, 1}, + {&__pyx_n_s__print_exception, __pyx_k__print_exception, sizeof(__pyx_k__print_exception), 0, 0, 1, 1}, + {&__pyx_n_s__priority, __pyx_k__priority, sizeof(__pyx_k__priority), 0, 0, 1, 1}, + {&__pyx_n_s__ptr, __pyx_k__ptr, sizeof(__pyx_k__ptr), 0, 0, 1, 1}, + {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1}, + {&__pyx_n_s__repeat, __pyx_k__repeat, sizeof(__pyx_k__repeat), 0, 0, 1, 1}, + {&__pyx_n_s__revents, __pyx_k__revents, sizeof(__pyx_k__revents), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {&__pyx_n_s__rstatus, __pyx_k__rstatus, sizeof(__pyx_k__rstatus), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__select, __pyx_k__select, sizeof(__pyx_k__select), 0, 0, 1, 1}, + {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + {&__pyx_n_s__sigfd, __pyx_k__sigfd, sizeof(__pyx_k__sigfd), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__signal, __pyx_k__signal, sizeof(__pyx_k__signal), 0, 0, 1, 1}, + {&__pyx_n_s__signalfd, __pyx_k__signalfd, sizeof(__pyx_k__signalfd), 0, 0, 1, 1}, + {&__pyx_n_s__signalmodule, __pyx_k__signalmodule, sizeof(__pyx_k__signalmodule), 0, 0, 1, 1}, + {&__pyx_n_s__signalnum, __pyx_k__signalnum, sizeof(__pyx_k__signalnum), 0, 0, 1, 1}, + {&__pyx_n_s__signum, __pyx_k__signum, sizeof(__pyx_k__signum), 0, 0, 1, 1}, + {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__strerror, __pyx_k__strerror, sizeof(__pyx_k__strerror), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__supported_backends, __pyx_k__supported_backends, sizeof(__pyx_k__supported_backends), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__tb, __pyx_k__tb, sizeof(__pyx_k__tb), 0, 0, 1, 1}, + {&__pyx_n_s__throw, __pyx_k__throw, sizeof(__pyx_k__throw), 0, 0, 1, 1}, + {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + {&__pyx_n_s__trace, __pyx_k__trace, sizeof(__pyx_k__trace), 0, 0, 1, 1}, +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1}, + {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1}, + {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__version_info, __pyx_k__version_info, sizeof(__pyx_k__version_info), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s____import__); if (!__pyx_builtin___import__) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s__hex); if (!__pyx_builtin_hex) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_SystemError = __Pyx_GetBuiltinName(__pyx_n_s__SystemError); if (!__pyx_builtin_SystemError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + +/* "gevent/core.pyx":160 + * try: + * if isinstance(flags, basestring): + * flags = flags.split(',') # <<<<<<<<<<<<<< + * for value in flags: + * value = value.strip().lower() + */ + __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + +/* "gevent/core.pyx":361 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef unsigned int flags = 0 + * if nowait: + */ + __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + +/* "gevent/core.pyx":377 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_ref(self._ptr) + * + */ + __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + +/* "gevent/core.pyx":383 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_unref(self._ptr) + * + */ + __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + +/* "gevent/core.pyx":389 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_break(self._ptr, how) + * + */ + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + +/* "gevent/core.pyx":395 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_verify(self._ptr) + * + */ + __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_22); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + +/* "gevent/core.pyx":401 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_now(self._ptr) + * + */ + __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + +/* "gevent/core.pyx":407 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_now_update(self._ptr) + * + */ + __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + +/* "gevent/core.pyx":418 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return True if libev.ev_is_default_loop(self._ptr) else False + * + */ + __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + +/* "gevent/core.pyx":426 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_iteration(self._ptr) + * + */ + __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + +/* "gevent/core.pyx":434 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_depth(self._ptr) + * + */ + __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + +/* "gevent/core.pyx":442 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_backend(self._ptr) + * + */ + __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + +/* "gevent/core.pyx":450 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef unsigned int backend = libev.ev_backend(self._ptr) + * for key, value in _flags: + */ + __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + +/* "gevent/core.pyx":462 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return libev.ev_pending_count(self._ptr) + * + */ + __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + +/* "gevent/core.pyx":503 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * cdef callback cb = callback(func, args) + * self._callbacks.append(cb) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_40); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + +/* "gevent/core.pyx":556 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.activecnt + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_48 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_47 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_47); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); + +/* "gevent/core.pyx":564 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sig_pending + * + */ + __pyx_k_tuple_48 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_48); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":564 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sig_pending + * + */ + __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":582 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return _flags_to_list(self._ptr.origflags) + * + */ + __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":573 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sigfd + * + */ + __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_49); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":582 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return _flags_to_list(self._ptr.origflags) + * + */ + __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":590 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.origflags + * + */ + __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":573 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.sigfd + * + */ + __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_50); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":590 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.origflags + * + */ + __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":582 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return _flags_to_list(self._ptr.origflags) + * + */ + __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_51); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) +/* "gevent/core.pyx":706 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_53); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_52 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":590 + * + * if not self._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * return self._ptr.origflags + * + */ + __pyx_k_tuple_52 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_52); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":734 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_55); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_54); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + +/* "gevent/core.pyx":752 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_56); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); + +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_57); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_58); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":772 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_60); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_59); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":774 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * if pass_events: + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":734 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_62); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":706 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_61); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":840 + * def __set__(self, long fd): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") # <<<<<<<<<<<<<< + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_67 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_66)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":752 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":734 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_63); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_64); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":752 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_65); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ + __pyx_k_tuple_67 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_66)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":772 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_67 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_67); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ + __pyx_k_tuple_69 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":891 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_69 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_66 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":758 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_66 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_66); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":772 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_68 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_68); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +/* "gevent/core.pyx":774 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * if pass_events: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_69 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_69); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":891 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_71 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_70 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_70 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_70); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_71 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_71); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_72 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_72 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_68 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_68); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":840 + * def __set__(self, long fd): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") # <<<<<<<<<<<<<< + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + */ +#endif /* (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_72 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_71)); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_72); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_73 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_73 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_72)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_73); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_74 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":957 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_74 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":840 + * def __set__(self, long fd): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'fd' is read-only while watcher is active") # <<<<<<<<<<<<<< + * cdef int vfd = libev.vfd_open(fd) + * libev.vfd_free(self._watcher.fd) + */ + __pyx_k_tuple_74 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_73)); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_74)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ + __pyx_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_74)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_75); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_74 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_73)); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_74); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74)); + +#endif /* (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":957 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_76 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":852 + * def __set__(self, int events): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("'io' watcher attribute 'events' is read-only while watcher is active") # <<<<<<<<<<<<<< + * libev.ev_io_init(&self._watcher, gevent_callback_io, self._watcher.fd, events) + * + */ + __pyx_k_tuple_76 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_75)); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":891 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_76 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_76); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_76)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_77); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_75); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + +/* "gevent/core.pyx":1005 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":891 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_78 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_78 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_78 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_78); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_79); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_80 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_80 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":919 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_80 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_80 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_80); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":957 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":937 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_81); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":943 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_82); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":957 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_83); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_84); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":959 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_85); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_86 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) +/* "gevent/core.pyx":1005 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ +#endif /* (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_86 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_86); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_87); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":1161 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1005 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_88); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_89); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1036 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_90); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1064 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_91); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1082 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_92); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_93 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_93 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_93 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1088 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_93 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_93 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_93); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1102 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_94); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1280 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1161 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1104 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_95); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1280 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_97 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_96); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_97 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1161 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_97 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_97 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_97 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_97); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_98); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1189 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_99); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1207 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_100); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_101 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_101 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1213 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_101 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_101 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_101); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1399 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1280 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1227 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_102); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1399 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_103 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_103 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1229 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_103 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_103 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_103); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103)); + +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1280 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_104); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_105); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1308 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_106); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1326 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_107); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_108 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_108 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1332 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_108 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_108 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_108); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1518 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1399 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1346 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_109); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1518 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1348 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_110); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110)); + +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1399 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_111); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_112); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1427 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_113); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1445 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_114); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_115 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_115 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1451 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_115 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_115 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_115); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1621 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_async_send(self.loop._ptr, &self._watcher) + * + */ + __pyx_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1518 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1465 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_116); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1621 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_async_send(self.loop._ptr, &self._watcher) + * + */ + __pyx_k_tuple_118 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_117 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_117 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1467 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_117 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_117 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_117); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117)); + +#endif /* (!EV_USE_SIGNALFD && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_118 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1518 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_118 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_118 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_118 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_118); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1644 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_119 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_119); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1672 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1546 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_120); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1690 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1564 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_k_tuple_121); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1696 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_122 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_122 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_122 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1570 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_122 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_122 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_122); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1710 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_123 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_123 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1621 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_async_send(self.loop._ptr, &self._watcher) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_123 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1584 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_123 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_123); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123)); + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1712 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_124 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_124 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1586 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_124 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_124 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_124); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1736 + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') # <<<<<<<<<<<<<< + * libev.gevent_install_sigchld_handler() + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_126)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1621 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * libev.ev_async_send(self.loop._ptr, &self._watcher) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_125 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_125 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_125 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_125); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1644 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_126); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1672 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1644 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_127); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ + __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1690 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_128 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_128 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1672 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_128 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_128 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_128); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_128)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1696 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1690 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_129); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_130 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1710 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_130 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1696 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_130 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_130 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_k_tuple_130); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_131 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1712 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_131 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1710 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_131 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_131); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_132 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) +/* "gevent/core.pyx":8 + * import sys + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * import traceback + * import signal as signalmodule + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_132 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1712 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_132 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_132); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_133 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_133 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_133); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133)); + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_134 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1736 + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') # <<<<<<<<<<<<<< + * libev.gevent_install_sigchld_handler() + * libev.ev_child_init(&self._watcher, gevent_callback_child, pid, trace) + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_134 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_133)); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_134); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134)); + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":8 + * import sys + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * import traceback + * import signal as signalmodule + */ +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_137 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_135 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_134)); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_135); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1789 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if value: + * if not self._flags & 4: + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_136 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_136); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136)); + +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_137 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_137 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_137); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_tuple_125 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_125); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_138 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + +/* "gevent/core.pyx":1817 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if self._flags & 2: + * libev.ev_ref(self.loop._ptr) + */ + __pyx_k_tuple_138 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_138); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_139 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1835 + * def __set__(self, int priority): + * if libev.ev_is_active(&self._watcher): + * raise AttributeError("Cannot set priority of an active watcher") # <<<<<<<<<<<<<< + * libev.ev_set_priority(&self._watcher, priority) + * + */ + __pyx_k_tuple_139 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_139); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_140 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1841 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_140 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_140); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_141 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_68)); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1855 + * + * if not self.loop._ptr: + * raise ValueError('operation on destroyed loop') # <<<<<<<<<<<<<< + * if callback is None: + * raise TypeError('callback must be callable, not None') + */ + __pyx_k_tuple_141 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_k_tuple_141); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1857 + * raise ValueError('operation on destroyed loop') + * if callback is None: + * raise TypeError('callback must be callable, not None') # <<<<<<<<<<<<<< + * self.callback = callback + * self.args = args + */ + __pyx_k_tuple_142 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_142); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":8 + * import sys + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * import traceback + * import signal as signalmodule + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_144 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_144); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144)); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_tuple_145 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_145); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_145)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +/* "gevent/core.pyx":90 + * + * + * def get_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_127 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_146 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_134 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_147 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_147)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_135 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":94 + * + * + * def get_header_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_130 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_149 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_149)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_137 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_150 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__get_header_version, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":203 + * + * + * def supported_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_supported_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_131 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_150 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_151 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__supported_backends, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":207 + * + * + * def recommended_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_recommended_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_144 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s_138, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_132 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s_126, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_151 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s_145, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s_133, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_152 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s_146, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_140 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s_134, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":211 + * + * + * def embeddable_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_embeddable_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_133 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_152 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_140 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_153 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_141 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__embeddable_backends, 211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + +/* "gevent/core.pyx":215 + * + * + * def time(): # <<<<<<<<<<<<<< + * return libev.ev_time() + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_146 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_140, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_134 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_128, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_153 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_147, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_141 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_135, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_148, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__time, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcore(void); /*proto*/ +PyMODINIT_FUNC initcore(void) +#else +PyMODINIT_FUNC PyInit_core(void); /*proto*/ +PyMODINIT_FUNC PyInit_core(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_core(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("core"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "gevent.core")) { + if (unlikely(PyDict_SetItemString(modules, "gevent.core", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main_gevent__core) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + GEVENT_CORE_EVENTS = Py_None; Py_INCREF(Py_None); + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_6gevent_4core__EVENTSType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core__EVENTSType = &__pyx_type_6gevent_4core__EVENTSType; + __pyx_vtabptr_6gevent_4core_loop = &__pyx_vtable_6gevent_4core_loop; + __pyx_vtable_6gevent_4core_loop._run_callbacks = (PyObject *(*)(struct PyGeventLoopObject *))__pyx_f_6gevent_4core_4loop__run_callbacks; + __pyx_vtable_6gevent_4core_loop.handle_error = (PyObject *(*)(struct PyGeventLoopObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6gevent_4core_4loop_handle_error; + __pyx_vtable_6gevent_4core_loop._default_handle_error = (PyObject *(*)(struct PyGeventLoopObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6gevent_4core_4loop__default_handle_error; + if (PyType_Ready(&PyGeventLoop_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(PyGeventLoop_Type.tp_dict, __pyx_vtabptr_6gevent_4core_loop) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "loop", (PyObject *)&PyGeventLoop_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_loop = &PyGeventLoop_Type; + if (PyType_Ready(&PyGeventCallback_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "callback", (PyObject *)&PyGeventCallback_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_callback = &PyGeventCallback_Type; + if (PyType_Ready(&PyGeventWatcher_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "watcher", (PyObject *)&PyGeventWatcher_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_watcher = &PyGeventWatcher_Type; + PyGeventIO_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventIO_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "io", (PyObject *)&PyGeventIO_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_io = &PyGeventIO_Type; + PyGeventTimer_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventTimer_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "timer", (PyObject *)&PyGeventTimer_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_timer = &PyGeventTimer_Type; + PyGeventSignal_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventSignal_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "signal", (PyObject *)&PyGeventSignal_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_signal = &PyGeventSignal_Type; + PyGeventIdle_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventIdle_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "idle", (PyObject *)&PyGeventIdle_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_idle = &PyGeventIdle_Type; + PyGeventPrepare_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventPrepare_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "prepare", (PyObject *)&PyGeventPrepare_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_prepare = &PyGeventPrepare_Type; + PyGeventFork_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventFork_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "fork", (PyObject *)&PyGeventFork_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_fork = &PyGeventFork_Type; + PyGeventAsync_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventAsync_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "async", (PyObject *)&PyGeventAsync_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_async = &PyGeventAsync_Type; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + PyGeventChild_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventChild_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "child", (PyObject *)&PyGeventChild_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_child = &PyGeventChild_Type; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + PyGeventStat_Type.tp_base = __pyx_ptype_6gevent_4core_watcher; + if (PyType_Ready(&PyGeventStat_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "stat", (PyObject *)&PyGeventStat_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core_stat = &PyGeventStat_Type; + if (PyType_Ready(&__pyx_type_6gevent_4core___pyx_scope_struct__genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6gevent_4core___pyx_scope_struct__genexpr = &__pyx_type_6gevent_4core___pyx_scope_struct__genexpr; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + +/* "gevent/core.pyx":6 + * cimport libev + * from python cimport * + * import sys # <<<<<<<<<<<<<< + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +/* "gevent/core.pyx":8 + * import sys + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * import traceback + * import signal as signalmodule + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__level), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_137), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_125), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_144), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_132), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_145), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_133), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":9 + * # Work around lack of absolute_import in Cython + * os = __import__('os', level=0) + * import traceback # <<<<<<<<<<<<<< + * import signal as signalmodule + * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__traceback), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__traceback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":10 + * os = __import__('os', level=0) + * import traceback + * import signal as signalmodule # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__signal), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__signalmodule, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":13 + * + * + * __all__ = ['get_version', # <<<<<<<<<<<<<< + * 'get_header_version', + * 'supported_backends', + */ + __pyx_t_2 = PyList_New(7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__get_version)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__get_version)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_version)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__get_header_version)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__get_header_version)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_header_version)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__supported_backends)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__supported_backends)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__supported_backends)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_138)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_138)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_138)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_126)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_126)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_126)); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_145)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_145)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_145)); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_133)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_133)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_133)); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_146)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_146)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_146)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __Pyx_INCREF(((PyObject *)__pyx_n_s_134)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_134)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_134)); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_INCREF(((PyObject *)__pyx_n_s__embeddable_backends)); + PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s__embeddable_backends)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__embeddable_backends)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__time)); + PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_s__time)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__time)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__loop)); + PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_s__loop)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loop)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + +/* "gevent/core.pyx":44 + * + * + * UNDEF = libev.EV_UNDEF # <<<<<<<<<<<<<< + * NONE = libev.EV_NONE + * READ = libev.EV_READ + */ + __pyx_t_2 = PyInt_FromLong(EV_UNDEF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__UNDEF, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":45 + * + * UNDEF = libev.EV_UNDEF + * NONE = libev.EV_NONE # <<<<<<<<<<<<<< + * READ = libev.EV_READ + * WRITE = libev.EV_WRITE + */ + __pyx_t_2 = PyInt_FromLong(EV_NONE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__NONE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":46 + * UNDEF = libev.EV_UNDEF + * NONE = libev.EV_NONE + * READ = libev.EV_READ # <<<<<<<<<<<<<< + * WRITE = libev.EV_WRITE + * TIMER = libev.EV_TIMER + */ + __pyx_t_2 = PyInt_FromLong(EV_READ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__READ, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":47 + * NONE = libev.EV_NONE + * READ = libev.EV_READ + * WRITE = libev.EV_WRITE # <<<<<<<<<<<<<< + * TIMER = libev.EV_TIMER + * PERIODIC = libev.EV_PERIODIC + */ + __pyx_t_2 = PyInt_FromLong(EV_WRITE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__WRITE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":48 + * READ = libev.EV_READ + * WRITE = libev.EV_WRITE + * TIMER = libev.EV_TIMER # <<<<<<<<<<<<<< + * PERIODIC = libev.EV_PERIODIC + * SIGNAL = libev.EV_SIGNAL + */ + __pyx_t_2 = PyInt_FromLong(EV_TIMER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__TIMER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":49 + * WRITE = libev.EV_WRITE + * TIMER = libev.EV_TIMER + * PERIODIC = libev.EV_PERIODIC # <<<<<<<<<<<<<< + * SIGNAL = libev.EV_SIGNAL + * CHILD = libev.EV_CHILD + */ + __pyx_t_2 = PyInt_FromLong(EV_PERIODIC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__PERIODIC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":50 + * TIMER = libev.EV_TIMER + * PERIODIC = libev.EV_PERIODIC + * SIGNAL = libev.EV_SIGNAL # <<<<<<<<<<<<<< + * CHILD = libev.EV_CHILD + * STAT = libev.EV_STAT + */ + __pyx_t_2 = PyInt_FromLong(EV_SIGNAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__SIGNAL, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":51 + * PERIODIC = libev.EV_PERIODIC + * SIGNAL = libev.EV_SIGNAL + * CHILD = libev.EV_CHILD # <<<<<<<<<<<<<< + * STAT = libev.EV_STAT + * IDLE = libev.EV_IDLE + */ + __pyx_t_2 = PyInt_FromLong(EV_CHILD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__CHILD, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":52 + * SIGNAL = libev.EV_SIGNAL + * CHILD = libev.EV_CHILD + * STAT = libev.EV_STAT # <<<<<<<<<<<<<< + * IDLE = libev.EV_IDLE + * PREPARE = libev.EV_PREPARE + */ + __pyx_t_2 = PyInt_FromLong(EV_STAT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__STAT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":53 + * CHILD = libev.EV_CHILD + * STAT = libev.EV_STAT + * IDLE = libev.EV_IDLE # <<<<<<<<<<<<<< + * PREPARE = libev.EV_PREPARE + * CHECK = libev.EV_CHECK + */ + __pyx_t_2 = PyInt_FromLong(EV_IDLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__IDLE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":54 + * STAT = libev.EV_STAT + * IDLE = libev.EV_IDLE + * PREPARE = libev.EV_PREPARE # <<<<<<<<<<<<<< + * CHECK = libev.EV_CHECK + * EMBED = libev.EV_EMBED + */ + __pyx_t_2 = PyInt_FromLong(EV_PREPARE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__PREPARE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":55 + * IDLE = libev.EV_IDLE + * PREPARE = libev.EV_PREPARE + * CHECK = libev.EV_CHECK # <<<<<<<<<<<<<< + * EMBED = libev.EV_EMBED + * FORK = libev.EV_FORK + */ + __pyx_t_2 = PyInt_FromLong(EV_CHECK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__CHECK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":56 + * PREPARE = libev.EV_PREPARE + * CHECK = libev.EV_CHECK + * EMBED = libev.EV_EMBED # <<<<<<<<<<<<<< + * FORK = libev.EV_FORK + * CLEANUP = libev.EV_CLEANUP + */ + __pyx_t_2 = PyInt_FromLong(EV_EMBED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EMBED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":57 + * CHECK = libev.EV_CHECK + * EMBED = libev.EV_EMBED + * FORK = libev.EV_FORK # <<<<<<<<<<<<<< + * CLEANUP = libev.EV_CLEANUP + * ASYNC = libev.EV_ASYNC + */ + __pyx_t_2 = PyInt_FromLong(EV_FORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__FORK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":58 + * EMBED = libev.EV_EMBED + * FORK = libev.EV_FORK + * CLEANUP = libev.EV_CLEANUP # <<<<<<<<<<<<<< + * ASYNC = libev.EV_ASYNC + * CUSTOM = libev.EV_CUSTOM + */ + __pyx_t_2 = PyInt_FromLong(EV_CLEANUP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__CLEANUP, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":59 + * FORK = libev.EV_FORK + * CLEANUP = libev.EV_CLEANUP + * ASYNC = libev.EV_ASYNC # <<<<<<<<<<<<<< + * CUSTOM = libev.EV_CUSTOM + * ERROR = libev.EV_ERROR + */ + __pyx_t_2 = PyInt_FromLong(EV_ASYNC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ASYNC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":60 + * CLEANUP = libev.EV_CLEANUP + * ASYNC = libev.EV_ASYNC + * CUSTOM = libev.EV_CUSTOM # <<<<<<<<<<<<<< + * ERROR = libev.EV_ERROR + * + */ + __pyx_t_2 = PyInt_FromLong(EV_CUSTOM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__CUSTOM, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":61 + * ASYNC = libev.EV_ASYNC + * CUSTOM = libev.EV_CUSTOM + * ERROR = libev.EV_ERROR # <<<<<<<<<<<<<< + * + * READWRITE = libev.EV_READ | libev.EV_WRITE + */ + __pyx_t_2 = PyInt_FromLong(EV_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__ERROR, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":63 + * ERROR = libev.EV_ERROR + * + * READWRITE = libev.EV_READ | libev.EV_WRITE # <<<<<<<<<<<<<< + * + * MINPRI = libev.EV_MINPRI + */ + __pyx_t_2 = PyInt_FromLong((EV_READ | EV_WRITE)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__READWRITE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":65 + * READWRITE = libev.EV_READ | libev.EV_WRITE + * + * MINPRI = libev.EV_MINPRI # <<<<<<<<<<<<<< + * MAXPRI = libev.EV_MAXPRI + * + */ + __pyx_t_2 = PyInt_FromLong(EV_MINPRI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__MINPRI, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":66 + * + * MINPRI = libev.EV_MINPRI + * MAXPRI = libev.EV_MAXPRI # <<<<<<<<<<<<<< + * + * BACKEND_PORT = libev.EVBACKEND_PORT + */ + __pyx_t_2 = PyInt_FromLong(EV_MAXPRI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__MAXPRI, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":68 + * MAXPRI = libev.EV_MAXPRI + * + * BACKEND_PORT = libev.EVBACKEND_PORT # <<<<<<<<<<<<<< + * BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE + * BACKEND_EPOLL = libev.EVBACKEND_EPOLL + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_PORT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__BACKEND_PORT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":69 + * + * BACKEND_PORT = libev.EVBACKEND_PORT + * BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE # <<<<<<<<<<<<<< + * BACKEND_EPOLL = libev.EVBACKEND_EPOLL + * BACKEND_POLL = libev.EVBACKEND_POLL + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_KQUEUE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__BACKEND_KQUEUE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":70 + * BACKEND_PORT = libev.EVBACKEND_PORT + * BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE + * BACKEND_EPOLL = libev.EVBACKEND_EPOLL # <<<<<<<<<<<<<< + * BACKEND_POLL = libev.EVBACKEND_POLL + * BACKEND_SELECT = libev.EVBACKEND_SELECT + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_EPOLL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__BACKEND_EPOLL, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":71 + * BACKEND_KQUEUE = libev.EVBACKEND_KQUEUE + * BACKEND_EPOLL = libev.EVBACKEND_EPOLL + * BACKEND_POLL = libev.EVBACKEND_POLL # <<<<<<<<<<<<<< + * BACKEND_SELECT = libev.EVBACKEND_SELECT + * FORKCHECK = libev.EVFLAG_FORKCHECK + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_POLL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__BACKEND_POLL, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":72 + * BACKEND_EPOLL = libev.EVBACKEND_EPOLL + * BACKEND_POLL = libev.EVBACKEND_POLL + * BACKEND_SELECT = libev.EVBACKEND_SELECT # <<<<<<<<<<<<<< + * FORKCHECK = libev.EVFLAG_FORKCHECK + * NOINOTIFY = libev.EVFLAG_NOINOTIFY + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_SELECT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__BACKEND_SELECT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":73 + * BACKEND_POLL = libev.EVBACKEND_POLL + * BACKEND_SELECT = libev.EVBACKEND_SELECT + * FORKCHECK = libev.EVFLAG_FORKCHECK # <<<<<<<<<<<<<< + * NOINOTIFY = libev.EVFLAG_NOINOTIFY + * SIGNALFD = libev.EVFLAG_SIGNALFD + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_FORKCHECK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__FORKCHECK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":74 + * BACKEND_SELECT = libev.EVBACKEND_SELECT + * FORKCHECK = libev.EVFLAG_FORKCHECK + * NOINOTIFY = libev.EVFLAG_NOINOTIFY # <<<<<<<<<<<<<< + * SIGNALFD = libev.EVFLAG_SIGNALFD + * NOSIGMASK = libev.EVFLAG_NOSIGMASK + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_NOINOTIFY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__NOINOTIFY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":75 + * FORKCHECK = libev.EVFLAG_FORKCHECK + * NOINOTIFY = libev.EVFLAG_NOINOTIFY + * SIGNALFD = libev.EVFLAG_SIGNALFD # <<<<<<<<<<<<<< + * NOSIGMASK = libev.EVFLAG_NOSIGMASK + * + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_SIGNALFD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__SIGNALFD, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":76 + * NOINOTIFY = libev.EVFLAG_NOINOTIFY + * SIGNALFD = libev.EVFLAG_SIGNALFD + * NOSIGMASK = libev.EVFLAG_NOSIGMASK # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_NOSIGMASK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__NOSIGMASK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":86 + * + * + * cdef public object GEVENT_CORE_EVENTS = _EVENTSType() # <<<<<<<<<<<<<< + * EVENTS = GEVENT_CORE_EVENTS + * + */ + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6gevent_4core__EVENTSType)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF(GEVENT_CORE_EVENTS); + __Pyx_DECREF(GEVENT_CORE_EVENTS); + __Pyx_GIVEREF(__pyx_t_2); + GEVENT_CORE_EVENTS = __pyx_t_2; + __pyx_t_2 = 0; + +/* "gevent/core.pyx":87 + * + * cdef public object GEVENT_CORE_EVENTS = _EVENTSType() + * EVENTS = GEVENT_CORE_EVENTS # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EVENTS, GEVENT_CORE_EVENTS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +/* "gevent/core.pyx":90 + * + * + * def get_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.ev_version_major(), libev.ev_version_minor()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_1get_version, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":94 + * + * + * def get_header_version(): # <<<<<<<<<<<<<< + * return 'libev-%d.%02d' % (libev.EV_VERSION_MAJOR, libev.EV_VERSION_MINOR) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_3get_header_version, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_header_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":99 + * + * # This list backends in the order they are actually tried by libev + * _flags = [(libev.EVBACKEND_PORT, 'port'), # <<<<<<<<<<<<<< + * (libev.EVBACKEND_KQUEUE, 'kqueue'), + * (libev.EVBACKEND_EPOLL, 'epoll'), + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_PORT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__port)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__port)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__port)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":100 + * # This list backends in the order they are actually tried by libev + * _flags = [(libev.EVBACKEND_PORT, 'port'), + * (libev.EVBACKEND_KQUEUE, 'kqueue'), # <<<<<<<<<<<<<< + * (libev.EVBACKEND_EPOLL, 'epoll'), + * (libev.EVBACKEND_POLL, 'poll'), + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_KQUEUE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__kqueue)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__kqueue)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__kqueue)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":101 + * _flags = [(libev.EVBACKEND_PORT, 'port'), + * (libev.EVBACKEND_KQUEUE, 'kqueue'), + * (libev.EVBACKEND_EPOLL, 'epoll'), # <<<<<<<<<<<<<< + * (libev.EVBACKEND_POLL, 'poll'), + * (libev.EVBACKEND_SELECT, 'select'), + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_EPOLL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__epoll)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__epoll)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epoll)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":102 + * (libev.EVBACKEND_KQUEUE, 'kqueue'), + * (libev.EVBACKEND_EPOLL, 'epoll'), + * (libev.EVBACKEND_POLL, 'poll'), # <<<<<<<<<<<<<< + * (libev.EVBACKEND_SELECT, 'select'), + * (libev.EVFLAG_NOENV, 'noenv'), + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_POLL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__poll)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__poll)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__poll)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":103 + * (libev.EVBACKEND_EPOLL, 'epoll'), + * (libev.EVBACKEND_POLL, 'poll'), + * (libev.EVBACKEND_SELECT, 'select'), # <<<<<<<<<<<<<< + * (libev.EVFLAG_NOENV, 'noenv'), + * (libev.EVFLAG_FORKCHECK, 'forkcheck'), + */ + __pyx_t_2 = PyInt_FromLong(EVBACKEND_SELECT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__select)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__select)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__select)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":104 + * (libev.EVBACKEND_POLL, 'poll'), + * (libev.EVBACKEND_SELECT, 'select'), + * (libev.EVFLAG_NOENV, 'noenv'), # <<<<<<<<<<<<<< + * (libev.EVFLAG_FORKCHECK, 'forkcheck'), + * (libev.EVFLAG_NOINOTIFY, 'noinotify'), + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_NOENV); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__noenv)); + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__noenv)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__noenv)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":105 + * (libev.EVBACKEND_SELECT, 'select'), + * (libev.EVFLAG_NOENV, 'noenv'), + * (libev.EVFLAG_FORKCHECK, 'forkcheck'), # <<<<<<<<<<<<<< + * (libev.EVFLAG_NOINOTIFY, 'noinotify'), + * (libev.EVFLAG_SIGNALFD, 'signalfd'), + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_FORKCHECK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__forkcheck)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_n_s__forkcheck)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__forkcheck)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":106 + * (libev.EVFLAG_NOENV, 'noenv'), + * (libev.EVFLAG_FORKCHECK, 'forkcheck'), + * (libev.EVFLAG_NOINOTIFY, 'noinotify'), # <<<<<<<<<<<<<< + * (libev.EVFLAG_SIGNALFD, 'signalfd'), + * (libev.EVFLAG_NOSIGMASK, 'nosigmask')] + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_NOINOTIFY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__noinotify)); + PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_n_s__noinotify)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__noinotify)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":107 + * (libev.EVFLAG_FORKCHECK, 'forkcheck'), + * (libev.EVFLAG_NOINOTIFY, 'noinotify'), + * (libev.EVFLAG_SIGNALFD, 'signalfd'), # <<<<<<<<<<<<<< + * (libev.EVFLAG_NOSIGMASK, 'nosigmask')] + * + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_SIGNALFD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__signalfd)); + PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_n_s__signalfd)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__signalfd)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":108 + * (libev.EVFLAG_NOINOTIFY, 'noinotify'), + * (libev.EVFLAG_SIGNALFD, 'signalfd'), + * (libev.EVFLAG_NOSIGMASK, 'nosigmask')] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(EVFLAG_NOSIGMASK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nosigmask)); + PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_n_s__nosigmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nosigmask)); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyList_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + PyList_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyList_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___flags, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + +/* "gevent/core.pyx":111 + * + * + * _flags_str2int = dict((string, flag) for (flag, string) in _flags) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_pf_6gevent_4core_22genexpr(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___flags_str2int, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":114 + * + * + * _events = [(libev.EV_READ, 'READ'), # <<<<<<<<<<<<<< + * (libev.EV_WRITE, 'WRITE'), + * (libev.EV__IOFDSET, '_IOFDSET'), + */ + __pyx_t_2 = PyInt_FromLong(EV_READ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__READ)); + PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_n_s__READ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__READ)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":115 + * + * _events = [(libev.EV_READ, 'READ'), + * (libev.EV_WRITE, 'WRITE'), # <<<<<<<<<<<<<< + * (libev.EV__IOFDSET, '_IOFDSET'), + * (libev.EV_PERIODIC, 'PERIODIC'), + */ + __pyx_t_2 = PyInt_FromLong(EV_WRITE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__WRITE)); + PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_n_s__WRITE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WRITE)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":116 + * _events = [(libev.EV_READ, 'READ'), + * (libev.EV_WRITE, 'WRITE'), + * (libev.EV__IOFDSET, '_IOFDSET'), # <<<<<<<<<<<<<< + * (libev.EV_PERIODIC, 'PERIODIC'), + * (libev.EV_SIGNAL, 'SIGNAL'), + */ + __pyx_t_2 = PyInt_FromLong(EV__IOFDSET); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s___IOFDSET)); + PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_n_s___IOFDSET)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s___IOFDSET)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":117 + * (libev.EV_WRITE, 'WRITE'), + * (libev.EV__IOFDSET, '_IOFDSET'), + * (libev.EV_PERIODIC, 'PERIODIC'), # <<<<<<<<<<<<<< + * (libev.EV_SIGNAL, 'SIGNAL'), + * (libev.EV_CHILD, 'CHILD'), + */ + __pyx_t_2 = PyInt_FromLong(EV_PERIODIC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PERIODIC)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_n_s__PERIODIC)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PERIODIC)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":118 + * (libev.EV__IOFDSET, '_IOFDSET'), + * (libev.EV_PERIODIC, 'PERIODIC'), + * (libev.EV_SIGNAL, 'SIGNAL'), # <<<<<<<<<<<<<< + * (libev.EV_CHILD, 'CHILD'), + * (libev.EV_STAT, 'STAT'), + */ + __pyx_t_2 = PyInt_FromLong(EV_SIGNAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SIGNAL)); + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__SIGNAL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SIGNAL)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":119 + * (libev.EV_PERIODIC, 'PERIODIC'), + * (libev.EV_SIGNAL, 'SIGNAL'), + * (libev.EV_CHILD, 'CHILD'), # <<<<<<<<<<<<<< + * (libev.EV_STAT, 'STAT'), + * (libev.EV_IDLE, 'IDLE'), + */ + __pyx_t_2 = PyInt_FromLong(EV_CHILD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CHILD)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__CHILD)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CHILD)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":120 + * (libev.EV_SIGNAL, 'SIGNAL'), + * (libev.EV_CHILD, 'CHILD'), + * (libev.EV_STAT, 'STAT'), # <<<<<<<<<<<<<< + * (libev.EV_IDLE, 'IDLE'), + * (libev.EV_PREPARE, 'PREPARE'), + */ + __pyx_t_2 = PyInt_FromLong(EV_STAT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__STAT)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__STAT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__STAT)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":121 + * (libev.EV_CHILD, 'CHILD'), + * (libev.EV_STAT, 'STAT'), + * (libev.EV_IDLE, 'IDLE'), # <<<<<<<<<<<<<< + * (libev.EV_PREPARE, 'PREPARE'), + * (libev.EV_CHECK, 'CHECK'), + */ + __pyx_t_2 = PyInt_FromLong(EV_IDLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__IDLE)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__IDLE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IDLE)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":122 + * (libev.EV_STAT, 'STAT'), + * (libev.EV_IDLE, 'IDLE'), + * (libev.EV_PREPARE, 'PREPARE'), # <<<<<<<<<<<<<< + * (libev.EV_CHECK, 'CHECK'), + * (libev.EV_EMBED, 'EMBED'), + */ + __pyx_t_2 = PyInt_FromLong(EV_PREPARE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PREPARE)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__PREPARE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PREPARE)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":123 + * (libev.EV_IDLE, 'IDLE'), + * (libev.EV_PREPARE, 'PREPARE'), + * (libev.EV_CHECK, 'CHECK'), # <<<<<<<<<<<<<< + * (libev.EV_EMBED, 'EMBED'), + * (libev.EV_FORK, 'FORK'), + */ + __pyx_t_2 = PyInt_FromLong(EV_CHECK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CHECK)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__CHECK)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CHECK)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":124 + * (libev.EV_PREPARE, 'PREPARE'), + * (libev.EV_CHECK, 'CHECK'), + * (libev.EV_EMBED, 'EMBED'), # <<<<<<<<<<<<<< + * (libev.EV_FORK, 'FORK'), + * (libev.EV_CLEANUP, 'CLEANUP'), + */ + __pyx_t_2 = PyInt_FromLong(EV_EMBED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__EMBED)); + PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_n_s__EMBED)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EMBED)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":125 + * (libev.EV_CHECK, 'CHECK'), + * (libev.EV_EMBED, 'EMBED'), + * (libev.EV_FORK, 'FORK'), # <<<<<<<<<<<<<< + * (libev.EV_CLEANUP, 'CLEANUP'), + * (libev.EV_ASYNC, 'ASYNC'), + */ + __pyx_t_2 = PyInt_FromLong(EV_FORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FORK)); + PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_n_s__FORK)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORK)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":126 + * (libev.EV_EMBED, 'EMBED'), + * (libev.EV_FORK, 'FORK'), + * (libev.EV_CLEANUP, 'CLEANUP'), # <<<<<<<<<<<<<< + * (libev.EV_ASYNC, 'ASYNC'), + * (libev.EV_CUSTOM, 'CUSTOM'), + */ + __pyx_t_2 = PyInt_FromLong(EV_CLEANUP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CLEANUP)); + PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_n_s__CLEANUP)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CLEANUP)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":127 + * (libev.EV_FORK, 'FORK'), + * (libev.EV_CLEANUP, 'CLEANUP'), + * (libev.EV_ASYNC, 'ASYNC'), # <<<<<<<<<<<<<< + * (libev.EV_CUSTOM, 'CUSTOM'), + * (libev.EV_ERROR, 'ERROR')] + */ + __pyx_t_2 = PyInt_FromLong(EV_ASYNC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ASYNC)); + PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_n_s__ASYNC)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASYNC)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":128 + * (libev.EV_CLEANUP, 'CLEANUP'), + * (libev.EV_ASYNC, 'ASYNC'), + * (libev.EV_CUSTOM, 'CUSTOM'), # <<<<<<<<<<<<<< + * (libev.EV_ERROR, 'ERROR')] + * + */ + __pyx_t_2 = PyInt_FromLong(EV_CUSTOM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CUSTOM)); + PyTuple_SET_ITEM(__pyx_t_16, 1, ((PyObject *)__pyx_n_s__CUSTOM)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CUSTOM)); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":129 + * (libev.EV_ASYNC, 'ASYNC'), + * (libev.EV_CUSTOM, 'CUSTOM'), + * (libev.EV_ERROR, 'ERROR')] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(EV_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ERROR)); + PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)__pyx_n_s__ERROR)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ERROR)); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_2, 10, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + PyList_SET_ITEM(__pyx_t_2, 11, ((PyObject *)__pyx_t_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); + PyList_SET_ITEM(__pyx_t_2, 12, ((PyObject *)__pyx_t_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_14)); + PyList_SET_ITEM(__pyx_t_2, 13, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + PyList_SET_ITEM(__pyx_t_2, 14, ((PyObject *)__pyx_t_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_16)); + PyList_SET_ITEM(__pyx_t_2, 15, ((PyObject *)__pyx_t_17)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_17)); + __pyx_t_11 = 0; + __pyx_t_10 = 0; + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_6 = 0; + __pyx_t_5 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___events, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + +/* "gevent/core.pyx":145 + * + * + * if sys.version_info[0] >= 3: # <<<<<<<<<<<<<< + * basestring = (bytes, str) + * else: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__version_info); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_17, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (__pyx_t_18) { + +/* "gevent/core.pyx":146 + * + * if sys.version_info[0] >= 3: + * basestring = (bytes, str) # <<<<<<<<<<<<<< + * else: + * basestring = __builtins__.basestring + */ + __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyBytes_Type)))); + PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)((PyObject*)(&PyBytes_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyBytes_Type)))); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__basestring, ((PyObject *)__pyx_t_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + goto __pyx_L2; + } + /*else*/ { + +/* "gevent/core.pyx":148 + * basestring = (bytes, str) + * else: + * basestring = __builtins__.basestring # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s____builtins__); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__basestring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__basestring, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L2:; + +/* "gevent/core.pyx":203 + * + * + * def supported_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_supported_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_13supported_backends, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__supported_backends, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":207 + * + * + * def recommended_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_recommended_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_15recommended_backends, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_138, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_126, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_145, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_133, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_146, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_134, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":211 + * + * + * def embeddable_backends(): # <<<<<<<<<<<<<< + * return _flags_to_list(libev.ev_embeddable_backends()) + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_17embeddable_backends, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__embeddable_backends, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":215 + * + * + * def time(): # <<<<<<<<<<<<<< + * return libev.ev_time() + * + */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_141); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_129); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_148); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_136); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_149); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6gevent_4core_19time, NULL, __pyx_n_s_137); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__time, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":221 + * + * + * cdef bint _default_loop_destroyed = False # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_6gevent_4core__default_loop_destroyed = 0; + +/* "gevent/core.pyx":358 + * libev.ev_break(self._ptr, libev.EVBREAK_ONE) + * + * def run(self, nowait=False, once=False): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_14 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_15 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":386 + * libev.ev_unref(self._ptr) + * + * def break_(self, int how=libev.EVBREAK_ONE): # <<<<<<<<<<<<<< + * + * if not self._ptr: + */ + __pyx_k_20 = EVBREAK_ONE; + +/* "gevent/core.pyx":465 + * return libev.ev_pending_count(self._ptr) + * + * def io(self, int fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * return io(self, fd, events, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_32 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":468 + * return io(self, fd, events, ref, priority) + * + * def timer(self, double after, double repeat=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * return timer(self, after, repeat, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_33 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":471 + * return timer(self, after, repeat, ref, priority) + * + * def signal(self, int signum, ref=True, priority=None): # <<<<<<<<<<<<<< + * return signal(self, signum, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_34 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":474 + * return signal(self, signum, ref, priority) + * + * def idle(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return idle(self, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_35 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":477 + * return idle(self, ref, priority) + * + * def prepare(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return prepare(self, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_36 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":480 + * return prepare(self, ref, priority) + * + * def fork(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return fork(self, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_37 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":483 + * return fork(self, ref, priority) + * + * def async(self, ref=True, priority=None): # <<<<<<<<<<<<<< + * return async(self, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_38 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":489 + * + * + * def child(self, int pid, bint trace=0, ref=True): # <<<<<<<<<<<<<< + * return child(self, pid, trace, ref) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":497 + * + * + * def stat(self, bytes path, float interval=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * return stat(self, path, interval, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_39 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":497 + * + * + * def stat(self, bytes path, float interval=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * return stat(self, path, interval, ref, priority) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_40 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +/* "gevent/core.pyx":769 + * self._flags |= 1 + * + * def start(self, object callback, *args, pass_events=False): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_59 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_58 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_66 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_65 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_67 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":817 + * + * + * def __init__(self, loop loop, int fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * if fd < 0: + * raise ValueError('fd must be non-negative: %r' % fd) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +/* "gevent/core.pyx":801 + * + * + * def __init__(self, loop loop, long fd, int events, ref=True, priority=None): # <<<<<<<<<<<<<< + * if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE): + * raise ValueError('illegal event mask: %r' % events) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_63 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_62 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_70 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_69 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_71 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":954 + * self._flags |= 1 + * + * def start(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_75 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_73 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_82 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_80 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_83 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_81 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":983 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * if repeat < 0.0: + * raise ValueError("repeat must be positive or zero: %r" % repeat) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_76 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_83 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_84 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1002 + * # QQQ: add 'after' and 'repeat' properties? + * + * def again(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __pyx_k_86 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1002 + * # QQQ: add 'after' and 'repeat' properties? + * + * def again(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __pyx_k_85 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1002 + * # QQQ: add 'after' and 'repeat' properties? + * + * def again(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + __pyx_k_78 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1002 + * # QQQ: add 'after' and 'repeat' properties? + * + * def again(self, object callback, *args, update=True): # <<<<<<<<<<<<<< + * + * if not self.loop._ptr: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_80 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_87 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_88 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +/* "gevent/core.pyx":1126 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, int signalnum, ref=True, priority=None): # <<<<<<<<<<<<<< + * if signalnum < 1 or signalnum >= signalmodule.NSIG: + * raise ValueError('illegal signal number: %r' % signalnum) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_88 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_86 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_95 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_93 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_96 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_94 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1252 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_idle_init(&self._watcher, gevent_callback_idle ) + * self.loop = loop + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_96 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_94 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_103 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_101 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_104 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_102 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1371 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_prepare_init(&self._watcher, gevent_callback_prepare ) + * self.loop = loop + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_103 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_101 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_110 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_108 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_111 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_109 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1490 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_fork_init(&self._watcher, gevent_callback_fork ) + * self.loop = loop + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_110 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_108 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_115 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_118 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_116 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1608 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_async_init(&self._watcher, gevent_callback_async ) + * self.loop = loop + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED) && defined(_WIN32)) || (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(_WIN32)) + __pyx_k_117 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) +/* "gevent/core.pyx":1608 + * + * + * def __init__(self, loop loop , ref=True, priority=None): # <<<<<<<<<<<<<< + * libev.ev_async_init(&self._watcher, gevent_callback_async ) + * self.loop = loop + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_124 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_125 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) +/* "gevent/core.pyx":1734 + * return True if libev.ev_is_pending(&self._watcher) else False + * + * def __init__(self, loop loop, int pid, bint trace=0, ref=True): # <<<<<<<<<<<<<< + * if not loop.default: + * raise TypeError('child watchers are only available on the default loop') + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) || (!EV_USE_SIGNALFD && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_125 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_115 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_132 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_122 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_133 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_123 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1880 + * cdef readonly bytes path + * + * def __init__(self, loop loop, bytes path, float interval=0.0, ref=True, priority=None): # <<<<<<<<<<<<<< + * self.path = path + * libev.ev_stat_init(&self._watcher, gevent_callback_stat, self.path, interval) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_135 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_123 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_142 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_130 = __pyx_t_2; +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + __pyx_k_143 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + __pyx_k_131 = __pyx_t_2; +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + +/* "gevent/core.pyx":1911 + * + * + * __SYSERR_CALLBACK = None # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s____SYSERR_CALLBACK, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) +/* "gevent/core.pyx":1948 + * + * + * LIBEV_EMBED = False # <<<<<<<<<<<<<< + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) +/* "gevent/core.pyx":1937 + * + * + * LIBEV_EMBED = True # <<<<<<<<<<<<<< + * EV_USE_FLOOR = libev.EV_USE_FLOOR + * EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LIBEV_EMBED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && !defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LIBEV_EMBED, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1938 + * + * LIBEV_EMBED = True + * EV_USE_FLOOR = libev.EV_USE_FLOOR # <<<<<<<<<<<<<< + * EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL + * EV_USE_REALTIME = libev.EV_USE_REALTIME + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_FLOOR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_FLOOR, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1939 + * LIBEV_EMBED = True + * EV_USE_FLOOR = libev.EV_USE_FLOOR + * EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL # <<<<<<<<<<<<<< + * EV_USE_REALTIME = libev.EV_USE_REALTIME + * EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_CLOCK_SYSCALL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_154, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_142, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (!EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_155, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_143, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1940 + * EV_USE_FLOOR = libev.EV_USE_FLOOR + * EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL + * EV_USE_REALTIME = libev.EV_USE_REALTIME # <<<<<<<<<<<<<< + * EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC + * EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_REALTIME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_REALTIME, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1941 + * EV_USE_CLOCK_SYSCALL = libev.EV_USE_CLOCK_SYSCALL + * EV_USE_REALTIME = libev.EV_USE_REALTIME + * EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC # <<<<<<<<<<<<<< + * EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP + * EV_USE_INOTIFY = libev.EV_USE_INOTIFY + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_MONOTONIC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_MONOTONIC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1942 + * EV_USE_REALTIME = libev.EV_USE_REALTIME + * EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC + * EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP # <<<<<<<<<<<<<< + * EV_USE_INOTIFY = libev.EV_USE_INOTIFY + * EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_NANOSLEEP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_NANOSLEEP, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1943 + * EV_USE_MONOTONIC = libev.EV_USE_MONOTONIC + * EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP + * EV_USE_INOTIFY = libev.EV_USE_INOTIFY # <<<<<<<<<<<<<< + * EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD + * EV_USE_EVENTFD = libev.EV_USE_EVENTFD + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_INOTIFY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_INOTIFY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1944 + * EV_USE_NANOSLEEP = libev.EV_USE_NANOSLEEP + * EV_USE_INOTIFY = libev.EV_USE_INOTIFY + * EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD # <<<<<<<<<<<<<< + * EV_USE_EVENTFD = libev.EV_USE_EVENTFD + * EV_USE_4HEAP = libev.EV_USE_4HEAP + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_SIGNALFD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_SIGNALFD, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1945 + * EV_USE_INOTIFY = libev.EV_USE_INOTIFY + * EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD + * EV_USE_EVENTFD = libev.EV_USE_EVENTFD # <<<<<<<<<<<<<< + * EV_USE_4HEAP = libev.EV_USE_4HEAP + * + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_EVENTFD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_EVENTFD, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1946 + * EV_USE_SIGNALFD = libev.EV_USE_SIGNALFD + * EV_USE_EVENTFD = libev.EV_USE_EVENTFD + * EV_USE_4HEAP = libev.EV_USE_4HEAP # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyInt_FromLong(EV_USE_4HEAP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__EV_USE_4HEAP, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (defined(LIBEV_EMBED)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +/* "gevent/core.pyx":1 + * # Generated by cythonpp.py on 2013-11-26 17:25:45 # <<<<<<<<<<<<<< + * # Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. + * cimport cython + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + if (__pyx_m) { + __Pyx_AddTraceback("init gevent.core", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init gevent.core"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; +/* Make sure tstate is in a consistent state when we XDECREF + these objects (DECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_COMPILING_IN_CPYTHON +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + if (!r) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + goto bad; + PyErr_Clear(); + r = d; + Py_INCREF(d); + } + return r; +bad: + return NULL; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CPYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32)) || (!EV_USE_SIGNALFD && defined(_WIN32)) */ +#if (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { + PyTypeObject* type = Py_TYPE(obj); + while (type && type->tp_traverse != current_tp_traverse) + type = type->tp_base; + while (type && type->tp_traverse == current_tp_traverse) + type = type->tp_base; + if (type && type->tp_traverse) + return type->tp_traverse(obj, v, a); + return 0; +} + +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { + PyTypeObject* type = Py_TYPE(obj); + while (type && type->tp_clear != current_tp_clear) + type = type->tp_base; + while (type && type->tp_clear == current_tp_clear) + type = type->tp_base; + if (type && type->tp_clear) + type->tp_clear(obj); +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; +#else + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); +#endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} + +static PyObject *__Pyx_Generator_Next(PyObject *self); +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Generator_Close(PyObject *self); +static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (unlikely(et != PyExc_StopIteration) && + unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + if (likely(et == PyExc_StopIteration)) { + if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + ev = Py_None; + } + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = ev; + return 0; + } + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args); + Py_DECREF(ev); + if (likely(args)) { + value = PyObject_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +#endif +static CYTHON_INLINE +void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { + PyObject *exc_type = self->exc_type; + PyObject *exc_value = self->exc_value; + PyObject *exc_traceback = self->exc_traceback; + self->exc_type = NULL; + self->exc_value = NULL; + self->exc_traceback = NULL; + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); +} +static CYTHON_INLINE +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { + PyErr_SetString(PyExc_ValueError, + "generator already executing"); + return 1; + } + return 0; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + PyErr_SetString(PyExc_TypeError, + "can't send non-None value to a " + "just-started generator"); + return NULL; + } + } + if (unlikely(self->resume_label == -1)) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if (value) { +#if CYTHON_COMPILING_IN_PYPY +#else +/* Generators always return to their most recent caller, not + * necessarily their creator. */ + if (self->exc_traceback) { + PyThreadState *tstate = PyThreadState_GET(); + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_XINCREF(tstate->frame); + assert(f->f_back == NULL); + f->f_back = tstate->frame; + } +#endif + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); + } else { + __Pyx_Generator_ExceptionClear(self); + } + self->is_running = 1; + retval = self->body((PyObject *) self, value); + self->is_running = 0; + if (retval) { + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); +#if CYTHON_COMPILING_IN_PYPY +#else +/* Don't keep the reference to f_back any longer than necessary. It + * may keep a chain of frames alive or it could create a reference + * cycle. */ + if (self->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + } +#endif + } else { + __Pyx_Generator_ExceptionClear(self); + } + return retval; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Generator_Undelegate(gen); + __Pyx_PyGen_FetchStopIterationValue(&val); + ret = __Pyx_Generator_SendEx(gen, val); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, Py_None); +} +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Send(yf, value); + } else { + if (value == Py_None) + ret = PyIter_Next(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, value); +} +static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Generator_Close(yf); + if (!retval) + return -1; + } else { + PyObject *meth; + gen->is_running = 1; + meth = PyObject_GetAttr(yf, __pyx_n_s__close); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Close(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Generator_CloseIter(gen, yf); + __Pyx_Generator_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) +#if PY_VERSION_HEX < 0x02050000 + PyErr_SetNone(PyExc_StopIteration); +#else + PyErr_SetNone(PyExc_GeneratorExit); +#endif + retval = __Pyx_Generator_SendEx(gen, NULL); + if (retval) { + Py_DECREF(retval); + PyErr_SetString(PyExc_RuntimeError, + "generator ignored GeneratorExit"); + return NULL; + } + raised_exception = PyErr_Occurred(); + if (!raised_exception + || raised_exception == PyExc_StopIteration +#if PY_VERSION_HEX >= 0x02050000 + || raised_exception == PyExc_GeneratorExit + || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) +#endif + || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) + { + if (raised_exception) PyErr_Clear(); /* ignore these errors */ + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *typ; + PyObject *tb = NULL; + PyObject *val = NULL; + PyObject *yf = gen->yieldfrom; + if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) + return NULL; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + Py_INCREF(yf); +#if PY_VERSION_HEX >= 0x02050000 + if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { + int err = __Pyx_Generator_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Generator_Undelegate(gen); + if (err < 0) + return __Pyx_Generator_SendEx(gen, NULL); + goto throw_here; + } +#endif + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Throw(yf, args); + } else { + PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Generator_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + ret = PyObject_CallObject(meth, args); + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Generator_FinishDelegation(gen); + } + return ret; + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Generator_SendEx(gen, NULL); +} +static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + Py_VISIT(gen->exc_type); + Py_VISIT(gen->exc_value); + Py_VISIT(gen->exc_traceback); + return 0; +} +static int __Pyx_Generator_clear(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + Py_CLEAR(gen->exc_type); + Py_CLEAR(gen->exc_value); + Py_CLEAR(gen->exc_traceback); + return 0; +} +static void __Pyx_Generator_dealloc(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + PyObject_GC_Track(self); + if (gen->resume_label > 0) { + Py_TYPE(gen)->tp_del(self); + if (self->ob_refcnt > 0) + return; /* resurrected. :( */ + } + PyObject_GC_UnTrack(self); + __Pyx_Generator_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Generator_del(PyObject *self) { + PyObject *res; + PyObject *error_type, *error_value, *error_traceback; + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + if (gen->resume_label <= 0) + return ; + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); + res = __Pyx_Generator_Close(self); + if (res == NULL) + PyErr_WriteUnraisable(self); + else + Py_DECREF(res); + __Pyx_ErrRestore(error_type, error_value, error_traceback); +/* Undo the temporary resurrection; can't use DECREF here, it would + * cause a recursive call. + */ + assert(self->ob_refcnt > 0); + if (--self->ob_refcnt == 0) + return; /* this is the normal path out */ +/* close() resurrected it! Make it look like the original Py_DECREF + * never happened. + */ + { + Py_ssize_t refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(self->ob_type) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); +/* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so + * we need to undo that. */ + _Py_DEC_REFTOTAL; +#endif +/* If Py_TRACE_REFS, _Py_NewReference re-added self to the object + * chain, so no more to do there. + * If COUNT_ALLOCS, the original decref bumped tp_frees, and + * _Py_NewReference bumped tp_allocs: both of those need to be + * undone. + */ +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +} +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", +#if PY_VERSION_HEX >= 0x02060000 + T_BOOL, +#else + T_BYTE, +#endif + offsetof(__pyx_GeneratorObject, is_running), + READONLY, + NULL}, + {0, 0, 0, 0, 0} +}; +static PyMethodDef __pyx_Generator_methods[] = { + {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0}, + {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0}, + {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("generator"), /*tp_name*/ + sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ + __pyx_Generator_methods, /*tp_methods*/ + __pyx_Generator_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + __Pyx_Generator_del, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { + __pyx_GeneratorObject *gen = + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); + if (gen == NULL) + return NULL; + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->exc_type = NULL; + gen->exc_value = NULL; + gen->exc_traceback = NULL; + gen->gi_weakreflist = NULL; + PyObject_GC_Track(gen); + return gen; +} +static int __pyx_Generator_init(void) { + __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + if (PyType_Ready(&__pyx_GeneratorType_type)) { + return -1; + } + __pyx_GeneratorType = &__pyx_GeneratorType_type; + return 0; +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ +#endif /* (EV_USE_SIGNALFD && defined(LIBEV_EMBED)) || (!EV_USE_SIGNALFD) */ + +#include "callbacks.c" diff -Nru python-gevent-0.13.7/gevent/gevent.core.h python-gevent-1.0/gevent/gevent.core.h --- python-gevent-0.13.7/gevent/gevent.core.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent.core.h 2013-11-26 16:25:58.000000000 +0000 @@ -0,0 +1,219 @@ +#ifndef __PYX_HAVE__gevent__core +#define __PYX_HAVE__gevent__core + +struct PyGeventLoopObject; +struct PyGeventCallbackObject; +struct PyGeventWatcherObject; +struct PyGeventIOObject; +struct PyGeventTimerObject; +struct PyGeventSignalObject; +struct PyGeventIdleObject; +struct PyGeventPrepareObject; +struct PyGeventForkObject; +struct PyGeventAsyncObject; +struct PyGeventStatObject; + +/* "gevent/core.pyx":229 + * + * + * cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: # <<<<<<<<<<<<<< + * cdef libev.ev_loop* _ptr + * cdef public object error_handler + */ +struct PyGeventLoopObject { + PyObject_HEAD + struct __pyx_vtabstruct_6gevent_4core_loop *__pyx_vtab; + struct ev_loop *_ptr; + PyObject *error_handler; + struct ev_prepare _prepare; + PyObject *_callbacks; + struct ev_timer _timer0; + struct ev_timer _periodic_signal_checker; +}; + +/* "gevent/core.pyx":596 + * + * + * cdef public class callback [object PyGeventCallbackObject, type PyGeventCallback_Type]: # <<<<<<<<<<<<<< + * cdef public object callback + * cdef public tuple args + */ +struct PyGeventCallbackObject { + PyObject_HEAD + PyObject *callback; + PyObject *args; +}; + +/* "gevent/core.pyx":664 + * + * + * cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Type]: # <<<<<<<<<<<<<< + * """Abstract base class for all the watchers""" + * + */ +struct PyGeventWatcherObject { + PyObject_HEAD +}; + +/* "gevent/core.pyx":689 + * + * + * cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventIOObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_io _watcher; +}; + +/* "gevent/core.pyx":874 + * + * + * cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventTimerObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_timer _watcher; +}; + +/* "gevent/core.pyx":1019 + * + * + * cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSignal_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventSignalObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_signal _watcher; +}; + +/* "gevent/core.pyx":1144 + * + * + * cdef public class idle(watcher) [object PyGeventIdleObject, type PyGeventIdle_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventIdleObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_idle _watcher; +}; + +/* "gevent/core.pyx":1263 + * + * + * cdef public class prepare(watcher) [object PyGeventPrepareObject, type PyGeventPrepare_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventPrepareObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_prepare _watcher; +}; + +/* "gevent/core.pyx":1382 + * + * + * cdef public class fork(watcher) [object PyGeventForkObject, type PyGeventFork_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventForkObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_fork _watcher; +}; + +/* "gevent/core.pyx":1501 + * + * + * cdef public class async(watcher) [object PyGeventAsyncObject, type PyGeventAsync_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventAsyncObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_async _watcher; +}; + +/* "gevent/core.pyx":1772 + * + * + * cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Type]: # <<<<<<<<<<<<<< + * + * + */ +struct PyGeventStatObject { + struct PyGeventWatcherObject __pyx_base; + struct PyGeventLoopObject *loop; + PyObject *_callback; + PyObject *args; + int _flags; + struct ev_stat _watcher; + PyObject *path; +}; + +#ifndef __PYX_HAVE_API__gevent__core + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventLoop_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventCallback_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventWatcher_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventIO_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventTimer_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventSignal_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventIdle_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventPrepare_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventFork_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventAsync_Type; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) PyGeventStat_Type; + +__PYX_EXTERN_C DL_IMPORT(PyObject) *GEVENT_CORE_EVENTS; + +#endif /* !__PYX_HAVE_API__gevent__core */ + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcore(void); +#else +PyMODINIT_FUNC PyInit_core(void); +#endif + +#endif /* !__PYX_HAVE__gevent__core */ diff -Nru python-gevent-0.13.7/gevent/gevent._semaphore.c python-gevent-1.0/gevent/gevent._semaphore.c --- python-gevent-0.13.7/gevent/gevent._semaphore.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent._semaphore.c 2013-11-26 16:26:19.000000000 +0000 @@ -0,0 +1,6275 @@ +/* Generated by Cython 0.19 on Tue Nov 26 17:26:18 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__gevent___semaphore +#define __PYX_HAVE_API__gevent___semaphore +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_semaphore.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_defaults; +typedef struct __pyx_defaults __pyx_defaults; +struct __pyx_defaults { + PyObject *__pyx_arg_blocking; +}; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) +#else +#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) { + PyObject *method, *result = NULL; + if (unlikely(!args)) return NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; + result = PyObject_Call(method, args, NULL); + Py_DECREF(method); +bad: + Py_DECREF(args); + return result; +} +#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3)) +#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2)) +#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1)) +#define __Pyx_PyObject_CallMethod0(obj, name) \ + __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple)) + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ + +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; + int flags; + PyObject *func_dict; + PyObject *func_weakreflist; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; /* No-args super() class cell */ + void *defaults; + int defaults_pyobjects; + PyObject *defaults_tuple; /* Const defaults tuple */ + PyObject *defaults_kwdict; /* Const kwonly defaults dict */ + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; /* function annotations dict */ +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, PyObject *module, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __Pyx_CyFunction_init(void); + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *qualname, PyObject *modname); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'gevent._semaphore' */ +#define __Pyx_MODULE_NAME "gevent._semaphore" +int __pyx_module_is_main_gevent___semaphore = 0; + +/* Implementation of 'gevent._semaphore' */ +static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_4locked(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_6release(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_8_start_notify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_10_notify_links(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_12rawlink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_14unlink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_16wait(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_18acquire(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_blocking, PyObject *__pyx_v_timeout); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_20__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_22__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args); /* proto */ +static char __pyx_k_1[] = "semaphore initial value must be >= 0"; +static char __pyx_k_3[] = "<%s counter=%s _links[%s]>"; +static char __pyx_k_4[] = "Expected callable: %r"; +static char __pyx_k_5[] = "Invalid switch into Semaphore.wait(): %r"; +static char __pyx_k_6[] = "Invalid switch into Semaphore.acquire(): %r"; +static char __pyx_k_7[] = "gevent.hub"; +static char __pyx_k_8[] = "gevent.timeout"; +static char __pyx_k_11[] = "/tmp/gevent-make-dist/gevent/gevent/_semaphore.pyx"; +static char __pyx_k_13[] = "Semaphore.__init__"; +static char __pyx_k_14[] = "gevent._semaphore"; +static char __pyx_k_17[] = "Semaphore.__str__"; +static char __pyx_k_20[] = "Semaphore.locked"; +static char __pyx_k_23[] = "Semaphore.release"; +static char __pyx_k_26[] = "Semaphore._start_notify"; +static char __pyx_k_29[] = "Semaphore._notify_links"; +static char __pyx_k_32[] = "Semaphore.rawlink"; +static char __pyx_k_35[] = "Semaphore.unlink"; +static char __pyx_k_39[] = "Semaphore.wait"; +static char __pyx_k_42[] = "Semaphore.acquire"; +static char __pyx_k_45[] = "Semaphore.__enter__"; +static char __pyx_k_48[] = "Semaphore.__exit__"; +static char __pyx_k_49[] = "A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls,\n plus an initial value. The acquire() method blocks if necessary until it can return without making the counter\n negative.\n\n If not given, value defaults to 1.\n\n This Semaphore's __exit__ method does not call the trace function.\n "; +static char __pyx_k__ex[] = "ex"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__args[] = "args"; +static char __pyx_k__link[] = "link"; +static char __pyx_k__loop[] = "loop"; +static char __pyx_k__self[] = "self"; +static char __pyx_k__wait[] = "wait"; +static char __pyx_k__timer[] = "timer"; +static char __pyx_k__value[] = "value"; +static char __pyx_k___dirty[] = "_dirty"; +static char __pyx_k___links[] = "_links"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__cancel[] = "cancel"; +static char __pyx_k__locked[] = "locked"; +static char __pyx_k__object[] = "object"; +static char __pyx_k__params[] = "params"; +static char __pyx_k__remove[] = "remove"; +static char __pyx_k__result[] = "result"; +static char __pyx_k__switch[] = "switch"; +static char __pyx_k__unlink[] = "unlink"; +static char __pyx_k__Timeout[] = "Timeout"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k____str__[] = "__str__"; +static char __pyx_k__acquire[] = "acquire"; +static char __pyx_k__counter[] = "counter"; +static char __pyx_k__get_hub[] = "get_hub"; +static char __pyx_k__rawlink[] = "rawlink"; +static char __pyx_k__release[] = "release"; +static char __pyx_k__timeout[] = "timeout"; +static char __pyx_k____exit__[] = "__exit__"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____name__[] = "__name__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__blocking[] = "blocking"; +static char __pyx_k__callback[] = "callback"; +static char __pyx_k__exc_info[] = "exc_info"; +static char __pyx_k__Semaphore[] = "Semaphore"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k____class__[] = "__class__"; +static char __pyx_k____enter__[] = "__enter__"; +static char __pyx_k___notifier[] = "_notifier"; +static char __pyx_k__start_new[] = "start_new"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k____module__[] = "__module__"; +static char __pyx_k__getcurrent[] = "getcurrent"; +static char __pyx_k____qualname__[] = "__qualname__"; +static char __pyx_k__handle_error[] = "handle_error"; +static char __pyx_k__run_callback[] = "run_callback"; +static char __pyx_k____metaclass__[] = "__metaclass__"; +static char __pyx_k___notify_links[] = "_notify_links"; +static char __pyx_k___start_notify[] = "_start_notify"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_n_s_13; +static PyObject *__pyx_n_s_14; +static PyObject *__pyx_n_s_17; +static PyObject *__pyx_n_s_20; +static PyObject *__pyx_n_s_23; +static PyObject *__pyx_n_s_26; +static PyObject *__pyx_n_s_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_n_s_32; +static PyObject *__pyx_n_s_35; +static PyObject *__pyx_n_s_39; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_n_s_42; +static PyObject *__pyx_n_s_45; +static PyObject *__pyx_n_s_48; +static PyObject *__pyx_kp_s_49; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_n_s_7; +static PyObject *__pyx_n_s_8; +static PyObject *__pyx_n_s__Semaphore; +static PyObject *__pyx_n_s__Timeout; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____enter__; +static PyObject *__pyx_n_s____exit__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____metaclass__; +static PyObject *__pyx_n_s____module__; +static PyObject *__pyx_n_s____name__; +static PyObject *__pyx_n_s____qualname__; +static PyObject *__pyx_n_s____str__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___dirty; +static PyObject *__pyx_n_s___links; +static PyObject *__pyx_n_s___notifier; +static PyObject *__pyx_n_s___notify_links; +static PyObject *__pyx_n_s___start_notify; +static PyObject *__pyx_n_s__acquire; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__args; +static PyObject *__pyx_n_s__blocking; +static PyObject *__pyx_n_s__callback; +static PyObject *__pyx_n_s__cancel; +static PyObject *__pyx_n_s__counter; +static PyObject *__pyx_n_s__ex; +static PyObject *__pyx_n_s__exc_info; +static PyObject *__pyx_n_s__get_hub; +static PyObject *__pyx_n_s__getcurrent; +static PyObject *__pyx_n_s__handle_error; +static PyObject *__pyx_n_s__link; +static PyObject *__pyx_n_s__locked; +static PyObject *__pyx_n_s__loop; +static PyObject *__pyx_n_s__object; +static PyObject *__pyx_n_s__params; +static PyObject *__pyx_n_s__rawlink; +static PyObject *__pyx_n_s__release; +static PyObject *__pyx_n_s__remove; +static PyObject *__pyx_n_s__result; +static PyObject *__pyx_n_s__run_callback; +static PyObject *__pyx_n_s__self; +static PyObject *__pyx_n_s__start_new; +static PyObject *__pyx_n_s__switch; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__timeout; +static PyObject *__pyx_n_s__timer; +static PyObject *__pyx_n_s__unlink; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__wait; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_36; +static PyObject *__pyx_k_tuple_38; +static PyObject *__pyx_k_tuple_40; +static PyObject *__pyx_k_tuple_43; +static PyObject *__pyx_k_tuple_46; +static PyObject *__pyx_k_codeobj_10; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_19; +static PyObject *__pyx_k_codeobj_22; +static PyObject *__pyx_k_codeobj_25; +static PyObject *__pyx_k_codeobj_28; +static PyObject *__pyx_k_codeobj_31; +static PyObject *__pyx_k_codeobj_34; +static PyObject *__pyx_k_codeobj_37; +static PyObject *__pyx_k_codeobj_41; +static PyObject *__pyx_k_codeobj_44; +static PyObject *__pyx_k_codeobj_47; + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_value = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__value,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)((PyObject *)__pyx_int_1)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore___init__(__pyx_self, __pyx_v_self, __pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":19 + * """ + * + * def __init__(self, value=1): # <<<<<<<<<<<<<< + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "gevent/_semaphore.pyx":20 + * + * def __init__(self, value=1): + * if value < 0: # <<<<<<<<<<<<<< + * raise ValueError("semaphore initial value must be >= 0") + * self._links = [] + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "gevent/_semaphore.pyx":21 + * def __init__(self, value=1): + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") # <<<<<<<<<<<<<< + * self._links = [] + * self.counter = value + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/_semaphore.pyx":22 + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") + * self._links = [] # <<<<<<<<<<<<<< + * self.counter = value + * self._notifier = None + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___links, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":23 + * raise ValueError("semaphore initial value must be >= 0") + * self._links = [] + * self.counter = value # <<<<<<<<<<<<<< + * self._notifier = None + * # we don't want to do get_hub() here to allow module-level locks + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__counter, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":24 + * self._links = [] + * self.counter = value + * self._notifier = None # <<<<<<<<<<<<<< + * # we don't want to do get_hub() here to allow module-level locks + * # without initializing the hub + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___notifier, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_3__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_3__str__, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_2__str__(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":28 + * # without initializing the hub + * + * def __str__(self): # <<<<<<<<<<<<<< + * params = (self.__class__.__name__, self.counter, len(self._links)) + * return '<%s counter=%s _links[%s]>' % params + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_params = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "gevent/_semaphore.pyx":29 + * + * def __str__(self): + * params = (self.__class__.__name__, self.counter, len(self._links)) # <<<<<<<<<<<<<< + * return '<%s counter=%s _links[%s]>' % params + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___links); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_v_params = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "gevent/_semaphore.pyx":30 + * def __str__(self): + * params = (self.__class__.__name__, self.counter, len(self._links)) + * return '<%s counter=%s _links[%s]>' % params # <<<<<<<<<<<<<< + * + * def locked(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_v_params)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_5locked(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_5locked = {__Pyx_NAMESTR("locked"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_5locked, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_5locked(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("locked (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_4locked(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":32 + * return '<%s counter=%s _links[%s]>' % params + * + * def locked(self): # <<<<<<<<<<<<<< + * return self.counter <= 0 + * + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_4locked(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("locked", 0); + + /* "gevent/_semaphore.pyx":33 + * + * def locked(self): + * return self.counter <= 0 # <<<<<<<<<<<<<< + * + * def release(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.locked", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_7release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_7release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_7release, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_7release(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("release (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_6release(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":35 + * return self.counter <= 0 + * + * def release(self): # <<<<<<<<<<<<<< + * self.counter += 1 + * self._start_notify() + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_6release(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("release", 0); + + /* "gevent/_semaphore.pyx":36 + * + * def release(self): + * self.counter += 1 # <<<<<<<<<<<<<< + * self._start_notify() + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__counter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":37 + * def release(self): + * self.counter += 1 + * self._start_notify() # <<<<<<<<<<<<<< + * + * def _start_notify(self): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___start_notify); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.release", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_9_start_notify(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_9_start_notify = {__Pyx_NAMESTR("_start_notify"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_9_start_notify, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_9_start_notify(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_start_notify (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_8_start_notify(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":39 + * self._start_notify() + * + * def _start_notify(self): # <<<<<<<<<<<<<< + * if self._links and self.counter > 0 and not self._notifier: + * self._notifier = get_hub().loop.run_callback(self._notify_links) + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_8_start_notify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_start_notify", 0); + + /* "gevent/_semaphore.pyx":40 + * + * def _start_notify(self): + * if self._links and self.counter > 0 and not self._notifier: # <<<<<<<<<<<<<< + * self._notifier = get_hub().loop.run_callback(self._notify_links) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___notifier); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (!__pyx_t_5); + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "gevent/_semaphore.pyx":41 + * def _start_notify(self): + * if self._links and self.counter > 0 and not self._notifier: + * self._notifier = get_hub().loop.run_callback(self._notify_links) # <<<<<<<<<<<<<< + * + * def _notify_links(self): + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__get_hub); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__loop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__run_callback); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___notify_links); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___notifier, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("gevent._semaphore.Semaphore._start_notify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_11_notify_links(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_11_notify_links = {__Pyx_NAMESTR("_notify_links"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_11_notify_links, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_11_notify_links(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_notify_links (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_10_notify_links(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":43 + * self._notifier = get_hub().loop.run_callback(self._notify_links) + * + * def _notify_links(self): # <<<<<<<<<<<<<< + * while True: + * self._dirty = False + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_10_notify_links(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_link = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_notify_links", 0); + + /* "gevent/_semaphore.pyx":44 + * + * def _notify_links(self): + * while True: # <<<<<<<<<<<<<< + * self._dirty = False + * for link in self._links: + */ + while (1) { + if (!1) break; + + /* "gevent/_semaphore.pyx":45 + * def _notify_links(self): + * while True: + * self._dirty = False # <<<<<<<<<<<<<< + * for link in self._links: + * if self.counter <= 0: + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___dirty, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":46 + * while True: + * self._dirty = False + * for link in self._links: # <<<<<<<<<<<<<< + * if self.counter <= 0: + * return + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_1; + __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":47 + * self._dirty = False + * for link in self._links: + * if self.counter <= 0: # <<<<<<<<<<<<<< + * return + * try: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "gevent/_semaphore.pyx":48 + * for link in self._links: + * if self.counter <= 0: + * return # <<<<<<<<<<<<<< + * try: + * link(self) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "gevent/_semaphore.pyx":49 + * if self.counter <= 0: + * return + * try: # <<<<<<<<<<<<<< + * link(self) + * except: + */ + { + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + + /* "gevent/_semaphore.pyx":50 + * return + * try: + * link(self) # <<<<<<<<<<<<<< + * except: + * getcurrent().handle_error((link, self), *sys.exc_info()) + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_1 = PyObject_Call(__pyx_v_link, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L15_try_end; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":51 + * try: + * link(self) + * except: # <<<<<<<<<<<<<< + * getcurrent().handle_error((link, self), *sys.exc_info()) + * if self._dirty: + */ + /*except:*/ { + __Pyx_AddTraceback("gevent._semaphore.Semaphore._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_10); + + /* "gevent/_semaphore.pyx":52 + * link(self) + * except: + * getcurrent().handle_error((link, self), *sys.exc_info()) # <<<<<<<<<<<<<< + * if self._dirty: + * break + */ + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__getcurrent); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__handle_error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_link); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_link); + __Pyx_GIVEREF(__pyx_v_link); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PySequence_Tuple(__pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Add(((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L9_exception_handled; + } + __pyx_L10_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L9_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L15_try_end:; + } + + /* "gevent/_semaphore.pyx":53 + * except: + * getcurrent().handle_error((link, self), *sys.exc_info()) + * if self._dirty: # <<<<<<<<<<<<<< + * break + * if not self._dirty: + */ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___dirty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_6) { + + /* "gevent/_semaphore.pyx":54 + * getcurrent().handle_error((link, self), *sys.exc_info()) + * if self._dirty: + * break # <<<<<<<<<<<<<< + * if not self._dirty: + * return + */ + goto __pyx_L6_break; + goto __pyx_L18; + } + __pyx_L18:; + } + __pyx_L6_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":55 + * if self._dirty: + * break + * if not self._dirty: # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___dirty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_15 = (!__pyx_t_6); + if (__pyx_t_15) { + + /* "gevent/_semaphore.pyx":56 + * break + * if not self._dirty: + * return # <<<<<<<<<<<<<< + * + * def rawlink(self, callback): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L19; + } + __pyx_L19:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("gevent._semaphore.Semaphore._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_link); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_13rawlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6gevent_10_semaphore_9Semaphore_12rawlink[] = "Register a callback to call when a counter is more than zero.\n\n *callback* will be called in the :class:`Hub `, so it must not use blocking gevent API.\n *callback* will be passed one argument: this instance.\n "; +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_13rawlink = {__Pyx_NAMESTR("rawlink"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_13rawlink, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_10_semaphore_9Semaphore_12rawlink)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_13rawlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_callback = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rawlink (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("rawlink", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rawlink") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rawlink", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_12rawlink(__pyx_self, __pyx_v_self, __pyx_v_callback); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":58 + * return + * + * def rawlink(self, callback): # <<<<<<<<<<<<<< + * """Register a callback to call when a counter is more than zero. + * + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_12rawlink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rawlink", 0); + + /* "gevent/_semaphore.pyx":64 + * *callback* will be passed one argument: this instance. + * """ + * if not callable(callback): # <<<<<<<<<<<<<< + * raise TypeError('Expected callable: %r' % (callback, )) + * self._links.append(callback) + */ + __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "gevent/_semaphore.pyx":65 + * """ + * if not callable(callback): + * raise TypeError('Expected callable: %r' % (callback, )) # <<<<<<<<<<<<<< + * self._links.append(callback) + * self._dirty = True + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "gevent/_semaphore.pyx":66 + * if not callable(callback): + * raise TypeError('Expected callable: %r' % (callback, )) + * self._links.append(callback) # <<<<<<<<<<<<<< + * self._dirty = True + * + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___links); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_v_callback); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gevent/_semaphore.pyx":67 + * raise TypeError('Expected callable: %r' % (callback, )) + * self._links.append(callback) + * self._dirty = True # <<<<<<<<<<<<<< + * + * def unlink(self, callback): + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___dirty, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_15unlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6gevent_10_semaphore_9Semaphore_14unlink[] = "Remove the callback set by :meth:`rawlink`"; +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_15unlink = {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_15unlink, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6gevent_10_semaphore_9Semaphore_14unlink)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_15unlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_callback = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unlink (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("unlink", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unlink") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unlink", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_14unlink(__pyx_self, __pyx_v_self, __pyx_v_callback); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":69 + * self._dirty = True + * + * def unlink(self, callback): # <<<<<<<<<<<<<< + * """Remove the callback set by :meth:`rawlink`""" + * try: + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_14unlink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unlink", 0); + + /* "gevent/_semaphore.pyx":71 + * def unlink(self, callback): + * """Remove the callback set by :meth:`rawlink`""" + * try: # <<<<<<<<<<<<<< + * self._links.remove(callback) + * self._dirty = True + */ + { + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "gevent/_semaphore.pyx":72 + * """Remove the callback set by :meth:`rawlink`""" + * try: + * self._links.remove(callback) # <<<<<<<<<<<<<< + * self._dirty = True + * except ValueError: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___links); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__remove); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_callback); + __Pyx_GIVEREF(__pyx_v_callback); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "gevent/_semaphore.pyx":73 + * try: + * self._links.remove(callback) + * self._dirty = True # <<<<<<<<<<<<<< + * except ValueError: + * pass + */ + __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___dirty, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L10_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "gevent/_semaphore.pyx":74 + * self._links.remove(callback) + * self._dirty = True + * except ValueError: # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_7) { + PyErr_Restore(0,0,0); + goto __pyx_L4_exception_handled; + } + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L10_try_end:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_17wait(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_17wait = {__Pyx_NAMESTR("wait"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_17wait, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_17wait(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_timeout = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wait (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__timeout,0}; + PyObject* values[2] = {0,0}; + + /* "gevent/_semaphore.pyx":77 + * pass + * + * def wait(self, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * return self.counter + */ + values[1] = ((PyObject *)((PyObject *)Py_None)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wait") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_timeout = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("wait", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_16wait(__pyx_self, __pyx_v_self, __pyx_v_timeout); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_16wait(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_timeout) { + PyObject *__pyx_v_switch = NULL; + PyObject *__pyx_v_timer = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_ex = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wait", 0); + + /* "gevent/_semaphore.pyx":78 + * + * def wait(self, timeout=None): + * if self.counter > 0: # <<<<<<<<<<<<<< + * return self.counter + * else: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "gevent/_semaphore.pyx":79 + * def wait(self, timeout=None): + * if self.counter > 0: + * return self.counter # <<<<<<<<<<<<<< + * else: + * switch = getcurrent().switch + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "gevent/_semaphore.pyx":81 + * return self.counter + * else: + * switch = getcurrent().switch # <<<<<<<<<<<<<< + * self.rawlink(switch) + * try: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__getcurrent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__switch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_switch = __pyx_t_2; + __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":82 + * else: + * switch = getcurrent().switch + * self.rawlink(switch) # <<<<<<<<<<<<<< + * try: + * timer = Timeout.start_new(timeout) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__rawlink); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_switch); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_switch); + __Pyx_GIVEREF(__pyx_v_switch); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "gevent/_semaphore.pyx":83 + * switch = getcurrent().switch + * self.rawlink(switch) + * try: # <<<<<<<<<<<<<< + * timer = Timeout.start_new(timeout) + * try: + */ + /*try:*/ { + + /* "gevent/_semaphore.pyx":84 + * self.rawlink(switch) + * try: + * timer = Timeout.start_new(timeout) # <<<<<<<<<<<<<< + * try: + * try: + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__Timeout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__start_new); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_timeout); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_timeout); + __Pyx_GIVEREF(__pyx_v_timeout); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_timer = __pyx_t_2; + __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":85 + * try: + * timer = Timeout.start_new(timeout) + * try: # <<<<<<<<<<<<<< + * try: + * result = get_hub().switch() + */ + /*try:*/ { + + /* "gevent/_semaphore.pyx":86 + * timer = Timeout.start_new(timeout) + * try: + * try: # <<<<<<<<<<<<<< + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) + */ + { + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + + /* "gevent/_semaphore.pyx":87 + * try: + * try: + * result = get_hub().switch() # <<<<<<<<<<<<<< + * assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) + * except Timeout: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__get_hub); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__switch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + + /* "gevent/_semaphore.pyx":88 + * try: + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) # <<<<<<<<<<<<<< + * except Timeout: + * ex = sys.exc_info()[1] + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_3 = (__pyx_v_result == __pyx_v_self); + if (unlikely(!__pyx_t_3)) { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_result); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + } + #endif + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L17_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":89 + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) + * except Timeout: # <<<<<<<<<<<<<< + * ex = sys.exc_info()[1] + * if ex is not timer: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__Timeout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("gevent._semaphore.Semaphore.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_1); + + /* "gevent/_semaphore.pyx":90 + * assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) + * except Timeout: + * ex = sys.exc_info()[1] # <<<<<<<<<<<<<< + * if ex is not timer: + * raise + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_ex = __pyx_t_10; + __pyx_t_10 = 0; + + /* "gevent/_semaphore.pyx":91 + * except Timeout: + * ex = sys.exc_info()[1] + * if ex is not timer: # <<<<<<<<<<<<<< + * raise + * finally: + */ + __pyx_t_3 = (__pyx_v_ex != __pyx_v_timer); + if (__pyx_t_3) { + + /* "gevent/_semaphore.pyx":92 + * ex = sys.exc_info()[1] + * if ex is not timer: + * raise # <<<<<<<<<<<<<< + * finally: + * timer.cancel() + */ + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_4, __pyx_t_1); + __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + goto __pyx_L20; + } + __pyx_L20:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L11_exception_handled; + } + __pyx_L12_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L8; + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L17_try_end:; + } + } + + /* "gevent/_semaphore.pyx":94 + * raise + * finally: + * timer.cancel() # <<<<<<<<<<<<<< + * finally: + * self.unlink(switch) + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L9; + __pyx_L8: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L9; + } + __pyx_L9:; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_timer, __pyx_n_s__cancel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L21_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L21_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L22; + __pyx_L21_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L5; + __pyx_L22:; + switch (__pyx_why) { + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L5; + } + } + } + } + + /* "gevent/_semaphore.pyx":96 + * timer.cancel() + * finally: + * self.unlink(switch) # <<<<<<<<<<<<<< + * return self.counter + * + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L6; + __pyx_L5: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L6; + } + __pyx_L6:; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__unlink); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_switch); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_switch); + __Pyx_GIVEREF(__pyx_v_switch); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L24; + __pyx_L23_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L1_error; + __pyx_L24:; + switch (__pyx_why) { + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + } + __pyx_L3:; + + /* "gevent/_semaphore.pyx":97 + * finally: + * self.unlink(switch) + * return self.counter # <<<<<<<<<<<<<< + * + * def acquire(self, blocking=True, timeout=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_switch); + __Pyx_XDECREF(__pyx_v_timer); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":99 + * return self.counter + * + * def acquire(self, blocking=True, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * self.counter -= 1 + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__defaults__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocking); + PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocking); + __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocking); + __Pyx_INCREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_19acquire(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_19acquire = {__Pyx_NAMESTR("acquire"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_19acquire, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_19acquire(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_blocking = 0; + PyObject *__pyx_v_timeout = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("acquire (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__blocking,&__pyx_n_s__timeout,0}; + PyObject* values[3] = {0,0,0}; + __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self); + values[1] = __pyx_dynamic_args->__pyx_arg_blocking; + values[2] = ((PyObject *)((PyObject *)Py_None)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blocking); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acquire") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_blocking = values[1]; + __pyx_v_timeout = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("acquire", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_18acquire(__pyx_self, __pyx_v_self, __pyx_v_blocking, __pyx_v_timeout); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_18acquire(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_blocking, PyObject *__pyx_v_timeout) { + PyObject *__pyx_v_switch = NULL; + PyObject *__pyx_v_timer = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_ex = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("acquire", 0); + + /* "gevent/_semaphore.pyx":100 + * + * def acquire(self, blocking=True, timeout=None): + * if self.counter > 0: # <<<<<<<<<<<<<< + * self.counter -= 1 + * return True + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "gevent/_semaphore.pyx":101 + * def acquire(self, blocking=True, timeout=None): + * if self.counter > 0: + * self.counter -= 1 # <<<<<<<<<<<<<< + * return True + * elif not blocking: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__counter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":102 + * if self.counter > 0: + * self.counter -= 1 + * return True # <<<<<<<<<<<<<< + * elif not blocking: + * return False + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "gevent/_semaphore.pyx":103 + * self.counter -= 1 + * return True + * elif not blocking: # <<<<<<<<<<<<<< + * return False + * else: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_blocking); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "gevent/_semaphore.pyx":104 + * return True + * elif not blocking: + * return False # <<<<<<<<<<<<<< + * else: + * switch = getcurrent().switch + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "gevent/_semaphore.pyx":106 + * return False + * else: + * switch = getcurrent().switch # <<<<<<<<<<<<<< + * self.rawlink(switch) + * try: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__getcurrent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__switch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_switch = __pyx_t_1; + __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":107 + * else: + * switch = getcurrent().switch + * self.rawlink(switch) # <<<<<<<<<<<<<< + * try: + * timer = Timeout.start_new(timeout) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__rawlink); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_switch); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_switch); + __Pyx_GIVEREF(__pyx_v_switch); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "gevent/_semaphore.pyx":108 + * switch = getcurrent().switch + * self.rawlink(switch) + * try: # <<<<<<<<<<<<<< + * timer = Timeout.start_new(timeout) + * try: + */ + /*try:*/ { + + /* "gevent/_semaphore.pyx":109 + * self.rawlink(switch) + * try: + * timer = Timeout.start_new(timeout) # <<<<<<<<<<<<<< + * try: + * try: + */ + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__Timeout); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__start_new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_timeout); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_timeout); + __Pyx_GIVEREF(__pyx_v_timeout); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_timer = __pyx_t_1; + __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":110 + * try: + * timer = Timeout.start_new(timeout) + * try: # <<<<<<<<<<<<<< + * try: + * result = get_hub().switch() + */ + /*try:*/ { + + /* "gevent/_semaphore.pyx":111 + * timer = Timeout.start_new(timeout) + * try: + * try: # <<<<<<<<<<<<<< + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) + */ + { + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { + + /* "gevent/_semaphore.pyx":112 + * try: + * try: + * result = get_hub().switch() # <<<<<<<<<<<<<< + * assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) + * except Timeout: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__get_hub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__switch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + + /* "gevent/_semaphore.pyx":113 + * try: + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) # <<<<<<<<<<<<<< + * except Timeout: + * ex = sys.exc_info()[1] + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_4 = (__pyx_v_result == __pyx_v_self); + if (unlikely(!__pyx_t_4)) { + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_result); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + } + #endif + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L17_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":114 + * result = get_hub().switch() + * assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) + * except Timeout: # <<<<<<<<<<<<<< + * ex = sys.exc_info()[1] + * if ex is timer: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__Timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_9) { + __Pyx_AddTraceback("gevent._semaphore.Semaphore.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_2); + + /* "gevent/_semaphore.pyx":115 + * assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) + * except Timeout: + * ex = sys.exc_info()[1] # <<<<<<<<<<<<<< + * if ex is timer: + * return False + */ + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_ex = __pyx_t_11; + __pyx_t_11 = 0; + + /* "gevent/_semaphore.pyx":116 + * except Timeout: + * ex = sys.exc_info()[1] + * if ex is timer: # <<<<<<<<<<<<<< + * return False + * raise + */ + __pyx_t_4 = (__pyx_v_ex == __pyx_v_timer); + if (__pyx_t_4) { + + /* "gevent/_semaphore.pyx":117 + * ex = sys.exc_info()[1] + * if ex is timer: + * return False # <<<<<<<<<<<<<< + * raise + * finally: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L13_except_return; + goto __pyx_L20; + } + __pyx_L20:; + + /* "gevent/_semaphore.pyx":118 + * if ex is timer: + * return False + * raise # <<<<<<<<<<<<<< + * finally: + * timer.cancel() + */ + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_2); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L11_exception_handled; + } + __pyx_L12_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L8; + __pyx_L13_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L7; + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_L17_try_end:; + } + } + + /* "gevent/_semaphore.pyx":120 + * raise + * finally: + * timer.cancel() # <<<<<<<<<<<<<< + * finally: + * self.unlink(switch) + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L9; + __pyx_L7: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 3; goto __pyx_L9; + __pyx_L8: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L9; + } + __pyx_L9:; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_timer, __pyx_n_s__cancel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L21_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L21_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L22; + __pyx_L21_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L5; + __pyx_L22:; + switch (__pyx_why) { + case 3: goto __pyx_L4; + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L5; + } + } + } + } + + /* "gevent/_semaphore.pyx":122 + * timer.cancel() + * finally: + * self.unlink(switch) # <<<<<<<<<<<<<< + * self.counter -= 1 + * assert self.counter >= 0 + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L6; + __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 3; goto __pyx_L6; + __pyx_L5: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L6; + } + __pyx_L6:; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__unlink); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_switch); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_switch); + __Pyx_GIVEREF(__pyx_v_switch); + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L24; + __pyx_L23_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L1_error; + __pyx_L24:; + switch (__pyx_why) { + case 3: goto __pyx_L0; + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + + /* "gevent/_semaphore.pyx":123 + * finally: + * self.unlink(switch) + * self.counter -= 1 # <<<<<<<<<<<<<< + * assert self.counter >= 0 + * return True + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__counter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":124 + * self.unlink(switch) + * self.counter -= 1 + * assert self.counter >= 0 # <<<<<<<<<<<<<< + * return True + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "gevent/_semaphore.pyx":125 + * self.counter -= 1 + * assert self.counter >= 0 + * return True # <<<<<<<<<<<<<< + * + * def __enter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_switch); + __Pyx_XDECREF(__pyx_v_timer); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_21__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_21__enter__ = {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_21__enter__, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_21__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_20__enter__(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":127 + * return True + * + * def __enter__(self): # <<<<<<<<<<<<<< + * self.acquire() + * + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_20__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "gevent/_semaphore.pyx":128 + * + * def __enter__(self): + * self.acquire() # <<<<<<<<<<<<<< + * + * def __exit__(self, *args): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__acquire); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_23__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_10_semaphore_9Semaphore_23__exit__ = {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_6gevent_10_semaphore_9Semaphore_23__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_10_semaphore_9Semaphore_23__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + CYTHON_UNUSED PyObject *__pyx_v_args = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_10_semaphore_9Semaphore_22__exit__(__pyx_self, __pyx_v_self, __pyx_v_args); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_semaphore.pyx":130 + * self.acquire() + * + * def __exit__(self, *args): # <<<<<<<<<<<<<< + * self.release() + */ + +static PyObject *__pyx_pf_6gevent_10_semaphore_9Semaphore_22__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "gevent/_semaphore.pyx":131 + * + * def __exit__(self, *args): + * self.release() # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("gevent._semaphore.Semaphore.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_semaphore"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_n_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 1}, + {&__pyx_n_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 1}, + {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, + {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, + {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, + {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1}, + {&__pyx_n_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 1}, + {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_n_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 1}, + {&__pyx_n_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 1}, + {&__pyx_n_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 1}, + {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1}, + {&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1}, + {&__pyx_n_s__Semaphore, __pyx_k__Semaphore, sizeof(__pyx_k__Semaphore), 0, 0, 1, 1}, + {&__pyx_n_s__Timeout, __pyx_k__Timeout, sizeof(__pyx_k__Timeout), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1}, + {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1}, + {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1}, + {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, + {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1}, + {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___dirty, __pyx_k___dirty, sizeof(__pyx_k___dirty), 0, 0, 1, 1}, + {&__pyx_n_s___links, __pyx_k___links, sizeof(__pyx_k___links), 0, 0, 1, 1}, + {&__pyx_n_s___notifier, __pyx_k___notifier, sizeof(__pyx_k___notifier), 0, 0, 1, 1}, + {&__pyx_n_s___notify_links, __pyx_k___notify_links, sizeof(__pyx_k___notify_links), 0, 0, 1, 1}, + {&__pyx_n_s___start_notify, __pyx_k___start_notify, sizeof(__pyx_k___start_notify), 0, 0, 1, 1}, + {&__pyx_n_s__acquire, __pyx_k__acquire, sizeof(__pyx_k__acquire), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1}, + {&__pyx_n_s__blocking, __pyx_k__blocking, sizeof(__pyx_k__blocking), 0, 0, 1, 1}, + {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, + {&__pyx_n_s__cancel, __pyx_k__cancel, sizeof(__pyx_k__cancel), 0, 0, 1, 1}, + {&__pyx_n_s__counter, __pyx_k__counter, sizeof(__pyx_k__counter), 0, 0, 1, 1}, + {&__pyx_n_s__ex, __pyx_k__ex, sizeof(__pyx_k__ex), 0, 0, 1, 1}, + {&__pyx_n_s__exc_info, __pyx_k__exc_info, sizeof(__pyx_k__exc_info), 0, 0, 1, 1}, + {&__pyx_n_s__get_hub, __pyx_k__get_hub, sizeof(__pyx_k__get_hub), 0, 0, 1, 1}, + {&__pyx_n_s__getcurrent, __pyx_k__getcurrent, sizeof(__pyx_k__getcurrent), 0, 0, 1, 1}, + {&__pyx_n_s__handle_error, __pyx_k__handle_error, sizeof(__pyx_k__handle_error), 0, 0, 1, 1}, + {&__pyx_n_s__link, __pyx_k__link, sizeof(__pyx_k__link), 0, 0, 1, 1}, + {&__pyx_n_s__locked, __pyx_k__locked, sizeof(__pyx_k__locked), 0, 0, 1, 1}, + {&__pyx_n_s__loop, __pyx_k__loop, sizeof(__pyx_k__loop), 0, 0, 1, 1}, + {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1}, + {&__pyx_n_s__params, __pyx_k__params, sizeof(__pyx_k__params), 0, 0, 1, 1}, + {&__pyx_n_s__rawlink, __pyx_k__rawlink, sizeof(__pyx_k__rawlink), 0, 0, 1, 1}, + {&__pyx_n_s__release, __pyx_k__release, sizeof(__pyx_k__release), 0, 0, 1, 1}, + {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1}, + {&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1}, + {&__pyx_n_s__run_callback, __pyx_k__run_callback, sizeof(__pyx_k__run_callback), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {&__pyx_n_s__start_new, __pyx_k__start_new, sizeof(__pyx_k__start_new), 0, 0, 1, 1}, + {&__pyx_n_s__switch, __pyx_k__switch, sizeof(__pyx_k__switch), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1}, + {&__pyx_n_s__timer, __pyx_k__timer, sizeof(__pyx_k__timer), 0, 0, 1, 1}, + {&__pyx_n_s__unlink, __pyx_k__unlink, sizeof(__pyx_k__unlink), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__wait, __pyx_k__wait, sizeof(__pyx_k__wait), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "gevent/_semaphore.pyx":21 + * def __init__(self, value=1): + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") # <<<<<<<<<<<<<< + * self._links = [] + * self.counter = value + */ + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "gevent/_semaphore.pyx":19 + * """ + * + * def __init__(self, value=1): # <<<<<<<<<<<<<< + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") + */ + __pyx_k_tuple_9 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__value)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_codeobj_10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s____init__, 19, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "gevent/_semaphore.pyx":28 + * # without initializing the hub + * + * def __str__(self): # <<<<<<<<<<<<<< + * params = (self.__class__.__name__, self.counter, len(self._links)) + * return '<%s counter=%s _links[%s]>' % params + */ + __pyx_k_tuple_15 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__params)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s____str__, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":32 + * return '<%s counter=%s _links[%s]>' % params + * + * def locked(self): # <<<<<<<<<<<<<< + * return self.counter <= 0 + * + */ + __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__locked, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":35 + * return self.counter <= 0 + * + * def release(self): # <<<<<<<<<<<<<< + * self.counter += 1 + * self._start_notify() + */ + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__release, 35, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":39 + * self._start_notify() + * + * def _start_notify(self): # <<<<<<<<<<<<<< + * if self._links and self.counter > 0 and not self._notifier: + * self._notifier = get_hub().loop.run_callback(self._notify_links) + */ + __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s___start_notify, 39, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":43 + * self._notifier = get_hub().loop.run_callback(self._notify_links) + * + * def _notify_links(self): # <<<<<<<<<<<<<< + * while True: + * self._dirty = False + */ + __pyx_k_tuple_27 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__link)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_k_codeobj_28 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s___notify_links, 43, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":58 + * return + * + * def rawlink(self, callback): # <<<<<<<<<<<<<< + * """Register a callback to call when a counter is more than zero. + * + */ + __pyx_k_tuple_30 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__callback)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + __pyx_k_codeobj_31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__rawlink, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":69 + * self._dirty = True + * + * def unlink(self, callback): # <<<<<<<<<<<<<< + * """Remove the callback set by :meth:`rawlink`""" + * try: + */ + __pyx_k_tuple_33 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__callback)); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__unlink, 69, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":77 + * pass + * + * def wait(self, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * return self.counter + */ + __pyx_k_tuple_36 = PyTuple_Pack(6, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__timeout), ((PyObject *)__pyx_n_s__switch), ((PyObject *)__pyx_n_s__timer), ((PyObject *)__pyx_n_s__result), ((PyObject *)__pyx_n_s__ex)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_36); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__wait, 77, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_38); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); + + /* "gevent/_semaphore.pyx":99 + * return self.counter + * + * def acquire(self, blocking=True, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * self.counter -= 1 + */ + __pyx_k_tuple_40 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__blocking), ((PyObject *)__pyx_n_s__timeout), ((PyObject *)__pyx_n_s__switch), ((PyObject *)__pyx_n_s__timer), ((PyObject *)__pyx_n_s__result), ((PyObject *)__pyx_n_s__ex)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_40); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + __pyx_k_codeobj_41 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s__acquire, 99, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":127 + * return True + * + * def __enter__(self): # <<<<<<<<<<<<<< + * self.acquire() + * + */ + __pyx_k_tuple_43 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_43); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); + __pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s____enter__, 127, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_semaphore.pyx":130 + * self.acquire() + * + * def __exit__(self, *args): # <<<<<<<<<<<<<< + * self.release() + */ + __pyx_k_tuple_46 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__args), ((PyObject *)__pyx_n_s__args)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_46); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); + __pyx_k_codeobj_47 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_11, __pyx_n_s____exit__, 130, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_semaphore(void); /*proto*/ +PyMODINIT_FUNC init_semaphore(void) +#else +PyMODINIT_FUNC PyInit__semaphore(void); /*proto*/ +PyMODINIT_FUNC PyInit__semaphore(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__semaphore(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_semaphore"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "gevent._semaphore")) { + if (unlikely(PyDict_SetItemString(modules, "gevent._semaphore", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main_gevent___semaphore) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "gevent/_semaphore.pyx":1 + * import sys # <<<<<<<<<<<<<< + * from gevent.hub import get_hub, getcurrent + * from gevent.timeout import Timeout + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":2 + * import sys + * from gevent.hub import get_hub, getcurrent # <<<<<<<<<<<<<< + * from gevent.timeout import Timeout + * + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__get_hub)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__get_hub)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_hub)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__getcurrent)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__getcurrent)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__getcurrent)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_7), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__get_hub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_hub, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__getcurrent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__getcurrent, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":3 + * import sys + * from gevent.hub import get_hub, getcurrent + * from gevent.timeout import Timeout # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Timeout)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__Timeout)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Timeout)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_8), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__Timeout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__Timeout, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":6 + * + * + * __all__ = ['Semaphore'] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Semaphore)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Semaphore)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Semaphore)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":9 + * + * + * class Semaphore(object): # <<<<<<<<<<<<<< + * """A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, + * plus an initial value. The acquire() method blocks if necessary until it can return without making the counter + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "gevent/_semaphore.pyx":19 + * """ + * + * def __init__(self, value=1): # <<<<<<<<<<<<<< + * if value < 0: + * raise ValueError("semaphore initial value must be >= 0") + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_1__init__, 0, __pyx_n_s_13, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_12)); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":28 + * # without initializing the hub + * + * def __str__(self): # <<<<<<<<<<<<<< + * params = (self.__class__.__name__, self.counter, len(self._links)) + * return '<%s counter=%s _links[%s]>' % params + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_3__str__, 0, __pyx_n_s_17, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_16)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":32 + * return '<%s counter=%s _links[%s]>' % params + * + * def locked(self): # <<<<<<<<<<<<<< + * return self.counter <= 0 + * + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_5locked, 0, __pyx_n_s_20, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_19)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__locked, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":35 + * return self.counter <= 0 + * + * def release(self): # <<<<<<<<<<<<<< + * self.counter += 1 + * self._start_notify() + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_7release, 0, __pyx_n_s_23, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_22)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":39 + * self._start_notify() + * + * def _start_notify(self): # <<<<<<<<<<<<<< + * if self._links and self.counter > 0 and not self._notifier: + * self._notifier = get_hub().loop.run_callback(self._notify_links) + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_9_start_notify, 0, __pyx_n_s_26, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_25)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s___start_notify, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":43 + * self._notifier = get_hub().loop.run_callback(self._notify_links) + * + * def _notify_links(self): # <<<<<<<<<<<<<< + * while True: + * self._dirty = False + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_11_notify_links, 0, __pyx_n_s_29, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_28)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s___notify_links, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":58 + * return + * + * def rawlink(self, callback): # <<<<<<<<<<<<<< + * """Register a callback to call when a counter is more than zero. + * + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_13rawlink, 0, __pyx_n_s_32, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_31)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__rawlink, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":69 + * self._dirty = True + * + * def unlink(self, callback): # <<<<<<<<<<<<<< + * """Remove the callback set by :meth:`rawlink`""" + * try: + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_15unlink, 0, __pyx_n_s_35, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_34)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__unlink, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":77 + * pass + * + * def wait(self, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * return self.counter + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_17wait, 0, __pyx_n_s_39, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_37)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_38)); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__wait, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":99 + * return self.counter + * + * def acquire(self, blocking=True, timeout=None): # <<<<<<<<<<<<<< + * if self.counter > 0: + * self.counter -= 1 + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_19acquire, 0, __pyx_n_s_42, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_41)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_blocking = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6gevent_10_semaphore_9Semaphore_24__defaults__); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__acquire, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":127 + * return True + * + * def __enter__(self): # <<<<<<<<<<<<<< + * self.acquire() + * + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_21__enter__, 0, __pyx_n_s_45, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_44)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____enter__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":130 + * self.acquire() + * + * def __exit__(self, *args): # <<<<<<<<<<<<<< + * self.release() + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_10_semaphore_9Semaphore_23__exit__, 0, __pyx_n_s_48, NULL, __pyx_n_s_14, ((PyObject *)__pyx_k_codeobj_47)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____exit__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_semaphore.pyx":9 + * + * + * class Semaphore(object): # <<<<<<<<<<<<<< + * """A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, + * plus an initial value. The acquire() method blocks if necessary until it can return without making the counter + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_builtin_object); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object); + __Pyx_GIVEREF(__pyx_builtin_object); + if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_49)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__Semaphore, __pyx_n_s__Semaphore, __pyx_n_s_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__Semaphore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "gevent/_semaphore.pyx":1 + * import sys # <<<<<<<<<<<<<< + * from gevent.hub import get_hub, getcurrent + * from gevent.timeout import Timeout + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init gevent._semaphore", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init gevent._semaphore"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (DECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } else { + return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x); + } +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) + value = Py_None; /* Mark as deleted */ + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + PyObject* dict = PyModule_GetDict(__pyx_m); + Py_XINCREF(dict); + return dict; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + Py_DECREF(res); + return 0; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */ +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + op->func_weakreflist = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (m->func_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return PyMethod_New(func, + type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +#if CYTHON_COMPILING_IN_PYPY +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + Py_ssize_t size; + switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + case METH_VARARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 0) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 1) + return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +#else +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return PyCFunction_Call(func, arg, kw); +} +#endif +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ + sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __Pyx_CyFunction_Call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/ + (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_CyFunction_methods, /*tp_methods*/ + __pyx_CyFunction_members, /*tp_members*/ + __pyx_CyFunction_getsets, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + __Pyx_CyFunction_descr_get, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static int __Pyx_CyFunction_init(void) { +#if !CYTHON_COMPILING_IN_PYPY + __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; +#endif + if (PyType_Ready(&__pyx_CyFunctionType_type) < 0) + return -1; + __pyx_CyFunctionType = &__pyx_CyFunctionType_type; + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { + PyObject *metaclass; +#if PY_MAJOR_VERSION < 3 + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__); + if (!metaclass) { + PyErr_Clear(); + metaclass = (PyObject*) Py_TYPE(base); + } + } else { + metaclass = (PyObject *) &PyClass_Type; + } +#else + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = (PyObject*) Py_TYPE(base); + } else { + metaclass = (PyObject *) &PyType_Type; + } +#endif + Py_INCREF(metaclass); + return metaclass; +} + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *qualname, PyObject *modname) { + PyObject *result; + PyObject *metaclass; + if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0) + return NULL; + if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0) + return NULL; + metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__); + if (metaclass) { + Py_INCREF(metaclass); + } else { + metaclass = __Pyx_FindPy2Metaclass(bases); + } + result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); + Py_DECREF(metaclass); + return result; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff -Nru python-gevent-0.13.7/gevent/gevent._util.c python-gevent-1.0/gevent/gevent._util.c --- python-gevent-0.13.7/gevent/gevent._util.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/gevent._util.c 2013-11-26 16:26:19.000000000 +0000 @@ -0,0 +1,2224 @@ +/* Generated by Cython 0.19 on Tue Nov 26 17:26:19 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__gevent___util +#define __PYX_HAVE_API__gevent___util +#include "frameobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_util.pyx", +}; + +/*--- Type declarations ---*/ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'gevent.python' */ + +/* Module declarations from 'gevent._util' */ +#define __Pyx_MODULE_NAME "gevent._util" +int __pyx_module_is_main_gevent___util = 0; + +/* Implementation of 'gevent._util' */ +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_pf_6gevent_5_util_SocketAdapter__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_close); /* proto */ +static PyObject *__pyx_pf_6gevent_5_util_2noop(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ +static char __pyx_k_5[] = "SocketAdapter__del__"; +static char __pyx_k_6[] = "/tmp/gevent-make-dist/gevent/gevent/_util.pyx"; +static char __pyx_k_7[] = "gevent._util"; +static char __pyx_k__os[] = "os"; +static char __pyx_k__noop[] = "noop"; +static char __pyx_k__self[] = "self"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__level[] = "level"; +static char __pyx_k___close[] = "_close"; +static char __pyx_k__fileno[] = "fileno"; +static char __pyx_k___fileno[] = "_fileno"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k____import__[] = "__import__"; +static PyObject *__pyx_n_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_n_s_7; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___close; +static PyObject *__pyx_n_s___fileno; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__fileno; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__noop; +static PyObject *__pyx_n_s__os; +static PyObject *__pyx_n_s__self; +static PyObject *__pyx_int_0; +static PyObject *__pyx_k_1; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_codeobj_4; +static PyObject *__pyx_k_codeobj_9; + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_5_util_1SocketAdapter__del__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_5_util_1SocketAdapter__del__ = {__Pyx_NAMESTR("SocketAdapter__del__"), (PyCFunction)__pyx_pw_6gevent_5_util_1SocketAdapter__del__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_5_util_1SocketAdapter__del__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_close = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SocketAdapter__del__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__close,0}; + PyObject* values[2] = {0,0}; + values[1] = __pyx_k_1; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__close); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SocketAdapter__del__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_close = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("SocketAdapter__del__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("gevent._util.SocketAdapter__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gevent_5_util_SocketAdapter__del__(__pyx_self, __pyx_v_self, __pyx_v_close); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_util.pyx":7 + * # We implement __del__s in Cython so that they are safe against signals + * + * def SocketAdapter__del__(self, close=os.close): # <<<<<<<<<<<<<< + * fileno = self._fileno + * if fileno is not None: + */ + +static PyObject *__pyx_pf_6gevent_5_util_SocketAdapter__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_close) { + PyObject *__pyx_v_fileno = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("SocketAdapter__del__", 0); + + /* "gevent/_util.pyx":8 + * + * def SocketAdapter__del__(self, close=os.close): + * fileno = self._fileno # <<<<<<<<<<<<<< + * if fileno is not None: + * self._fileno = None + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_fileno = __pyx_t_1; + __pyx_t_1 = 0; + + /* "gevent/_util.pyx":9 + * def SocketAdapter__del__(self, close=os.close): + * fileno = self._fileno + * if fileno is not None: # <<<<<<<<<<<<<< + * self._fileno = None + * if self._close: + */ + __pyx_t_2 = (__pyx_v_fileno != Py_None); + if (__pyx_t_2) { + + /* "gevent/_util.pyx":10 + * fileno = self._fileno + * if fileno is not None: + * self._fileno = None # <<<<<<<<<<<<<< + * if self._close: + * close(fileno) + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___fileno, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_util.pyx":11 + * if fileno is not None: + * self._fileno = None + * if self._close: # <<<<<<<<<<<<<< + * close(fileno) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "gevent/_util.pyx":12 + * self._fileno = None + * if self._close: + * close(fileno) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_fileno); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fileno); + __Pyx_GIVEREF(__pyx_v_fileno); + __pyx_t_3 = PyObject_Call(__pyx_v_close, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("gevent._util.SocketAdapter__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fileno); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6gevent_5_util_3noop(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6gevent_5_util_3noop = {__Pyx_NAMESTR("noop"), (PyCFunction)__pyx_pw_6gevent_5_util_3noop, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_6gevent_5_util_3noop(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("noop (wrapper)", 0); + __pyx_r = __pyx_pf_6gevent_5_util_2noop(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "gevent/_util.pyx":15 + * + * + * def noop(self): # <<<<<<<<<<<<<< + * pass + */ + +static PyObject *__pyx_pf_6gevent_5_util_2noop(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("noop", 0); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_util"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 1}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___close, __pyx_k___close, sizeof(__pyx_k___close), 0, 0, 1, 1}, + {&__pyx_n_s___fileno, __pyx_k___fileno, sizeof(__pyx_k___fileno), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__noop, __pyx_k__noop, sizeof(__pyx_k__noop), 0, 0, 1, 1}, + {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s____import__); if (!__pyx_builtin___import__) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "gevent/_util.pyx":3 + * from python cimport * + * # Work around lack of absolute_import in Cython. + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * + * # We implement __del__s in Cython so that they are safe against signals + */ + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__os)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "gevent/_util.pyx":7 + * # We implement __del__s in Cython so that they are safe against signals + * + * def SocketAdapter__del__(self, close=os.close): # <<<<<<<<<<<<<< + * fileno = self._fileno + * if fileno is not None: + */ + __pyx_k_tuple_3 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__close), ((PyObject *)__pyx_n_s__fileno)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_3); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + __pyx_k_codeobj_4 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_6, __pyx_n_s_5, 7, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "gevent/_util.pyx":15 + * + * + * def noop(self): # <<<<<<<<<<<<<< + * pass + */ + __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_codeobj_9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_6, __pyx_n_s__noop, 15, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_util(void); /*proto*/ +PyMODINIT_FUNC init_util(void) +#else +PyMODINIT_FUNC PyInit__util(void); /*proto*/ +PyMODINIT_FUNC PyInit__util(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__util(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_util"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "gevent._util")) { + if (unlikely(PyDict_SetItemString(modules, "gevent._util", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main_gevent___util) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "gevent/_util.pyx":3 + * from python cimport * + * # Work around lack of absolute_import in Cython. + * os = __import__('os', level=0) # <<<<<<<<<<<<<< + * + * # We implement __del__s in Cython so that they are safe against signals + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__level), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin___import__, ((PyObject *)__pyx_k_tuple_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gevent/_util.pyx":7 + * # We implement __del__s in Cython so that they are safe against signals + * + * def SocketAdapter__del__(self, close=os.close): # <<<<<<<<<<<<<< + * fileno = self._fileno + * if fileno is not None: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_k_1 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_5_util_1SocketAdapter__del__, NULL, __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_util.pyx":15 + * + * + * def noop(self): # <<<<<<<<<<<<<< + * pass + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gevent_5_util_3noop, NULL, __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__noop, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gevent/_util.pyx":1 + * from python cimport * # <<<<<<<<<<<<<< + * # Work around lack of absolute_import in Cython. + * os = __import__('os', level=0) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init gevent._util", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init gevent._util"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff -Nru python-gevent-0.13.7/gevent/greenlet.py python-gevent-1.0/gevent/greenlet.py --- python-gevent-0.13.7/gevent/greenlet.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/greenlet.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,10 +1,9 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. import sys -import traceback -from gevent import core -from gevent.hub import greenlet, getcurrent, get_hub, GreenletExit, Waiter +from gevent.hub import greenlet, getcurrent, get_hub, GreenletExit, Waiter, PY3, iwait, wait from gevent.timeout import Timeout +from collections import deque __all__ = ['Greenlet', @@ -20,6 +19,8 @@ __slots__ = ['callback'] def __init__(self, callback): + if not callable(callback): + raise TypeError("Expected callable: %r" % (callback, )) self.callback = callback def __call__(self, source): @@ -67,83 +68,38 @@ return SpawnedLink.__call__(self, source) -class GreenletLink(object): - """A wrapper around greenlet that raises a LinkedExited exception when called. - - Can be called only from main loop. - """ - __slots__ = ['greenlet'] - - def __init__(self, greenlet): - self.greenlet = greenlet - - def __call__(self, source): - if source.successful(): - if isinstance(source.value, GreenletExit): - error = LinkedKilled(source) - else: - error = LinkedCompleted(source) - else: - error = LinkedFailed(source) - self.greenlet.throw(error) - - def __hash__(self): - return hash(self.greenlet) - - def __eq__(self, other): - return self.greenlet == getattr(other, 'greenlet', other) - - def __str__(self): - return str(self.greenlet) - - def __repr__(self): - return repr(self.greenlet) - - -class SuccessGreenletLink(GreenletLink): - """A wrapper around greenlet that raises a LinkedExited exception when called - if source has succeed. - - Can be called only from main loop. - """ - __slots__ = [] - - def __call__(self, source): - if source.successful(): - return GreenletLink.__call__(self, source) - - -class FailureGreenletLink(GreenletLink): - """A wrapper around greenlet that raises a LinkedExited exception when called - if source has failed. - - Can be called only from main loop. - """ - __slots__ = [] - - def __call__(self, source): - if not source.successful(): - return GreenletLink.__call__(self, source) - - class Greenlet(greenlet): """A light-weight cooperatively-scheduled execution unit.""" def __init__(self, run=None, *args, **kwargs): - greenlet.__init__(self, parent=get_hub()) + hub = get_hub() + greenlet.__init__(self, parent=hub) if run is not None: self._run = run self.args = args self.kwargs = kwargs - self._links = [] + self._links = deque() self.value = None self._exception = _NONE self._notifier = None self._start_event = None @property + def loop(self): + # needed by killall + return self.parent.loop + + if PY3: + def __bool__(self): + return self._start_event is not None and self._exception is _NONE + else: + def __nonzero__(self): + return self._start_event is not None and self._exception is _NONE + + @property def started(self): - return self._start_event is not None or bool(self) + # DEPRECATED + return bool(self) def ready(self): """Return true if and only if the greenlet has finished execution.""" @@ -202,17 +158,18 @@ a) cancel the event that will start it b) fire the notifications as if an exception was raised in a greenlet """ - if self._start_event is not None: - self._start_event.cancel() - self._start_event = None + if self._start_event is None: + self._start_event = _dummy_event + else: + self._start_event.stop() try: greenlet.throw(self, *args) finally: if self._exception is _NONE and self.dead: - # the greenlet was not started yet, so _report_error was not called, so + # the greenlet was never switched to before and it will never be, _report_error was not called # the result was not set and the links weren't notified. let's do it here. - # checking that self.dead is true is essential, because the exception raised by - # throw() could have been cancelled by the greenlet's function. + # checking that self.dead is true is essential, because throw() does not necessarily kill the greenlet + # (if the exception raised by throw() is caught somewhere inside the greenlet). if len(args) == 1: arg = args[0] #if isinstance(arg, type): @@ -226,13 +183,14 @@ def start(self): """Schedule the greenlet to run in this loop iteration""" - assert not self.started, 'Greenlet already started' - self._start_event = core.active_event(self.switch) + if self._start_event is None: + self._start_event = self.parent.loop.run_callback(self.switch) def start_later(self, seconds): """Schedule the greenlet to run in the future loop iteration *seconds* later""" - assert not self.started, 'Greenlet already started' - self._start_event = core.timer(seconds, self.switch) + if self._start_event is None: + self._start_event = self.parent.loop.timer(seconds) + self._start_event.start(self.switch) @classmethod def spawn(cls, *args, **kwargs): @@ -254,24 +212,6 @@ g.start_later(seconds) return g - @classmethod - def spawn_link(cls, *args, **kwargs): - g = cls.spawn(*args, **kwargs) - g.link() - return g - - @classmethod - def spawn_link_value(cls, *args, **kwargs): - g = cls.spawn(*args, **kwargs) - g.link_value() - return g - - @classmethod - def spawn_link_exception(cls, *args, **kwargs): - g = cls.spawn(*args, **kwargs) - g.link_exception() - return g - def kill(self, exception=GreenletExit, block=True, timeout=None): """Raise the exception in the greenlet. @@ -282,12 +222,15 @@ `Changed in version 0.13.0:` *block* is now ``True`` by default. """ - if self._start_event is not None: - self._start_event.cancel() - self._start_event = None + # XXX this function should not switch out if greenlet is not started but it does + # XXX fix it (will have to override 'dead' property of greenlet.greenlet) + if self._start_event is None: + self._start_event = _dummy_event + else: + self._start_event.stop() if not self.dead: waiter = Waiter() - core.active_event(_kill, self, exception, waiter) + self.parent.loop.run_callback(_kill, self, exception, waiter) if block: waiter.get() self.join(timeout) @@ -348,9 +291,9 @@ assert result is self, 'Invalid switch into Greenlet.join(): %r' % (result, ) finally: t.cancel() - except Timeout, ex: + except Timeout: self.unlink(switch) - if ex is not t: + if sys.exc_info()[1] is not t: raise except: self.unlink(switch) @@ -359,33 +302,27 @@ def _report_result(self, result): self._exception = None self.value = result - if self._links and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + if self._links and not self._notifier: + self._notifier = self.parent.loop.run_callback(self._notify_links) def _report_error(self, exc_info): exception = exc_info[1] if isinstance(exception, GreenletExit): self._report_result(exception) return - try: - traceback.print_exception(*exc_info) - except: - pass self._exception = exception - if self._links and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + if self._links and not self._notifier: + self._notifier = self.parent.loop.run_callback(self._notify_links) - info = str(self) + ' failed with ' - try: - info += self._exception.__class__.__name__ - except Exception: - info += str(self._exception) or repr(self._exception) - sys.stderr.write(info + '\n\n') + self.parent.handle_error(self, *exc_info) def run(self): try: - self._start_event = None + if self._start_event is None: + self._start_event = _dummy_event + else: + self._start_event.stop() try: result = self._run(*self.args, **self.kwargs) except: @@ -405,108 +342,70 @@ if not callable(callback): raise TypeError('Expected callable: %r' % (callback, )) self._links.append(callback) - if self.ready() and self._notifier is None: - self._notifier = core.active_event(self._notify_links) + if self.ready() and self._links and not self._notifier: + self._notifier = self.parent.loop.run_callback(self._notify_links) - def link(self, receiver=None, GreenletLink=GreenletLink, SpawnedLink=SpawnedLink): - """Link greenlet's completion to callable or another greenlet. + def link(self, callback, SpawnedLink=SpawnedLink): + """Link greenlet's completion to a callable. - If *receiver* is a callable then it will be called with this instance as an argument + The *callback* will be called with this instance as an argument once this greenlet's dead. A callable is called in its own greenlet. - - If *receiver* is a greenlet then an :class:`LinkedExited` exception will be - raised in it once this greenlet's dead. - - If *receiver* is ``None``, link to the current greenlet. - - Always asynchronous, unless receiver is a current greenlet and the result is ready. - If this greenlet is already dead, then notification will performed in this loop - iteration as soon as this greenlet switches to the hub. """ - current = getcurrent() - if receiver is None or receiver is current: - receiver = GreenletLink(current) - if self.ready(): - # special case : linking to current greenlet when the result is ready - # raise LinkedExited immediatelly - receiver(self) - return - elif not callable(receiver): - if isinstance(receiver, greenlet): - receiver = GreenletLink(receiver) - else: - raise TypeError('Expected callable or greenlet: %r' % (receiver, )) - else: - receiver = SpawnedLink(receiver) - self.rawlink(receiver) + self.rawlink(SpawnedLink(callback)) - def unlink(self, receiver=None): - """Remove the receiver set by :meth:`link` or :meth:`rawlink`""" - if receiver is None: - receiver = getcurrent() - # discarding greenlets when we have GreenletLink instances in _links works, because - # a GreenletLink instance pretends to be a greenlet, hash-wise and eq-wise + def unlink(self, callback): + """Remove the callback set by :meth:`link` or :meth:`rawlink`""" try: - self._links.remove(receiver) + self._links.remove(callback) except ValueError: pass - def link_value(self, receiver=None, GreenletLink=SuccessGreenletLink, SpawnedLink=SuccessSpawnedLink): - """Like :meth:`link` but *receiver* is only notified when the greenlet has completed successfully""" - self.link(receiver=receiver, GreenletLink=GreenletLink, SpawnedLink=SpawnedLink) - - def link_exception(self, receiver=None, GreenletLink=FailureGreenletLink, SpawnedLink=FailureSpawnedLink): - """Like :meth:`link` but *receiver* is only notified when the greenlet dies because of unhandled exception""" - self.link(receiver=receiver, GreenletLink=GreenletLink, SpawnedLink=SpawnedLink) + def link_value(self, callback, SpawnedLink=SuccessSpawnedLink): + """Like :meth:`link` but *callback* is only notified when the greenlet has completed successfully""" + self.link(callback, SpawnedLink=SpawnedLink) + + def link_exception(self, callback, SpawnedLink=FailureSpawnedLink): + """Like :meth:`link` but *callback* is only notified when the greenlet dies because of unhandled exception""" + self.link(callback, SpawnedLink=SpawnedLink) def _notify_links(self): - try: - while self._links: - link = self._links.pop() - try: - link(self) - except: - traceback.print_exc() - try: - sys.stderr.write('Failed to notify link %s of %r\n\n' % (getfuncname(link), self)) - except: - traceback.print_exc() - finally: - self._notifier = None + while self._links: + link = self._links.popleft() + try: + link(self) + except: + self.parent.handle_error((link, self), *sys.exc_info()) + + +class _dummy_event(object): + + def stop(self): + pass + + +_dummy_event = _dummy_event() def _kill(greenlet, exception, waiter): try: greenlet.throw(exception) except: - traceback.print_exc() + # XXX do we need this here? + greenlet.parent.handle_error(greenlet, *sys.exc_info()) waiter.switch() -def joinall(greenlets, timeout=None, raise_error=False): - from gevent.queue import Queue - queue = Queue() - put = queue.put - timeout = Timeout.start_new(timeout) - try: - try: - for greenlet in greenlets: - greenlet.rawlink(put) - if raise_error: - for _ in xrange(len(greenlets)): - greenlet = queue.get() - if not greenlet.successful(): - raise greenlet.exception - else: - for _ in xrange(len(greenlets)): - queue.get() - except: - for greenlet in greenlets: - greenlet.unlink(put) - if sys.exc_info()[1] is not timeout: - raise - finally: - timeout.cancel() +def joinall(greenlets, timeout=None, raise_error=False, count=None): + if not raise_error: + wait(greenlets, timeout=timeout) + else: + for obj in iwait(greenlets, timeout=timeout): + if getattr(obj, 'exception', None) is not None: + raise obj.exception + if count is not None: + count -= 1 + if count <= 0: + break def _killall3(greenlets, exception, waiter): @@ -516,7 +415,7 @@ try: g.throw(exception) except: - traceback.print_exc() + g.parent.handle_error(g, *sys.exc_info()) if not g.dead: diehards.append(g) waiter.switch(diehards) @@ -528,69 +427,35 @@ try: g.throw(exception) except: - traceback.print_exc() + g.parent.handle_error(g, *sys.exc_info()) def killall(greenlets, exception=GreenletExit, block=True, timeout=None): + if not greenlets: + return + loop = greenlets[0].loop if block: waiter = Waiter() - core.active_event(_killall3, greenlets, exception, waiter) - if block: - t = Timeout.start_new(timeout) - try: - alive = waiter.get() - if alive: - joinall(alive, raise_error=False) - finally: - t.cancel() - else: - core.active_event(_killall, greenlets, exception) - - -class LinkedExited(Exception): - pass - - -class LinkedCompleted(LinkedExited): - """Raised when a linked greenlet finishes the execution cleanly""" - - msg = "%r completed successfully" - - def __init__(self, source): - assert source.ready(), source - assert source.successful(), source - LinkedExited.__init__(self, self.msg % source) - - -class LinkedKilled(LinkedCompleted): - """Raised when a linked greenlet returns GreenletExit instance""" - - msg = "%r returned %s" - - def __init__(self, source): + loop.run_callback(_killall3, greenlets, exception, waiter) + t = Timeout.start_new(timeout) try: - result = source.value.__class__.__name__ - except: - result = str(source) or repr(source) - LinkedExited.__init__(self, self.msg % (source, result)) - - -class LinkedFailed(LinkedExited): - """Raised when a linked greenlet dies because of unhandled exception""" + alive = waiter.get() + if alive: + joinall(alive, raise_error=False) + finally: + t.cancel() + else: + loop.run_callback(_killall, greenlets, exception) - msg = "%r failed with %s" - def __init__(self, source): - exception = source.exception - try: - excname = exception.__class__.__name__ - except: - excname = str(exception) or repr(exception) - LinkedExited.__init__(self, self.msg % (source, excname)) +if PY3: + _meth_self = "__self__" +else: + _meth_self = "im_self" def getfuncname(func): - if not hasattr(func, 'im_self'): + if not hasattr(func, _meth_self): try: funcname = func.__name__ except AttributeError: diff -Nru python-gevent-0.13.7/gevent/httplib.py python-gevent-1.0/gevent/httplib.py --- python-gevent-0.13.7/gevent/httplib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/httplib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -# Copyright (C) 2010-2011 gevent contributors. See LICENSE for details. - -# Get the standard Python httplib as __httplib__, ensuring we get a version -# that hasn't already been modified by monkey patching of any of its members. -# HTTPSConnection must use the standard HTTPConnection because libevent-http -# does not currently support https. -import imp -__httplib__ = imp.load_module('__httplib__', *imp.find_module('httplib')) - -from gevent import core -from gevent.hub import Waiter - -__implements__ = [ - 'HTTPConnection', - 'HTTPResponse', -] - -__imports__ = [ - 'HTTPSConnection', - 'HTTPException', - 'InvalidURL', -] - -__all__ = __implements__ + __imports__ - -InvalidURL = __httplib__.InvalidURL -HTTP_PORT = __httplib__.HTTP_PORT -HTTPException = __httplib__.HTTPException -HTTPSConnection = __httplib__.HTTPSConnection - -EV_METHOD_TYPES = dict((name, id) for (id, name) in core.HTTP_method2name.items()) - - -class RequestFailed(HTTPException): - pass - - -class HTTPMessage(object): - - def __init__(self, headers): - self._headers = headers - self.dict = dict(headers) - - def getheaders(self, name): - name = name.lower() - result = [] - for key, value in self._headers: - if key == name: - result.append(value) - return result - - # emulation of rfc822.Message (base class of httplib.HTTPMessage) - @property - def headers(self): - return [': '.join(item) for item in self._headers] - - # Access as a dictionary (only finds *last* header of each type): - - def __len__(self): - """Get the number of headers in a message.""" - return len(self.dict) - - def __getitem__(self, name): - """Get a specific header, as from a dictionary.""" - return self.dict[name.lower()] - - def get(self, name, default=None): - name = name.lower() - try: - return self.dict[name] - except KeyError: - return default - - def has_key(self, name): - """Determine whether a message contains the named header.""" - return name.lower() in self.dict - - def __contains__(self, name): - """Determine whether a message contains the named header.""" - return name.lower() in self.dict - - def __iter__(self): - return iter(self.dict) - - def keys(self): - """Get all of a message's header field names.""" - return self.dict.keys() - - def values(self): - """Get all of a message's header field values.""" - return self.dict.values() - - def items(self): - return self.dict.items() - - def __str__(self): - return ''.join(self.headers) - - -class HTTPResponse(object): - - def __init__(self, request, debuglevel=0): - self._request = request - self.debuglevel = debuglevel - self.version = request.major * 10 + request.minor - assert self.version, request - self.status = request.response_code - assert self.status, request - self.reason = request.response_code_line - self.headers = request.get_input_headers() - self.msg = HTTPMessage(self.headers) - - if self.debuglevel > 0: - for (k, v) in self.getheaders(): - print 'header:', k, v - - def read(self, amt=-1): - return self._request.input_buffer.read(amt) - - def getheader(self, name, default=None): - return self.msg.get(name, default) - - def getheaders(self): - return self.msg.items() - - def close(self): - self._request = None - - -class HTTPConnection(object): - response_class = HTTPResponse - default_port = HTTP_PORT - debuglevel = 0 - - def __init__(self, host, port=None, timeout=None): - self.timeout = timeout - self._set_hostport(host, port) - self.conn = None - self.resp = None - self._waiter = None - - def _set_hostport(self, host, port): - if port is None: - i = host.rfind(':') - j = host.rfind(']') # ipv6 addresses have [...] - if i > j: - try: - port = int(host[i+1:]) - except ValueError: - raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) - host = host[:i] - else: - port = self.default_port - if host and host[0] == '[' and host[-1] == ']': - host = host[1:-1] - self.host = host - self.port = port - - def set_debuglevel(self, level): - self.debuglevel = level - - def request(self, method, uri, body=None, headers=None): - headers = headers or {} - - self.resp = None - self.putrequest(method, uri) - - for (k, v) in headers.iteritems(): - self.putheader(k, v) - - self.endheaders() - - if hasattr(body, 'read'): - while True: - d = body.read(4096) - if not d: break - self.send(d) - elif body: - self.send(body) - - self.getresponse() - - def getresponse(self): - if self.resp is None: - self.conn.make_request(self.req, self.method, self.uri) - assert self._waiter is None, self._waiter - self._waiter = Waiter() - try: - self.resp = self._waiter.get() - finally: - self._waiter = None - - return self.resp - - def _callback(self, request): - waiter = self._waiter - self._waiter = None - if waiter is not None: - if request.response_code: - waiter.switch(self.response_class(request, debuglevel=self.debuglevel)) - else: - # this seems to be evhttp bug - waiter.throw(RequestFailed) - - def connect(self): - if self.conn: return - - if self.debuglevel > 0: - print 'connect: (%s, %u)' % (self.host, self.port) - - self.conn = core.http_connection.new(self.host, self.port) - - if self.timeout is not None: - self.conn.set_timeout(int(min(1, self.timeout))) - - def close(self): - self.resp = None - self.conn = None - - def putrequest(self, request, selector, skip_host=None, skip_accept_encoding=None): - self.connect() - self.req = core.http_request_client(self._callback) - - if not skip_host: - if self.port == HTTP_PORT: - self.putheader('Host', self.host) - else: - self.putheader('Host', '%s:%u' % (self.host, self.port)) - - if not skip_accept_encoding: - self.putheader('Accept-Encoding', 'identity') - - self.method = EV_METHOD_TYPES[request] - self.uri = selector or '/' - - def putheader(self, header, *args): - self.req.add_output_header(header, '\r\n\t'.join(args)) - - def endheaders(self): - pass - - def send(self, data): - if self.debuglevel > 0: - print 'send:', repr(data) - - self.req.output_buffer.write(data) diff -Nru python-gevent-0.13.7/gevent/http.py python-gevent-1.0/gevent/http.py --- python-gevent-0.13.7/gevent/http.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/http.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. -from gevent import core -from gevent.baseserver import BaseServer - - -__all__ = ['HTTPServer'] - - -class HTTPServer(BaseServer): - """An HTTP server based on libevent-http. - - *handle* is called with one argument: an :class:`gevent.core.http_request` instance. - """ - - default_response_headers = [('Connection', 'close')] - - def __init__(self, listener, handle=None, backlog=None, spawn='default', default_response_headers='default'): - BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn) - self.http = None - if default_response_headers != 'default': - self.default_response_headers = default_response_headers - - def _on_request(self, request): - spawn = self._spawn - if spawn is None: - self.handle(request) - else: - if self.full(): - self._on_full(request) - else: - spawn(self.handle, request) - - def _on_full(self, request): - msg = 'Service Temporarily Unavailable' - request.add_output_header('Connection', 'close') - request.add_output_header('Content-type', 'text/plain') - request.add_output_header('Content-length', str(len(msg))) - request.send_reply(503, 'Service Unavailable', msg) - - def start_accepting(self): - self.http = core.http(self._on_request, self.default_response_headers) - self.http.accept(self.socket.fileno()) - - def stop_accepting(self): - self.http = None diff -Nru python-gevent-0.13.7/gevent/hub.py python-gevent-1.0/gevent/hub.py --- python-gevent-0.13.7/gevent/hub.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/hub.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,9 +1,18 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +from __future__ import absolute_import import sys import os import traceback -from gevent import core + +import greenlet # http://pypi.python.org/pypi/greenlet/ +greenlet_version = getattr(greenlet, '__version__', None) +if greenlet_version: + greenlet_version_info = [int(x) for x in greenlet_version.split('.')] +if not greenlet_version or greenlet_version_info[:3] < [0, 3, 2]: + raise ImportError('''Your version of greenlet (%s) is too old (required >= 0.3.2) + You can get a newer version of greenlet from http://pypi.python.org/pypi/greenlet/''' % (greenlet_version, )) +from greenlet import greenlet, getcurrent, GreenletExit __all__ = ['getcurrent', @@ -12,75 +21,66 @@ 'sleep', 'kill', 'signal', - 'fork', - 'shutdown', + 'reinit', 'get_hub', 'Hub', 'Waiter'] -def __import_py_magic_greenlet(): - try: - from py.magic import greenlet - return greenlet - except ImportError: - pass +PY3 = sys.version_info[0] >= 3 + -try: - greenlet = __import__('greenlet').greenlet -except ImportError: - greenlet = __import_py_magic_greenlet() - if greenlet is None: - raise - -getcurrent = greenlet.getcurrent -GreenletExit = greenlet.GreenletExit -MAIN = greenlet.getcurrent() +if PY3: + string_types = str, + integer_types = int, +else: + string_types = basestring, + integer_types = (int, long) -thread = __import__('thread') + +if sys.version_info[0] <= 2: + import thread +else: + import _thread as thread threadlocal = thread._local _threadlocal = threadlocal() _threadlocal.Hub = None -try: - _original_fork = os.fork -except AttributeError: - _original_fork = None - __all__.remove('fork') - - -def _switch_helper(function, args, kwargs): - # work around the fact that greenlet.switch does not support keyword args - return function(*args, **kwargs) +get_ident = thread.get_ident +MAIN_THREAD = get_ident() def spawn_raw(function, *args, **kwargs): - if kwargs: - g = greenlet(_switch_helper, get_hub()) - core.active_event(g.switch, function, args, kwargs) - return g - else: - g = greenlet(function, get_hub()) - core.active_event(g.switch, *args) - return g + hub = get_hub() + g = greenlet(function, hub) + hub.loop.run_callback(g.switch, *args, **kwargs) + return g -def sleep(seconds=0): +def sleep(seconds=0, ref=True): """Put the current greenlet to sleep for at least *seconds*. *seconds* may be specified as an integer, or a float if fractional seconds - are desired. Calling sleep with *seconds* of 0 is the canonical way of - expressing a cooperative yield. + are desired. + + If *ref* is false, the greenlet running sleep() will not prevent gevent.wait() + from exiting. """ - unique_mark = object() - if not seconds >= 0: - raise IOError(22, 'Invalid argument') - timer = core.timer(seconds, getcurrent().switch, unique_mark) - try: - switch_result = get_hub().switch() - assert switch_result is unique_mark, 'Invalid switch into sleep(): %r' % (switch_result, ) - except: - timer.cancel() - raise + hub = get_hub() + loop = hub.loop + if seconds <= 0: + waiter = Waiter() + loop.run_callback(waiter.switch) + waiter.get() + else: + hub.wait(loop.timer(seconds, ref=ref)) + + +def idle(priority=0): + hub = get_hub() + watcher = hub.loop.idle() + if priority: + watcher.priority = priority + hub.wait(watcher) def kill(greenlet, exception=GreenletExit): @@ -91,131 +91,363 @@ so you have to use this function. """ if not greenlet.dead: - core.active_event(greenlet.throw, exception) + get_hub().loop.run_callback(greenlet.throw, exception) -def _wrap_signal_handler(handler, args, kwargs): - try: - handler(*args, **kwargs) - except: - core.active_event(MAIN.throw, *sys.exc_info()) +class signal(object): + greenlet_class = None -def signal(signalnum, handler, *args, **kwargs): - return core.signal(signalnum, lambda: spawn_raw(_wrap_signal_handler, handler, args, kwargs)) + def __init__(self, signalnum, handler, *args, **kwargs): + self.hub = get_hub() + self.watcher = self.hub.loop.signal(signalnum, ref=False) + self.watcher.start(self._start) + self.handler = handler + self.args = args + self.kwargs = kwargs + if self.greenlet_class is None: + from gevent import Greenlet + self.greenlet_class = Greenlet + def _get_ref(self): + return self.watcher.ref -if _original_fork is not None: + def _set_ref(self, value): + self.watcher.ref = value - def fork(): - result = _original_fork() - if not result: - core.reinit() - return result + ref = property(_get_ref, _set_ref) + del _get_ref, _set_ref + def cancel(self): + self.watcher.stop() -def shutdown(): - """Cancel our CTRL-C handler and wait for core.dispatch() to return.""" - global _threadlocal - hub = _threadlocal.__dict__.get('hub') + def _start(self): + try: + greenlet = self.greenlet_class(self.handle) + greenlet.switch() + except: + self.hub.handle_error(None, *sys._exc_info()) + + def handle(self): + try: + self.handler(*self.args, **self.kwargs) + except: + self.hub.handle_error(None, *sys.exc_info()) + + +def reinit(): + hub = _get_hub() if hub is not None: - hub.shutdown() + hub.loop.reinit() + +def get_hub_class(): + """Return the type of hub to use for the current thread. -def get_hub(): + If there's no type of hub for the current thread yet, 'gevent.hub.Hub' is used. + """ + global _threadlocal + try: + hubtype = _threadlocal.Hub + except AttributeError: + hubtype = None + if hubtype is None: + hubtype = _threadlocal.Hub = Hub + return hubtype + + +def get_hub(*args, **kwargs): + """Return the hub for the current thread. + + If hub does not exists in the current thread, the new one is created with call to :meth:`get_hub_class`. + """ global _threadlocal try: return _threadlocal.hub except AttributeError: - try: - hubtype = _threadlocal.Hub - except AttributeError: - # do not pretend to support multiple threads because it's not implemented properly by core.pyx - # this may change in the future, although currently I don't have a strong need for this - raise NotImplementedError('gevent is only usable from a single thread') - if hubtype is None: - hubtype = Hub - hub = _threadlocal.hub = hubtype() + hubtype = get_hub_class() + hub = _threadlocal.hub = hubtype(*args, **kwargs) return hub +def _get_hub(): + """Return the hub for the current thread. + + Return ``None`` if no hub has been created yet. + """ + global _threadlocal + try: + return _threadlocal.hub + except AttributeError: + pass + + +def set_hub(hub): + _threadlocal.hub = hub + + +def _import(path): + if isinstance(path, list): + if not path: + raise ImportError('Cannot import from empty list: %r' % (path, )) + for item in path[:-1]: + try: + return _import(item) + except ImportError: + pass + return _import(path[-1]) + if not isinstance(path, string_types): + return path + if '.' not in path: + raise ImportError("Cannot import %r (required format: [path/][package.]module.class)" % path) + if '/' in path: + package_path, path = path.rsplit('/', 1) + sys.path = [package_path] + sys.path + else: + package_path = None + try: + module, item = path.rsplit('.', 1) + x = __import__(module) + for attr in path.split('.')[1:]: + oldx = x + x = getattr(x, attr, _NONE) + if x is _NONE: + raise ImportError('Cannot import %r from %r' % (attr, oldx)) + return x + finally: + try: + sys.path.remove(package_path) + except ValueError: + pass + + +def config(default, envvar): + result = os.environ.get(envvar) or default + if isinstance(result, string_types): + return result.split(',') + return result + + +def resolver_config(default, envvar): + result = config(default, envvar) + return [_resolvers.get(x, x) for x in result] + + +_resolvers = {'ares': 'gevent.resolver_ares.Resolver', + 'thread': 'gevent.resolver_thread.Resolver', + 'block': 'gevent.socket.BlockingResolver'} + + class Hub(greenlet): """A greenlet that runs the event loop. It is created automatically by :func:`get_hub`. """ - def __init__(self): + SYSTEM_ERROR = (KeyboardInterrupt, SystemExit, SystemError) + NOT_ERROR = (GreenletExit, SystemExit) + loop_class = config('gevent.core.loop', 'GEVENT_LOOP') + resolver_class = ['gevent.resolver_thread.Resolver', + 'gevent.resolver_ares.Resolver', + 'gevent.socket.BlockingResolver'] + resolver_class = resolver_config(resolver_class, 'GEVENT_RESOLVER') + threadpool_class = config('gevent.threadpool.ThreadPool', 'GEVENT_THREADPOOL') + backend = config(None, 'GEVENT_BACKEND') + format_context = 'pprint.pformat' + threadpool_size = 10 + + def __init__(self, loop=None, default=None): greenlet.__init__(self) - self.keyboard_interrupt_signal = None + if hasattr(loop, 'run'): + if default is not None: + raise TypeError("Unexpected argument: default") + self.loop = loop + else: + if default is None and get_ident() != MAIN_THREAD: + default = False + loop_class = _import(self.loop_class) + if loop is None: + loop = self.backend + self.loop = loop_class(flags=loop, default=default) + self._resolver = None + self._threadpool = None + self.format_context = _import(self.format_context) + + def __repr__(self): + if self.loop is None: + info = 'destroyed' + else: + try: + info = self.loop._format() + except Exception, ex: + info = str(ex) or repr(ex) or 'error' + result = '<%s at 0x%x %s' % (self.__class__.__name__, id(self), info) + if self._resolver is not None: + result += ' resolver=%r' % self._resolver + if self._threadpool is not None: + result += ' threadpool=%r' % self._threadpool + return result + '>' + + def handle_error(self, context, type, value, tb): + if not issubclass(type, self.NOT_ERROR): + self.print_exception(context, type, value, tb) + if context is None or issubclass(type, self.SYSTEM_ERROR): + self.handle_system_error(type, value) + + def handle_system_error(self, type, value): + current = getcurrent() + if current is self or current is self.parent or self.loop is None: + self.parent.throw(type, value) + else: + # in case system error was handled and life goes on + # switch back to this greenlet as well + cb = None + try: + cb = self.loop.run_callback(current.switch) + except: + traceback.print_exc() + try: + self.parent.throw(type, value) + finally: + if cb is not None: + cb.stop() - def switch(self): - cur = getcurrent() - assert cur is not self, 'Cannot switch to MAINLOOP from MAINLOOP' - exc_type, exc_value = sys.exc_info()[:2] - try: - switch_out = getattr(cur, 'switch_out', None) - if switch_out is not None: + def print_exception(self, context, type, value, tb): + traceback.print_exception(type, value, tb) + del tb + if context is not None: + if not isinstance(context, str): try: - switch_out() + context = self.format_context(context) except: traceback.print_exc() - sys.exc_clear() - return greenlet.switch(self) + context = repr(context) + sys.stderr.write('%s failed with %s\n\n' % (context, getattr(type, '__name__', 'exception'), )) + + def switch(self): + switch_out = getattr(getcurrent(), 'switch_out', None) + if switch_out is not None: + switch_out() + return greenlet.switch(self) + + def switch_out(self): + raise AssertionError('Impossible to call blocking function in the event loop callback') + + def wait(self, watcher): + waiter = Waiter() + unique = object() + watcher.start(waiter.switch, unique) + try: + result = waiter.get() + assert result is unique, 'Invalid switch into %s: %r (expected %r)' % (getcurrent(), result, unique) finally: - core.set_exc_info(exc_type, exc_value) + watcher.stop() + + def cancel_wait(self, watcher, error): + if watcher.callback is not None: + self.loop.run_callback(self._cancel_wait, watcher, error) + + def _cancel_wait(self, watcher, error): + if watcher.active: + switch = watcher.callback + if switch is not None: + greenlet = getattr(switch, '__self__', None) + if greenlet is not None: + greenlet.throw(error) def run(self): - global _threadlocal - assert self is getcurrent(), 'Do not call run() directly' - try: - self.keyboard_interrupt_signal = signal(2, core.active_event, MAIN.throw, KeyboardInterrupt) - except IOError: - pass # no signal() on Windows + assert self is getcurrent(), 'Do not call Hub.run() directly' + while True: + loop = self.loop + loop.error_handler = self + try: + loop.run() + finally: + loop.error_handler = None # break the refcount cycle + self.parent.throw(LoopExit('This operation would block forever')) + # this function must never return, as it will cause switch() in the parent greenlet + # to return an unexpected value + # It is still possible to kill this greenlet with throw. However, in that case + # switching to it is no longer safe, as switch will return immediatelly + + def join(self, timeout=None): + """Wait for the event loop to finish. Exits only when there are + no more spawned greenlets, started servers, active timeouts or watchers. + + If *timeout* is provided, wait no longer for the specified number of seconds. + + Returns True if exited because the loop finished execution. + Returns False if exited because of timeout expired. + """ + assert getcurrent() is self.parent, "only possible from the MAIN greenlet" + if self.dead: + return True + + waiter = Waiter() + + if timeout is not None: + timeout = self.loop.timer(timeout, ref=False) + timeout.start(waiter.switch) + try: - loop_count = 0 - while True: - try: - result = core.dispatch() - except IOError, ex: - loop_count += 1 - if loop_count > 15: - MAIN.throw(*sys.exc_info()) - sys.stderr.write('Restarting gevent.core.dispatch() after an error [%s]: %s\n' % (loop_count, ex)) - continue - raise DispatchExit(result) - # this function must never return, as it will cause switch() in MAIN to return an unexpected value + try: + waiter.get() + except LoopExit: + return True finally: - if self.keyboard_interrupt_signal is not None: - self.keyboard_interrupt_signal.cancel() - self.keyboard_interrupt_signal = None - if _threadlocal.__dict__.get('hub') is self: - _threadlocal.__dict__.pop('hub') - - def shutdown(self): - assert getcurrent() is MAIN, "Shutting down is only possible from MAIN greenlet" - if self.keyboard_interrupt_signal is not None: - self.keyboard_interrupt_signal.cancel() - self.keyboard_interrupt_signal = None - core.dns_shutdown() - if not self or self.dead: - if _threadlocal.__dict__.get('hub') is self: - _threadlocal.__dict__.pop('hub') - self.run = None - return - try: - self.switch() - except DispatchExit, ex: - if ex.code == 1: # no more events registered? - return - raise + if timeout is not None: + timeout.stop() + return False + + def destroy(self, destroy_loop=None): + global _threadlocal + if self._resolver is not None: + self._resolver.close() + del self._resolver + if self._threadpool is not None: + self._threadpool.kill() + del self._threadpool + if destroy_loop is None: + destroy_loop = not self.loop.default + if destroy_loop: + self.loop.destroy() + self.loop = None + if getattr(_threadlocal, 'hub', None) is self: + del _threadlocal.hub + + def _get_resolver(self): + if self._resolver is None: + if self.resolver_class is not None: + self.resolver_class = _import(self.resolver_class) + self._resolver = self.resolver_class(hub=self) + return self._resolver + + def _set_resolver(self, value): + self._resolver = value + + def _del_resolver(self): + del self._resolver + + resolver = property(_get_resolver, _set_resolver, _del_resolver) + + def _get_threadpool(self): + if self._threadpool is None: + if self.threadpool_class is not None: + self.threadpool_class = _import(self.threadpool_class) + self._threadpool = self.threadpool_class(self.threadpool_size, hub=self) + return self._threadpool + + def _set_threadpool(self, value): + self._threadpool = value + + def _del_threadpool(self): + del self._threadpool + threadpool = property(_get_threadpool, _set_threadpool, _del_threadpool) -class DispatchExit(Exception): - def __init__(self, code): - self.code = code - Exception.__init__(self, code) +class LoopExit(Exception): + pass class Waiter(object): @@ -232,7 +464,8 @@ The :meth:`get` method must be called from a greenlet other than :class:`Hub`. >>> result = Waiter() - >>> _ = core.timer(0.1, result.switch, 'hello from Waiter') + >>> timer = get_hub().loop.timer(0.1) + >>> timer.start(result.switch, 'hello from Waiter') >>> result.get() # blocks for 0.1 seconds 'hello from Waiter' @@ -240,7 +473,8 @@ :class:`Waiter` stores the value. >>> result = Waiter() - >>> _ = core.timer(0.1, result.switch, 'hi from Waiter') + >>> timer = get_hub().loop.timer(0.1) + >>> timer.start(result.switch, 'hi from Waiter') >>> sleep(0.2) >>> result.get() # returns immediatelly without blocking 'hi from Waiter' @@ -252,9 +486,18 @@ :class:`Event`/:class:`AsyncResult`/:class:`Queue` classes. """ - __slots__ = ['greenlet', 'value', '_exception'] + __slots__ = ['hub', 'greenlet', 'value', '_exception'] + + def __init__(self, hub=None): + if hub is None: + self.hub = get_hub() + else: + self.hub = hub + self.greenlet = None + self.value = None + self._exception = _NONE - def __init__(self): + def clear(self): self.greenlet = None self.value = None self._exception = _NONE @@ -283,29 +526,33 @@ def switch(self, value=None): """Switch to the greenlet if one's available. Otherwise store the value.""" - if self.greenlet is None: + greenlet = self.greenlet + if greenlet is None: self.value = value self._exception = None else: - assert getcurrent() is get_hub(), "Can only use Waiter.switch method from the Hub greenlet" + assert getcurrent() is self.hub, "Can only use Waiter.switch method from the Hub greenlet" + switch = greenlet.switch try: - self.greenlet.switch(value) + switch(value) except: - traceback.print_exc() + self.hub.handle_error(switch, *sys.exc_info()) def switch_args(self, *args): return self.switch(args) def throw(self, *throw_args): """Switch to the greenlet with the exception. If there's no greenlet, store the exception.""" - if self.greenlet is None: + greenlet = self.greenlet + if greenlet is None: self._exception = throw_args else: - assert getcurrent() is get_hub(), "Can only use Waiter.switch method from the Hub greenlet" + assert getcurrent() is self.hub, "Can only use Waiter.switch method from the Hub greenlet" + throw = greenlet.throw try: - self.greenlet.throw(*throw_args) + throw(*throw_args) except: - traceback.print_exc() + self.hub.handle_error(throw, *sys.exc_info()) def get(self): """If a value/an exception is stored, return/raise it. Otherwise until switch() or throw() is called.""" @@ -318,12 +565,10 @@ assert self.greenlet is None, 'This Waiter is already used by %r' % (self.greenlet, ) self.greenlet = getcurrent() try: - return get_hub().switch() + return self.hub.switch() finally: self.greenlet = None - wait = get # XXX backward compatibility; will be removed in the next release - def __call__(self, source): if source.exception is None: self.switch(source.value) @@ -334,6 +579,93 @@ # and unwraps it in wait() thus checking that switch() was indeed called +def iwait(objects, timeout=None): + """Yield objects as they are ready, until all are ready or timeout expired. + + *objects* must be iterable yielding instance implementing wait protocol (rawlink() and unlink()). + """ + # QQQ would be nice to support iterable here that can be generated slowly (why?) + waiter = Waiter() + switch = waiter.switch + if timeout is not None: + timer = get_hub().loop.timer(timeout, priority=-1) + timer.start(waiter.switch, _NONE) + try: + count = len(objects) + for obj in objects: + obj.rawlink(switch) + for _ in xrange(count): + item = waiter.get() + waiter.clear() + if item is _NONE: + return + yield item + finally: + if timeout is not None: + timer.stop() + for obj in objects: + unlink = getattr(obj, 'unlink', None) + if unlink: + try: + unlink(switch) + except: + traceback.print_exc() + + +def wait(objects=None, timeout=None, count=None): + """Wait for *objects* to become ready or for event loop to finish. + + If *objects* is provided, it should be an iterable containg objects implementing wait protocol (rawlink() and + unlink() methods): + + - :class:`gevent.Greenlet` instance + - :class:`gevent.event.Event` instance + - :class:`gevent.lock.Semaphore` instance + - :class:`gevent.subprocess.Popen` instance + + If *objects* is ``None`` (the default), ``wait()`` blocks until all event loops has nothing to do: + + - all greenlets have finished + - all servers were stopped + - all event loop watchers were stopped. + + If *count* is ``None`` (the default), wait for all of *object* to become ready. + + If *count* is a number, wait for *count* object to become ready. (For example, if count is ``1`` then the + function exits when any object in the list is ready). + + If *timeout* is provided, it specifies the maximum number of seconds ``wait()`` will block. + + Returns the list of ready objects, in the order in which they were ready. + """ + if objects is None: + return get_hub().join(timeout=timeout) + result = [] + if count is None: + return list(iwait(objects, timeout)) + for obj in iwait(objects=objects, timeout=timeout): + result.append(obj) + count -= 1 + if count <= 0: + break + return result + + +class linkproxy(object): + __slots__ = ['callback', 'obj'] + + def __init__(self, callback, obj): + self.callback = callback + self.obj = obj + + def __call__(self, *args): + callback = self.callback + obj = self.obj + self.callback = None + self.obj = None + callback(obj) + + class _NONE(object): "A special thingy you must never pass to any of gevent API" __slots__ = [] diff -Nru python-gevent-0.13.7/gevent/__init__.py python-gevent-1.0/gevent/__init__.py --- python-gevent-0.13.7/gevent/__init__.py 2012-04-11 22:26:24.000000000 +0000 +++ python-gevent-1.0/gevent/__init__.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,60 +1,57 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. """ gevent is a coroutine-based Python networking library that uses greenlet -to provide a high-level synchronous API on top of libevent event loop. +to provide a high-level synchronous API on top of libev event loop. See http://www.gevent.org/ for the documentation. """ -version_info = (0, 13, 7) -__version__ = '0.13.7' -__changeset__ = '1744:76188d9922e0' +from __future__ import absolute_import -__all__ = ['Greenlet', +version_info = (1, 0, 0, 'final', 0) +__version__ = '1.0' +__changeset__ = '1.0-0-ga5ae94c' + + +__all__ = ['get_hub', + 'Greenlet', 'GreenletExit', 'spawn', 'spawn_later', - 'spawn_link', - 'spawn_link_value', - 'spawn_link_exception', 'spawn_raw', - 'joinall', + 'iwait', + 'wait', 'killall', 'Timeout', 'with_timeout', 'getcurrent', 'sleep', + 'idle', 'kill', 'signal', 'fork', - 'shutdown', - 'core', 'reinit'] -import sys -if sys.platform == 'win32': - __import__('socket') # trigger WSAStartup call -del sys - - -from gevent import core -core.EV_TIMEOUT = 0x01 -core.EV_READ = 0x02 -core.EV_WRITE = 0x04 -core.EV_SIGNAL = 0x08 -core.EV_PERSIST = 0x10 - -from gevent.core import reinit +from gevent.hub import get_hub, iwait, wait from gevent.greenlet import Greenlet, joinall, killall spawn = Greenlet.spawn spawn_later = Greenlet.spawn_later -spawn_link = Greenlet.spawn_link -spawn_link_value = Greenlet.spawn_link_value -spawn_link_exception = Greenlet.spawn_link_exception from gevent.timeout import Timeout, with_timeout -from gevent.hub import getcurrent, GreenletExit, spawn_raw, sleep, kill, signal, shutdown +from gevent.hub import getcurrent, GreenletExit, spawn_raw, sleep, idle, kill, signal, reinit try: - from gevent.hub import fork + from gevent.os import fork except ImportError: __all__.remove('fork') + + +# the following makes hidden imports visible to freezing tools like +# py2exe. see https://github.com/surfly/gevent/issues/181 +def __dependencies_for_freezing(): + from gevent import core, resolver_thread, resolver_ares, socket,\ + threadpool, thread, threading, select, subprocess + import pprint + import traceback + import signal + +del __dependencies_for_freezing diff -Nru python-gevent-0.13.7/gevent/libevent.h python-gevent-1.0/gevent/libevent.h --- python-gevent-0.13.7/gevent/libevent.h 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/libevent.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. */ - -#ifdef WIN32 -#include "winsock2.h" // for timeval -#endif - -#include "sys/queue.h" - -#include "event.h" - -#if defined(_EVENT_NUMERIC_VERSION) && _EVENT_NUMERIC_VERSION >= 0x2000000 - -#if _EVENT_NUMERIC_VERSION >= 0x02000900 -#define LIBEVENT_HTTP_MODERN -#endif - -#include "event2/event.h" -#include "event2/event_struct.h" -#include "event2/event_compat.h" -#include "event2/http.h" -#include "event2/http_compat.h" -#include "event2/http_struct.h" -#include "event2/buffer.h" -#include "event2/buffer_compat.h" -#include "event2/dns.h" -#include "event2/dns_compat.h" - -#define EVBUFFER_DRAIN evbuffer_drain -#define EVHTTP_SET_CB evhttp_set_cb -#define EVBUFFER_PULLUP(BUF, SIZE) evbuffer_pullup(BUF, SIZE) - -#if _EVENT_NUMERIC_VERSION >= 0x02000500 -#define current_base event_global_current_base_ -#endif - -#else - -#include "evhttp.h" -#include "evdns.h" - -/* compatibility */ - -#define evbuffer_get_length EVBUFFER_LENGTH -#define EVBUFFER_PULLUP(BUF, SIZE) EVBUFFER_DATA(BUF) - -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -/* functions that return int in libeven2 but void in libevent1 */ -#define EVBUFFER_DRAIN(A, B) (evbuffer_drain((A), (B)), 0) -#define EVHTTP_SET_CB(A, B, C, D) (evhttp_set_cb((A), (B), (C), (D)), 0) - -#endif - -#define TAILQ_GET_NEXT(X) TAILQ_NEXT((X), next) - -extern void *current_base; - diff -Nru python-gevent-0.13.7/gevent/libev.h python-gevent-1.0/gevent/libev.h --- python-gevent-0.13.7/gevent/libev.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/libev.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,44 @@ +#if defined(LIBEV_EMBED) +#include "ev.c" +#else +#include "ev.h" + +#ifndef _WIN32 +#include +#endif + +#endif + +#ifndef _WIN32 + +static struct sigaction libev_sigchld; +static int sigchld_state = 0; + +static struct ev_loop* gevent_ev_default_loop(unsigned int flags) +{ + if (sigchld_state) + return ev_default_loop(flags); + struct ev_loop* result; + struct sigaction tmp; + sigaction(SIGCHLD, NULL, &tmp); + result = ev_default_loop(flags); + // XXX what if SIGCHLD received there? + sigaction(SIGCHLD, &tmp, &libev_sigchld); + sigchld_state = 1; + return result; +} + + +static void gevent_install_sigchld_handler(void) { + if (sigchld_state == 1) { + sigaction(SIGCHLD, &libev_sigchld, NULL); + sigchld_state = 2; + } +} + +#else + +#define gevent_ev_default_loop ev_default_loop +static void gevent_install_sigchld_handler(void) { } + +#endif diff -Nru python-gevent-0.13.7/gevent/libev.pxd python-gevent-1.0/gevent/libev.pxd --- python-gevent-0.13.7/gevent/libev.pxd 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/libev.pxd 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,191 @@ +cdef extern from "libev_vfd.h": + long vfd_get(int) + int vfd_open(long) except -1 + void vfd_free(int) + +cdef extern from "libev.h": + int EV_MINPRI + int EV_MAXPRI + + int EV_VERSION_MAJOR + int EV_VERSION_MINOR + + int EV_USE_FLOOR + int EV_USE_CLOCK_SYSCALL + int EV_USE_REALTIME + int EV_USE_MONOTONIC + int EV_USE_NANOSLEEP + int EV_USE_SELECT + int EV_USE_POLL + int EV_USE_EPOLL + int EV_USE_KQUEUE + int EV_USE_PORT + int EV_USE_INOTIFY + int EV_USE_SIGNALFD + int EV_USE_EVENTFD + int EV_USE_4HEAP + int EV_USE_IOCP + int EV_SELECT_IS_WINSOCKET + + int EV_UNDEF + int EV_NONE + int EV_READ + int EV_WRITE + int EV__IOFDSET + int EV_TIMER + int EV_PERIODIC + int EV_SIGNAL + int EV_CHILD + int EV_STAT + int EV_IDLE + int EV_PREPARE + int EV_CHECK + int EV_EMBED + int EV_FORK + int EV_CLEANUP + int EV_ASYNC + int EV_CUSTOM + int EV_ERROR + + int EVFLAG_AUTO + int EVFLAG_NOENV + int EVFLAG_FORKCHECK + int EVFLAG_NOINOTIFY + int EVFLAG_SIGNALFD + int EVFLAG_NOSIGMASK + + int EVBACKEND_SELECT + int EVBACKEND_POLL + int EVBACKEND_EPOLL + int EVBACKEND_KQUEUE + int EVBACKEND_DEVPOLL + int EVBACKEND_PORT + int EVBACKEND_IOCP + int EVBACKEND_ALL + int EVBACKEND_MASK + + int EVRUN_NOWAIT + int EVRUN_ONCE + + int EVBREAK_CANCEL + int EVBREAK_ONE + int EVBREAK_ALL + + struct ev_loop: + int activecnt + int sig_pending + int backend_fd + int sigfd + unsigned int origflags + + struct ev_io: + int fd + int events + + struct ev_timer: + double at + + struct ev_signal: + pass + + struct ev_idle: + pass + + struct ev_prepare: + pass + + struct ev_fork: + pass + + struct ev_async: + pass + + struct ev_child: + int pid + int rpid + int rstatus + + struct stat: + int st_nlink + + struct ev_stat: + stat attr + stat prev + double interval + + int ev_version_major() + int ev_version_minor() + + unsigned int ev_supported_backends() + unsigned int ev_recommended_backends() + unsigned int ev_embeddable_backends() + + double ev_time() + void ev_set_syserr_cb(void *) + + int ev_priority(void*) + void ev_set_priority(void*, int) + + int ev_is_pending(void*) + int ev_is_active(void*) + void ev_io_init(ev_io*, void* callback, int fd, int events) + void ev_io_start(ev_loop*, ev_io*) + void ev_io_stop(ev_loop*, ev_io*) + void ev_feed_event(ev_loop*, void*, int) + + void ev_timer_init(ev_timer*, void* callback, double, double) + void ev_timer_start(ev_loop*, ev_timer*) + void ev_timer_stop(ev_loop*, ev_timer*) + void ev_timer_again(ev_loop*, ev_timer*) + + void ev_signal_init(ev_signal*, void* callback, int) + void ev_signal_start(ev_loop*, ev_signal*) + void ev_signal_stop(ev_loop*, ev_signal*) + + void ev_idle_init(ev_idle*, void* callback) + void ev_idle_start(ev_loop*, ev_idle*) + void ev_idle_stop(ev_loop*, ev_idle*) + + void ev_prepare_init(ev_prepare*, void* callback) + void ev_prepare_start(ev_loop*, ev_prepare*) + void ev_prepare_stop(ev_loop*, ev_prepare*) + + void ev_fork_init(ev_fork*, void* callback) + void ev_fork_start(ev_loop*, ev_fork*) + void ev_fork_stop(ev_loop*, ev_fork*) + + void ev_async_init(ev_async*, void* callback) + void ev_async_start(ev_loop*, ev_async*) + void ev_async_stop(ev_loop*, ev_async*) + void ev_async_send(ev_loop*, ev_async*) + int ev_async_pending(ev_async*) + + void ev_child_init(ev_child*, void* callback, int, int) + void ev_child_start(ev_loop*, ev_child*) + void ev_child_stop(ev_loop*, ev_child*) + + void ev_stat_init(ev_stat*, void* callback, char*, double) + void ev_stat_start(ev_loop*, ev_stat*) + void ev_stat_stop(ev_loop*, ev_stat*) + + ev_loop* ev_default_loop(unsigned int flags) + ev_loop* ev_loop_new(unsigned int flags) + void ev_loop_destroy(ev_loop*) + void ev_loop_fork(ev_loop*) + int ev_is_default_loop(ev_loop*) + unsigned int ev_iteration(ev_loop*) + unsigned int ev_depth(ev_loop*) + unsigned int ev_backend(ev_loop*) + void ev_verify(ev_loop*) + void ev_run(ev_loop*, int flags) nogil + + double ev_now(ev_loop*) + void ev_now_update(ev_loop*) + + void ev_ref(ev_loop*) + void ev_unref(ev_loop*) + void ev_break(ev_loop*, int) + unsigned int ev_pending_count(ev_loop*) + + ev_loop* gevent_ev_default_loop(unsigned int flags) + void gevent_install_sigchld_handler() diff -Nru python-gevent-0.13.7/gevent/libev_vfd.h python-gevent-1.0/gevent/libev_vfd.h --- python-gevent-0.13.7/gevent/libev_vfd.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/libev_vfd.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,209 @@ +#ifdef _WIN32 +#ifdef LIBEV_EMBED +/* + * If libev on win32 is embedded, then we can use an + * arbitrary mapping between integer fds and OS + * handles. Then by defining special macros libev + * will use our functions. + */ + +#define WIN32_LEAN_AND_MEAN +#include +#include + +typedef struct vfd_entry_t +{ + long handle; /* OS handle, i.e. SOCKET */ + int count; /* Reference count, 0 if free */ + int next; /* Next free fd, -1 if last */ +} vfd_entry; + +#define VFD_INCREMENT 128 +static int vfd_num = 0; /* num allocated fds */ +static int vfd_max = 0; /* max allocated fds */ +static int vfd_next = -1; /* next free fd for reuse */ +static PyObject* vfd_map = NULL; /* map OS handle -> virtual fd */ +static vfd_entry* vfd_entries = NULL; /* list of virtual fd entries */ + +#ifdef WITH_THREAD +static CRITICAL_SECTION* volatile vfd_lock = NULL; +static CRITICAL_SECTION* vfd_make_lock() +{ + if (vfd_lock == NULL) { + /* must use malloc and not PyMem_Malloc here */ + CRITICAL_SECTION* lock = malloc(sizeof(CRITICAL_SECTION)); + InitializeCriticalSection(lock); + if (InterlockedCompareExchangePointer(&vfd_lock, lock, NULL) != NULL) { + /* another thread initialized lock first */ + DeleteCriticalSection(lock); + free(lock); + } + } + return vfd_lock; +} +#define VFD_LOCK_ENTER EnterCriticalSection(vfd_make_lock()) +#define VFD_LOCK_LEAVE LeaveCriticalSection(vfd_lock) +#define VFD_GIL_DECLARE PyGILState_STATE ___save +#define VFD_GIL_ENSURE ___save = PyGILState_Ensure() +#define VFD_GIL_RELEASE PyGILState_Release(___save) +#else +#define VFD_LOCK_ENTER +#define VFD_LOCK_LEAVE +#define VFD_GIL_DECLARE +#define VFD_GIL_ENSURE +#define VFD_GIL_RELEASE +#endif + +/* + * Given a virtual fd returns an OS handle or -1 + * This function is speed critical, so it cannot use GIL + */ +static long vfd_get(int fd) +{ + int handle = -1; + VFD_LOCK_ENTER; + if (vfd_entries != NULL && fd >= 0 && fd < vfd_num) + handle = vfd_entries[fd].handle; + VFD_LOCK_LEAVE; + return handle; +} + +#define EV_FD_TO_WIN32_HANDLE(fd) vfd_get((fd)) + +/* + * Given an OS handle finds or allocates a virtual fd + * Returns -1 on failure and sets Python exception if pyexc is non-zero + */ +static int vfd_open_(long handle, int pyexc) +{ + VFD_GIL_DECLARE; + int fd = -1; + unsigned long arg; + PyObject* key = NULL; + PyObject* value; + + if (!pyexc) { + VFD_GIL_ENSURE; + } + if (ioctlsocket(handle, FIONREAD, &arg) != 0) { + if (pyexc) + PyErr_Format(PyExc_IOError, "%ld is not a socket (files are not supported)", handle); + goto done; + } + if (vfd_map == NULL) { + vfd_map = PyDict_New(); + if (vfd_map == NULL) + goto done; + } + key = PyLong_FromLong(handle); + /* check if it's already in the dict */ + value = PyDict_GetItem(vfd_map, key); + if (value != NULL) { + /* is it safe to use PyInt_AS_LONG(value) here? */ + fd = PyInt_AsLong(value); + if (fd >= 0) { + ++vfd_entries[fd].count; + goto done; + } + } + /* use the free entry, if available */ + if (vfd_next >= 0) { + fd = vfd_next; + vfd_next = vfd_entries[fd].next; + VFD_LOCK_ENTER; + goto allocated; + } + /* check if it would be out of bounds */ + if (vfd_num >= FD_SETSIZE) { + /* libev's select doesn't support more that FD_SETSIZE fds */ + if (pyexc) + PyErr_Format(PyExc_IOError, "cannot watch more than %d sockets", (int)FD_SETSIZE); + goto done; + } + /* allocate more space if needed */ + VFD_LOCK_ENTER; + if (vfd_num >= vfd_max) { + int newsize = vfd_max + VFD_INCREMENT; + vfd_entry* entries = PyMem_Realloc(vfd_entries, sizeof(vfd_entry) * newsize); + if (entries == NULL) { + VFD_LOCK_LEAVE; + if (pyexc) + PyErr_NoMemory(); + goto done; + } + vfd_entries = entries; + vfd_max = newsize; + } + fd = vfd_num++; +allocated: + /* vfd_lock must be acquired when entering here */ + vfd_entries[fd].handle = handle; + vfd_entries[fd].count = 1; + VFD_LOCK_LEAVE; + value = PyInt_FromLong(fd); + PyDict_SetItem(vfd_map, key, value); + Py_DECREF(value); +done: + Py_XDECREF(key); + if (!pyexc) { + VFD_GIL_RELEASE; + } + return fd; +} + +#define vfd_open(fd) vfd_open_((fd), 1) +#define EV_WIN32_HANDLE_TO_FD(handle) vfd_open_((handle), 0) + +static void vfd_free_(int fd, int needclose) +{ + VFD_GIL_DECLARE; + PyObject* key; + + if (needclose) { + VFD_GIL_ENSURE; + } + if (fd < 0 || fd >= vfd_num) + goto done; /* out of bounds */ + if (vfd_entries[fd].count <= 0) + goto done; /* free entry, ignore */ + if (!--vfd_entries[fd].count) { + /* fd has just been freed */ + long handle = vfd_entries[fd].handle; + vfd_entries[fd].handle = -1; + vfd_entries[fd].next = vfd_next; + vfd_next = fd; + if (needclose) + closesocket(handle); + /* vfd_map is assumed to be != NULL */ + key = PyLong_FromLong(handle); + PyDict_DelItem(vfd_map, key); + Py_DECREF(key); + } +done: + if (needclose) { + VFD_GIL_RELEASE; + } +} + +#define vfd_free(fd) vfd_free_((fd), 0) +#define EV_WIN32_CLOSE_FD(fd) vfd_free_((fd), 1) + +#else +/* + * If libev on win32 is not embedded in gevent, then + * the only way to map vfds is to use the default of + * using runtime fds in libev. Note that it will leak + * fds, because there's no way of closing them safely + */ +#define vfd_get(fd) _get_osfhandle((fd)) +#define vfd_open(fd) _open_osfhandle((fd), 0) +#define vfd_free(fd) +#endif +#else +/* + * On non-win32 platforms vfd_* are noop macros + */ +#define vfd_get(fd) (fd) +#define vfd_open(fd) ((int)(fd)) +#define vfd_free(fd) +#endif diff -Nru python-gevent-0.13.7/gevent/local.py python-gevent-1.0/gevent/local.py --- python-gevent-0.13.7/gevent/local.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/local.py 2013-11-26 16:25:45.000000000 +0000 @@ -129,7 +129,7 @@ from weakref import WeakKeyDictionary from copy import copy from gevent.hub import getcurrent -from gevent.coros import RLock +from gevent.lock import RLock __all__ = ["local"] diff -Nru python-gevent-0.13.7/gevent/lock.py python-gevent-1.0/gevent/lock.py --- python-gevent-0.13.7/gevent/lock.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/lock.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,118 @@ +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +"""Locking primitives""" + +from gevent.hub import getcurrent +from gevent._semaphore import Semaphore + + +__all__ = ['Semaphore', 'DummySemaphore', 'BoundedSemaphore', 'RLock'] + + +class DummySemaphore(object): + # XXX what is this used for? + """A Semaphore initialized with "infinite" initial value. None of its methods ever block.""" + + def __str__(self): + return '<%s>' % self.__class__.__name__ + + def locked(self): + return False + + def release(self): + pass + + def rawlink(self, callback): + # XXX should still work and notify? + pass + + def unlink(self, callback): + pass + + def wait(self, timeout=None): + pass + + def acquire(self, blocking=True, timeout=None): + pass + + def __enter__(self): + pass + + def __exit__(self, typ, val, tb): + pass + + +class BoundedSemaphore(Semaphore): + """A bounded semaphore checks to make sure its current value doesn't exceed its initial value. + If it does, ``ValueError`` is raised. In most situations semaphores are used to guard resources + with limited capacity. If the semaphore is released too many times it's a sign of a bug. + + If not given, *value* defaults to 1.""" + + def __init__(self, value=1): + Semaphore.__init__(self, value) + self._initial_value = value + + def release(self): + if self.counter >= self._initial_value: + raise ValueError("Semaphore released too many times") + return Semaphore.release(self) + + +class RLock(object): + + def __init__(self): + self._block = Semaphore(1) + self._owner = None + self._count = 0 + + def __repr__(self): + return "<%s at 0x%x _block=%s _count=%r _owner=%r)>" % ( + self.__class__.__name__, + id(self), + self._block, + self._count, + self._owner) + + def acquire(self, blocking=1): + me = getcurrent() + if self._owner is me: + self._count = self._count + 1 + return 1 + rc = self._block.acquire(blocking) + if rc: + self._owner = me + self._count = 1 + return rc + + def __enter__(self): + return self.acquire() + + def release(self): + if self._owner is not getcurrent(): + raise RuntimeError("cannot release un-aquired lock") + self._count = count = self._count - 1 + if not count: + self._owner = None + self._block.release() + + def __exit__(self, typ, value, tb): + self.release() + + # Internal methods used by condition variables + + def _acquire_restore(self, count_owner): + count, owner = count_owner + self._block.acquire() + self._count = count + self._owner = owner + + def _release_save(self): + count = self._count + self._count = 0 + owner = self._owner + self._owner = None + self._block.release() + return (count, owner) + + def _is_owned(self): + return self._owner is getcurrent() diff -Nru python-gevent-0.13.7/gevent/monkey.py python-gevent-1.0/gevent/monkey.py --- python-gevent-0.13.7/gevent/monkey.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/monkey.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,116 +1,119 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. -"""Make the standard library cooperative. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. +"""Make the standard library cooperative.""" +from __future__ import absolute_import +import sys +from sys import version_info -The functions in this module patch parts of the standard library with compatible cooperative counterparts -from :mod:`gevent` package. - -To patch an individual module call the corresponding ``patch_*`` function. For example, to patch -socket module only, call :func:`patch_socket`. To patch all default modules, call ``gevent.monkey.patch_all()``. - -Monkey can also patch thread and threading to become greenlet-based. So :func:`thread.start_new_thread` -starts a new greenlet instead and :class:`threading.local` becomes a greenlet-local storage. - -Monkey patches: - -* :mod:`socket` module -- :func:`patch_socket` - - - :class:`socket` - - :class:`SocketType` - - :func:`socketpair` - - :func:`fromfd` - - :func:`ssl` and :class:`sslerror` - - :func:`socket.getaddrinfo` - - :func:`socket.gethostbyname` - - It is possible to disable dns patching by passing ``dns=False`` to :func:`patch_socket` of :func:`patch_all` - - If ssl is not available (Python < 2.6 without ``ssl`` and ``PyOpenSSL`` packages installed) then :func:`ssl` is removed from the target :mod:`socket` module. - -* :mod:`ssl` module -- :func:`patch_ssl` +__all__ = ['patch_all', + 'patch_socket', + 'patch_ssl', + 'patch_os', + 'patch_time', + 'patch_select', + 'patch_thread', + 'patch_subprocess', + 'patch_sys'] + + +# maps module name -> attribute name -> original item +# e.g. "time" -> "sleep" -> built-in function sleep +saved = {} + + +def _get_original(name, items): + d = saved.get(name, {}) + values = [] + module = None + for item in items: + if item in d: + values.append(d[item]) + else: + if module is None: + module = __import__(name) + values.append(getattr(module, item)) + return values - - :class:`SSLSocket` - - :func:`wrap_socket` - - :func:`get_server_certificate` - - :func:`sslwrap_simple` -* :mod:`os` module -- :func:`patch_os` +def get_original(name, item): + if isinstance(item, basestring): + return _get_original(name, [item])[0] + else: + return _get_original(name, item) - - :func:`fork` -* :mod:`time` module -- :func:`patch_time` +def patch_item(module, attr, newitem): + NONE = object() + olditem = getattr(module, attr, NONE) + if olditem is not NONE: + saved.setdefault(module.__name__, {}).setdefault(attr, olditem) + setattr(module, attr, newitem) - - :func:`time` -* :mod:`select` module -- :func:`patch_select` +def remove_item(module, attr): + NONE = object() + olditem = getattr(module, attr, NONE) + if olditem is NONE: + return + saved.setdefault(module.__name__, {}).setdefault(attr, olditem) + delattr(module, attr) - - :func:`select` - - Removes polling mechanisms that :mod:`gevent.select` does not simulate: poll, epoll, kqueue, kevent -* :mod:`thread` and :mod:`threading` modules -- :func:`patch_thread` - - - Become greenlet-based. - - :func:`get_ident` - - :func:`start_new_thread` - - :class:`LockType` - - :func:`allocate_lock` - - :func:`exit` - - :func:`stack_size` - - thread-local storage becomes greenlet-local storage -""" - -__all__ = ['patch_all', - 'patch_socket', - 'patch_ssl', - 'patch_os', - 'patch_time', - 'patch_select', - 'patch_thread'] +def patch_module(name, items=None): + gevent_module = getattr(__import__('gevent.' + name), name) + module_name = getattr(gevent_module, '__target__', name) + module = __import__(module_name) + if items is None: + items = getattr(gevent_module, '__implements__', None) + if items is None: + raise AttributeError('%r does not have __implements__' % gevent_module) + for attr in items: + patch_item(module, attr, getattr(gevent_module, attr)) + + +def _patch_sys_std(name): + from gevent.fileobject import FileObjectThread + orig = getattr(sys, name) + if not isinstance(orig, FileObjectThread): + patch_item(sys, name, FileObjectThread(orig)) + + +def patch_sys(stdin=True, stdout=True, stderr=True): + if stdin: + _patch_sys_std('stdin') + if stdout: + _patch_sys_std('stdout') + if stderr: + _patch_sys_std('stderr') def patch_os(): - """Replace :func:`os.fork` with :func:`gevent.fork`.""" - try: - from gevent.hub import fork - except ImportError: - return - import os - os.fork = fork + """Replace :func:`os.fork` with :func:`gevent.fork`. Does nothing if fork is not available.""" + patch_module('os') def patch_time(): """Replace :func:`time.sleep` with :func:`gevent.sleep`.""" from gevent.hub import sleep - _time = __import__('time') - _time.sleep = sleep + import time + patch_item(time, 'sleep', sleep) -def patch_thread(threading=True, _threading_local=True): +def patch_thread(threading=True, _threading_local=True, Event=False): """Replace the standard :mod:`thread` module to make it greenlet-based. - If *threading* is true (the default), also patch ``threading.local``. + If *threading* is true (the default), also patch ``threading``. If *_threading_local* is true (the default), also patch ``_threading_local.local``. """ - from gevent import thread as green_thread - thread = __import__('thread') - if thread.exit is not green_thread.exit: - thread.get_ident = green_thread.get_ident - thread.start_new_thread = green_thread.start_new_thread - thread.LockType = green_thread.LockType - thread.allocate_lock = green_thread.allocate_lock - thread.exit = green_thread.exit - if hasattr(green_thread, 'stack_size'): - thread.stack_size = green_thread.stack_size + patch_module('thread') + if threading: + patch_module('threading') + threading = __import__('threading') + if Event: + from gevent.event import Event + threading.Event = Event + if _threading_local: + _threading_local = __import__('_threading_local') from gevent.local import local - thread._local = local - if threading: - threading = __import__('threading') - threading.local = local - threading._start_new_thread = green_thread.start_new_thread - threading._allocate_lock = green_thread.allocate_lock - threading.Lock = green_thread.allocate_lock - threading._get_ident = green_thread.get_ident - from gevent.hub import sleep - threading._sleep = sleep - if _threading_local: - _threading_local = __import__('_threading_local') - _threading_local.local = local + _threading_local.local = local def patch_socket(dns=True, aggressive=True): @@ -119,74 +122,53 @@ If *dns* is true, also patch dns functions in :mod:`socket`. """ from gevent import socket - _socket = __import__('socket') - _socket.socket = socket.socket - _socket.SocketType = socket.SocketType - _socket.create_connection = socket.create_connection - if hasattr(socket, 'socketpair'): - _socket.socketpair = socket.socketpair - if hasattr(socket, 'fromfd'): - _socket.fromfd = socket.fromfd - try: - from gevent.socket import ssl, sslerror - _socket.ssl = ssl - _socket.sslerror = sslerror - except ImportError: - if aggressive: - try: - del _socket.ssl - except AttributeError: - pass + # Note: although it seems like it's not strictly necessary to monkey patch 'create_connection', + # it's better to do it. If 'create_connection' was not monkey patched, but the rest of socket module + # was, create_connection would still use "green" getaddrinfo and "green" socket. + # However, because gevent.socket.socket.connect is a Python function, the exception raised by it causes + # _socket object to be referenced by the frame, thus causing the next invocation of bind(source_address) to fail. if dns: - patch_dns() + items = socket.__implements__ + else: + items = set(socket.__implements__) - set(socket.__dns__) + patch_module('socket', items=items) + if aggressive: + if 'ssl' not in socket.__implements__: + remove_item(socket, 'ssl') def patch_dns(): - from gevent.socket import gethostbyname, getaddrinfo - _socket = __import__('socket') - _socket.getaddrinfo = getaddrinfo - _socket.gethostbyname = gethostbyname + from gevent import socket + patch_module('socket', items=socket.__dns__) def patch_ssl(): - try: - _ssl = __import__('ssl') - except ImportError: - return - from gevent.ssl import SSLSocket, wrap_socket, get_server_certificate, sslwrap_simple - _ssl.SSLSocket = SSLSocket - _ssl.wrap_socket = wrap_socket - _ssl.get_server_certificate = get_server_certificate - _ssl.sslwrap_simple = sslwrap_simple + patch_module('ssl') -def patch_select(aggressive=False): +def patch_select(aggressive=True): """Replace :func:`select.select` with :func:`gevent.select.select`. If aggressive is true (the default), also remove other blocking functions the :mod:`select`. """ - from gevent.select import select - _select = __import__('select') - globals()['_select_select'] = _select.select - _select.select = select + patch_module('select') if aggressive: - # since these are blocking and don't work with the libevent's event loop - # we're removing them here. This makes some other modules (e.g. asyncore) - # non-blocking, as they use select that we provide when none of these are available. - _select.__dict__.pop('poll', None) - _select.__dict__.pop('epoll', None) - _select.__dict__.pop('kqueue', None) - _select.__dict__.pop('kevent', None) - - -def patch_httplib(): - httplib = __import__('httplib') - from gevent.httplib import HTTPConnection, HTTPSConnection - httplib.HTTPConnection = HTTPConnection - httplib.HTTPSConnection = HTTPSConnection + select = __import__('select') + # since these are blocking we're removing them here. This makes some other + # modules (e.g. asyncore) non-blocking, as they use select that we provide + # when none of these are available. + remove_item(select, 'poll') + remove_item(select, 'epoll') + remove_item(select, 'kqueue') + remove_item(select, 'kevent') -def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, aggressive=True): +def patch_subprocess(): + patch_module('subprocess') + + +def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, + subprocess=False, sys=False, aggressive=True, Event=False): """Do all of the default monkey patching (calls every other function in this module.""" # order is important if os: @@ -194,20 +176,33 @@ if time: patch_time() if thread: - patch_thread() + patch_thread(Event=Event) + # sys must be patched after thread. in other cases threading._shutdown will be + # initiated to _MainThread with real thread ident + if sys: + patch_sys() if socket: patch_socket(dns=dns, aggressive=aggressive) if select: patch_select(aggressive=aggressive) if ssl: - patch_ssl() + if version_info[:2] > (2, 5): + patch_ssl() + else: + try: + patch_ssl() + except ImportError: + pass # in Python 2.5, 'ssl' is a standalone package not included in stdlib if httplib: - patch_httplib() + raise ValueError('gevent.httplib is no longer provided, httplib must be False') + if subprocess: + patch_subprocess() if __name__ == '__main__': - import sys - modules = [x.replace('patch_', '') for x in globals().keys() if x.startswith('patch_') and x != 'patch_all'] + from inspect import getargspec + patch_all_args = getargspec(patch_all)[0] + modules = [x for x in patch_all_args if 'patch_' + x in globals()] script_help = """gevent.monkey - monkey patch the standard modules to use gevent. USAGE: python -m gevent.monkey [MONKEY OPTIONS] script [SCRIPT OPTIONS] @@ -225,10 +220,13 @@ option = argv[0][2:] if option == 'verbose': verbose = True - elif option.startswith('no-') and option.replace('no-', '') in modules: + elif option.startswith('no-') and option.replace('no-', '') in patch_all_args: args[option[3:]] = False - elif option not in modules: + elif option in patch_all_args: args[option] = True + if option in modules: + for module in modules: + args.setdefault(module, False) else: sys.exit(script_help + '\n\n' + 'Cannot patch %r' % option) del argv[0] @@ -236,16 +234,17 @@ if verbose: import pprint import os - print 'gevent.monkey.patch_all(%s)' % ', '.join('%s=%s' % item for item in args.items()) - print 'sys.version=%s' % (sys.version.strip().replace('\n', ' '), ) - print 'sys.path=%s' % pprint.pformat(sys.path) - print 'sys.modules=%s' % pprint.pformat(sorted(sys.modules.keys())) - print 'cwd=%s' % os.getcwd() + print ('gevent.monkey.patch_all(%s)' % ', '.join('%s=%s' % item for item in args.items())) + print ('sys.version=%s' % (sys.version.strip().replace('\n', ' '), )) + print ('sys.path=%s' % pprint.pformat(sys.path)) + print ('sys.modules=%s' % pprint.pformat(sorted(sys.modules.keys()))) + print ('cwd=%s' % os.getcwd()) patch_all(**args) if argv: sys.argv = argv __package__ = None + globals()['__file__'] = sys.argv[0] # issue #302 execfile(sys.argv[0]) else: - print script_help + print (script_help) diff -Nru python-gevent-0.13.7/gevent/os.py python-gevent-1.0/gevent/os.py --- python-gevent-0.13.7/gevent/os.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/os.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,106 @@ +""" +This module provides cooperative versions of os.read() and os.write(). +On Posix platforms this uses non-blocking IO, on Windows a threadpool +is used. +""" + +from __future__ import absolute_import + +import os +import sys +from gevent.hub import get_hub, reinit +from gevent.socket import EAGAIN +import errno + +try: + import fcntl +except ImportError: + fcntl = None + +__implements__ = ['fork'] +__extensions__ = ['tp_read', 'tp_write'] + +_read = os.read +_write = os.write + + +ignored_errors = [EAGAIN, errno.EINTR] + + +if fcntl: + + __extensions__ += ['make_nonblocking', 'nb_read', 'nb_write'] + + def make_nonblocking(fd): + flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) + if not bool(flags & os.O_NONBLOCK): + fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) + return True + + def nb_read(fd, n): + """Read up to `n` bytes from file descriptor `fd`. Return a string + containing the bytes read. If end-of-file is reached, an empty string + is returned. + + The descriptor must be in non-blocking mode. + """ + hub, event = None, None + while True: + try: + return _read(fd, n) + except OSError, e: + if e.errno not in ignored_errors: + raise + sys.exc_clear() + if hub is None: + hub = get_hub() + event = hub.loop.io(fd, 1) + hub.wait(event) + + def nb_write(fd, buf): + """Write bytes from buffer `buf` to file descriptor `fd`. Return the + number of bytes written. + + The file descriptor must be in non-blocking mode. + """ + hub, event = None, None + while True: + try: + return _write(fd, buf) + except OSError, e: + if e.errno not in ignored_errors: + raise + sys.exc_clear() + if hub is None: + hub = get_hub() + event = hub.loop.io(fd, 2) + hub.wait(event) + + +def tp_read(fd, n): + """Read up to `n` bytes from file descriptor `fd`. Return a string + containing the bytes read. If end-of-file is reached, an empty string + is returned.""" + return get_hub().threadpool.apply_e(BaseException, _read, (fd, n)) + + +def tp_write(fd, buf): + """Write bytes from buffer `buf` to file descriptor `fd`. Return the + number of bytes written.""" + return get_hub().threadpool.apply_e(BaseException, _write, (fd, buf)) + + +if hasattr(os, 'fork'): + _fork = os.fork + + def fork(): + result = _fork() + if not result: + reinit() + return result + +else: + __implements__.remove('fork') + + +__all__ = __implements__ + __extensions__ diff -Nru python-gevent-0.13.7/gevent/pool.py python-gevent-1.0/gevent/pool.py --- python-gevent-0.13.7/gevent/pool.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/pool.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2011 Denis Bilenko. See LICENSE for details. """Managing greenlets in a group. The :class:`Group` class in this module abstracts a group of running greenlets. @@ -9,11 +9,14 @@ greenlets in the pool has already reached the limit, until there is a free slot. """ -from gevent.hub import GreenletExit, getcurrent +import sys +from bisect import insort_right + +from gevent.hub import GreenletExit, getcurrent, kill as _kill, PY3 from gevent.greenlet import joinall, Greenlet from gevent.timeout import Timeout from gevent.event import Event -from gevent.coros import Semaphore, DummySemaphore +from gevent.lock import Semaphore, DummySemaphore __all__ = ['Group', 'Pool'] @@ -30,18 +33,14 @@ self.greenlets = set(*args) if args: for greenlet in args[0]: - greenlet.rawlink(self.discard) + greenlet.rawlink(self._discard) # each item we kill we place in dying, to avoid killing the same greenlet twice self.dying = set() self._empty_event = Event() self._empty_event.set() def __repr__(self): - try: - classname = self.__class__.__name__ - except AttributeError: - classname = 'Group' # XXX check if 2.4 really uses this line - return '<%s at %s %s>' % (classname, hex(id(self)), self.greenlets) + return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), self.greenlets) def __len__(self): return len(self.greenlets) @@ -53,39 +52,37 @@ return iter(self.greenlets) def add(self, greenlet): - greenlet.rawlink(self.discard) + try: + rawlink = greenlet.rawlink + except AttributeError: + pass # non-Greenlet greenlet, like MAIN + else: + rawlink(self._discard) self.greenlets.add(greenlet) self._empty_event.clear() - def discard(self, greenlet): + def _discard(self, greenlet): self.greenlets.discard(greenlet) self.dying.discard(greenlet) if not self.greenlets: self._empty_event.set() + def discard(self, greenlet): + self._discard(greenlet) + try: + unlink = greenlet.unlink + except AttributeError: + pass # non-Greenlet greenlet, like MAIN + else: + unlink(self._discard) + def start(self, greenlet): self.add(greenlet) greenlet.start() def spawn(self, *args, **kwargs): - add = self.add - greenlet = self.greenlet_class.spawn(*args, **kwargs) - add(greenlet) - return greenlet - - def spawn_link(self, *args, **kwargs): - greenlet = self.spawn(*args, **kwargs) - greenlet.link() - return greenlet - - def spawn_link_value(self, *args, **kwargs): - greenlet = self.spawn(*args, **kwargs) - greenlet.link_value() - return greenlet - - def spawn_link_exception(self, *args, **kwargs): - greenlet = self.spawn(*args, **kwargs) - greenlet.link_exception() + greenlet = self.greenlet_class(*args, **kwargs) + self.start(greenlet) return greenlet # def close(self): @@ -109,12 +106,18 @@ while self.greenlets: for greenlet in list(self.greenlets): if greenlet not in self.dying: - greenlet.kill(exception, block=False) + try: + kill = greenlet.kill + except AttributeError: + _kill(greenlet, exception) + else: + kill(exception, block=False) self.dying.add(greenlet) if not block: break joinall(self.greenlets) - except Timeout, ex: + except Timeout: + ex = sys.exc_info()[1] if ex is not timer: raise finally: @@ -163,8 +166,7 @@ return greenlet def map(self, func, iterable): - greenlets = [self.spawn(func, item) for item in iterable] - return [greenlet.get() for greenlet in greenlets] + return list(self.imap(func, iterable)) def map_cb(self, func, iterable, callback=None): result = self.map(func, iterable) @@ -182,16 +184,13 @@ return Greenlet.spawn(self.map_cb, func, iterable, callback) def imap(self, func, iterable): - """An equivalent of itertools.imap() - - **TODO**: Fix this. - """ - return iter(self.map(func, iterable)) + """An equivalent of itertools.imap()""" + return IMap.spawn(func, iterable, spawn=self.spawn) def imap_unordered(self, func, iterable): """The same as imap() except that the ordering of the results from the returned iterator should be considered in arbitrary order.""" - return IMapUnordered.spawn(self.spawn, func, iterable) + return IMapUnordered.spawn(func, iterable, spawn=self.spawn) def full(self): return False @@ -202,24 +201,40 @@ class IMapUnordered(Greenlet): - def __init__(self, spawn, func, iterable): + def __init__(self, func, iterable, spawn=None): from gevent.queue import Queue Greenlet.__init__(self) - self.spawn = spawn + if spawn is not None: + self.spawn = spawn self.func = func self.iterable = iterable self.queue = Queue() self.count = 0 + self.rawlink(self._on_finish) def __iter__(self): - return self.queue + return self + + def next(self): + value = self.queue.get() + if isinstance(value, Failure): + raise value.exc + return value + + if PY3: + __next__ = next + del next def _run(self): try: func = self.func + empty = True for item in self.iterable: self.count += 1 self.spawn(func, item).rawlink(self._on_result) + empty = False + if empty: + self.queue.put(Failure(StopIteration)) finally: self.__dict__.pop('spawn', None) self.__dict__.pop('func', None) @@ -229,21 +244,100 @@ self.count -= 1 if greenlet.successful(): self.queue.put(greenlet.value) + else: + self.queue.put(Failure(greenlet.exception)) + if self.ready() and self.count <= 0: + self.queue.put(Failure(StopIteration)) + + def _on_finish(self, _self): + if not self.successful(): + self.queue.put(Failure(self.exception)) + + +class IMap(Greenlet): + + def __init__(self, func, iterable, spawn=None): + from gevent.queue import Queue + Greenlet.__init__(self) + if spawn is not None: + self.spawn = spawn + self.func = func + self.iterable = iterable + self.queue = Queue() + self.count = 0 + self.waiting = [] # QQQ maybe deque will work faster there? + self.index = 0 + self.maxindex = -1 + self.rawlink(self._on_finish) + + def __iter__(self): + return self + + def next(self): + while True: + if self.waiting and self.waiting[0][0] <= self.index: + index, value = self.waiting.pop(0) + else: + index, value = self.queue.get() + if index > self.index: + insort_right(self.waiting, (index, value)) + continue + self.index += 1 + if isinstance(value, Failure): + raise value.exc + return value + + if PY3: + __next__ = next + del next + + def _run(self): + try: + empty = True + func = self.func + for item in self.iterable: + self.count += 1 + g = self.spawn(func, item) + g.rawlink(self._on_result) + self.maxindex += 1 + g.index = self.maxindex + empty = False + if empty: + self.maxindex += 1 + self.queue.put((self.maxindex, Failure(StopIteration))) + finally: + self.__dict__.pop('spawn', None) + self.__dict__.pop('func', None) + self.__dict__.pop('iterable', None) + + def _on_result(self, greenlet): + self.count -= 1 + if greenlet.successful(): + self.queue.put((greenlet.index, greenlet.value)) + else: + self.queue.put((greenlet.index, Failure(greenlet.exception))) if self.ready() and self.count <= 0: - self.queue.put(StopIteration) + self.maxindex += 1 + self.queue.put((self.maxindex, Failure(StopIteration))) + + def _on_finish(self, _self): + if not self.successful(): + self.maxindex += 1 + self.queue.put((self.maxindex, Failure(self.exception))) + +class Failure(object): + __slots__ = ['exc'] -def GreenletSet(*args, **kwargs): - import warnings - warnings.warn("gevent.pool.GreenletSet was renamed to gevent.pool.Group since version 0.13.0", DeprecationWarning, stacklevel=2) - return Group(*args, **kwargs) + def __init__(self, exc): + self.exc = exc class Pool(Group): def __init__(self, size=None, greenlet_class=None): - if size is not None and size < 1: - raise ValueError('Invalid size for pool (positive integer or None required): %r' % (size, )) + if size is not None and size < 0: + raise ValueError('size must not be negative: %r' % (size, )) Group.__init__(self) self.size = size if greenlet_class is not None: @@ -264,65 +358,19 @@ return 1 return max(0, self.size - len(self)) - def start(self, greenlet): - self._semaphore.acquire() - try: - self.add(greenlet) - except: - self._semaphore.release() - raise - greenlet.start() - - def spawn(self, *args, **kwargs): - self._semaphore.acquire() - try: - greenlet = self.greenlet_class.spawn(*args, **kwargs) - self.add(greenlet) - except: - self._semaphore.release() - raise - return greenlet - - def spawn_link(self, *args, **kwargs): - self._semaphore.acquire() - try: - greenlet = self.greenlet_class.spawn_link(*args, **kwargs) - self.add(greenlet) - except: - self._semaphore.release() - raise - return greenlet - - def spawn_link_value(self, *args, **kwargs): - self._semaphore.acquire() - try: - greenlet = self.greenlet_class.spawn_link_value(*args, **kwargs) - self.add(greenlet) - except: - self._semaphore.release() - raise - return greenlet - - def spawn_link_exception(self, *args, **kwargs): + def add(self, greenlet): self._semaphore.acquire() try: - greenlet = self.greenlet_class.spawn_link_exception(*args, **kwargs) - self.add(greenlet) + Group.add(self, greenlet) except: self._semaphore.release() raise - return greenlet - def discard(self, greenlet): - Group.discard(self, greenlet) + def _discard(self, greenlet): + Group._discard(self, greenlet) self._semaphore.release() -def get_values(greenlets): - joinall(greenlets) - return [x.value for x in greenlets] - - class pass_value(object): __slots__ = ['callback'] diff -Nru python-gevent-0.13.7/gevent/python.pxd python-gevent-1.0/gevent/python.pxd --- python-gevent-0.13.7/gevent/python.pxd 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/python.pxd 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,17 @@ +cdef extern from "Python.h": + struct PyObject: + pass + ctypedef PyObject* PyObjectPtr "PyObject*" + void Py_INCREF(PyObjectPtr) + void Py_DECREF(PyObjectPtr) + void Py_XDECREF(PyObjectPtr) + int Py_ReprEnter(PyObjectPtr) + void Py_ReprLeave(PyObjectPtr) + int PyCallable_Check(PyObjectPtr) + +cdef extern from "frameobject.h": + ctypedef struct PyThreadState: + PyObjectPtr exc_type + PyObjectPtr exc_value + PyObjectPtr exc_traceback + PyThreadState* PyThreadState_GET() diff -Nru python-gevent-0.13.7/gevent/pywsgi.py python-gevent-1.0/gevent/pywsgi.py --- python-gevent-0.13.7/gevent/pywsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/pywsgi.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,5 +1,5 @@ # Copyright (c) 2005-2009, eventlet contributors -# Copyright (c) 2009-2010, gevent contributors +# Copyright (c) 2009-2011, gevent contributors import errno import sys @@ -29,8 +29,8 @@ _INTERNAL_ERROR_HEADERS = [('Content-Type', 'text/plain'), ('Connection', 'close'), ('Content-Length', str(len(_INTERNAL_ERROR_BODY)))] -_REQUEST_TOO_LONG_RESPONSE = "HTTP/1.0 414 Request URI Too Long\r\nConnection: close\r\nContent-length: 0\r\n\r\n" -_BAD_REQUEST_RESPONSE = "HTTP/1.0 400 Bad Request\r\nConnection: close\r\nContent-length: 0\r\n\r\n" +_REQUEST_TOO_LONG_RESPONSE = "HTTP/1.1 414 Request URI Too Long\r\nConnection: close\r\nContent-length: 0\r\n\r\n" +_BAD_REQUEST_RESPONSE = "HTTP/1.1 400 Bad Request\r\nConnection: close\r\nContent-length: 0\r\n\r\n" _CONTINUE_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n" @@ -60,9 +60,13 @@ def _send_100_continue(self): if self.socket is not None: self.socket.sendall(_CONTINUE_RESPONSE) - self.sendall = None + self.socket = None - def _do_read(self, reader, length=None): + def _do_read(self, length=None, use_readline=False): + if use_readline: + reader = self.rfile.readline + else: + reader = self.rfile.read content_length = self.content_length if content_length is None: # Either Content-Length or "Transfer-Encoding: chunked" must be present in a request with a body @@ -78,9 +82,14 @@ return '' read = reader(length) self.position += len(read) + if len(read) < length: + if (use_readline and not read.endswith("\n")) or not use_readline: + raise IOError("unexpected end of file while reading request at position %s" % (self.position,)) + return read - def _chunked_read(self, rfile, length=None, use_readline=False): + def _chunked_read(self, length=None, use_readline=False): + rfile = self.rfile self._send_100_continue() if length == 0: @@ -120,23 +129,26 @@ if use_readline and data[-1] == "\n": break else: - self.chunk_length = int(rfile.readline().split(";", 1)[0], 16) + line = rfile.readline() + if not line.endswith("\n"): + self.chunk_length = 0 + raise IOError("unexpected end of file while reading chunked data header") + self.chunk_length = int(line.split(";", 1)[0], 16) self.position = 0 if self.chunk_length == 0: rfile.readline() - return ''.join(response) def read(self, length=None): if self.chunked_input: - return self._chunked_read(self.rfile, length) - return self._do_read(self.rfile.read, length) + return self._chunked_read(length) + return self._do_read(length) def readline(self, size=None): if self.chunked_input: - return self._chunked_read(self.rfile, size, True) + return self._chunked_read(size, True) else: - return self._do_read(self.rfile.readline, size) + return self._do_read(size, use_readline=True) def readlines(self, hint=None): return list(self) @@ -164,14 +176,6 @@ else: self.rfile = rfile - @property - def wfile(self): - # DEPRECATED, UNTESTED, TO BE REMOVED - wfile = getattr(self, '_wfile', None) - if wfile is None: - wfile = self._wfile = self.socket.makefile('wb', 0) - return wfile - def handle(self): try: while self.socket is not None: @@ -191,13 +195,16 @@ finally: if self.socket is not None: try: - self.socket._sock.close() # do not rely on garbage collection - self.socket.close() + # read out request data to prevent error: [Errno 104] Connection reset by peer + try: + self.socket._sock.recv(16384) + finally: + self.socket._sock.close() # do not rely on garbage collection + self.socket.close() except socket.error: pass self.__dict__.pop('socket', None) self.__dict__.pop('rfile', None) - self.__dict__.pop('_wfile', None) # XXX remove once wfile property is gone def _check_http_version(self): version = self.request_version @@ -238,13 +245,13 @@ except KeyError: pass - content_length = self.headers.get("Content-Length") + content_length = self.headers.get("content-length") if content_length is not None: content_length = int(content_length) if content_length < 0: self.log_error('Invalid Content-Length: %r', content_length) return - if content_length and self.command in ('GET', 'HEAD'): + if content_length and self.command in ('HEAD', ): self.log_error('Unexpected Content-Length') return @@ -284,27 +291,27 @@ return try: - raw_requestline = self.read_requestline() + self.requestline = self.read_requestline() except socket.error: # "Connection reset by peer" or other socket errors aren't interesting here return - if not raw_requestline: + if not self.requestline: return self.response_length = 0 - if len(raw_requestline) >= MAX_REQUEST_LINE: + if len(self.requestline) >= MAX_REQUEST_LINE: return ('414', _REQUEST_TOO_LONG_RESPONSE) try: - if not self.read_request(raw_requestline): + # for compatibility with older versions of pywsgi, we pass self.requestline as an argument there + if not self.read_request(self.requestline): return ('400', _BAD_REQUEST_RESPONSE) - except ValueError, ex: - self.log_error('Invalid request: %s', str(ex) or ex.__class__.__name__) - return ('400', _BAD_REQUEST_RESPONSE) - except Exception, ex: - traceback.print_exc() + except Exception: + ex = sys.exc_info()[1] + if not isinstance(ex, ValueError): + traceback.print_exc() self.log_error('Invalid request: %s', str(ex) or ex.__class__.__name__) return ('400', _BAD_REQUEST_RESPONSE) @@ -312,10 +319,12 @@ self.application = self.server.application try: self.handle_one_response() - except socket.error, ex: + except socket.error: + ex = sys.exc_info()[1] # Broken pipe, connection reset by peer - if ex[0] in (errno.EPIPE, errno.ECONNRESET): + if ex.args[0] in (errno.EPIPE, errno.ECONNRESET): sys.exc_clear() + return else: raise @@ -327,51 +336,89 @@ return True # read more requests + def finalize_headers(self): + if self.provided_date is None: + self.response_headers.append(('Date', format_date_time(time.time()))) + + if self.code not in (304, 204): + # the reply will include message-body; make sure we have either Content-Length or chunked + if self.provided_content_length is None: + if hasattr(self.result, '__len__'): + self.response_headers.append(('Content-Length', str(sum(len(chunk) for chunk in self.result)))) + else: + if self.request_version != 'HTTP/1.0': + self.response_use_chunked = True + self.response_headers.append(('Transfer-Encoding', 'chunked')) + + def _sendall(self, data): + try: + self.socket.sendall(data) + except socket.error, ex: + self.status = 'socket error: %s' % ex + if self.code > 0: + self.code = -self.code + raise + self.response_length += len(data) + + def _write(self, data): + if not data: + return + if self.response_use_chunked: + ## Write the chunked encoding + data = "%x\r\n%s\r\n" % (len(data), data) + self._sendall(data) + def write(self, data): - towrite = [] - if not self.status: - raise AssertionError("The application did not call start_response()") - if not self.headers_sent: - if 'Date' not in self.response_headers_list: - self.response_headers.append(('Date', format_date_time(time.time()))) - self.response_headers_list.append('Date') - - if self.request_version == 'HTTP/1.0' and 'Connection' not in self.response_headers_list: - self.response_headers.append(('Connection', 'close')) - self.response_headers_list.append('Connection') - self.close_connection = True - elif ('Connection', 'close') in self.response_headers: - self.close_connection = True + if self.code in (304, 204) and data: + raise AssertionError('The %s response must have no body' % self.code) - if self.code not in [204, 304]: - # the reply will include message-body; make sure we have either Content-Length or chunked - if 'Content-Length' not in self.response_headers_list: - if hasattr(self.result, '__len__'): - self.response_headers.append(('Content-Length', str(sum(len(chunk) for chunk in self.result)))) - self.response_headers_list.append('Content-Length') - else: - if self.request_version != 'HTTP/1.0': - self.response_use_chunked = True - self.response_headers.append(('Transfer-Encoding', 'chunked')) - self.response_headers_list.append('Transfer-Encoding') + if self.headers_sent: + self._write(data) + else: + if not self.status: + raise AssertionError("The application did not call start_response()") + self._write_with_headers(data) - towrite.append('%s %s\r\n' % (self.request_version, self.status)) + if sys.version_info[:2] >= (2, 6): + + def _write_with_headers(self, data): + towrite = bytearray() + self.headers_sent = True + self.finalize_headers() + + towrite.extend('HTTP/1.1 %s\r\n' % self.status) for header in self.response_headers: - towrite.append('%s: %s\r\n' % header) + towrite.extend('%s: %s\r\n' % header) - towrite.append('\r\n') + towrite.extend('\r\n') + if data: + if self.response_use_chunked: + ## Write the chunked encoding + towrite.extend("%x\r\n%s\r\n" % (len(data), data)) + else: + towrite.extend(data) + self._sendall(towrite) + + else: + # Python 2.5 does not have bytearray + + def _write_with_headers(self, data): + towrite = [] self.headers_sent = True + self.finalize_headers() - if data: - if self.response_use_chunked: - ## Write the chunked encoding - towrite.append("%x\r\n%s\r\n" % (len(data), data)) - else: - towrite.append(data) + towrite.append('HTTP/1.1 %s\r\n' % self.status) + for header in self.response_headers: + towrite.append('%s: %s\r\n' % header) - msg = ''.join(towrite) - self.socket.sendall(msg) - self.response_length += len(msg) + towrite.append('\r\n') + if data: + if self.response_use_chunked: + ## Write the chunked encoding + towrite.append("%x\r\n%s\r\n" % (len(data), data)) + else: + towrite.append(data) + self._sendall(''.join(towrite)) def start_response(self, status, headers, exc_info=None): if exc_info: @@ -384,8 +431,32 @@ exc_info = None self.code = int(status.split(' ', 1)[0]) self.status = status - self.response_headers = [('-'.join([x.capitalize() for x in key.split('-')]), value) for key, value in headers] - self.response_headers_list = [x[0] for x in self.response_headers] + self.response_headers = headers + + provided_connection = None + self.provided_date = None + self.provided_content_length = None + + for header, value in headers: + header = header.lower() + if header == 'connection': + provided_connection = value + elif header == 'date': + self.provided_date = value + elif header == 'content-length': + self.provided_content_length = value + + if self.request_version == 'HTTP/1.0' and provided_connection is None: + headers.append(('Connection', 'close')) + self.close_connection = True + elif provided_connection == 'close': + self.close_connection = True + + if self.code in (304, 204): + if self.provided_content_length is not None and self.provided_content_length != '0': + msg = 'Invalid Content-Length for %s response: %r (must be absent or zero)' % (self.code, self.provided_content_length) + raise AssertionError(msg) + return self.write def log_request(self): @@ -395,18 +466,17 @@ def format_request(self): now = datetime.now().replace(microsecond=0) + length = self.response_length or '-' if self.time_finish: delta = '%.6f' % (self.time_finish - self.time_start) - length = self.response_length else: delta = '-' - if not self.response_length: - length = '-' + client_address = self.client_address[0] if isinstance(self.client_address, tuple) else self.client_address return '%s - - [%s] "%s" %s %s %s' % ( - self.client_address[0], + client_address or '-', now, - self.requestline, - (self.status or '000').split()[0], + getattr(self, 'requestline', ''), + (getattr(self, 'status', None) or '000').split()[0], length, delta) @@ -436,30 +506,44 @@ try: try: self.run_application() - except GreenletExit: - raise - except Exception: - traceback.print_exc() - sys.exc_clear() - try: - args = (getattr(self, 'server', ''), - getattr(self, 'requestline', ''), - getattr(self, 'client_address', ''), - getattr(self, 'application', '')) - msg = '%s: Failed to handle request:\n request = %s from %s\n application = %s\n\n' % args - sys.stderr.write(msg) - except Exception: - sys.exc_clear() - if not self.response_length: - self.start_response(_INTERNAL_ERROR_STATUS, _INTERNAL_ERROR_HEADERS) - self.write(_INTERNAL_ERROR_BODY) + finally: + close = getattr(self.result, 'close', None) + if close is not None: + close() + self.wsgi_input._discard() + except: + self.handle_error(*sys.exc_info()) finally: - if hasattr(self.result, 'close'): - self.result.close() - self.wsgi_input._discard() self.time_finish = time.time() self.log_request() + def handle_error(self, type, value, tb): + if not issubclass(type, GreenletExit): + self.server.loop.handle_error(self.environ, type, value, tb) + del tb + if self.response_length: + self.close_connection = True + else: + self.start_response(_INTERNAL_ERROR_STATUS, _INTERNAL_ERROR_HEADERS[:]) + self.write(_INTERNAL_ERROR_BODY) + + def _headers(self): + key = None + value = None + for header in self.headers.headers: + if key is not None and header[:1] in " \t": + value += header + continue + + if key not in (None, 'CONTENT_TYPE', 'CONTENT_LENGTH'): + yield 'HTTP_' + key, value.strip() + + key, value = header.split(':', 1) + key = key.replace('-', '_').upper() + + if key not in (None, 'CONTENT_TYPE', 'CONTENT_LENGTH'): + yield 'HTTP_' + key, value.strip() + def get_environ(self): env = self.server.get_environ() env['REQUEST_METHOD'] = self.command @@ -478,23 +562,21 @@ length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length - env['SERVER_PROTOCOL'] = 'HTTP/1.0' + env['SERVER_PROTOCOL'] = self.request_version - env['REMOTE_ADDR'] = self.client_address[0] - - for header in self.headers.headers: - key, value = header.split(':', 1) - key = key.replace('-', '_').upper() - if key not in ('CONTENT_TYPE', 'CONTENT_LENGTH'): - value = value.strip() - key = 'HTTP_' + key - if key in env: - if 'COOKIE' in key: - env[key] += '; ' + value - else: - env[key] += ',' + value + client_address = self.client_address + if isinstance(client_address, tuple): + env['REMOTE_ADDR'] = str(client_address[0]) + env['REMOTE_PORT'] = str(client_address[1]) + + for key, value in self._headers(): + if key in env: + if 'COOKIE' in key: + env[key] += '; ' + value else: - env[key] = value + env[key] += ',' + value + else: + env[key] = value if env.get('HTTP_EXPECT') == '100-continue': socket = self.socket @@ -530,6 +612,7 @@ else: self.log = log self.set_environ(environ) + self.set_max_accept() def set_environ(self, environ=None): if environ is not None: @@ -545,11 +628,15 @@ if self.environ.get('wsgi.errors') is None: self.environ['wsgi.errors'] = sys.stderr + def set_max_accept(self): + if self.environ.get('wsgi.multiprocess'): + self.max_accept = 1 + def get_environ(self): return self.environ.copy() - def pre_start(self): - StreamServer.pre_start(self) + def init_socket(self): + StreamServer.init_socket(self) self.update_environ() def update_environ(self): diff -Nru python-gevent-0.13.7/gevent/queue.py python-gevent-1.0/gevent/queue.py --- python-gevent-0.13.7/gevent/queue.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,20 +1,13 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. """Synchronized queues. The :mod:`gevent.queue` module implements multi-producer, multi-consumer queues that work across greenlets, with the API similar to the classes found in the standard :mod:`Queue` and :class:`multiprocessing ` modules. -A major difference is that queues in this module operate as channels when -initialized with *maxsize* of zero. In such case, both :meth:`Queue.empty` -and :meth:`Queue.full` return ``True`` and :meth:`Queue.put` always blocks until a call -to :meth:`Queue.get` retrieves the item. - -Another interesting difference is that :meth:`Queue.qsize`, :meth:`Queue.empty`, and -:meth:`Queue.full` *can* be used as indicators of whether the subsequent :meth:`Queue.get` -or :meth:`Queue.put` will not block. +Changed in version 1.0: Queue(0) now means queue of infinite size, not a channel. -Additionally, queues in this module implement iterator protocol. Iterating over queue +The classes in this module implement iterator protocol. Iterating over queue means repeatedly calling :meth:`get ` until :meth:`get ` returns ``StopIteration``. >>> queue = gevent.queue.Queue() @@ -27,67 +20,89 @@ 2 """ +from __future__ import absolute_import import sys import heapq import collections -from Queue import Full, Empty + +if sys.version_info[0] == 2: + import Queue as __queue__ +else: + import queue as __queue__ +Full = __queue__.Full +Empty = __queue__.Empty from gevent.timeout import Timeout -from gevent.hub import get_hub, Waiter, getcurrent, _NONE -from gevent import core +from gevent.hub import get_hub, Waiter, getcurrent -__all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue'] +__all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue', 'Channel'] class Queue(object): """Create a queue object with a given maximum size. - If *maxsize* is less than zero or ``None``, the queue size is infinite. - - ``Queue(0)`` is a channel, that is, its :meth:`put` method always blocks until the - item is delivered. (This is unlike the standard :class:`Queue`, where 0 means - infinite size). + If *maxsize* is less than or equal to zero or ``None``, the queue size is infinite. """ - def __init__(self, maxsize=None): - if maxsize < 0: + def __init__(self, maxsize=None, items=None): + if maxsize is not None and maxsize <= 0: self.maxsize = None + if maxsize == 0: + import warnings + warnings.warn('Queue(0) now equivalent to Queue(None); if you want a channel, use Channel', + DeprecationWarning, stacklevel=2) else: self.maxsize = maxsize self.getters = set() self.putters = set() + self.hub = get_hub() self._event_unlock = None - self._init(maxsize) + if items: + self._init(maxsize, items) + else: + self._init(maxsize) # QQQ make maxsize into a property with setter that schedules unlock if necessary - def _init(self, maxsize): - self.queue = collections.deque() + def copy(self): + return type(self)(self.maxsize, self.queue) + + def _init(self, maxsize, items=None): + if items: + self.queue = collections.deque(items) + else: + self.queue = collections.deque() def _get(self): return self.queue.popleft() + def _peek(self): + return self.queue[0] + def _put(self, item): self.queue.append(item) def __repr__(self): - return '<%s at %s %s>' % (type(self).__name__, hex(id(self)), self._format()) + return '<%s at %s%s>' % (type(self).__name__, hex(id(self)), self._format()) def __str__(self): - return '<%s %s>' % (type(self).__name__, self._format()) + return '<%s%s>' % (type(self).__name__, self._format()) def _format(self): - result = 'maxsize=%r' % (self.maxsize, ) + result = [] + if self.maxsize is not None: + result.append('maxsize=%r' % (self.maxsize, )) if getattr(self, 'queue', None): - result += ' queue=%r' % self.queue + result.append('queue=%r' % (self.queue, )) if self.getters: - result += ' getters[%s]' % len(self.getters) + result.append('getters[%s]' % len(self.getters)) if self.putters: - result += ' putters[%s]' % len(self.putters) - if self._event_unlock is not None: - result += ' unlocking' - return result + result.append('putters[%s]' % len(self.putters)) + if result: + return ' ' + ' '.join(result) + else: + return '' def qsize(self): """Return the size of the queue.""" @@ -120,19 +135,18 @@ self._put(item) if self.getters: self._schedule_unlock() - elif not block and get_hub() is getcurrent(): - # we're in the mainloop, so we cannot wait; we can switch() to other greenlets though - # find a getter and deliver an item to it - while self.getters: + elif self.hub is getcurrent(): + # We're in the mainloop, so we cannot wait; we can switch to other greenlets though. + # Check if possible to get a free slot in the queue. + while self.getters and self.qsize() and self.qsize() >= self.maxsize: getter = self.getters.pop() - if getter: - self._put(item) - item = self._get() - getter.switch(item) - return + getter.switch(getter) + if self.qsize() < self.maxsize: + self._put(item) + return raise Full elif block: - waiter = ItemWaiter(item) + waiter = ItemWaiter(item, self) self.putters.add(waiter) timeout = Timeout.start_new(timeout, Full) try: @@ -140,8 +154,6 @@ self._schedule_unlock() result = waiter.get() assert result is waiter, "Invalid switch into Queue.put: %r" % (result, ) - if waiter.item is not _NONE: - self._put(item) finally: timeout.cancel() self.putters.discard(waiter) @@ -170,15 +182,13 @@ if self.putters: self._schedule_unlock() return self._get() - elif not block and get_hub() is getcurrent(): + elif self.hub is getcurrent(): # special case to make get_nowait() runnable in the mainloop greenlet # there are no items in the queue; try to fix the situation by unlocking putters while self.putters: - putter = self.putters.pop() - if putter: - putter.switch(putter) - if self.qsize(): - return self._get() + self.putters.pop().put_and_switch() + if self.qsize(): + return self._get() raise Empty elif block: waiter = Waiter() @@ -187,7 +197,9 @@ self.getters.add(waiter) if self.putters: self._schedule_unlock() - return waiter.get() + result = waiter.get() + assert result is waiter, 'Invalid switch into Queue.get: %r' % (result, ) + return self._get() finally: self.getters.discard(waiter) timeout.cancel() @@ -202,46 +214,67 @@ """ return self.get(False) + def peek(self, block=True, timeout=None): + """Return an item from the queue without removing it. + + If optional args *block* is true and *timeout* is ``None`` (the default), + block if necessary until an item is available. If *timeout* is a positive number, + it blocks at most *timeout* seconds and raises the :class:`Empty` exception + if no item was available within that time. Otherwise (*block* is false), return + an item if one is immediately available, else raise the :class:`Empty` exception + (*timeout* is ignored in that case). + """ + if self.qsize(): + return self._peek() + elif self.hub is getcurrent(): + # special case to make peek(False) runnable in the mainloop greenlet + # there are no items in the queue; try to fix the situation by unlocking putters + while self.putters: + self.putters.pop().put_and_switch() + if self.qsize(): + return self._peek() + raise Empty + elif block: + waiter = Waiter() + timeout = Timeout.start_new(timeout, Empty) + try: + self.getters.add(waiter) + if self.putters: + self._schedule_unlock() + result = waiter.get() + assert result is waiter, 'Invalid switch into Queue.peek: %r' % (result, ) + return self._peek() + finally: + self.getters.discard(waiter) + timeout.cancel() + else: + raise Empty + + def peek_nowait(self): + return self.peek(False) + def _unlock(self): - try: - while True: - if self.qsize() and self.getters: - getter = self.getters.pop() - if getter: - try: - item = self._get() - except: - getter.throw(*sys.exc_info()) - else: - getter.switch(item) - elif self.putters and self.getters: - putter = self.putters.pop() - if putter: - getter = self.getters.pop() - if getter: - item = putter.item - putter.item = _NONE # this makes greenlet calling put() not to call _put() again - self._put(item) - item = self._get() - getter.switch(item) - putter.switch(putter) - else: - self.putters.add(putter) - elif self.putters and (self.getters or self.qsize() < self.maxsize): + while True: + repeat = False + if self.putters and (self.maxsize is None or self.qsize() < self.maxsize): + repeat = True + try: putter = self.putters.pop() - putter.switch(putter) + self._put(putter.item) + except: + putter.throw(*sys.exc_info()) else: - break - finally: - self._event_unlock = None # QQQ maybe it's possible to obtain this info from libevent? - # i.e. whether this event is pending _OR_ currently executing - # testcase: 2 greenlets: while True: q.put(q.get()) - nothing else has a change to execute - # to avoid this, schedule unlock with timer(0, ...) once in a while + putter.switch(putter) + if self.getters and self.qsize(): + repeat = True + getter = self.getters.pop() + getter.switch(getter) + if not repeat: + return def _schedule_unlock(self): - if self._event_unlock is None: - self._event_unlock = core.active_event(self._unlock) - # QQQ re-activate event (with event_active libevent call) instead of creating a new one each time + if not self._event_unlock: + self._event_unlock = self.hub.loop.run_callback(self._unlock) def __iter__(self): return self @@ -254,11 +287,18 @@ class ItemWaiter(Waiter): - __slots__ = ['item'] + __slots__ = ['item', 'queue'] - def __init__(self, item): + def __init__(self, item, queue): Waiter.__init__(self) self.item = item + self.queue = queue + + def put_and_switch(self): + self.queue._put(self.item) + self.queue = None + self.item = None + return self.switch(self) class PriorityQueue(Queue): @@ -267,8 +307,11 @@ Entries are typically tuples of the form: ``(priority number, data)``. ''' - def _init(self, maxsize): - self.queue = [] + def _init(self, maxsize, items=None): + if items: + self.queue = list(items) + else: + self.queue = [] def _put(self, item, heappush=heapq.heappush): heappush(self.queue, item) @@ -280,8 +323,11 @@ class LifoQueue(Queue): '''A subclass of :class:`Queue` that retrieves most recently added entries first.''' - def _init(self, maxsize): - self.queue = [] + def _init(self, maxsize, items=None): + if items: + self.queue = list(items) + else: + self.queue = [] def _put(self, item): self.queue.append(item) @@ -293,13 +339,16 @@ class JoinableQueue(Queue): '''A subclass of :class:`Queue` that additionally has :meth:`task_done` and :meth:`join` methods.''' - def __init__(self, maxsize=None): + def __init__(self, maxsize=None, items=None, unfinished_tasks=None): from gevent.event import Event - Queue.__init__(self, maxsize) - self.unfinished_tasks = 0 + Queue.__init__(self, maxsize, items) + self.unfinished_tasks = unfinished_tasks or 0 self._cond = Event() self._cond.set() + def copy(self): + return type(self)(self.maxsize, self.queue, self.unfinished_tasks) + def _format(self): result = Queue._format(self) if self.unfinished_tasks: @@ -337,3 +386,120 @@ unfinished tasks drops to zero, :meth:`join` unblocks. ''' self._cond.wait() + + +class Channel(object): + + def __init__(self): + self.getters = collections.deque() + self.putters = collections.deque() + self.hub = get_hub() + self._event_unlock = None + + def __repr__(self): + return '<%s at %s %s>' % (type(self).__name__, hex(id(self)), self._format()) + + def __str__(self): + return '<%s %s>' % (type(self).__name__, self._format()) + + def _format(self): + result = '' + if self.getters: + result += ' getters[%s]' % len(self.getters) + if self.putters: + result += ' putters[%s]' % len(self.putters) + return result + + @property + def balance(self): + return len(self.putters) - len(self.getters) + + def qsize(self): + return 0 + + def empty(self): + return True + + def full(self): + return True + + def put(self, item, block=True, timeout=None): + if self.hub is getcurrent(): + if self.getters: + getter = self.getters.popleft() + getter.switch(item) + return + raise Full + + if not block: + timeout = 0 + + waiter = Waiter() + item = (item, waiter) + self.putters.append(item) + timeout = Timeout.start_new(timeout, Full) + try: + if self.getters: + self._schedule_unlock() + result = waiter.get() + assert result is waiter, "Invalid switch into Channel.put: %r" % (result, ) + except: + self._discard(item) + raise + finally: + timeout.cancel() + + def _discard(self, item): + try: + self.putters.remove(item) + except ValueError: + pass + + def put_nowait(self, item): + self.put(item, False) + + def get(self, block=True, timeout=None): + if self.hub is getcurrent(): + if self.putters: + item, putter = self.putters.popleft() + self.hub.loop.run_callback(putter.switch, putter) + return item + + if not block: + timeout = 0 + + waiter = Waiter() + timeout = Timeout.start_new(timeout, Empty) + try: + self.getters.append(waiter) + if self.putters: + self._schedule_unlock() + return waiter.get() + except: + self.getters.remove(waiter) + raise + finally: + timeout.cancel() + + def get_nowait(self): + return self.get(False) + + def _unlock(self): + while self.putters and self.getters: + getter = self.getters.popleft() + item, putter = self.putters.popleft() + getter.switch(item) + putter.switch(putter) + + def _schedule_unlock(self): + if not self._event_unlock: + self._event_unlock = self.hub.loop.run_callback(self._unlock) + + def __iter__(self): + return self + + def next(self): + result = self.get() + if result is StopIteration: + raise result + return result diff -Nru python-gevent-0.13.7/gevent/rawgreenlet.py python-gevent-1.0/gevent/rawgreenlet.py --- python-gevent-0.13.7/gevent/rawgreenlet.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/rawgreenlet.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. - -"""A few utilities for raw greenlets. - -.. warning:: - - This module is deprecated. Use :class:`gevent.Greenlet` instead. - -.. note:: - - These functions do not support *timeout* parameter. -""" - -import warnings -warnings.warn("gevent.rawgreenlet is deprecated", DeprecationWarning, stacklevel=2) - -import traceback -from gevent import core -from gevent.hub import GreenletExit, Waiter, sleep - - -__all__ = ['kill', - 'killall', - 'join', - 'joinall'] - - -def _kill(greenlet, exception, waiter): - try: - greenlet.throw(exception) - except: - traceback.print_exc() - waiter.switch() - - -def kill(greenlet, exception=GreenletExit, block=True, polling_period=0.2): - """Kill greenlet with exception (GreenletExit by default). - Wait for it to die if block is true. - """ - if not greenlet.dead: - waiter = Waiter() - core.active_event(_kill, greenlet, exception, waiter) - if block: - waiter.wait() - join(greenlet, polling_period=polling_period) - - -def _killall(greenlets, exception, waiter): - diehards = [] - for greenlet in greenlets: - if not greenlet.dead: - try: - greenlet.throw(exception) - except: - traceback.print_exc() - if not greenlet.dead: - diehards.append(greenlet) - waiter.switch(diehards) - - -def killall(greenlets, exception=GreenletExit, block=True, polling_period=0.2): - """Kill all the greenlets with exception (GreenletExit by default). - Wait for them to die if block is true. - """ - waiter = Waiter() - core.active_event(_killall, greenlets, exception, waiter) - if block: - alive = waiter.wait() - if alive: - joinall(alive, polling_period=polling_period) - - -def join(greenlet, polling_period=0.2): - """Wait for a greenlet to finish by polling its status""" - delay = 0.002 - while not greenlet.dead: - delay = min(polling_period, delay * 2) - sleep(delay) - - -def joinall(greenlets, polling_period=0.2): - """Wait for the greenlets to finish by polling their status""" - current = 0 - while current < len(greenlets) and greenlets[current].dead: - current += 1 - delay = 0.002 - while current < len(greenlets): - delay = min(polling_period, delay * 2) - sleep(delay) - while current < len(greenlets) and greenlets[current].dead: - current += 1 diff -Nru python-gevent-0.13.7/gevent/resolver_ares.py python-gevent-1.0/gevent/resolver_ares.py --- python-gevent-0.13.7/gevent/resolver_ares.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/resolver_ares.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,308 @@ +# Copyright (c) 2011 Denis Bilenko. See LICENSE for details. +from __future__ import absolute_import +import os +import sys +from _socket import getservbyname, getaddrinfo, gaierror, error +from gevent.hub import Waiter, get_hub, string_types +from gevent.socket import AF_UNSPEC, AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, AI_NUMERICHOST, EAI_SERVICE, AI_PASSIVE +from gevent.ares import channel, InvalidIP + + +__all__ = ['Resolver'] + + +class Resolver(object): + + ares_class = channel + + def __init__(self, hub=None, use_environ=True, **kwargs): + if hub is None: + hub = get_hub() + self.hub = hub + if use_environ: + for key in os.environ.iterkeys(): + if key.startswith('GEVENTARES_'): + name = key[11:].lower() + if name: + value = os.environ[key] + kwargs.setdefault(name, value) + self.ares = self.ares_class(hub.loop, **kwargs) + self.pid = os.getpid() + self.params = kwargs + self.fork_watcher = hub.loop.fork(ref=False) + self.fork_watcher.start(self._on_fork) + + def __repr__(self): + return '' % (id(self), self.ares) + + def _on_fork(self): + pid = os.getpid() + if pid != self.pid: + self.hub.loop.run_callback(self.ares.destroy) + self.ares = self.ares_class(self.hub.loop, **self.params) + self.pid = pid + + def close(self): + if self.ares is not None: + self.hub.loop.run_callback(self.ares.destroy) + self.ares = None + self.fork_watcher.stop() + + def gethostbyname(self, hostname, family=AF_INET): + hostname = _resolve_special(hostname, family) + return self.gethostbyname_ex(hostname, family)[-1][0] + + def gethostbyname_ex(self, hostname, family=AF_INET): + if isinstance(hostname, unicode): + hostname = hostname.encode('ascii') + elif not isinstance(hostname, str): + raise TypeError('Expected string, not %s' % type(hostname).__name__) + + while True: + ares = self.ares + try: + waiter = Waiter(self.hub) + ares.gethostbyname(waiter, hostname, family) + result = waiter.get() + if not result[-1]: + raise gaierror(-5, 'No address associated with hostname') + return result + except gaierror: + if ares is self.ares: + raise + # "self.ares is not ares" means channel was destroyed (because we were forked) + + def _lookup_port(self, port, socktype): + socktypes = [] + if isinstance(port, string_types): + try: + port = int(port) + except ValueError: + try: + if socktype == 0: + origport = port + try: + port = getservbyname(port, 'tcp') + socktypes.append(SOCK_STREAM) + except error: + port = getservbyname(port, 'udp') + socktypes.append(SOCK_DGRAM) + else: + try: + if port == getservbyname(origport, 'udp'): + socktypes.append(SOCK_DGRAM) + except error: + pass + elif socktype == SOCK_STREAM: + port = getservbyname(port, 'tcp') + elif socktype == SOCK_DGRAM: + port = getservbyname(port, 'udp') + else: + raise gaierror(EAI_SERVICE, 'Servname not supported for ai_socktype') + except error: + ex = sys.exc_info()[1] + if 'not found' in str(ex): + raise gaierror(EAI_SERVICE, 'Servname not supported for ai_socktype') + else: + raise gaierror(str(ex)) + except UnicodeEncodeError: + raise error('Int or String expected') + elif port is None: + port = 0 + elif isinstance(port, int): + pass + else: + raise error('Int or String expected') + port = int(port % 65536) + if not socktypes and socktype: + socktypes.append(socktype) + return port, socktypes + + def _getaddrinfo(self, host, port, family=0, socktype=0, proto=0, flags=0): + if isinstance(host, unicode): + host = host.encode('idna') + elif not isinstance(host, str) or (flags & AI_NUMERICHOST): + # this handles cases which do not require network access + # 1) host is None + # 2) host is of an invalid type + # 3) AI_NUMERICHOST flag is set + return getaddrinfo(host, port, family, socktype, proto, flags) + # we also call _socket.getaddrinfo below if family is not one of AF_* + + port, socktypes = self._lookup_port(port, socktype) + + socktype_proto = [(SOCK_STREAM, 6), (SOCK_DGRAM, 17), (SOCK_RAW, 0)] + if socktypes: + socktype_proto = [(x, y) for (x, y) in socktype_proto if x in socktypes] + if proto: + socktype_proto = [(x, y) for (x, y) in socktype_proto if proto == y] + + ares = self.ares + + if family == AF_UNSPEC: + values = Values(self.hub, 2) + ares.gethostbyname(values, host, AF_INET) + ares.gethostbyname(values, host, AF_INET6) + elif family == AF_INET: + values = Values(self.hub, 1) + ares.gethostbyname(values, host, AF_INET) + elif family == AF_INET6: + values = Values(self.hub, 1) + ares.gethostbyname(values, host, AF_INET6) + else: + raise gaierror(5, 'ai_family not supported: %r' % (family, )) + + values = values.get() + if len(values) == 2 and values[0] == values[1]: + values.pop() + + result = [] + result4 = [] + result6 = [] + + for addrs in values: + if addrs.family == AF_INET: + for addr in addrs[-1]: + sockaddr = (addr, port) + for socktype, proto in socktype_proto: + result4.append((AF_INET, socktype, proto, '', sockaddr)) + elif addrs.family == AF_INET6: + for addr in addrs[-1]: + if addr == '::1': + dest = result + else: + dest = result6 + sockaddr = (addr, port, 0, 0) + for socktype, proto in socktype_proto: + dest.append((AF_INET6, socktype, proto, '', sockaddr)) + + result += result4 + result6 + + if not result: + raise gaierror(-5, 'No address associated with hostname') + + return result + + def getaddrinfo(self, host, port, family=0, socktype=0, proto=0, flags=0): + while True: + ares = self.ares + try: + return self._getaddrinfo(host, port, family, socktype, proto, flags) + except gaierror: + if ares is self.ares: + raise + + def _gethostbyaddr(self, ip_address): + if isinstance(ip_address, unicode): + ip_address = ip_address.encode('ascii') + elif not isinstance(ip_address, str): + raise TypeError('Expected string, not %s' % type(ip_address).__name__) + + waiter = Waiter(self.hub) + try: + self.ares.gethostbyaddr(waiter, ip_address) + return waiter.get() + except InvalidIP: + result = self._getaddrinfo(ip_address, None, family=AF_UNSPEC, socktype=SOCK_DGRAM) + if not result: + raise + _ip_address = result[0][-1][0] + if _ip_address == ip_address: + raise + waiter.clear() + self.ares.gethostbyaddr(waiter, _ip_address) + return waiter.get() + + def gethostbyaddr(self, ip_address): + ip_address = _resolve_special(ip_address, AF_UNSPEC) + while True: + ares = self.ares + try: + return self._gethostbyaddr(ip_address) + except gaierror: + if ares is self.ares: + raise + + def _getnameinfo(self, sockaddr, flags): + if not isinstance(flags, int): + raise TypeError('an integer is required') + if not isinstance(sockaddr, tuple): + raise TypeError('getnameinfo() argument 1 must be a tuple') + + address = sockaddr[0] + if isinstance(address, unicode): + address = address.encode('ascii') + + if not isinstance(address, str): + raise TypeError('sockaddr[0] must be a string, not %s' % type(address).__name__) + + port = sockaddr[1] + if not isinstance(port, int): + raise TypeError('port must be an integer, not %s' % type(port)) + + waiter = Waiter(self.hub) + result = self._getaddrinfo(address, str(sockaddr[1]), family=AF_UNSPEC, socktype=SOCK_DGRAM) + if not result: + raise + elif len(result) != 1: + raise error('sockaddr resolved to multiple addresses') + family, socktype, proto, name, address = result[0] + + if family == AF_INET: + if len(sockaddr) != 2: + raise error("IPv4 sockaddr must be 2 tuple") + elif family == AF_INET6: + address = address[:2] + sockaddr[2:] + + self.ares.getnameinfo(waiter, address, flags) + node, service = waiter.get() + if service is None: + service = '0' + return node, service + + def getnameinfo(self, sockaddr, flags): + while True: + ares = self.ares + try: + return self._getnameinfo(sockaddr, flags) + except gaierror: + if ares is self.ares: + raise + + +class Values(object): + # helper to collect multiple values; ignore errors unless nothing has succeeded + # QQQ could probably be moved somewhere - hub.py? + + __slots__ = ['count', 'values', 'error', 'waiter'] + + def __init__(self, hub, count): + self.count = count + self.values = [] + self.error = None + self.waiter = Waiter(hub) + + def __call__(self, source): + self.count -= 1 + if source.exception is None: + self.values.append(source.value) + else: + self.error = source.exception + if self.count <= 0: + self.waiter.switch() + + def get(self): + self.waiter.get() + if self.values: + return self.values + else: + raise self.error + + +def _resolve_special(hostname, family): + if hostname == '': + result = getaddrinfo(None, 0, family, SOCK_DGRAM, 0, AI_PASSIVE) + if len(result) != 1: + raise error('wildcard resolved to multiple address') + return result[0][4][0] + return hostname diff -Nru python-gevent-0.13.7/gevent/resolver_thread.py python-gevent-1.0/gevent/resolver_thread.py --- python-gevent-0.13.7/gevent/resolver_thread.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/resolver_thread.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,40 @@ +# Copyright (c) 2012 Denis Bilenko. See LICENSE for details. +import _socket +from gevent.hub import get_hub + + +__all__ = ['Resolver'] + + +class Resolver(object): + + expected_errors = Exception + + def __init__(self, hub=None): + if hub is None: + hub = get_hub() + self.pool = hub.threadpool + + def __repr__(self): + return '' % (id(self), self.pool) + + def close(self): + pass + + # from briefly reading socketmodule.c, it seems that all of the functions + # below are thread-safe in Python, even if they are not thread-safe in C. + + def gethostbyname(self, *args): + return self.pool.apply_e(self.expected_errors, _socket.gethostbyname, args) + + def gethostbyname_ex(self, *args): + return self.pool.apply_e(self.expected_errors, _socket.gethostbyname_ex, args) + + def getaddrinfo(self, *args, **kwargs): + return self.pool.apply_e(self.expected_errors, _socket.getaddrinfo, args, kwargs) + + def gethostbyaddr(self, *args, **kwargs): + return self.pool.apply_e(self.expected_errors, _socket.gethostbyaddr, args, kwargs) + + def getnameinfo(self, *args, **kwargs): + return self.pool.apply_e(self.expected_errors, _socket.getnameinfo, args, kwargs) diff -Nru python-gevent-0.13.7/gevent/select.py python-gevent-1.0/gevent/select.py --- python-gevent-0.13.7/gevent/select.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/select.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,13 +1,14 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. - -from gevent import core +# Copyright (c) 2009-2011 Denis Bilenko. See LICENSE for details. +from __future__ import absolute_import +import sys from gevent.timeout import Timeout from gevent.event import Event +from gevent.hub import get_hub __implements__ = ['select'] __all__ = ['error'] + __implements__ -__select__ = __import__('select') +import select as __select__ error = __select__.error @@ -24,24 +25,20 @@ class SelectResult(object): - __slots__ = ['read', 'write', 'event', 'timer'] + __slots__ = ['read', 'write', 'event'] def __init__(self): self.read = [] self.write = [] self.event = Event() - self.timer = None - def update(self, event, evtype): - if evtype & core.EV_READ: - self.read.append(event.arg) - if self.timer is None: - self.timer = core.timer(0, self.event.set) - elif evtype & core.EV_WRITE: - self.write.append(event.arg) - if self.timer is None: - self.timer = core.timer(0, self.event.set) - # using core.timer(0, ...) to let other active events call update() before Event.wait() returns + def add_read(self, socket): + self.read.append(socket) + self.event.set() + + def add_write(self, socket): + self.write.append(socket) + self.event.set() def select(rlist, wlist, xlist, timeout=None): @@ -49,20 +46,28 @@ Note: *xlist* is ignored. """ - allevents = [] - timeout = Timeout.start_new(timeout) + watchers = [] + loop = get_hub().loop + io = loop.io + MAXPRI = loop.MAXPRI result = SelectResult() try: try: for readfd in rlist: - allevents.append(core.read_event(get_fileno(readfd), result.update, arg=readfd)) + watcher = io(get_fileno(readfd), 1) + watcher.priority = MAXPRI + watcher.start(result.add_read, readfd) + watchers.append(watcher) for writefd in wlist: - allevents.append(core.write_event(get_fileno(writefd), result.update, arg=writefd)) - except IOError, ex: + watcher = io(get_fileno(writefd), 2) + watcher.priority = MAXPRI + watcher.start(result.add_write, writefd) + watchers.append(watcher) + except IOError: + ex = sys.exc_info()[1] raise error(*ex.args) result.event.wait(timeout=timeout) return result.read, result.write, [] finally: - for evt in allevents: - evt.cancel() - timeout.cancel() + for watcher in watchers: + watcher.stop() diff -Nru python-gevent-0.13.7/gevent/_semaphore.pyx python-gevent-1.0/gevent/_semaphore.pyx --- python-gevent-0.13.7/gevent/_semaphore.pyx 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/_semaphore.pyx 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,131 @@ +import sys +from gevent.hub import get_hub, getcurrent +from gevent.timeout import Timeout + + +__all__ = ['Semaphore'] + + +class Semaphore(object): + """A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, + plus an initial value. The acquire() method blocks if necessary until it can return without making the counter + negative. + + If not given, value defaults to 1. + + This Semaphore's __exit__ method does not call the trace function. + """ + + def __init__(self, value=1): + if value < 0: + raise ValueError("semaphore initial value must be >= 0") + self._links = [] + self.counter = value + self._notifier = None + # we don't want to do get_hub() here to allow module-level locks + # without initializing the hub + + def __str__(self): + params = (self.__class__.__name__, self.counter, len(self._links)) + return '<%s counter=%s _links[%s]>' % params + + def locked(self): + return self.counter <= 0 + + def release(self): + self.counter += 1 + self._start_notify() + + def _start_notify(self): + if self._links and self.counter > 0 and not self._notifier: + self._notifier = get_hub().loop.run_callback(self._notify_links) + + def _notify_links(self): + while True: + self._dirty = False + for link in self._links: + if self.counter <= 0: + return + try: + link(self) + except: + getcurrent().handle_error((link, self), *sys.exc_info()) + if self._dirty: + break + if not self._dirty: + return + + def rawlink(self, callback): + """Register a callback to call when a counter is more than zero. + + *callback* will be called in the :class:`Hub `, so it must not use blocking gevent API. + *callback* will be passed one argument: this instance. + """ + if not callable(callback): + raise TypeError('Expected callable: %r' % (callback, )) + self._links.append(callback) + self._dirty = True + + def unlink(self, callback): + """Remove the callback set by :meth:`rawlink`""" + try: + self._links.remove(callback) + self._dirty = True + except ValueError: + pass + + def wait(self, timeout=None): + if self.counter > 0: + return self.counter + else: + switch = getcurrent().switch + self.rawlink(switch) + try: + timer = Timeout.start_new(timeout) + try: + try: + result = get_hub().switch() + assert result is self, 'Invalid switch into Semaphore.wait(): %r' % (result, ) + except Timeout: + ex = sys.exc_info()[1] + if ex is not timer: + raise + finally: + timer.cancel() + finally: + self.unlink(switch) + return self.counter + + def acquire(self, blocking=True, timeout=None): + if self.counter > 0: + self.counter -= 1 + return True + elif not blocking: + return False + else: + switch = getcurrent().switch + self.rawlink(switch) + try: + timer = Timeout.start_new(timeout) + try: + try: + result = get_hub().switch() + assert result is self, 'Invalid switch into Semaphore.acquire(): %r' % (result, ) + except Timeout: + ex = sys.exc_info()[1] + if ex is timer: + return False + raise + finally: + timer.cancel() + finally: + self.unlink(switch) + self.counter -= 1 + assert self.counter >= 0 + return True + + def __enter__(self): + self.acquire() + + def __exit__(self, *args): + self.release() diff -Nru python-gevent-0.13.7/gevent/server.py python-gevent-1.0/gevent/server.py --- python-gevent-0.13.7/gevent/server.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/server.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,15 +1,19 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. +# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details. """TCP/SSL server""" import sys -import errno -import traceback -from gevent import socket -from gevent import core +import _socket from gevent.baseserver import BaseServer -from gevent.socket import EWOULDBLOCK +from gevent.socket import EWOULDBLOCK, socket -__all__ = ['StreamServer'] +__all__ = ['StreamServer', 'DatagramServer'] + + +if sys.platform == 'win32': + # SO_REUSEADDR on Windows does not mean the same thing as on *nix (issue #217) + DEFAULT_REUSE_ADDR = None +else: + DEFAULT_REUSE_ADDR = 1 class StreamServer(BaseServer): @@ -35,124 +39,63 @@ The delay starts with :attr:`min_delay` and doubles with each successive error until it reaches :attr:`max_delay`. A successful :func:`accept` resets the delay to :attr:`min_delay` again. """ - # Sets the maximum number of consecutive accepts that a process may perform on - # a single wake up. High values give higher priority to high connection rates, - # while lower values give higher priority to already established connections. - max_accept = 100 - - # the number of seconds to sleep in case there was an error in accept() call - # for consecutive errors the delay will double until it reaches max_delay - # when accept() finally succeeds the delay will be reset to min_delay again - min_delay = 0.01 - max_delay = 1 + # the default backlog to use if none was provided in __init__ + backlog = 256 + + reuse_addr = DEFAULT_REUSE_ADDR def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args): - if ssl_args: - ssl_args.setdefault('server_side', True) - try: + BaseServer.__init__(self, listener, handle=handle, spawn=spawn) + try: + if ssl_args: + ssl_args.setdefault('server_side', True) from gevent.ssl import wrap_socket - except ImportError: - wrap_socket = _import_sslold_wrap_socket() - if wrap_socket is None: - raise - self.wrap_socket = wrap_socket - self.ssl_args = ssl_args - self.ssl_enabled = True - else: - self.ssl_enabled = False - BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn) - self.delay = self.min_delay - self._accept_event = None - self._start_accepting_timer = None + self.wrap_socket = wrap_socket + self.ssl_args = ssl_args + else: + self.ssl_args = None + if backlog is not None: + if hasattr(self, 'socket'): + raise TypeError('backlog must be None when a socket instance is passed') + self.backlog = backlog + except: + self.close() + raise + + @property + def ssl_enabled(self): + return self.ssl_args is not None - def set_listener(self, listener, backlog=None): - BaseServer.set_listener(self, listener, backlog=backlog) + def set_listener(self, listener): + BaseServer.set_listener(self, listener) try: self.socket = self.socket._sock except AttributeError: pass - def set_spawn(self, spawn): - BaseServer.set_spawn(self, spawn) - if self.pool is not None: - self.pool._semaphore.rawlink(self._start_accepting_if_started) - - def kill(self): - try: - BaseServer.kill(self) - finally: - self.__dict__.pop('_handle', None) - pool = getattr(self, 'pool', None) - if pool is not None: - pool._semaphore.unlink(self._start_accepting_if_started) - - def pre_start(self): - BaseServer.pre_start(self) - # make SSL work: - if self.ssl_enabled: + def init_socket(self): + if not hasattr(self, 'socket'): + self.socket = self.get_listener(self.address, self.backlog, self.family) + self.address = self.socket.getsockname() + if self.ssl_args: self._handle = self.wrap_socket_and_handle else: self._handle = self.handle - def start_accepting(self): - if self._accept_event is None: - self._accept_event = core.read_event(self.socket.fileno(), self._do_accept, persist=True) - - def _start_accepting_if_started(self, _event=None): - if self.started: - self.start_accepting() - - def stop_accepting(self): - if self._accept_event is not None: - self._accept_event.cancel() - self._accept_event = None - if self._start_accepting_timer is not None: - self._start_accepting_timer.cancel() - self._start_accepting_timer = None - - def _do_accept(self, event, _evtype): - assert event is self._accept_event - for _ in xrange(self.max_accept): - address = None - try: - if self.full(): - self.stop_accepting() - return - try: - client_socket, address = self.socket.accept() - except socket.error, err: - if err[0] == EWOULDBLOCK: - return - raise - self.delay = self.min_delay - client_socket = socket.socket(_sock=client_socket) - spawn = self._spawn - if spawn is None: - self._handle(client_socket, address) - else: - spawn(self._handle, client_socket, address) - except: - traceback.print_exc() - ex = sys.exc_info()[1] - if self.is_fatal_error(ex): - self.kill() - sys.stderr.write('ERROR: %s failed with %s\n' % (self, str(ex) or repr(ex))) - return - try: - if address is None: - sys.stderr.write('%s: Failed.\n' % (self, )) - else: - sys.stderr.write('%s: Failed to handle request from %s\n' % (self, address, )) - except Exception: - traceback.print_exc() - if self.delay >= 0: - self.stop_accepting() - self._start_accepting_timer = core.timer(self.delay, self.start_accepting) - self.delay = min(self.max_delay, self.delay * 2) - return + @classmethod + def get_listener(self, address, backlog=None, family=None): + if backlog is None: + backlog = self.backlog + return _tcp_listener(address, backlog=backlog, reuse_addr=self.reuse_addr, family=family) - def is_fatal_error(self, ex): - return isinstance(ex, socket.error) and ex[0] in (errno.EBADF, errno.EINVAL, errno.ENOTSOCK) + def do_read(self): + try: + client_socket, address = self.socket.accept() + except _socket.error, err: + if err[0] == EWOULDBLOCK: + return + raise + return socket(_sock=client_socket), address def wrap_socket_and_handle(self, client_socket, address): # used in case of ssl sockets @@ -160,9 +103,76 @@ return self.handle(ssl_socket, address) -def _import_sslold_wrap_socket(): +class DatagramServer(BaseServer): + """A UDP server""" + + reuse_addr = DEFAULT_REUSE_ADDR + + def __init__(self, *args, **kwargs): + BaseServer.__init__(self, *args, **kwargs) + from gevent.lock import Semaphore + self._writelock = Semaphore() + + def init_socket(self): + if not hasattr(self, 'socket'): + self.socket = self.get_listener(self.address, self.family) + self.address = self.socket.getsockname() + self._socket = self.socket + try: + self._socket = self._socket._sock + except AttributeError: + pass + + @classmethod + def get_listener(self, address, family=None): + return _udp_socket(address, reuse_addr=self.reuse_addr, family=family) + + def do_read(self): + try: + data, address = self._socket.recvfrom(8192) + except _socket.error, err: + if err[0] == EWOULDBLOCK: + return + raise + return data, address + + def sendto(self, *args): + self._writelock.acquire() + try: + self.socket.sendto(*args) + finally: + self._writelock.release() + + +def _tcp_listener(address, backlog=50, reuse_addr=None, family=_socket.AF_INET): + """A shortcut to create a TCP socket, bind it and put it into listening state.""" + sock = socket(family=family) + if reuse_addr is not None: + sock.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, reuse_addr) + try: + sock.bind(address) + except _socket.error: + ex = sys.exc_info()[1] + strerror = getattr(ex, 'strerror', None) + if strerror is not None: + ex.strerror = strerror + ': ' + repr(address) + raise + sock.listen(backlog) + sock.setblocking(0) + return sock + + +def _udp_socket(address, backlog=50, reuse_addr=None, family=_socket.AF_INET): + # we want gevent.socket.socket here + sock = socket(family=family, type=_socket.SOCK_DGRAM) + if reuse_addr is not None: + sock.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, reuse_addr) try: - from gevent.sslold import wrap_socket - return wrap_socket - except ImportError: - pass + sock.bind(address) + except _socket.error: + ex = sys.exc_info()[1] + strerror = getattr(ex, 'strerror', None) + if strerror is not None: + ex.strerror = strerror + ': ' + repr(address) + raise + return sock diff -Nru python-gevent-0.13.7/gevent/socket.py python-gevent-1.0/gevent/socket.py --- python-gevent-0.13.7/gevent/socket.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/socket.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,6 +1,6 @@ # Copyright (c) 2005-2006, Bob Ippolito # Copyright (c) 2007, Linden Research, Inc. -# Copyright (c) 2009-2010 Denis Bilenko +# Copyright (c) 2009-2012 Denis Bilenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -31,15 +31,24 @@ as well as the constants from :mod:`socket` module are imported into this module. """ +from __future__ import absolute_import + # standard functions and classes that this module re-implements in a gevent-aware way: __implements__ = ['create_connection', - 'getaddrinfo', - 'gethostbyname', 'socket', 'SocketType', 'fromfd', 'socketpair'] +__dns__ = ['getaddrinfo', + 'gethostbyname', + 'gethostbyname_ex', + 'gethostbyaddr', + 'getnameinfo', + 'getfqdn'] + +__implements__ += __dns__ + # non-standard functions that this module provides: __extensions__ = ['wait_read', 'wait_write', @@ -48,7 +57,6 @@ # standard functions and classes that this module re-imports __imports__ = ['error', 'gaierror', - 'getfqdn', 'herror', 'htonl', 'htons', @@ -75,8 +83,8 @@ import sys import time -import random -import re +from gevent.hub import get_hub, string_types, integer_types +from gevent.timeout import Timeout is_windows = sys.platform == 'win32' @@ -105,7 +113,7 @@ import _socket _realsocket = _socket.socket -__socket__ = __import__('socket') +import socket as __socket__ _fileobject = __socket__._fileobject for name in __imports__[:]: @@ -117,40 +125,33 @@ for name in __socket__.__all__: value = getattr(__socket__, name) - if isinstance(value, (int, long, basestring)): + if isinstance(value, integer_types) or isinstance(value, string_types): globals()[name] = value __imports__.append(name) del name, value -if 'inet_ntop' not in globals(): - # inet_ntop is required by our implementation of getaddrinfo - - def inet_ntop(address_family, packed_ip): - if address_family == AF_INET: - return inet_ntoa(packed_ip) - # XXX: ipv6 won't work on windows - raise NotImplementedError('inet_ntop() is not available on this platform') -# XXX: implement blocking functions that are not yet implemented - -from gevent.hub import getcurrent, get_hub -from gevent import core -from gevent import spawn -from gevent.util import wrap_errors - -_ip4_re = re.compile('^[\d\.]+$') +def wait(io, timeout=None, timeout_exc=timeout('timed out')): + """Block the current greenlet until *io* is ready. + If *timeout* is non-negative, then *timeout_exc* is raised after *timeout* second has passed. + By default *timeout_exc* is ``socket.timeout('timed out')``. -def _wait_helper(ev, evtype): - current, timeout_exc = ev.arg - if evtype & core.EV_TIMEOUT: - current.throw(timeout_exc) - else: - current.switch(ev) + If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. + """ + assert io.callback is None, 'This socket is already used by another greenlet: %r' % (io.callback, ) + if timeout is not None: + timeout = Timeout.start_new(timeout, timeout_exc) + try: + return get_hub().wait(io) + finally: + if timeout is not None: + timeout.cancel() + # rename "io" to "watcher" because wait() works with any watcher -def wait_read(fileno, timeout=None, timeout_exc=timeout('timed out'), event=None): +def wait_read(fileno, timeout=None, timeout_exc=timeout('timed out')): """Block the current greenlet until *fileno* is ready to read. If *timeout* is non-negative, then *timeout_exc* is raised after *timeout* second has passed. @@ -158,19 +159,8 @@ If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. """ - if event is None: - event = core.read_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc)) - else: - assert event.callback == _wait_helper, event.callback - assert event.arg is None, 'This event is already used by another greenlet: %r' % (event.arg, ) - event.arg = (getcurrent(), timeout_exc) - event.add(timeout) - try: - switch_result = get_hub().switch() - assert event is switch_result, 'Invalid switch into wait_read(): %r' % (switch_result, ) - finally: - event.cancel() - event.arg = None + io = get_hub().loop.io(fileno, 1) + return wait(io, timeout, timeout_exc) def wait_write(fileno, timeout=None, timeout_exc=timeout('timed out'), event=None): @@ -181,19 +171,8 @@ If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. """ - if event is None: - event = core.write_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc)) - else: - assert event.callback == _wait_helper, event.callback - assert event.arg is None, 'This event is already used by another greenlet: %r' % (event.arg, ) - event.arg = (getcurrent(), timeout_exc) - event.add(timeout) - try: - switch_result = get_hub().switch() - assert event is switch_result, 'Invalid switch into wait_write(): %r' % (switch_result, ) - finally: - event.arg = None - event.cancel() + io = get_hub().loop.io(fileno, 2) + return wait(io, timeout, timeout_exc) def wait_readwrite(fileno, timeout=None, timeout_exc=timeout('timed out'), event=None): @@ -204,53 +183,15 @@ If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. """ - if event is None: - event = core.readwrite_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc)) - else: - assert event.callback == _wait_helper, event.callback - assert event.arg is None, 'This event is already used by another greenlet: %r' % (event.arg, ) - event.arg = (getcurrent(), timeout_exc) - event.add(timeout) - try: - switch_result = get_hub().switch() - assert event is switch_result, 'Invalid switch into wait_readwrite(): %r' % (switch_result, ) - finally: - event.arg = None - event.cancel() - - -def __cancel_wait(event): - if event.pending: - arg = event.arg - if arg is not None: - arg[0].throw(error(EBADF, 'File descriptor was closed in another greenlet')) - - -def cancel_wait(event): - core.active_event(__cancel_wait, event) - - -if sys.version_info[:2] <= (2, 4): - # implement close argument to _fileobject that we require + io = get_hub().loop.io(fileno, 3) + return wait(io, timeout, timeout_exc) - realfileobject = _fileobject - class _fileobject(realfileobject): +cancel_wait_ex = error(EBADF, 'File descriptor was closed in another greenlet') - __slots__ = realfileobject.__slots__ + ['_close'] - def __init__(self, *args, **kwargs): - self._close = kwargs.pop('close', False) - realfileobject.__init__(self, *args, **kwargs) - - def close(self): - try: - if self._sock: - self.flush() - finally: - if self._close: - self._sock.close() - self._sock = None +def cancel_wait(watcher): + get_hub().cancel_wait(watcher, cancel_wait_ex) if sys.version_info[:2] < (2, 7): @@ -276,8 +217,6 @@ __getattr__ = _dummy -_delegate_methods = ("recv", "recvfrom", "recv_into", "recvfrom_into", "send", "sendto", 'sendall') - timeout_default = object() @@ -297,14 +236,11 @@ self._sock = _sock self.timeout = _socket.getdefaulttimeout() self._sock.setblocking(0) - self._read_event = core.event(core.EV_READ, self.fileno(), _wait_helper) - self._write_event = core.event(core.EV_WRITE, self.fileno(), _wait_helper) - # regarding the following, see issue #31 - # (http://code.google.com/p/gevent/issues/detail?id=31#c19) - if is_windows: - self._rw_event = core.event(core.EV_READ | core.EV_WRITE, self.fileno(), _wait_helper) - else: - self._rw_event = core.event(core.EV_WRITE, self.fileno(), _wait_helper) + fileno = self._sock.fileno() + self.hub = get_hub() + io = self.hub.loop.io + self._read_event = io(fileno, 1) + self._write_event = io(fileno, 2) def __repr__(self): return '<%s at %s %s>' % (type(self).__name__, hex(id(self)), self._formatinfo()) @@ -315,8 +251,8 @@ def _formatinfo(self): try: fileno = self.fileno() - except Exception, ex: - fileno = str(ex) + except Exception: + fileno = str(sys.exc_info()[1]) try: sockname = self.getsockname() sockname = '%s:%s' % sockname @@ -336,48 +272,70 @@ result += ' timeout=' + str(self.timeout) return result + def _get_ref(self): + return self._read_event.ref or self._write_event.ref + + def _set_ref(self, value): + self._read_event.ref = value + self._write_event.ref = value + + ref = property(_get_ref, _set_ref) + + def _wait(self, watcher, timeout_exc=timeout('timed out')): + """Block the current greenlet until *watcher* has pending events. + + If *timeout* is non-negative, then *timeout_exc* is raised after *timeout* second has passed. + By default *timeout_exc* is ``socket.timeout('timed out')``. + + If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. + """ + assert watcher.callback is None, 'This socket is already used by another greenlet: %r' % (watcher.callback, ) + if self.timeout is not None: + timeout = Timeout.start_new(self.timeout, timeout_exc, ref=False) + else: + timeout = None + try: + self.hub.wait(watcher) + finally: + if timeout is not None: + timeout.cancel() + def accept(self): sock = self._sock while True: try: client_socket, address = sock.accept() break - except error, ex: + except error: + ex = sys.exc_info()[1] if ex[0] != EWOULDBLOCK or self.timeout == 0.0: raise sys.exc_clear() - wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event) + self._wait(self._read_event) return socket(_sock=client_socket), address - def close(self): - cancel_wait(self._rw_event) - cancel_wait(self._read_event) - cancel_wait(self._write_event) + def close(self, _closedsocket=_closedsocket, cancel_wait_ex=cancel_wait_ex): + # This function should not reference any globals. See Python issue #808164. + self.hub.cancel_wait(self._read_event, cancel_wait_ex) + self.hub.cancel_wait(self._write_event, cancel_wait_ex) self._sock = _closedsocket() - dummy = self._sock._dummy - for method in _delegate_methods: - setattr(self, method, dummy) + + @property + def closed(self): + return isinstance(self._sock, _closedsocket) def connect(self, address): - if isinstance(address, tuple) and len(address) == 2: - address = gethostbyname(address[0]), address[1] if self.timeout == 0.0: return self._sock.connect(address) sock = self._sock - if self.timeout is None: - while True: - err = sock.getsockopt(SOL_SOCKET, SO_ERROR) - if err: - raise error(err, strerror(err)) - result = sock.connect_ex(address) - if not result or result == EISCONN: - break - elif (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows): - wait_readwrite(sock.fileno(), event=self._rw_event) - else: - raise error(result, strerror(result)) + if isinstance(address, tuple): + r = getaddrinfo(address[0], address[1], sock.family, sock.type, sock.proto) + address = r[0][-1] + if self.timeout is not None: + timer = Timeout.start_new(self.timeout, timeout('timed out')) else: - end = time.time() + self.timeout + timer = None + try: while True: err = sock.getsockopt(SOL_SOCKET, SO_ERROR) if err: @@ -386,21 +344,22 @@ if not result or result == EISCONN: break elif (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows): - timeleft = end - time.time() - if timeleft <= 0: - raise timeout('timed out') - wait_readwrite(sock.fileno(), timeout=timeleft, event=self._rw_event) + self._wait(self._write_event) else: raise error(result, strerror(result)) + finally: + if timer is not None: + timer.cancel() def connect_ex(self, address): try: return self.connect(address) or 0 except timeout: return EAGAIN - except error, ex: + except error: + ex = sys.exc_info()[1] if type(ex) is error: - return ex[0] + return ex.args[0] else: raise # gaierror is not silented by connect_ex @@ -412,68 +371,61 @@ return socket(_sock=self._sock) def makefile(self, mode='r', bufsize=-1): - # note that this does not inherit timeout either (intentionally, because that's - # how the standard socket behaves) - return _fileobject(self.dup(), mode, bufsize) + # Two things to look out for: + # 1) Closing the original socket object should not close the + # socket (hence creating a new instance) + # 2) The resulting fileobject must keep the timeout in order + # to be compatible with the stdlib's socket.makefile. + return _fileobject(type(self)(_sock=self), mode, bufsize) def recv(self, *args): sock = self._sock # keeping the reference so that fd is not closed during waiting while True: try: return sock.recv(*args) - except error, ex: - if ex[0] == EBADF: - return '' - if ex[0] != EWOULDBLOCK or self.timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or self.timeout == 0.0: raise # QQQ without clearing exc_info test__refcount.test_clean_exit fails sys.exc_clear() - try: - wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event) - except error, ex: - if ex[0] == EBADF: - return '' - raise + self._wait(self._read_event) def recvfrom(self, *args): sock = self._sock while True: try: return sock.recvfrom(*args) - except error, ex: - if ex[0] != EWOULDBLOCK or self.timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or self.timeout == 0.0: raise sys.exc_clear() - wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event) + self._wait(self._read_event) def recvfrom_into(self, *args): sock = self._sock while True: try: return sock.recvfrom_into(*args) - except error, ex: - if ex[0] != EWOULDBLOCK or self.timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or self.timeout == 0.0: raise sys.exc_clear() - wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event) + self._wait(self._read_event) def recv_into(self, *args): sock = self._sock while True: try: return sock.recv_into(*args) - except error, ex: - if ex[0] == EBADF: - return 0 - if ex[0] != EWOULDBLOCK or self.timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or self.timeout == 0.0: raise sys.exc_clear() - try: - wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event) - except error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._read_event) def send(self, data, flags=0, timeout=timeout_default): sock = self._sock @@ -481,27 +433,24 @@ timeout = self.timeout try: return sock.send(data, flags) - except error, ex: - if ex[0] != EWOULDBLOCK or timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or timeout == 0.0: raise sys.exc_clear() - try: - wait_write(sock.fileno(), timeout=timeout, event=self._write_event) - except error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._write_event) try: return sock.send(data, flags) - except error, ex2: - if ex2[0] == EWOULDBLOCK: + except error: + ex2 = sys.exc_info()[1] + if ex2.args[0] == EWOULDBLOCK: return 0 raise def sendall(self, data, flags=0): if isinstance(data, unicode): data = data.encode() - # this sendall is also reused by SSL subclasses (both from ssl and sslold modules), + # this sendall is also reused by gevent.ssl.SSLSocket subclass, # so it should not call self._sock methods directly if self.timeout is None: data_sent = 0 @@ -523,15 +472,17 @@ sock = self._sock try: return sock.sendto(*args) - except error, ex: - if ex[0] != EWOULDBLOCK or timeout == 0.0: + except error: + ex = sys.exc_info()[1] + if ex.args[0] != EWOULDBLOCK or timeout == 0.0: raise sys.exc_clear() - wait_write(sock.fileno(), timeout=self.timeout, event=self._write_event) + self._wait(self._write_event) try: return sock.sendto(*args) - except error, ex2: - if ex2[0] == EWOULDBLOCK: + except error: + ex2 = sys.exc_info()[1] + if ex2.args[0] == EWOULDBLOCK: return 0 raise @@ -556,14 +507,13 @@ return self.timeout def shutdown(self, how): - cancel_wait(self._rw_event) if how == 0: # SHUT_RD - cancel_wait(self._read_event) - elif how == 1: # SHUT_RW - cancel_wait(self._write_event) + self.hub.cancel_wait(self._read_event, cancel_wait_ex) + elif how == 1: # SHUT_WR + self.hub.cancel_wait(self._write_event, cancel_wait_ex) else: - cancel_wait(self._read_event) - cancel_wait(self._write_event) + self.hub.cancel_wait(self._read_event, cancel_wait_ex) + self.hub.cancel_wait(self._write_event, cancel_wait_ex) self._sock.shutdown(how) family = property(lambda self: self._sock.family, doc="the socket family") @@ -575,7 +525,7 @@ _s = ("def %s(self, *args): return self._sock.%s(*args)\n\n" "%s.__doc__ = _realsocket.%s.__doc__\n") for _m in set(__socket__._socketmethods) - set(locals()): - exec _s % (_m, _m, _m, _m) + exec (_s % (_m, _m, _m, _m)) del _m, _s SocketType = socket @@ -596,23 +546,6 @@ __implements__.remove('fromfd') -def bind_and_listen(descriptor, address=('', 0), backlog=50, reuse_addr=True): - if reuse_addr: - try: - descriptor.setsockopt(SOL_SOCKET, SO_REUSEADDR, descriptor.getsockopt(SOL_SOCKET, SO_REUSEADDR) | 1) - except error: - pass - descriptor.bind(address) - descriptor.listen(backlog) - - -def tcp_listener(address, backlog=50, reuse_addr=True): - """A shortcut to create a TCP socket, bind it and put it into listening state.""" - sock = socket() - bind_and_listen(sock, address, backlog=backlog, reuse_addr=reuse_addr) - return sock - - try: _GLOBAL_DEFAULT_TIMEOUT = __socket__._GLOBAL_DEFAULT_TIMEOUT except AttributeError: @@ -634,7 +567,7 @@ host, port = address err = None - for res in getaddrinfo(host, port, 0, SOCK_STREAM): + for res in getaddrinfo(host, port, 0 if has_ipv6 else AF_INET, SOCK_STREAM): af, socktype, proto, _canonname, sa = res sock = None try: @@ -645,8 +578,12 @@ sock.bind(source_address) sock.connect(sa) return sock - except error, ex: - err = ex + except error: + err = sys.exc_info()[1] + # without exc_clear(), if connect() fails once, the socket is referenced by the frame in exc_info + # and the next bind() fails (see test__socket.TestCreateConnection) + # that does not happen with regular sockets though, because _socket.socket.connect() is a built-in. + # this is similar to "getnameinfo loses a reference" failure in test_socket.py sys.exc_clear() if sock is not None: sock.close() @@ -656,144 +593,74 @@ raise error("getaddrinfo returns an empty list") -try: - from gevent.dns import resolve_ipv4, resolve_ipv6 -except Exception: - import traceback - traceback.print_exc() - __implements__.remove('gethostbyname') - __implements__.remove('getaddrinfo') -else: +class BlockingResolver(object): - def gethostbyname(hostname): - """:func:`socket.gethostbyname` implemented using :mod:`gevent.dns`. + def __init__(self, hub=None): + pass - Differs in the following ways: + def close(self): + pass - * raises :class:`DNSError` (a subclass of :class:`socket.gaierror`) with dns error - codes instead of standard socket error codes - * does not support ``/etc/hosts`` but calls the original :func:`socket.gethostbyname` - if *hostname* has no dots - * does not iterate through all addresses, instead picks a random one each time - """ - # TODO: this is supposed to iterate through all the addresses - # could use a global dict(hostname, iter) - # - fix these nasty hacks for localhost, ips, etc. - if not isinstance(hostname, str) or '.' not in hostname: - return _socket.gethostbyname(hostname) - if _ip4_re.match(hostname): - return hostname - if hostname == _socket.gethostname(): - return _socket.gethostbyname(hostname) - _ttl, addrs = resolve_ipv4(hostname) - return inet_ntoa(random.choice(addrs)) - - def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0, evdns_flags=0): - """*Some* approximation of :func:`socket.getaddrinfo` implemented using :mod:`gevent.dns`. - - If *host* is not a string, does not has any dots or is a numeric IP address, then - the standard :func:`socket.getaddrinfo` is called. - - Otherwise, calls :func:`resolve_ipv4` (for ``AF_INET``) or :func:`resolve_ipv6` (for ``AF_INET6``) or - both (for ``AF_UNSPEC``) and formats the result the way :func:`socket.getaddrinfo` does it. - - Differs in the following ways: - - * raises :class:`DNSError` (a subclass of :class:`gaierror`) with libevent-dns error - codes instead of standard socket error codes - * *flags* argument is ignored - * for IPv6, flow info and scope id are always 0 + for method in ['gethostbyname', + 'gethostbyname_ex', + 'getaddrinfo', + 'gethostbyaddr', + 'getnameinfo']: + locals()[method] = staticmethod(getattr(_socket, method)) - Additionally, supports *evdns_flags* keyword arguments (default ``0``) that is passed - to :mod:`dns` functions. - """ - if isinstance(host, unicode): - host = host.encode('idna') - if not isinstance(host, str) or \ - '.' not in host or \ - _ip4_re.match(host) is not None or \ - family not in (AF_UNSPEC, AF_INET, AF_INET6): - return _socket.getaddrinfo(host, port, family, socktype, proto, flags) - if isinstance(port, basestring): - try: - if socktype == 0: - try: - port = getservbyname(port, 'tcp') - socktype = SOCK_STREAM - except socket.error: - port = getservbyname(port, 'udp') - socktype = SOCK_DGRAM - elif socktype == SOCK_STREAM: - port = getservbyname(port, 'tcp') - elif socktype == SOCK_DGRAM: - port = getservbyname(port, 'udp') - else: - raise gaierror(EAI_SERVICE, 'Servname not supported for ai_socktype') - except error, ex: - if 'not found' in str(ex): - raise gaierror(EAI_SERVICE, 'Servname not supported for ai_socktype') - else: - raise gaierror(str(ex)) +def gethostbyname(hostname): + return get_hub().resolver.gethostbyname(hostname) + + +def gethostbyname_ex(hostname): + return get_hub().resolver.gethostbyname_ex(hostname) + + +def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0): + return get_hub().resolver.getaddrinfo(host, port, family, socktype, proto, flags) + + +def gethostbyaddr(ip_address): + return get_hub().resolver.gethostbyaddr(ip_address) - socktype_proto = [(SOCK_STREAM, 6), (SOCK_DGRAM, 17), (SOCK_RAW, 0)] - if socktype: - socktype_proto = [(x, y) for (x, y) in socktype_proto if socktype == x] - if proto: - socktype_proto = [(x, y) for (x, y) in socktype_proto if proto == y] - - result = [] - - if family == AF_INET: - for res in resolve_ipv4(host, evdns_flags)[1]: - sockaddr = (inet_ntop(family, res), port) - for socktype, proto in socktype_proto: - result.append((family, socktype, proto, '', sockaddr)) - elif family == AF_INET6: - for res in resolve_ipv6(host, evdns_flags)[1]: - sockaddr = (inet_ntop(family, res), port, 0, 0) - for socktype, proto in socktype_proto: - result.append((family, socktype, proto, '', sockaddr)) - else: - failure = None - job = spawn(wrap_errors(gaierror, resolve_ipv6), host, evdns_flags) - try: - try: - ipv4_res = resolve_ipv4(host, evdns_flags)[1] - except gaierror, failure: - ipv4_res = None - ipv6_res = job.get() - if isinstance(ipv6_res, gaierror): - ipv6_res = None - if failure is not None: - raise - if ipv4_res is not None: - for res in ipv4_res: - sockaddr = (inet_ntop(AF_INET, res), port) - for socktype, proto in socktype_proto: - result.append((AF_INET, socktype, proto, '', sockaddr)) - if ipv6_res is not None: - for res in ipv6_res[1]: - sockaddr = (inet_ntop(AF_INET6, res), port, 0, 0) - for socktype, proto in socktype_proto: - result.append((AF_INET6, socktype, proto, '', sockaddr)) - finally: - job.kill() - return result - # TODO libevent2 has getaddrinfo that is probably better than the hack above; should wrap that. +def getnameinfo(sockaddr, flags): + return get_hub().resolver.getnameinfo(sockaddr, flags) + + +def getfqdn(name=''): + """Get fully qualified domain name from name. + + An empty argument is interpreted as meaning the local host. + + First the hostname returned by gethostbyaddr() is checked, then + possibly existing aliases. In case no FQDN is available, hostname + from gethostname() is returned. + """ + name = name.strip() + if not name or name == '0.0.0.0': + name = gethostname() + try: + hostname, aliases, ipaddrs = gethostbyaddr(name) + except error: + pass + else: + aliases.insert(0, hostname) + for name in aliases: + if '.' in name: + break + else: + name = hostname + return name -_have_ssl = False try: from gevent.ssl import sslwrap_simple as ssl, SSLError as sslerror, SSLSocket as SSLType _have_ssl = True except ImportError: - try: - from gevent.sslold import ssl, sslerror, SSLObject as SSLType - _have_ssl = True - except ImportError: - pass + _have_ssl = False + if sys.version_info[:2] <= (2, 5) and _have_ssl: __implements__.extend(['ssl', 'sslerror', 'SSLType']) diff -Nru python-gevent-0.13.7/gevent/sslold.py python-gevent-1.0/gevent/sslold.py --- python-gevent-0.13.7/gevent/sslold.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/sslold.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -"""OpenSSL-based implementation of SSLObject. - -.. warning:: - - This module is deprecated. Use :mod:`ssl ` instead. -""" -from OpenSSL import SSL -from gevent.socket import socket, _fileobject, __socket__, error, timeout, EWOULDBLOCK -from gevent.socket import wait_read, wait_write, timeout_default -import sys - -__all__ = ['ssl', 'sslerror'] - -import warnings -warnings.warn("gevent.sslold is deprecated; use gevent.ssl instead (install ssl package from PyPI)", DeprecationWarning, stacklevel=2) - -try: - sslerror = __socket__.sslerror -except AttributeError: - - class sslerror(error): - pass - - -class SSLObject(socket): - - def __init__(self, sock, server_side=False): - socket.__init__(self, _sock=sock) - self._makefile_refs = 0 - if server_side: - self._sock.set_accept_state() - else: - self._sock.set_connect_state() - - def __getattr__(self, item): - assert item != '_sock', item - # since socket no longer implements __getattr__ let's do it here - # even though it's not good for the same reasons it was not good on socket instances - # (it confuses sublcasses) - return getattr(self._sock, item) - - def _formatinfo(self): - return socket._formatinfo(self) + ' state_string=%r' % self._sock.state_string() - - def accept(self): - sock, addr = socket.accept(self) - client = SSLObject(sock._sock, server_side=True) - client.do_handshake() - return client, addr - - def do_handshake(self): - while True: - try: - self._sock.do_handshake() - break - except SSL.WantReadError: - sys.exc_clear() - wait_read(self.fileno()) - except SSL.WantWriteError: - sys.exc_clear() - wait_write(self.fileno()) - except SSL.SysCallError, ex: - raise sslerror(SysCallError_code_mapping.get(ex.args[0], ex.args[0]), ex.args[1]) - except SSL.Error, ex: - raise sslerror(str(ex)) - - def connect(self, *args): - socket.connect(self, *args) - self.do_handshake() - - def send(self, data, flags=0, timeout=timeout_default): - if timeout is timeout_default: - timeout = self.timeout - while True: - try: - return self._sock.send(data, flags) - except SSL.WantWriteError, ex: - if self.timeout == 0.0: - raise timeout(str(ex)) - else: - sys.exc_clear() - wait_write(self.fileno(), timeout=timeout) - except SSL.WantReadError, ex: - if self.timeout == 0.0: - raise timeout(str(ex)) - else: - sys.exc_clear() - wait_read(self.fileno(), timeout=timeout) - except SSL.SysCallError, ex: - if ex[0] == -1 and data == "": - # errors when writing empty strings are expected and can be ignored - return 0 - raise sslerror(SysCallError_code_mapping.get(ex.args[0], ex.args[0]), ex.args[1]) - except SSL.Error, ex: - raise sslerror(str(ex)) - - def recv(self, buflen): - pending = self._sock.pending() - if pending: - return self._sock.recv(min(pending, buflen)) - while True: - try: - return self._sock.recv(buflen) - except SSL.WantReadError, ex: - if self.timeout == 0.0: - raise timeout(str(ex)) - else: - sys.exc_clear() - wait_read(self.fileno(), timeout=self.timeout) - except SSL.WantWriteError, ex: - if self.timeout == 0.0: - raise timeout(str(ex)) - else: - sys.exc_clear() - wait_read(self.fileno(), timeout=self.timeout) - except SSL.ZeroReturnError: - return '' - except SSL.SysCallError, ex: - raise sslerror(SysCallError_code_mapping.get(ex.args[0], ex.args[0]), ex.args[1]) - except SSL.Error, ex: - raise sslerror(str(ex)) - - def read(self, buflen=1024): - """ - NOTE: read() in SSLObject does not have the semantics of file.read - reading here until we have buflen bytes or hit EOF is an error - """ - return self.recv(buflen) - - def write(self, data): - try: - return self.sendall(data) - except SSL.Error, ex: - raise sslerror(str(ex)) - - def makefile(self, mode='r', bufsize=-1): - self._makefile_refs += 1 - return _fileobject(self, mode, bufsize, close=True) - - def close(self): - if self._makefile_refs < 1: - self._sock.shutdown() - # QQQ wait until shutdown completes? - socket.close(self) - else: - self._makefile_refs -= 1 - - -SysCallError_code_mapping = {-1: 8} - - -def ssl(sock, keyfile=None, certfile=None): - context = SSL.Context(SSL.SSLv23_METHOD) - if certfile is not None: - context.use_certificate_file(certfile) - if keyfile is not None: - context.use_privatekey_file(keyfile) - context.set_verify(SSL.VERIFY_NONE, lambda *x: True) - timeout = sock.gettimeout() - try: - sock = sock._sock - except AttributeError: - pass - connection = SSL.Connection(context, sock) - ssl_sock = SSLObject(connection) - ssl_sock.settimeout(timeout) - - try: - sock.getpeername() - except Exception: - # no, no connection yet - pass - else: - # yes, do the handshake - ssl_sock.do_handshake() - return ssl_sock - - -def wrap_socket(sock, keyfile=None, certfile=None, - server_side=None, cert_reqs=None, - ssl_version=None, ca_certs=None, - do_handshake_on_connect=None, - suppress_ragged_eofs=None): - """Create a new :class:`SSLObject` instance. - - For compatibility with :mod:`gevent.ssl` the function accepts all the arguments that :func:`gevent.ssl.wrap_socket` - accepts. However, it only understands what *sock*, *keyfile* and *certfile* mean, so it will raise - :exc:`ImportError` if you pass anything else. - """ - for arg in ['cert_reqs', 'ssl_version', 'ca_certs', 'do_handshake_on_connect', 'suppress_ragged_eofs']: - if locals()[arg] is not None: - raise TypeError('To use argument %r install ssl package: http://pypi.python.org/pypi/ssl' % arg) - return ssl(sock, keyfile=keyfile, certfile=certfile) diff -Nru python-gevent-0.13.7/gevent/ssl.py python-gevent-1.0/gevent/ssl.py --- python-gevent-0.13.7/gevent/ssl.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/ssl.py 2013-11-26 16:25:45.000000000 +0000 @@ -11,7 +11,8 @@ .. _`ssl package`: http://pypi.python.org/pypi/ssl """ -__ssl__ = __import__('ssl') +from __future__ import absolute_import +import ssl as __ssl__ try: _ssl = __ssl__._ssl @@ -20,8 +21,10 @@ import sys import errno -from gevent.socket import socket, _fileobject, wait_read, wait_write, timeout_default -from gevent.socket import error as socket_error, EBADF +from gevent.socket import socket, _fileobject, timeout_default +from gevent.socket import error as socket_error +from gevent.hub import string_types + __implements__ = ['SSLSocket', 'wrap_socket', @@ -47,7 +50,7 @@ for name in dir(__ssl__): if not name.startswith('_'): value = getattr(__ssl__, name) - if isinstance(value, (int, long, basestring, tuple)): + if isinstance(value, (int, long, tuple)) or isinstance(value, string_types): globals()[name] = value __imports__.append(name) @@ -105,30 +108,21 @@ while True: try: return self._sslobj.read(len) - except SSLError, ex: + except SSLError: + ex = sys.exc_info()[1] if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: return '' elif ex.args[0] == SSL_ERROR_WANT_READ: if self.timeout == 0.0: raise sys.exc_clear() - try: - wait_read(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorReadTimeout, event=self._read_event) - except socket_error, ex: - if ex[0] == EBADF: - return '' - raise + self._wait(self._read_event, timeout_exc=_SSLErrorReadTimeout) elif ex.args[0] == SSL_ERROR_WANT_WRITE: if self.timeout == 0.0: raise sys.exc_clear() - try: - # note: using _SSLErrorReadTimeout rather than _SSLErrorWriteTimeout below is intentional - wait_write(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorReadTimeout, event=self._write_event) - except socket_error, ex: - if ex[0] == EBADF: - return '' - raise + # note: using _SSLErrorReadTimeout rather than _SSLErrorWriteTimeout below is intentional + self._wait(self._write_event, timeout_exc=_SSLErrorReadTimeout) else: raise @@ -138,27 +132,18 @@ while True: try: return self._sslobj.write(data) - except SSLError, ex: + except SSLError: + ex = sys.exc_info()[1] if ex.args[0] == SSL_ERROR_WANT_READ: if self.timeout == 0.0: raise sys.exc_clear() - try: - wait_read(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout, event=self._read_event) - except socket_error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._read_event, timeout_exc=_SSLErrorWriteTimeout) elif ex.args[0] == SSL_ERROR_WANT_WRITE: if self.timeout == 0.0: raise sys.exc_clear() - try: - wait_write(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout, event=self._write_event) - except socket_error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._write_event, timeout_exc=_SSLErrorWriteTimeout) else: raise @@ -186,27 +171,18 @@ while True: try: v = self._sslobj.write(data) - except SSLError, x: + except SSLError: + x = sys.exc_info()[1] if x.args[0] == SSL_ERROR_WANT_READ: if self.timeout == 0.0: return 0 sys.exc_clear() - try: - wait_read(self.fileno(), timeout=timeout, event=self._read_event) - except socket_error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._read_event) elif x.args[0] == SSL_ERROR_WANT_WRITE: if self.timeout == 0.0: return 0 sys.exc_clear() - try: - wait_write(self.fileno(), timeout=timeout, event=self._write_event) - except socket_error, ex: - if ex[0] == EBADF: - return 0 - raise + self._wait(self._write_event) else: raise else: @@ -241,25 +217,21 @@ if self._sslobj: if flags != 0: raise ValueError( - "non-zero flags not allowed in calls to recv_into() on %s" % - self.__class__) + "non-zero flags not allowed in calls to recv_into() on %s" % + self.__class__) while True: try: tmp_buffer = self.read(nbytes) v = len(tmp_buffer) buffer[:v] = tmp_buffer return v - except SSLError, x: + except SSLError: + x = sys.exc_info()[1] if x.args[0] == SSL_ERROR_WANT_READ: - sys.exc_clear() if self.timeout == 0.0: raise - try: - wait_read(self.fileno(), timeout=self.timeout, event=self._read_event) - except socket_error, ex: - if ex[0] == EBADF: - return 0 - raise + sys.exc_clear() + self._wait(self._read_event) continue else: raise @@ -290,29 +262,20 @@ while True: try: return self._sslobj.shutdown() - except SSLError, ex: + except SSLError: + ex = sys.exc_info()[1] if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: return '' elif ex.args[0] == SSL_ERROR_WANT_READ: if self.timeout == 0.0: raise sys.exc_clear() - try: - wait_read(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorReadTimeout, event=self._read_event) - except socket_error, ex: - if ex[0] == EBADF: - return '' - raise + self._wait(self._read_event, timeout_exc=_SSLErrorReadTimeout) elif ex.args[0] == SSL_ERROR_WANT_WRITE: if self.timeout == 0.0: raise sys.exc_clear() - try: - wait_write(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout, event=self._write_event) - except socket_error, ex: - if ex[0] == EBADF: - return '' - raise + self._wait(self._write_event, timeout_exc=_SSLErrorWriteTimeout) else: raise @@ -340,17 +303,18 @@ while True: try: return self._sslobj.do_handshake() - except SSLError, ex: + except SSLError: + ex = sys.exc_info()[1] if ex.args[0] == SSL_ERROR_WANT_READ: if self.timeout == 0.0: raise sys.exc_clear() - wait_read(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorHandshakeTimeout, event=self._read_event) + self._wait(self._read_event, timeout_exc=_SSLErrorHandshakeTimeout) elif ex.args[0] == SSL_ERROR_WANT_WRITE: if self.timeout == 0.0: raise sys.exc_clear() - wait_write(self.fileno(), timeout=self.timeout, timeout_exc=_SSLErrorHandshakeTimeout, event=self._write_event) + self._wait(self._write_event, timeout_exc=_SSLErrorHandshakeTimeout) else: raise diff -Nru python-gevent-0.13.7/gevent/stathelper.c python-gevent-1.0/gevent/stathelper.c --- python-gevent-0.13.7/gevent/stathelper.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/stathelper.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,187 @@ +/* copied from Python-2.7.2/Modules/posixmodule.c */ +#include "structseq.h" + +#define STRUCT_STAT struct stat + +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE +#define ST_BLKSIZE_IDX 13 +#else +#define ST_BLKSIZE_IDX 12 +#endif + +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS +#define ST_BLOCKS_IDX (ST_BLKSIZE_IDX+1) +#else +#define ST_BLOCKS_IDX ST_BLKSIZE_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_RDEV +#define ST_RDEV_IDX (ST_BLOCKS_IDX+1) +#else +#define ST_RDEV_IDX ST_BLOCKS_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_FLAGS +#define ST_FLAGS_IDX (ST_RDEV_IDX+1) +#else +#define ST_FLAGS_IDX ST_RDEV_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_GEN +#define ST_GEN_IDX (ST_FLAGS_IDX+1) +#else +#define ST_GEN_IDX ST_FLAGS_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME +#define ST_BIRTHTIME_IDX (ST_GEN_IDX+1) +#else +#define ST_BIRTHTIME_IDX ST_GEN_IDX +#endif + + + +static PyObject* posixmodule = NULL; +static PyTypeObject* pStatResultType = NULL; + + +static PyObject* import_posixmodule(void) +{ + if (!posixmodule) { + posixmodule = PyImport_ImportModule("posix"); + } + return posixmodule; +} + + +static PyObject* import_StatResultType(void) +{ + PyObject* p = NULL; + if (!pStatResultType) { + PyObject* module; + module = import_posixmodule(); + if (module) { + p = PyObject_GetAttrString(module, "stat_result"); + } + } + return p; +} + +static void +fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) +{ + PyObject *fval,*ival; +#if SIZEOF_TIME_T > SIZEOF_LONG + ival = PyLong_FromLongLong((PY_LONG_LONG)sec); +#else + ival = PyInt_FromLong((long)sec); +#endif + if (!ival) + return; + fval = PyFloat_FromDouble(sec + 1e-9*nsec); + PyStructSequence_SET_ITEM(v, index, ival); + PyStructSequence_SET_ITEM(v, index+3, fval); +} + +/* pack a system stat C structure into the Python stat tuple + (used by posix_stat() and posix_fstat()) */ +static PyObject* +_pystat_fromstructstat(STRUCT_STAT *st) +{ + unsigned long ansec, mnsec, cnsec; + PyObject *v; + + PyTypeObject* StatResultType = (PyTypeObject*)import_StatResultType(); + if (StatResultType == NULL) { + return NULL; + } + + v = PyStructSequence_New(StatResultType); + if (v == NULL) + return NULL; + + PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode)); +#ifdef HAVE_LARGEFILE_SUPPORT + PyStructSequence_SET_ITEM(v, 1, + PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); +#else + PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino)); +#endif +#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) + PyStructSequence_SET_ITEM(v, 2, + PyLong_FromLongLong((PY_LONG_LONG)st->st_dev)); +#else + PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st->st_dev)); +#endif + PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink)); + PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid)); + PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid)); +#ifdef HAVE_LARGEFILE_SUPPORT + PyStructSequence_SET_ITEM(v, 6, + PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); +#else + PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size)); +#endif + +#if defined(HAVE_STAT_TV_NSEC) + ansec = st->st_atim.tv_nsec; + mnsec = st->st_mtim.tv_nsec; + cnsec = st->st_ctim.tv_nsec; +#elif defined(HAVE_STAT_TV_NSEC2) + ansec = st->st_atimespec.tv_nsec; + mnsec = st->st_mtimespec.tv_nsec; + cnsec = st->st_ctimespec.tv_nsec; +#elif defined(HAVE_STAT_NSEC) + ansec = st->st_atime_nsec; + mnsec = st->st_mtime_nsec; + cnsec = st->st_ctime_nsec; +#else + ansec = mnsec = cnsec = 0; +#endif + fill_time(v, 7, st->st_atime, ansec); + fill_time(v, 8, st->st_mtime, mnsec); + fill_time(v, 9, st->st_ctime, cnsec); + +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, + PyInt_FromLong((long)st->st_blksize)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS + PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, + PyInt_FromLong((long)st->st_blocks)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_RDEV + PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, + PyInt_FromLong((long)st->st_rdev)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_GEN + PyStructSequence_SET_ITEM(v, ST_GEN_IDX, + PyInt_FromLong((long)st->st_gen)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME + { + PyObject *val; + unsigned long bsec,bnsec; + bsec = (long)st->st_birthtime; +#ifdef HAVE_STAT_TV_NSEC2 + bnsec = st->st_birthtimespec.tv_nsec; +#else + bnsec = 0; +#endif + val = PyFloat_FromDouble(bsec + 1e-9*bnsec); + PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, + val); + } +#endif +#ifdef HAVE_STRUCT_STAT_ST_FLAGS + PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, + PyInt_FromLong((long)st->st_flags)); +#endif + + if (PyErr_Occurred()) { + Py_DECREF(v); + return NULL; + } + + return v; +} diff -Nru python-gevent-0.13.7/gevent/subprocess.py python-gevent-1.0/gevent/subprocess.py --- python-gevent-0.13.7/gevent/subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/subprocess.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,809 @@ +from __future__ import absolute_import +import sys +import os +import errno +import types +import gc +import signal +import traceback +from gevent.event import AsyncResult +from gevent.hub import get_hub, linkproxy, sleep, getcurrent +from gevent.fileobject import FileObject +from gevent.greenlet import Greenlet, joinall +spawn = Greenlet.spawn +import subprocess as __subprocess__ + + +# Standard functions and classes that this module re-implements in a gevent-aware way. +__implements__ = ['Popen', + 'call', + 'check_call', + 'check_output'] + + +# Standard functions and classes that this module re-imports. +__imports__ = ['PIPE', + 'STDOUT', + 'CalledProcessError', + # Windows: + 'CREATE_NEW_CONSOLE', + 'CREATE_NEW_PROCESS_GROUP', + 'STD_INPUT_HANDLE', + 'STD_OUTPUT_HANDLE', + 'STD_ERROR_HANDLE', + 'SW_HIDE', + 'STARTF_USESTDHANDLES', + 'STARTF_USESHOWWINDOW'] + + +__extra__ = ['MAXFD', + '_eintr_retry_call', + 'STARTUPINFO', + 'pywintypes', + 'list2cmdline', + '_subprocess', + # Python 2.5 does not have _subprocess, so we don't use it + 'WAIT_OBJECT_0', + 'WaitForSingleObject', + 'GetExitCodeProcess', + 'GetStdHandle', + 'CreatePipe', + 'DuplicateHandle', + 'GetCurrentProcess', + 'DUPLICATE_SAME_ACCESS', + 'GetModuleFileName', + 'GetVersion', + 'CreateProcess', + 'INFINITE', + 'TerminateProcess'] + + +for name in __imports__[:]: + try: + value = getattr(__subprocess__, name) + globals()[name] = value + except AttributeError: + __imports__.remove(name) + __extra__.append(name) + +if sys.version_info[:2] <= (2, 6): + __implements__.remove('check_output') + __extra__.append('check_output') + +_subprocess = getattr(__subprocess__, '_subprocess', None) +_NONE = object() + +for name in __extra__[:]: + if name in globals(): + continue + value = _NONE + try: + value = getattr(__subprocess__, name) + except AttributeError: + if _subprocess is not None: + try: + value = getattr(_subprocess, name) + except AttributeError: + pass + if value is _NONE: + __extra__.remove(name) + else: + globals()[name] = value + + +__all__ = __implements__ + __imports__ + + +mswindows = sys.platform == 'win32' +if mswindows: + import msvcrt +else: + import fcntl + import pickle + from gevent import monkey + fork = monkey.get_original('os', 'fork') + + +def call(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete, then + return the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + retcode = call(["ls", "-l"]) + """ + return Popen(*popenargs, **kwargs).wait() + + +def check_call(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete. If + the exit code was zero then return, otherwise raise + CalledProcessError. The CalledProcessError object will have the + return code in the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + check_call(["ls", "-l"]) + """ + retcode = call(*popenargs, **kwargs) + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise CalledProcessError(retcode, cmd) + return 0 + + +def check_output(*popenargs, **kwargs): + r"""Run command with arguments and return its output as a byte string. + + If the exit code was non-zero it raises a CalledProcessError. The + CalledProcessError object will have the return code in the returncode + attribute and output in the output attribute. + + The arguments are the same as for the Popen constructor. Example: + + >>> check_output(["ls", "-1", "/dev/null"]) + '/dev/null\n' + + The stdout argument is not allowed as it is used internally. + To capture standard error in the result, use stderr=STDOUT. + + >>> check_output(["/bin/sh", "-c", "echo hello world"], stderr=STDOUT) + 'hello world\n' + """ + if 'stdout' in kwargs: + raise ValueError('stdout argument not allowed, it will be overridden.') + process = Popen(stdout=PIPE, *popenargs, **kwargs) + output = process.communicate()[0] + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + ex = CalledProcessError(retcode, cmd) + # on Python 2.6 and older CalledProcessError does not accept 'output' argument + ex.output = output + raise ex + return output + + +class Popen(object): + + def __init__(self, args, bufsize=0, executable=None, + stdin=None, stdout=None, stderr=None, + preexec_fn=None, close_fds=False, shell=False, + cwd=None, env=None, universal_newlines=False, + startupinfo=None, creationflags=0, threadpool=None): + """Create new Popen instance.""" + if not isinstance(bufsize, (int, long)): + raise TypeError("bufsize must be an integer") + hub = get_hub() + + if mswindows: + if preexec_fn is not None: + raise ValueError("preexec_fn is not supported on Windows " + "platforms") + if close_fds and (stdin is not None or stdout is not None or + stderr is not None): + raise ValueError("close_fds is not supported on Windows " + "platforms if you redirect stdin/stdout/stderr") + if threadpool is None: + threadpool = hub.threadpool + self.threadpool = threadpool + self._waiting = False + else: + # POSIX + if startupinfo is not None: + raise ValueError("startupinfo is only supported on Windows " + "platforms") + if creationflags != 0: + raise ValueError("creationflags is only supported on Windows " + "platforms") + assert threadpool is None + self._loop = hub.loop + + self.stdin = None + self.stdout = None + self.stderr = None + self.pid = None + self.returncode = None + self.universal_newlines = universal_newlines + self.result = AsyncResult() + + # Input and output objects. The general principle is like + # this: + # + # Parent Child + # ------ ----- + # p2cwrite ---stdin---> p2cread + # c2pread <--stdout--- c2pwrite + # errread <--stderr--- errwrite + # + # On POSIX, the child objects are file descriptors. On + # Windows, these are Windows file handles. The parent objects + # are file descriptors on both platforms. The parent objects + # are None when not using PIPEs. The child objects are None + # when not redirecting. + + (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) = self._get_handles(stdin, stdout, stderr) + + self._execute_child(args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + if mswindows: + if p2cwrite is not None: + p2cwrite = msvcrt.open_osfhandle(p2cwrite.Detach(), 0) + if c2pread is not None: + c2pread = msvcrt.open_osfhandle(c2pread.Detach(), 0) + if errread is not None: + errread = msvcrt.open_osfhandle(errread.Detach(), 0) + + if p2cwrite is not None: + self.stdin = FileObject(p2cwrite, 'wb') + if c2pread is not None: + if universal_newlines: + self.stdout = FileObject(c2pread, 'rU') + else: + self.stdout = FileObject(c2pread, 'rb') + if errread is not None: + if universal_newlines: + self.stderr = FileObject(errread, 'rU') + else: + self.stderr = FileObject(errread, 'rb') + + def __repr__(self): + return '<%s at 0x%x pid=%r returncode=%r>' % (self.__class__.__name__, id(self), self.pid, self.returncode) + + def _on_child(self, watcher): + watcher.stop() + status = watcher.rstatus + if os.WIFSIGNALED(status): + self.returncode = -os.WTERMSIG(status) + else: + self.returncode = os.WEXITSTATUS(status) + self.result.set(self.returncode) + + def communicate(self, input=None): + """Interact with process: Send data to stdin. Read data from + stdout and stderr, until end-of-file is reached. Wait for + process to terminate. The optional input argument should be a + string to be sent to the child process, or None, if no data + should be sent to the child. + + communicate() returns a tuple (stdout, stderr).""" + greenlets = [] + if self.stdin: + greenlets.append(spawn(write_and_close, self.stdin, input)) + + if self.stdout: + stdout = spawn(self.stdout.read) + greenlets.append(stdout) + else: + stdout = None + + if self.stderr: + stderr = spawn(self.stderr.read) + greenlets.append(stderr) + else: + stderr = None + + joinall(greenlets) + + if self.stdout: + self.stdout.close() + if self.stderr: + self.stderr.close() + + self.wait() + return (None if stdout is None else stdout.value or '', + None if stderr is None else stderr.value or '') + + def poll(self): + return self._internal_poll() + + def rawlink(self, callback): + self.result.rawlink(linkproxy(callback, self)) + # XXX unlink + + if mswindows: + # + # Windows methods + # + def _get_handles(self, stdin, stdout, stderr): + """Construct and return tuple with IO objects: + p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite + """ + if stdin is None and stdout is None and stderr is None: + return (None, None, None, None, None, None) + + p2cread, p2cwrite = None, None + c2pread, c2pwrite = None, None + errread, errwrite = None, None + + if stdin is None: + p2cread = GetStdHandle(STD_INPUT_HANDLE) + if p2cread is None: + p2cread, _ = CreatePipe(None, 0) + elif stdin == PIPE: + p2cread, p2cwrite = CreatePipe(None, 0) + elif isinstance(stdin, int): + p2cread = msvcrt.get_osfhandle(stdin) + else: + # Assuming file-like object + p2cread = msvcrt.get_osfhandle(stdin.fileno()) + p2cread = self._make_inheritable(p2cread) + + if stdout is None: + c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE) + if c2pwrite is None: + _, c2pwrite = CreatePipe(None, 0) + elif stdout == PIPE: + c2pread, c2pwrite = CreatePipe(None, 0) + elif isinstance(stdout, int): + c2pwrite = msvcrt.get_osfhandle(stdout) + else: + # Assuming file-like object + c2pwrite = msvcrt.get_osfhandle(stdout.fileno()) + c2pwrite = self._make_inheritable(c2pwrite) + + if stderr is None: + errwrite = GetStdHandle(STD_ERROR_HANDLE) + if errwrite is None: + _, errwrite = CreatePipe(None, 0) + elif stderr == PIPE: + errread, errwrite = CreatePipe(None, 0) + elif stderr == STDOUT: + errwrite = c2pwrite + elif isinstance(stderr, int): + errwrite = msvcrt.get_osfhandle(stderr) + else: + # Assuming file-like object + errwrite = msvcrt.get_osfhandle(stderr.fileno()) + errwrite = self._make_inheritable(errwrite) + + return (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + def _make_inheritable(self, handle): + """Return a duplicate of handle, which is inheritable""" + return DuplicateHandle(GetCurrentProcess(), + handle, GetCurrentProcess(), 0, 1, + DUPLICATE_SAME_ACCESS) + + def _find_w9xpopen(self): + """Find and return absolut path to w9xpopen.exe""" + w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), + "w9xpopen.exe") + if not os.path.exists(w9xpopen): + # Eeek - file-not-found - possibly an embedding + # situation - see if we can locate it in sys.exec_prefix + w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix), + "w9xpopen.exe") + if not os.path.exists(w9xpopen): + raise RuntimeError("Cannot locate w9xpopen.exe, which is " + "needed for Popen to work with your " + "shell or platform.") + return w9xpopen + + def _execute_child(self, args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite): + """Execute program (MS Windows version)""" + + if not isinstance(args, types.StringTypes): + args = list2cmdline(args) + + # Process startup details + if startupinfo is None: + startupinfo = STARTUPINFO() + if None not in (p2cread, c2pwrite, errwrite): + startupinfo.dwFlags |= STARTF_USESTDHANDLES + startupinfo.hStdInput = p2cread + startupinfo.hStdOutput = c2pwrite + startupinfo.hStdError = errwrite + + if shell: + startupinfo.dwFlags |= STARTF_USESHOWWINDOW + startupinfo.wShowWindow = SW_HIDE + comspec = os.environ.get("COMSPEC", "cmd.exe") + args = '{} /c "{}"'.format(comspec, args) + if GetVersion() >= 0x80000000 or os.path.basename(comspec).lower() == "command.com": + # Win9x, or using command.com on NT. We need to + # use the w9xpopen intermediate program. For more + # information, see KB Q150956 + # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp) + w9xpopen = self._find_w9xpopen() + args = '"%s" %s' % (w9xpopen, args) + # Not passing CREATE_NEW_CONSOLE has been known to + # cause random failures on win9x. Specifically a + # dialog: "Your program accessed mem currently in + # use at xxx" and a hopeful warning about the + # stability of your system. Cost is Ctrl+C wont + # kill children. + creationflags |= CREATE_NEW_CONSOLE + + # Start the process + try: + hp, ht, pid, tid = CreateProcess(executable, args, + # no special security + None, None, + int(not close_fds), + creationflags, + env, + cwd, + startupinfo) + except pywintypes.error, e: + # Translate pywintypes.error to WindowsError, which is + # a subclass of OSError. FIXME: We should really + # translate errno using _sys_errlist (or similar), but + # how can this be done from Python? + raise WindowsError(*e.args) + finally: + # Child is launched. Close the parent's copy of those pipe + # handles that only the child should have open. You need + # to make sure that no handles to the write end of the + # output pipe are maintained in this process or else the + # pipe will not close when the child process exits and the + # ReadFile will hang. + if p2cread is not None: + p2cread.Close() + if c2pwrite is not None: + c2pwrite.Close() + if errwrite is not None: + errwrite.Close() + + # Retain the process handle, but close the thread handle + self._handle = hp + self.pid = pid + ht.Close() + + def _internal_poll(self): + """Check if child process has terminated. Returns returncode + attribute. + """ + if self.returncode is None: + if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: + self.returncode = GetExitCodeProcess(self._handle) + self.result.set(self.returncode) + return self.returncode + + def rawlink(self, callback): + if not self.result.ready() and not self._waiting: + self._waiting = True + Greenlet.spawn(self._wait) + self.result.rawlink(linkproxy(callback, self)) + # XXX unlink + + def _blocking_wait(self): + WaitForSingleObject(self._handle, INFINITE) + self.returncode = GetExitCodeProcess(self._handle) + return self.returncode + + def _wait(self): + self.threadpool.spawn(self._blocking_wait).rawlink(self.result) + + def wait(self, timeout=None): + """Wait for child process to terminate. Returns returncode + attribute.""" + if self.returncode is None: + if not self._waiting: + self._waiting = True + self._wait() + return self.result.wait(timeout=timeout) + + def send_signal(self, sig): + """Send a signal to the process + """ + if sig == signal.SIGTERM: + self.terminate() + elif sig == signal.CTRL_C_EVENT: + os.kill(self.pid, signal.CTRL_C_EVENT) + elif sig == signal.CTRL_BREAK_EVENT: + os.kill(self.pid, signal.CTRL_BREAK_EVENT) + else: + raise ValueError("Unsupported signal: {}".format(sig)) + + def terminate(self): + """Terminates the process + """ + TerminateProcess(self._handle, 1) + + kill = terminate + + else: + # + # POSIX methods + # + def _get_handles(self, stdin, stdout, stderr): + """Construct and return tuple with IO objects: + p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite + """ + p2cread, p2cwrite = None, None + c2pread, c2pwrite = None, None + errread, errwrite = None, None + + if stdin is None: + pass + elif stdin == PIPE: + p2cread, p2cwrite = self.pipe_cloexec() + elif isinstance(stdin, int): + p2cread = stdin + else: + # Assuming file-like object + p2cread = stdin.fileno() + + if stdout is None: + pass + elif stdout == PIPE: + c2pread, c2pwrite = self.pipe_cloexec() + elif isinstance(stdout, int): + c2pwrite = stdout + else: + # Assuming file-like object + c2pwrite = stdout.fileno() + + if stderr is None: + pass + elif stderr == PIPE: + errread, errwrite = self.pipe_cloexec() + elif stderr == STDOUT: + errwrite = c2pwrite + elif isinstance(stderr, int): + errwrite = stderr + else: + # Assuming file-like object + errwrite = stderr.fileno() + + return (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + def _set_cloexec_flag(self, fd, cloexec=True): + try: + cloexec_flag = fcntl.FD_CLOEXEC + except AttributeError: + cloexec_flag = 1 + + old = fcntl.fcntl(fd, fcntl.F_GETFD) + if cloexec: + fcntl.fcntl(fd, fcntl.F_SETFD, old | cloexec_flag) + else: + fcntl.fcntl(fd, fcntl.F_SETFD, old & ~cloexec_flag) + + def _remove_nonblock_flag(self, fd): + flags = fcntl.fcntl(fd, fcntl.F_GETFL) & (~os.O_NONBLOCK) + fcntl.fcntl(fd, fcntl.F_SETFL, flags) + + def pipe_cloexec(self): + """Create a pipe with FDs set CLOEXEC.""" + # Pipes' FDs are set CLOEXEC by default because we don't want them + # to be inherited by other subprocesses: the CLOEXEC flag is removed + # from the child's FDs by _dup2(), between fork() and exec(). + # This is not atomic: we would need the pipe2() syscall for that. + r, w = os.pipe() + self._set_cloexec_flag(r) + self._set_cloexec_flag(w) + return r, w + + def _close_fds(self, but): + if hasattr(os, 'closerange'): + os.closerange(3, but) + os.closerange(but + 1, MAXFD) + else: + for i in xrange(3, MAXFD): + if i == but: + continue + try: + os.close(i) + except: + pass + + def _execute_child(self, args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite): + """Execute program (POSIX version)""" + + if isinstance(args, types.StringTypes): + args = [args] + else: + args = list(args) + + if shell: + args = ["/bin/sh", "-c"] + args + if executable: + args[0] = executable + + if executable is None: + executable = args[0] + + self._loop.install_sigchld() + + # For transferring possible exec failure from child to parent + # The first char specifies the exception type: 0 means + # OSError, 1 means some other error. + errpipe_read, errpipe_write = self.pipe_cloexec() + try: + try: + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. http://bugs.python.org/issue1336 + gc.disable() + try: + self.pid = fork() + except: + if gc_was_enabled: + gc.enable() + raise + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite is not None: + os.close(p2cwrite) + if c2pread is not None: + os.close(c2pread) + if errread is not None: + os.close(errread) + os.close(errpipe_read) + + # When duping fds, if there arises a situation + # where one of the fds is either 0, 1 or 2, it + # is possible that it is overwritten (#12607). + if c2pwrite == 0: + c2pwrite = os.dup(c2pwrite) + if errwrite == 0 or errwrite == 1: + errwrite = os.dup(errwrite) + + # Dup fds for child + def _dup2(a, b): + # dup2() removes the CLOEXEC flag but + # we must do it ourselves if dup2() + # would be a no-op (issue #10806). + if a == b: + self._set_cloexec_flag(a, False) + elif a is not None: + os.dup2(a, b) + self._remove_nonblock_flag(b) + _dup2(p2cread, 0) + _dup2(c2pwrite, 1) + _dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the + # same fd more than once, or standard fds. + closed = set([None]) + for fd in [p2cread, c2pwrite, errwrite]: + if fd not in closed and fd > 2: + os.close(fd) + closed.add(fd) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + preexec_fn() + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + finally: + # Make sure that the process exits no matter what. + # The return code does not matter much as it won't be + # reported to the application + os._exit(1) + + # Parent + self._watcher = self._loop.child(self.pid) + self._watcher.start(self._on_child, self._watcher) + + if gc_was_enabled: + gc.enable() + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) + + if p2cread is not None and p2cwrite is not None: + os.close(p2cread) + if c2pwrite is not None and c2pread is not None: + os.close(c2pwrite) + if errwrite is not None and errread is not None: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising exception + errpipe_read = FileObject(errpipe_read, 'rb') + data = errpipe_read.read() + finally: + if hasattr(errpipe_read, 'close'): + errpipe_read.close() + else: + os.close(errpipe_read) + + if data != "": + self.wait() + child_exception = pickle.loads(data) + for fd in (p2cwrite, c2pread, errread): + if fd is not None: + os.close(fd) + raise child_exception + + def _handle_exitstatus(self, sts): + if os.WIFSIGNALED(sts): + self.returncode = -os.WTERMSIG(sts) + elif os.WIFEXITED(sts): + self.returncode = os.WEXITSTATUS(sts) + else: + # Should never happen + raise RuntimeError("Unknown child exit status!") + + def _internal_poll(self): + """Check if child process has terminated. Returns returncode + attribute. + """ + if self.returncode is None: + if get_hub() is not getcurrent(): + sig_pending = getattr(self._loop, 'sig_pending', True) + if sig_pending: + sleep(0.00001) + return self.returncode + + def wait(self, timeout=None): + """Wait for child process to terminate. Returns returncode + attribute.""" + return self.result.wait(timeout=timeout) + + def send_signal(self, sig): + """Send a signal to the process + """ + os.kill(self.pid, sig) + + def terminate(self): + """Terminate the process with SIGTERM + """ + self.send_signal(signal.SIGTERM) + + def kill(self): + """Kill the process with SIGKILL + """ + self.send_signal(signal.SIGKILL) + + +def write_and_close(fobj, data): + try: + if data: + fobj.write(data) + except (OSError, IOError), ex: + if ex.errno != errno.EPIPE and ex.errno != errno.EINVAL: + raise + finally: + try: + fobj.close() + except EnvironmentError: + pass diff -Nru python-gevent-0.13.7/gevent/_threading.py python-gevent-1.0/gevent/_threading.py --- python-gevent-0.13.7/gevent/_threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/_threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,508 @@ +"""A clone of threading module (version 2.7.2) that always +targets real OS threads. (Unlike 'threading' which flips between +green and OS threads based on whether the monkey patching is in effect +or not). + +This module is missing 'Thread' class, but includes 'Queue'. +""" +from Queue import Full, Empty +from collections import deque +import heapq +from time import time as _time, sleep as _sleep + +from gevent import monkey +from gevent.hub import PY3 + + +__all__ = ['Condition', + 'Event', + 'Lock', + 'RLock', + 'Semaphore', + 'BoundedSemaphore', + 'Queue', + 'local', + 'stack_size'] + + +thread_name = '_thread' if PY3 else 'thread' +start_new_thread, Lock, get_ident, local, stack_size = monkey.get_original(thread_name, [ + 'start_new_thread', 'allocate_lock', 'get_ident', '_local', 'stack_size']) + + +class RLock(object): + + def __init__(self): + self.__block = Lock() + self.__owner = None + self.__count = 0 + + def __repr__(self): + owner = self.__owner + return "<%s owner=%r count=%d>" % ( + self.__class__.__name__, owner, self.__count) + + def acquire(self, blocking=1): + me = get_ident() + if self.__owner == me: + self.__count = self.__count + 1 + return 1 + rc = self.__block.acquire(blocking) + if rc: + self.__owner = me + self.__count = 1 + return rc + + __enter__ = acquire + + def release(self): + if self.__owner != get_ident(): + raise RuntimeError("cannot release un-acquired lock") + self.__count = count = self.__count - 1 + if not count: + self.__owner = None + self.__block.release() + + def __exit__(self, t, v, tb): + self.release() + + # Internal methods used by condition variables + + def _acquire_restore(self, count_owner): + count, owner = count_owner + self.__block.acquire() + self.__count = count + self.__owner = owner + + def _release_save(self): + count = self.__count + self.__count = 0 + owner = self.__owner + self.__owner = None + self.__block.release() + return (count, owner) + + def _is_owned(self): + return self.__owner == get_ident() + + +class Condition(object): + + def __init__(self, lock=None): + if lock is None: + lock = RLock() + self.__lock = lock + # Export the lock's acquire() and release() methods + self.acquire = lock.acquire + self.release = lock.release + # If the lock defines _release_save() and/or _acquire_restore(), + # these override the default implementations (which just call + # release() and acquire() on the lock). Ditto for _is_owned(). + try: + self._release_save = lock._release_save + except AttributeError: + pass + try: + self._acquire_restore = lock._acquire_restore + except AttributeError: + pass + try: + self._is_owned = lock._is_owned + except AttributeError: + pass + self.__waiters = [] + + def __enter__(self): + return self.__lock.__enter__() + + def __exit__(self, *args): + return self.__lock.__exit__(*args) + + def __repr__(self): + return "" % (self.__lock, len(self.__waiters)) + + def _release_save(self): + self.__lock.release() # No state to save + + def _acquire_restore(self, x): + self.__lock.acquire() # Ignore saved state + + def _is_owned(self): + # Return True if lock is owned by current_thread. + # This method is called only if __lock doesn't have _is_owned(). + if self.__lock.acquire(0): + self.__lock.release() + return False + else: + return True + + def wait(self, timeout=None): + if not self._is_owned(): + raise RuntimeError("cannot wait on un-acquired lock") + waiter = Lock() + waiter.acquire() + self.__waiters.append(waiter) + saved_state = self._release_save() + try: # restore state no matter what (e.g., KeyboardInterrupt) + if timeout is None: + waiter.acquire() + else: + # Balancing act: We can't afford a pure busy loop, so we + # have to sleep; but if we sleep the whole timeout time, + # we'll be unresponsive. The scheme here sleeps very + # little at first, longer as time goes on, but never longer + # than 20 times per second (or the timeout time remaining). + endtime = _time() + timeout + delay = 0.0005 # 500 us -> initial delay of 1 ms + while True: + gotit = waiter.acquire(0) + if gotit: + break + remaining = endtime - _time() + if remaining <= 0: + break + delay = min(delay * 2, remaining, .05) + _sleep(delay) + if not gotit: + try: + self.__waiters.remove(waiter) + except ValueError: + pass + finally: + self._acquire_restore(saved_state) + + def notify(self, n=1): + if not self._is_owned(): + raise RuntimeError("cannot notify on un-acquired lock") + __waiters = self.__waiters + waiters = __waiters[:n] + if not waiters: + return + for waiter in waiters: + waiter.release() + try: + __waiters.remove(waiter) + except ValueError: + pass + + def notify_all(self): + self.notify(len(self.__waiters)) + + +class Semaphore(object): + + # After Tim Peters' semaphore class, but not quite the same (no maximum) + + def __init__(self, value=1): + if value < 0: + raise ValueError("semaphore initial value must be >= 0") + self.__cond = Condition(Lock()) + self.__value = value + + def acquire(self, blocking=1): + rc = False + self.__cond.acquire() + while self.__value == 0: + if not blocking: + break + self.__cond.wait() + else: + self.__value = self.__value - 1 + rc = True + self.__cond.release() + return rc + + __enter__ = acquire + + def release(self): + self.__cond.acquire() + self.__value = self.__value + 1 + self.__cond.notify() + self.__cond.release() + + def __exit__(self, t, v, tb): + self.release() + + +class BoundedSemaphore(Semaphore): + """Semaphore that checks that # releases is <= # acquires""" + def __init__(self, value=1): + Semaphore.__init__(self, value) + self._initial_value = value + + def release(self): + if self.Semaphore__value >= self._initial_value: + raise ValueError("Semaphore released too many times") + return Semaphore.release(self) + + +class Event(object): + + # After Tim Peters' event class (without is_posted()) + + def __init__(self): + self.__cond = Condition(Lock()) + self.__flag = False + + def _reset_internal_locks(self): + # private! called by Thread._reset_internal_locks by _after_fork() + self.__cond.__init__() + + def is_set(self): + return self.__flag + + def set(self): + self.__cond.acquire() + try: + self.__flag = True + self.__cond.notify_all() + finally: + self.__cond.release() + + def clear(self): + self.__cond.acquire() + try: + self.__flag = False + finally: + self.__cond.release() + + def wait(self, timeout=None): + self.__cond.acquire() + try: + if not self.__flag: + self.__cond.wait(timeout) + return self.__flag + finally: + self.__cond.release() + + +class Queue: + """Create a queue object with a given maximum size. + + If maxsize is <= 0, the queue size is infinite. + """ + def __init__(self, maxsize=0): + self.maxsize = maxsize + self._init(maxsize) + # mutex must be held whenever the queue is mutating. All methods + # that acquire mutex must release it before returning. mutex + # is shared between the three conditions, so acquiring and + # releasing the conditions also acquires and releases mutex. + self.mutex = Lock() + # Notify not_empty whenever an item is added to the queue; a + # thread waiting to get is notified then. + self.not_empty = Condition(self.mutex) + # Notify not_full whenever an item is removed from the queue; + # a thread waiting to put is notified then. + self.not_full = Condition(self.mutex) + # Notify all_tasks_done whenever the number of unfinished tasks + # drops to zero; thread waiting to join() is notified to resume + self.all_tasks_done = Condition(self.mutex) + self.unfinished_tasks = 0 + + def task_done(self): + """Indicate that a formerly enqueued task is complete. + + Used by Queue consumer threads. For each get() used to fetch a task, + a subsequent call to task_done() tells the queue that the processing + on the task is complete. + + If a join() is currently blocking, it will resume when all items + have been processed (meaning that a task_done() call was received + for every item that had been put() into the queue). + + Raises a ValueError if called more times than there were items + placed in the queue. + """ + self.all_tasks_done.acquire() + try: + unfinished = self.unfinished_tasks - 1 + if unfinished <= 0: + if unfinished < 0: + raise ValueError('task_done() called too many times') + self.all_tasks_done.notify_all() + self.unfinished_tasks = unfinished + finally: + self.all_tasks_done.release() + + def join(self): + """Blocks until all items in the Queue have been gotten and processed. + + The count of unfinished tasks goes up whenever an item is added to the + queue. The count goes down whenever a consumer thread calls task_done() + to indicate the item was retrieved and all work on it is complete. + + When the count of unfinished tasks drops to zero, join() unblocks. + """ + self.all_tasks_done.acquire() + try: + while self.unfinished_tasks: + self.all_tasks_done.wait() + finally: + self.all_tasks_done.release() + + def qsize(self): + """Return the approximate size of the queue (not reliable!).""" + self.mutex.acquire() + try: + return self._qsize() + finally: + self.mutex.release() + + def empty(self): + """Return True if the queue is empty, False otherwise (not reliable!).""" + self.mutex.acquire() + try: + return not self._qsize() + finally: + self.mutex.release() + + def full(self): + """Return True if the queue is full, False otherwise (not reliable!).""" + self.mutex.acquire() + try: + if self.maxsize <= 0: + return False + if self.maxsize >= self._qsize(): + return True + finally: + self.mutex.release() + + def put(self, item, block=True, timeout=None): + """Put an item into the queue. + + If optional args 'block' is true and 'timeout' is None (the default), + block if necessary until a free slot is available. If 'timeout' is + a positive number, it blocks at most 'timeout' seconds and raises + the Full exception if no free slot was available within that time. + Otherwise ('block' is false), put an item on the queue if a free slot + is immediately available, else raise the Full exception ('timeout' + is ignored in that case). + """ + self.not_full.acquire() + try: + if self.maxsize > 0: + if not block: + if self._qsize() >= self.maxsize: + raise Full + elif timeout is None: + while self._qsize() >= self.maxsize: + self.not_full.wait() + elif timeout < 0: + raise ValueError("'timeout' must be a positive number") + else: + endtime = _time() + timeout + while self._qsize() >= self.maxsize: + remaining = endtime - _time() + if remaining <= 0.0: + raise Full + self.not_full.wait(remaining) + self._put(item) + self.unfinished_tasks += 1 + self.not_empty.notify() + finally: + self.not_full.release() + + def put_nowait(self, item): + """Put an item into the queue without blocking. + + Only enqueue the item if a free slot is immediately available. + Otherwise raise the Full exception. + """ + return self.put(item, False) + + def get(self, block=True, timeout=None): + """Remove and return an item from the queue. + + If optional args 'block' is true and 'timeout' is None (the default), + block if necessary until an item is available. If 'timeout' is + a positive number, it blocks at most 'timeout' seconds and raises + the Empty exception if no item was available within that time. + Otherwise ('block' is false), return an item if one is immediately + available, else raise the Empty exception ('timeout' is ignored + in that case). + """ + self.not_empty.acquire() + try: + if not block: + if not self._qsize(): + raise Empty + elif timeout is None: + while not self._qsize(): + self.not_empty.wait() + elif timeout < 0: + raise ValueError("'timeout' must be a positive number") + else: + endtime = _time() + timeout + while not self._qsize(): + remaining = endtime - _time() + if remaining <= 0.0: + raise Empty + self.not_empty.wait(remaining) + item = self._get() + self.not_full.notify() + return item + finally: + self.not_empty.release() + + def get_nowait(self): + """Remove and return an item from the queue without blocking. + + Only get an item if one is immediately available. Otherwise + raise the Empty exception. + """ + return self.get(False) + + # Override these methods to implement other queue organizations + # (e.g. stack or priority queue). + # These will only be called with appropriate locks held + + # Initialize the queue representation + def _init(self, maxsize): + self.queue = deque() + + def _qsize(self, len=len): + return len(self.queue) + + # Put a new item in the queue + def _put(self, item): + self.queue.append(item) + + # Get an item from the queue + def _get(self): + return self.queue.popleft() + + +class PriorityQueue(Queue): + '''Variant of Queue that retrieves open entries in priority order (lowest first). + + Entries are typically tuples of the form: (priority number, data). + ''' + + def _init(self, maxsize): + self.queue = [] + + def _qsize(self, len=len): + return len(self.queue) + + def _put(self, item, heappush=heapq.heappush): + heappush(self.queue, item) + + def _get(self, heappop=heapq.heappop): + return heappop(self.queue) + + +class LifoQueue(Queue): + '''Variant of Queue that retrieves most recently added entries first.''' + + def _init(self, maxsize): + self.queue = [] + + def _qsize(self, len=len): + return len(self.queue) + + def _put(self, item): + self.queue.append(item) + + def _get(self): + return self.queue.pop() diff -Nru python-gevent-0.13.7/gevent/threading.py python-gevent-1.0/gevent/threading.py --- python-gevent-0.13.7/gevent/threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,34 @@ +from __future__ import absolute_import + + +__implements__ = ['local', + '_start_new_thread', + '_allocate_lock', + 'Lock', + '_get_ident', + '_sleep', + '_DummyThread'] + + +import threading as __threading__ +_DummyThread_ = __threading__._DummyThread +from gevent.local import local +from gevent.thread import start_new_thread as _start_new_thread, allocate_lock as _allocate_lock, get_ident as _get_ident +from gevent.hub import sleep as _sleep, getcurrent +Lock = _allocate_lock + + +def _cleanup(g): + __threading__._active.pop(id(g)) + + +class _DummyThread(_DummyThread_): + # instances of this will cleanup its own entry + # in ``threading._active`` + + def __init__(self): + _DummyThread_.__init__(self) + g = getcurrent() + rawlink = getattr(g, 'rawlink', None) + if rawlink is not None: + rawlink(_cleanup) diff -Nru python-gevent-0.13.7/gevent/threadpool.py python-gevent-1.0/gevent/threadpool.py --- python-gevent-0.13.7/gevent/threadpool.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/threadpool.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,329 @@ +# Copyright (c) 2012 Denis Bilenko. See LICENSE for details. +from __future__ import with_statement, absolute_import +import sys +import os +from gevent.hub import get_hub, getcurrent, sleep, integer_types +from gevent.event import AsyncResult +from gevent.greenlet import Greenlet +from gevent.pool import IMap, IMapUnordered +from gevent.lock import Semaphore +from gevent._threading import Lock, Queue, start_new_thread + +# XXX apply_e is ugly and must not be needed +# XXX apply() should re-raise everything + + +__all__ = ['ThreadPool', + 'ThreadResult'] + + +class ThreadPool(object): + + def __init__(self, maxsize, hub=None): + if hub is None: + hub = get_hub() + self.hub = hub + self._maxsize = 0 + self.manager = None + self.pid = os.getpid() + self.fork_watcher = hub.loop.fork(ref=False) + self._init(maxsize) + + def _set_maxsize(self, maxsize): + if not isinstance(maxsize, integer_types): + raise TypeError('maxsize must be integer: %r' % (maxsize, )) + if maxsize < 0: + raise ValueError('maxsize must not be negative: %r' % (maxsize, )) + difference = maxsize - self._maxsize + self._semaphore.counter += difference + self._maxsize = maxsize + self.adjust() + # make sure all currently blocking spawn() start unlocking if maxsize increased + self._semaphore._start_notify() + + def _get_maxsize(self): + return self._maxsize + + maxsize = property(_get_maxsize, _set_maxsize) + + def __repr__(self): + return '<%s at 0x%x %s/%s/%s>' % (self.__class__.__name__, id(self), len(self), self.size, self.maxsize) + + def __len__(self): + # XXX just do unfinished_tasks property + return self.task_queue.unfinished_tasks + + def _get_size(self): + return self._size + + def _set_size(self, size): + if size < 0: + raise ValueError('Size of the pool cannot be negative: %r' % (size, )) + if size > self._maxsize: + raise ValueError('Size of the pool cannot be bigger than maxsize: %r > %r' % (size, self._maxsize)) + if self.manager: + self.manager.kill() + while self._size < size: + self._add_thread() + delay = 0.0001 + while self._size > size: + while self._size - size > self.task_queue.unfinished_tasks: + self.task_queue.put(None) + if getcurrent() is self.hub: + break + sleep(delay) + delay = min(delay * 2, .05) + if self._size: + self.fork_watcher.start(self._on_fork) + else: + self.fork_watcher.stop() + + size = property(_get_size, _set_size) + + def _init(self, maxsize): + self._size = 0 + self._semaphore = Semaphore(1) + self._lock = Lock() + self.task_queue = Queue() + self._set_maxsize(maxsize) + + def _on_fork(self): + # fork() only leaves one thread; also screws up locks; + # let's re-create locks and threads + pid = os.getpid() + if pid != self.pid: + self.pid = pid + # Do not mix fork() and threads; since fork() only copies one thread + # all objects referenced by other threads has refcount that will never + # go down to 0. + self._init(self._maxsize) + + def join(self): + delay = 0.0005 + while self.task_queue.unfinished_tasks > 0: + sleep(delay) + delay = min(delay * 2, .05) + + def kill(self): + self.size = 0 + + def _adjust_step(self): + # if there is a possibility & necessity for adding a thread, do it + while self._size < self._maxsize and self.task_queue.unfinished_tasks > self._size: + self._add_thread() + # while the number of threads is more than maxsize, kill one + # we do not check what's already in task_queue - it could be all Nones + while self._size - self._maxsize > self.task_queue.unfinished_tasks: + self.task_queue.put(None) + if self._size: + self.fork_watcher.start(self._on_fork) + else: + self.fork_watcher.stop() + + def _adjust_wait(self): + delay = 0.0001 + while True: + self._adjust_step() + if self._size <= self._maxsize: + return + sleep(delay) + delay = min(delay * 2, .05) + + def adjust(self): + self._adjust_step() + if not self.manager and self._size > self._maxsize: + # might need to feed more Nones into the pool + self.manager = Greenlet.spawn(self._adjust_wait) + + def _add_thread(self): + with self._lock: + self._size += 1 + try: + start_new_thread(self._worker, ()) + except: + with self._lock: + self._size -= 1 + raise + + def spawn(self, func, *args, **kwargs): + while True: + semaphore = self._semaphore + semaphore.acquire() + if semaphore is self._semaphore: + break + try: + task_queue = self.task_queue + result = AsyncResult() + thread_result = ThreadResult(result, hub=self.hub) + task_queue.put((func, args, kwargs, thread_result)) + self.adjust() + # rawlink() must be the last call + result.rawlink(lambda *args: self._semaphore.release()) + # XXX this _semaphore.release() is competing for order with get() + # XXX this is not good, just make ThreadResult release the semaphore before doing anything else + except: + semaphore.release() + raise + return result + + def _decrease_size(self): + if sys is None: + return + _lock = getattr(self, '_lock', None) + if _lock is not None: + with _lock: + self._size -= 1 + + def _worker(self): + need_decrease = True + try: + while True: + task_queue = self.task_queue + task = task_queue.get() + try: + if task is None: + need_decrease = False + self._decrease_size() + # we want first to decrease size, then decrease unfinished_tasks + # otherwise, _adjust might think there's one more idle thread that + # needs to be killed + return + func, args, kwargs, result = task + try: + value = func(*args, **kwargs) + except: + exc_info = getattr(sys, 'exc_info', None) + if exc_info is None: + return + result.handle_error((self, func), exc_info()) + else: + if sys is None: + return + result.set(value) + del value + finally: + del func, args, kwargs, result, task + finally: + if sys is None: + return + task_queue.task_done() + finally: + if need_decrease: + self._decrease_size() + + # XXX apply() should re-raise error by default + # XXX because that's what builtin apply does + # XXX check gevent.pool.Pool.apply and multiprocessing.Pool.apply + def apply_e(self, expected_errors, function, args=None, kwargs=None): + if args is None: + args = () + if kwargs is None: + kwargs = {} + success, result = self.spawn(wrap_errors, expected_errors, function, args, kwargs).get() + if success: + return result + raise result + + def apply(self, func, args=None, kwds=None): + """Equivalent of the apply() builtin function. It blocks till the result is ready.""" + if args is None: + args = () + if kwds is None: + kwds = {} + return self.spawn(func, *args, **kwds).get() + + def apply_cb(self, func, args=None, kwds=None, callback=None): + result = self.apply(func, args, kwds) + if callback is not None: + callback(result) + return result + + def apply_async(self, func, args=None, kwds=None, callback=None): + """A variant of the apply() method which returns a Greenlet object. + + If callback is specified then it should be a callable which accepts a single argument. When the result becomes ready + callback is applied to it (unless the call failed).""" + if args is None: + args = () + if kwds is None: + kwds = {} + return Greenlet.spawn(self.apply_cb, func, args, kwds, callback) + + def map(self, func, iterable): + return list(self.imap(func, iterable)) + + def map_cb(self, func, iterable, callback=None): + result = self.map(func, iterable) + if callback is not None: + callback(result) + return result + + def map_async(self, func, iterable, callback=None): + """ + A variant of the map() method which returns a Greenlet object. + + If callback is specified then it should be a callable which accepts a + single argument. + """ + return Greenlet.spawn(self.map_cb, func, iterable, callback) + + def imap(self, func, iterable): + """An equivalent of itertools.imap()""" + return IMap.spawn(func, iterable, spawn=self.spawn) + + def imap_unordered(self, func, iterable): + """The same as imap() except that the ordering of the results from the + returned iterator should be considered in arbitrary order.""" + return IMapUnordered.spawn(func, iterable, spawn=self.spawn) + + +class ThreadResult(object): + + def __init__(self, receiver, hub=None): + if hub is None: + hub = get_hub() + self.receiver = receiver + self.hub = hub + self.value = None + self.context = None + self.exc_info = None + self.async = hub.loop.async() + self.async.start(self._on_async) + + def _on_async(self): + self.async.stop() + try: + if self.exc_info is not None: + try: + self.hub.handle_error(self.context, *self.exc_info) + finally: + self.exc_info = None + self.context = None + self.async = None + self.hub = None + if self.receiver is not None: + # XXX exception!!!? + self.receiver(self) + finally: + self.receiver = None + self.value = None + + def set(self, value): + self.value = value + self.async.send() + + def handle_error(self, context, exc_info): + self.context = context + self.exc_info = exc_info + self.async.send() + + # link protocol: + def successful(self): + return True + + +def wrap_errors(errors, function, args, kwargs): + try: + return True, function(*args, **kwargs) + except errors: + return False, sys.exc_info()[1] diff -Nru python-gevent-0.13.7/gevent/thread.py python-gevent-1.0/gevent/thread.py --- python-gevent-0.13.7/gevent/thread.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/thread.py 2013-11-26 16:25:45.000000000 +0000 @@ -6,21 +6,27 @@ used directly. For spawning greenlets in your applications, prefer :class:`Greenlet` class. """ +from __future__ import absolute_import +import sys __implements__ = ['allocate_lock', 'get_ident', 'exit', 'LockType', 'stack_size', - 'start_new_thread'] + 'start_new_thread', + '_local'] __imports__ = ['error'] - -__thread__ = __import__('thread') +if sys.version_info[0] <= 2: + import thread as __thread__ +else: + import _thread as __thread__ error = __thread__.error from gevent.hub import getcurrent, GreenletExit from gevent.greenlet import Greenlet -from gevent.coros import Semaphore as LockType +from gevent.lock import Semaphore as LockType +from gevent.local import local as _local def get_ident(gr=None): @@ -35,8 +41,7 @@ return get_ident(greenlet) -def allocate_lock(): - return LockType(1) +allocate_lock = LockType def exit(): @@ -59,5 +64,7 @@ __all__ = __implements__ + __imports__ +__all__.remove('_local') -# XXX interrupt_main, _local +# XXX interrupt_main +# XXX _count() diff -Nru python-gevent-0.13.7/gevent/timeout.py python-gevent-1.0/gevent/timeout.py --- python-gevent-0.13.7/gevent/timeout.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -13,8 +13,8 @@ which no switches occur, :class:`Timeout` is powerless. """ -from gevent import core -from gevent.hub import getcurrent, _NONE +import sys +from gevent.hub import getcurrent, _NONE, get_hub, string_types __all__ = ['Timeout', 'with_timeout'] @@ -83,23 +83,24 @@ raise # not my timeout """ - def __init__(self, seconds=None, exception=None): + def __init__(self, seconds=None, exception=None, ref=True, priority=-1): self.seconds = seconds self.exception = exception - self.timer = None + self.timer = get_hub().loop.timer(seconds or 0.0, ref=ref, priority=priority) def start(self): """Schedule the timeout.""" assert not self.pending, '%r is already started; to restart it, cancel it first' % self if self.seconds is None: # "fake" timeout (never expires) - self.timer = None - elif self.exception is None or self.exception is False: # timeout that raises self - self.timer = core.timer(self.seconds, getcurrent().throw, self) + pass + elif self.exception is None or self.exception is False or isinstance(self.exception, string_types): + # timeout that raises self + self.timer.start(getcurrent().throw, self) else: # regular timeout with user-provided exception - self.timer = core.timer(self.seconds, getcurrent().throw, self.exception) + self.timer.start(getcurrent().throw, self.exception) @classmethod - def start_new(cls, timeout=None, exception=None): + def start_new(cls, timeout=None, exception=None, ref=True): """Create a started :class:`Timeout`. This is a shortcut, the exact action depends on *timeout*'s type: @@ -114,22 +115,18 @@ if not timeout.pending: timeout.start() return timeout - timeout = cls(timeout, exception) + timeout = cls(timeout, exception, ref=ref) timeout.start() return timeout @property def pending(self): """Return True if the timeout is scheduled to be raised.""" - if self.timer is not None: - return self.timer.pending - else: - return False + return self.timer.pending or self.timer.active def cancel(self): """If the timeout is pending, cancel it. Otherwise, do nothing.""" - if self.timer is not None: - self.timer.cancel() + self.timer.stop() def __repr__(self): try: @@ -164,10 +161,10 @@ elif self.exception is False: return '%s second%s (silent)' % (self.seconds, suffix) else: - return '%s second%s (%s)' % (self.seconds, suffix, self.exception) + return '%s second%s: %s' % (self.seconds, suffix, self.exception) def __enter__(self): - if self.timer is None: + if not self.pending: self.start() return self @@ -191,8 +188,8 @@ try: try: return function(*args, **kwds) - except Timeout, ex: - if ex is timeout and timeout_value is not _NONE: + except Timeout: + if sys.exc_info()[1] is timeout and timeout_value is not _NONE: return timeout_value raise finally: diff -Nru python-gevent-0.13.7/gevent/util.py python-gevent-1.0/gevent/util.py --- python-gevent-0.13.7/gevent/util.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/util.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,5 +1,7 @@ # Copyright (c) 2009 Denis Bilenko. See LICENSE for details. -__all__ = ['wrap_errors', 'lazy_property'] +__all__ = ['wrap_errors'] + +import sys class wrap_errors(object): @@ -35,8 +37,8 @@ func = self.func try: return func(*args, **kwargs) - except self.errors, ex: - return ex + except self.errors: + return sys.exc_info()[1] def __str__(self): return str(self.func) @@ -46,20 +48,3 @@ def __getattr__(self, item): return getattr(self.func, item) - - -# XXX no longer used anywhere, remove it -class lazy_property(object): - '''A decorator similar to :meth:`property` that only calls the *function* once.''' - - def __init__(self, function): - import warnings - warnings.warn("gevent.util.lazy_propery is deprecated", DeprecationWarning, stacklevel=2) - self._calculate = function - - def __get__(self, obj, _=None): - if obj is None: - return self - value = self._calculate(obj) - setattr(obj, self._calculate.func_name, value) - return value diff -Nru python-gevent-0.13.7/gevent/_util.pyx python-gevent-1.0/gevent/_util.pyx --- python-gevent-0.13.7/gevent/_util.pyx 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/gevent/_util.pyx 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,16 @@ +from python cimport * +# Work around lack of absolute_import in Cython. +os = __import__('os', level=0) + +# We implement __del__s in Cython so that they are safe against signals + +def SocketAdapter__del__(self, close=os.close): + fileno = self._fileno + if fileno is not None: + self._fileno = None + if self._close: + close(fileno) + + +def noop(self): + pass diff -Nru python-gevent-0.13.7/gevent/win32util.py python-gevent-1.0/gevent/win32util.py --- python-gevent-0.13.7/gevent/win32util.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/win32util.py 2013-11-26 16:25:45.000000000 +0000 @@ -23,6 +23,7 @@ The code is taken from twisted.python.win32 module. """ +from __future__ import absolute_import import os diff -Nru python-gevent-0.13.7/gevent/wsgi.py python-gevent-1.0/gevent/wsgi.py --- python-gevent-0.13.7/gevent/wsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/gevent/wsgi.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,237 +1,4 @@ -# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. -import sys -import traceback -from urllib import unquote -from datetime import datetime -socket = __import__('socket') - -import gevent -from gevent.http import HTTPServer -from gevent.hub import GreenletExit - - -__all__ = ['WSGIServer', - 'WSGIHandler'] - - -class WSGIHandler(object): - - def __init__(self, request, server): - self.request = request - self.server = server - self.code = None - self.reason = None - self.headers = None - self.data = [] - - def start_response(self, status, headers, exc_info=None): - if not exc_info: - assert self.reason is None, 'start_response was already called' - else: - self.data = [] - code, self.reason = status.split(' ', 1) - self.code = int(code) - self.headers = headers - return self.write - - def write(self, data): - self.data.append(data) - - def end(self, env): - assert self.headers is not None, 'Application did not call start_response()' - has_content_length = False - for header, value in self.headers: - self.request.add_output_header(header, str(value)) - if header == 'Content-Length': - has_content_length = True - data = ''.join(self.data) - if not has_content_length: - self.request.add_output_header('Content-Length', str(len(data))) - - # QQQ work around bug in libevent 2.0.2 (and probably in older) - if (self.request.find_input_header('Transfer-Encoding') or '').lower() == 'chunked': - # if input is chunked, libevent assumes output chunked as well regardless - # of presence of 'Content-Length' - self.request.remove_output_header('Content-Length') - # QQQ end of work around - # QQQ when this is fixed, add version guard - - SERVER_SOFTWARE = env.get('SERVER_SOFTWARE') - if SERVER_SOFTWARE and not self.request.find_output_header('Server'): - self.request.add_output_header('Server', SERVER_SOFTWARE) - - self.request.send_reply(self.code, self.reason, data) - self.log_request(len(data)) - - def format_request(self, length='-'): - req = self.request - referer = req.find_input_header('Referer') or '-' - agent = req.find_input_header('User-Agent') or '-' - # QQQ fix datetime format - now = datetime.now().replace(microsecond=0) - args = (req.remote_host, now, req.typestr, req.uri, - req.major, req.minor, req.response_code, length, referer, agent) - return '%s - - [%s] "%s %s HTTP/%s.%s" %s %s "%s" "%s"' % args - - def log_request(self, *args): - log = self.server.log - if log: - log.write(self.format_request(*args) + '\n') - - def prepare_env(self): - req = self.request - env = self.server.get_environ() - if '?' in req.uri: - path, query = req.uri.split('?', 1) - else: - path, query = req.uri, '' - path = unquote(path) - env.update({'REQUEST_METHOD': req.typestr, - 'PATH_INFO': path, - 'QUERY_STRING': query, - 'SERVER_PROTOCOL': 'HTTP/%d.%d' % req.version, - 'REMOTE_ADDR': req.remote_host, - 'REMOTE_PORT': str(req.remote_port), - 'REQUEST_URI': req.uri, - 'wsgi.input': req.input_buffer}) - for header, value in req.get_input_headers(): - header = header.replace('-', '_').upper() - if header not in ('CONTENT_LENGTH', 'CONTENT_TYPE'): - header = 'HTTP_' + header - if header in env: - if 'COOKIE' in header: - env[header] += '; ' + value - else: - env[header] += ',' + value - else: - env[header] = value - return env - - def handle(self): - env = self.prepare_env() - try: - try: - result = self.server.application(env, self.start_response) - try: - self.data.extend(result) - finally: - if hasattr(result, 'close'): - result.close() - except GreenletExit: - self._reply500() - raise - except: - traceback.print_exc() - try: - sys.stderr.write('%s: Failed to handle request:\n request = %s\n application = %s\n\n' % - (self.server, self.request, self.server.application)) - except Exception: - pass - self._reply500() - finally: - sys.exc_clear() - if self is not None and self.code is not None: - self.end(env) - - def _reply500(self): - self.reason = None - self.start_response('500 Internal Server Error', [('Content-Type', 'text/plain')]) - self.write('Internal Server Error') - - -class WSGIServer(HTTPServer): - """A fast WSGI server based on :class:`HTTPServer`.""" - - handler_class = WSGIHandler - base_env = {'GATEWAY_INTERFACE': 'CGI/1.1', - 'SERVER_SOFTWARE': 'gevent/%d.%d Python/%d.%d' % (gevent.version_info[:2] + sys.version_info[:2]), - 'SCRIPT_NAME': '', - 'wsgi.version': (1, 0), - 'wsgi.url_scheme': 'http', - 'wsgi.multithread': False, - 'wsgi.multiprocess': False, - 'wsgi.run_once': False} - # If 'wsgi.errors' is not present in base_env, it will be set to sys.stderr - - def __init__(self, listener, application=None, backlog=None, spawn='default', log='default', handler_class=None, environ=None): - HTTPServer.__init__(self, listener, backlog=backlog, spawn=spawn) - if application is not None: - self.application = application - if handler_class is not None: - self.handler_class = handler_class - if log == 'default': - self.log = sys.stderr - else: - self.log = log - self.set_environ(environ) - - def set_environ(self, environ=None): - if environ is not None: - self.environ = environ - environ_update = getattr(self, 'environ', None) - self.environ = self.base_env.copy() - if environ_update is not None: - self.environ.update(environ_update) - if self.environ.get('wsgi.errors') is None: - self.environ['wsgi.errors'] = sys.stderr - - def get_environ(self): - return self.environ.copy() - - def pre_start(self): - HTTPServer.pre_start(self) - if 'SERVER_NAME' not in self.environ: - self.environ['SERVER_NAME'] = socket.getfqdn(self.server_host) - self.environ.setdefault('SERVER_PORT', str(self.server_port)) - - def kill(self): - super(WSGIServer, self).kill() - self.__dict__.pop('application', None) - self.__dict__.pop('log', None) - self.__dict__.pop('environ', None) - self.__dict__.pop('handler_class', None) - - def handle(self, req): - handler = self.handler_class(req, self) - handler.handle() - - -def extract_application(filename): - import imp - import os - basename = os.path.basename(filename) - if '.' in basename: - name, suffix = basename.rsplit('.', 1) - else: - name, suffix = basename, '' - module = imp.load_module(name, open(filename), filename, (suffix, 'r', imp.PY_SOURCE)) - return module.application - - -if __name__ == '__main__': - USAGE = '''python -m gevent.wsgi [options] /path/to/myapp.wsgi -Where /path/to/myapp.wsgi is a Python script that defines "application" callable.''' - import optparse - parser = optparse.OptionParser(USAGE) - parser.add_option('-p', '--port', default='8080', type='int', help='Set listening port (default is 8080)') - parser.add_option('-i', '--interface', metavar='IP', default='127.0.0.1', help='Set listening interface (default is 127.0.0.1)') - parser.add_option('--pool', metavar='SIZE', dest='spawn', type='int', help='Maximum number of concurrent connections') - parser.add_option('--no-spawn', action='store_true', help='Do not spawn greenlets (no blocking calls)') - options, args = parser.parse_args() - if options.no_spawn is not None and options.spawn is not None: - sys.exit('Please specify either --pool or --no-spawn but not both') - if options.no_spawn: - options.spawn = None - elif options.spawn is None: - options.spawn = 'default' - if len(args) == 1: - filename = args[0] - try: - application = extract_application(filename) - except AttributeError: - sys.exit("Could not find application in %s" % filename) - server = WSGIServer((options.interface, options.port), application, spawn=options.spawn) - print 'Serving %s on %s:%s' % (filename, options.interface, options.port) - server.serve_forever() - else: - sys.stderr.write(parser.format_help()) +from gevent.pywsgi import * +import gevent.pywsgi as _pywsgi +__all__ = _pywsgi.__all__ +del _pywsgi diff -Nru python-gevent-0.13.7/gevent.egg-info/dependency_links.txt python-gevent-1.0/gevent.egg-info/dependency_links.txt --- python-gevent-0.13.7/gevent.egg-info/dependency_links.txt 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/gevent.egg-info/dependency_links.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru python-gevent-0.13.7/gevent.egg-info/PKG-INFO python-gevent-1.0/gevent.egg-info/PKG-INFO --- python-gevent-0.13.7/gevent.egg-info/PKG-INFO 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/gevent.egg-info/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -Metadata-Version: 1.0 -Name: gevent -Version: 0.13.7 -Summary: Python network library that uses greenlet and libevent for easy and scalable concurrency -Home-page: http://www.gevent.org/ -Author: Denis Bilenko -Author-email: denis.bilenko@gmail.com -License: UNKNOWN -Description: gevent_ - ======= - - .. attention:: - - New_ version of gevent uses libev_ and c-ares rather than libevent and includes all the dependencies in the release tarball. - - You can download the 1.0 beta release from `google code`_. Please give it a try. - - .. _libev: http://blog.gevent.org/2011/04/28/libev-and-libevent/ - .. _google code: http://code.google.com/p/gevent/downloads/ - .. _New: https://bitbucket.org/denis/gevent/src/tip/changelog.rst#cl-7 - - gevent_ is a Python networking library that uses greenlet_ to provide synchronous API on top of libevent_ event loop. - - Features include: - - * Fast event loop based on libevent_. - * Lightweight execution units based on greenlet_. - * Familiar API that re-uses concepts from the Python standard library. - * Cooperative sockets with ssl support. - * DNS queries performed through libevent-dns. - * Ability to use standard library and 3rd party modules written for standard blocking sockets - * Fast WSGI server based on libevent-http. - - gevent_ is `inspired by eventlet`_ but features more consistent API, simpler implementation and better performance. Read why others `use gevent`_ and check out the list of the `open source projects based on gevent`_. - - gevent_ is written and maintained by `Denis Bilenko`_ and is licensed under MIT license. - - - get gevent - ---------- - - Install Python 2.4 or newer, greenlet and libevent. - - Download the latest release from `Python Package Index`_ or clone `the repository`_. - - Read the documentation online at http://www.gevent.org - - Post feedback and issues on the `bug tracker`_, `mailing list`_, blog_ and `twitter (@gevent)`_. - - - .. _gevent: http://www.gevent.org - .. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html - .. _libevent: http://monkey.org/~provos/libevent/ - .. _inspired by eventlet: http://blog.gevent.org/2010/02/27/why-gevent/ - .. _use gevent: http://groups.google.com/group/gevent/browse_thread/thread/4de9703e5dca8271 - .. _open source projects based on gevent: http://code.google.com/p/gevent/wiki/ProjectsUsingGevent - .. _Denis Bilenko: http://denisbilenko.com - .. _Python Package Index: http://pypi.python.org/pypi/gevent - .. _the repository: http://bitbucket.org/denis/gevent - .. _bug tracker: http://code.google.com/p/gevent/issues/list - .. _mailing list: http://groups.google.com/group/gevent - .. _blog: http://blog.gevent.org - .. _twitter (@gevent): http://twitter.com/gevent - - -Platform: UNKNOWN -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.4 -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows -Classifier: Topic :: Internet -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Intended Audience :: Developers -Classifier: Development Status :: 4 - Beta diff -Nru python-gevent-0.13.7/gevent.egg-info/requires.txt python-gevent-1.0/gevent.egg-info/requires.txt --- python-gevent-0.13.7/gevent.egg-info/requires.txt 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/gevent.egg-info/requires.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -greenlet \ No newline at end of file diff -Nru python-gevent-0.13.7/gevent.egg-info/SOURCES.txt python-gevent-1.0/gevent.egg-info/SOURCES.txt --- python-gevent-0.13.7/gevent.egg-info/SOURCES.txt 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/gevent.egg-info/SOURCES.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,182 +0,0 @@ -AUTHORS -LICENSE -LICENSE.pyevent -MANIFEST.in -README.rst -TODO -changelog.rst -fetch_libevent.py -setup.py -doc/Makefile -doc/community.rst -doc/conf.py -doc/contents.rst -doc/generate_rst.py -doc/gevent.core.rst -doc/gevent.event.rst -doc/gevent.hub.rst -doc/gevent.queue.rst -doc/gevent.rst -doc/intro.rst -doc/make.bat -doc/mysphinxext.py -doc/networking.rst -doc/reference.rst -doc/servers.rst -doc/synchronization.rst -doc/_templates/layout.html -examples/concurrent_download.py -examples/dns_mass_resolve.py -examples/echoserver.py -examples/geventsendfile.py -examples/httpserver.py -examples/processes.py -examples/server.crt -examples/server.key -examples/webproxy.py -examples/webpy.py -examples/wsgiserver.py -examples/wsgiserver_ssl.py -examples/webchat/README -examples/webchat/__init__.py -examples/webchat/manage.py -examples/webchat/run.py -examples/webchat/settings.py -examples/webchat/urls.py -examples/webchat/chat/__init__.py -examples/webchat/chat/views.py -examples/webchat/static/chat.css -examples/webchat/static/chat.js -examples/webchat/templates/404.html -examples/webchat/templates/500.html -examples/webchat/templates/index.html -examples/webchat/templates/message.html -gevent/__init__.py -gevent/backdoor.py -gevent/baseserver.py -gevent/core.c -gevent/core.pyx -gevent/coros.py -gevent/dns.py -gevent/evbuffer.pxi -gevent/evdns.pxi -gevent/event.py -gevent/evhttp.pxi -gevent/greenlet.py -gevent/http.py -gevent/httplib.py -gevent/hub.py -gevent/libevent.h -gevent/local.py -gevent/monkey.py -gevent/pool.py -gevent/pywsgi.py -gevent/queue.py -gevent/rawgreenlet.py -gevent/select.py -gevent/server.py -gevent/socket.py -gevent/ssl.py -gevent/sslold.py -gevent/thread.py -gevent/timeout.py -gevent/util.py -gevent/win32util.py -gevent/wsgi.py -gevent.egg-info/PKG-INFO -gevent.egg-info/SOURCES.txt -gevent.egg-info/dependency_links.txt -gevent.egg-info/requires.txt -gevent.egg-info/top_level.txt -greentest/badcert.pem -greentest/badkey.pem -greentest/bench_sendall.py -greentest/bench_sleep0.py -greentest/bench_spawn.py -greentest/greentest.py -greentest/helper.py -greentest/https_svn_python_org_root.pem -greentest/keycert.pem -greentest/lock_tests.py -greentest/mysubprocess.py -greentest/nullcert.pem -greentest/patched_test.py -greentest/patched_tests_setup.py -greentest/sha256.pem -greentest/test__all__.py -greentest/test__api.py -greentest/test__api_timeout.py -greentest/test__backdoor.py -greentest/test__benchmarks.py -greentest/test__core_active_event.py -greentest/test__dns.py -greentest/test__doctests.py -greentest/test__event.py -greentest/test__examples.py -greentest/test__exc_info.py -greentest/test__execmodules.py -greentest/test__greenio.py -greentest/test__greenlet.py -greentest/test__greenletset.py -greentest/test__greenness.py -greentest/test__http.py -greentest/test__httplib.py -greentest/test__hub.py -greentest/test__issue58.py -greentest/test__local.py -greentest/test__memleak.py -greentest/test__monkey.py -greentest/test__pool.py -greentest/test__pywsgi.py -greentest/test__queue.py -greentest/test__refcount.py -greentest/test__select.py -greentest/test__semaphore.py -greentest/test__server.py -greentest/test__server_http.py -greentest/test__server_pywsgi.py -greentest/test__server_wsgi.py -greentest/test__socket.py -greentest/test__socket_close.py -greentest/test__socket_dns.py -greentest/test__socket_errors.py -greentest/test__socket_ssl.py -greentest/test__socket_timeout.py -greentest/test__threading_patched_local.py -greentest/test__timeout.py -greentest/test__wsgi.py -greentest/test_hub_shutdown.py -greentest/test_patched_asyncore.py -greentest/test_patched_ftplib.py -greentest/test_patched_httplib.py -greentest/test_patched_httplib2.py -greentest/test_patched_httpservers.py -greentest/test_patched_queue.py -greentest/test_patched_select.py -greentest/test_patched_smtplib.py -greentest/test_patched_socket.py -greentest/test_patched_socket_ssl.py -greentest/test_patched_ssl.py -greentest/test_patched_telnetlib.py -greentest/test_patched_threading.py -greentest/test_patched_threading_local.py -greentest/test_patched_timeout.py -greentest/test_patched_urllib.py -greentest/test_patched_urllib2.py -greentest/test_patched_urllib2_localnet.py -greentest/test_patched_urllib2net.py -greentest/test_patched_wsgiref.py -greentest/test_queue.py -greentest/test_server.crt -greentest/test_server.key -greentest/test_socketserver.py -greentest/test_ssl.py -greentest/test_support.py -greentest/test_thread.py -greentest/test_threading_2.py -greentest/test_threading_local.py -greentest/testrunner.py -greentest/update_patched_tests.py -greentest/wrongcert.pem -greentest/xtest__server_close.py -greentest/xtest_pep8.py \ No newline at end of file diff -Nru python-gevent-0.13.7/gevent.egg-info/top_level.txt python-gevent-1.0/gevent.egg-info/top_level.txt --- python-gevent-0.13.7/gevent.egg-info/top_level.txt 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/gevent.egg-info/top_level.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -gevent diff -Nru python-gevent-0.13.7/greentest/2.5/test_httplib.py python-gevent-1.0/greentest/2.5/test_httplib.py --- python-gevent-0.13.7/greentest/2.5/test_httplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_httplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,172 @@ +import httplib +import StringIO +import sys + +from unittest import TestCase + +from test import test_support + +class FakeSocket: + def __init__(self, text, fileclass=StringIO.StringIO): + self.text = text + self.fileclass = fileclass + + def sendall(self, data): + self.data = data + + def makefile(self, mode, bufsize=None): + if mode != 'r' and mode != 'rb': + raise httplib.UnimplementedFileMode() + return self.fileclass(self.text) + +class NoEOFStringIO(StringIO.StringIO): + """Like StringIO, but raises AssertionError on EOF. + + This is used below to test that httplib doesn't try to read + more from the underlying file than it should. + """ + def read(self, n=-1): + data = StringIO.StringIO.read(self, n) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + def readline(self, length=None): + data = StringIO.StringIO.readline(self, length) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + +class HeaderTests(TestCase): + def test_auto_headers(self): + # Some headers are added automatically, but should not be added by + # .request() if they are explicitly set. + + import httplib + + class HeaderCountingBuffer(list): + def __init__(self): + self.count = {} + def append(self, item): + kv = item.split(':') + if len(kv) > 1: + # item is a 'Key: Value' header string + lcKey = kv[0].lower() + self.count.setdefault(lcKey, 0) + self.count[lcKey] += 1 + list.append(self, item) + + for explicit_header in True, False: + for header in 'Content-length', 'Host', 'Accept-encoding': + conn = httplib.HTTPConnection('example.com') + conn.sock = FakeSocket('blahblahblah') + conn._buffer = HeaderCountingBuffer() + + body = 'spamspamspam' + headers = {} + if explicit_header: + headers[header] = str(len(body)) + conn.request('POST', '/', body, headers) + self.assertEqual(conn._buffer.count[header.lower()], 1) + +# Collect output to a buffer so that we don't have to cope with line-ending +# issues across platforms. Specifically, the headers will have \r\n pairs +# and some platforms will strip them from the output file. + +def test(): + buf = StringIO.StringIO() + _stdout = sys.stdout + try: + sys.stdout = buf + _test() + finally: + sys.stdout = _stdout + + # print individual lines with endings stripped + s = buf.getvalue() + for line in s.split("\n"): + print line.strip() + +def _test(): + # Test HTTP status lines + + body = "HTTP/1.1 200 Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock, 1) + resp.begin() + print resp.read() + resp.close() + + body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock, 1) + try: + resp.begin() + except httplib.BadStatusLine: + print "BadStatusLine raised as expected" + else: + print "Expect BadStatusLine" + + # Check invalid host_port + + for hp in ("www.python.org:abc", "www.python.org:"): + try: + h = httplib.HTTP(hp) + except httplib.InvalidURL: + print "InvalidURL raised as expected" + else: + print "Expect InvalidURL" + + for hp,h,p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), + ("www.python.org:80", "www.python.org", 80), + ("www.python.org", "www.python.org", 80), + ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): + try: + http = httplib.HTTP(hp) + except httplib.InvalidURL: + print "InvalidURL raised erroneously" + c = http._conn + if h != c.host: raise AssertionError, ("Host incorrectly parsed", h, c.host) + if p != c.port: raise AssertionError, ("Port incorrectly parsed", p, c.host) + + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s, 1) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + raise AssertionError, "multiple headers not combined properly" + + # Test that the library doesn't attempt to read any data + # from a HEAD request. (Tickles SF bug #622042.) + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 14432\r\n' + '\r\n', + NoEOFStringIO) + resp = httplib.HTTPResponse(sock, 1, method="HEAD") + resp.begin() + if resp.read() != "": + raise AssertionError, "Did not expect response from HEAD request" + resp.close() + + +class OfflineTest(TestCase): + def test_responses(self): + self.assertEquals(httplib.responses[httplib.NOT_FOUND], "Not Found") + +def test_main(verbose=None): + tests = [HeaderTests,OfflineTest] + test_support.run_unittest(*tests) + +test() diff -Nru python-gevent-0.13.7/greentest/2.5/test_queue.py python-gevent-1.0/greentest/2.5/test_queue.py --- python-gevent-0.13.7/greentest/2.5/test_queue.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,281 @@ +# Some simple Queue module tests, plus some failure conditions +# to ensure the Queue locks remain stable. +import Queue +import sys +import threading +import time + +from test.test_support import verify, TestFailed, verbose + +QUEUE_SIZE = 5 + +# A thread to run a function that unclogs a blocked Queue. +class _TriggerThread(threading.Thread): + def __init__(self, fn, args): + self.fn = fn + self.args = args + self.startedEvent = threading.Event() + threading.Thread.__init__(self) + + def run(self): + # The sleep isn't necessary, but is intended to give the blocking + # function in the main thread a chance at actually blocking before + # we unclog it. But if the sleep is longer than the timeout-based + # tests wait in their blocking functions, those tests will fail. + # So we give them much longer timeout values compared to the + # sleep here (I aimed at 10 seconds for blocking functions -- + # they should never actually wait that long - they should make + # progress as soon as we call self.fn()). + time.sleep(0.1) + self.startedEvent.set() + self.fn(*self.args) + +# Execute a function that blocks, and in a separate thread, a function that +# triggers the release. Returns the result of the blocking function. +# Caution: block_func must guarantee to block until trigger_func is +# called, and trigger_func must guarantee to change queue state so that +# block_func can make enough progress to return. In particular, a +# block_func that just raises an exception regardless of whether trigger_func +# is called will lead to timing-dependent sporadic failures, and one of +# those went rarely seen but undiagnosed for years. Now block_func +# must be unexceptional. If block_func is supposed to raise an exception, +# call _doExceptionalBlockingTest() instead. +def _doBlockingTest(block_func, block_args, trigger_func, trigger_args): + t = _TriggerThread(trigger_func, trigger_args) + t.start() + result = block_func(*block_args) + # If block_func returned before our thread made the call, we failed! + if not t.startedEvent.isSet(): + raise TestFailed("blocking function '%r' appeared not to block" % + block_func) + t.join(10) # make sure the thread terminates + if t.isAlive(): + raise TestFailed("trigger function '%r' appeared to not return" % + trigger_func) + return result + +# Call this instead if block_func is supposed to raise an exception. +def _doExceptionalBlockingTest(block_func, block_args, trigger_func, + trigger_args, expected_exception_class): + t = _TriggerThread(trigger_func, trigger_args) + t.start() + try: + try: + block_func(*block_args) + except expected_exception_class: + raise + else: + raise TestFailed("expected exception of kind %r" % + expected_exception_class) + finally: + t.join(10) # make sure the thread terminates + if t.isAlive(): + raise TestFailed("trigger function '%r' appeared to not return" % + trigger_func) + if not t.startedEvent.isSet(): + raise TestFailed("trigger thread ended but event never set") + +# A Queue subclass that can provoke failure at a moment's notice :) +class FailingQueueException(Exception): + pass + +class FailingQueue(Queue.Queue): + def __init__(self, *args): + self.fail_next_put = False + self.fail_next_get = False + Queue.Queue.__init__(self, *args) + def _put(self, item): + if self.fail_next_put: + self.fail_next_put = False + raise FailingQueueException, "You Lose" + return Queue.Queue._put(self, item) + def _get(self): + if self.fail_next_get: + self.fail_next_get = False + raise FailingQueueException, "You Lose" + return Queue.Queue._get(self) + +def FailingQueueTest(q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + for i in range(QUEUE_SIZE-1): + q.put(i) + # Test a failing non-blocking put. + q.fail_next_put = True + try: + q.put("oops", block=0) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.fail_next_put = True + try: + q.put("oops", timeout=0.1) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.put("last") + verify(q.full(), "Queue should be full") + # Test a failing blocking put + q.fail_next_put = True + try: + _doBlockingTest(q.put, ("full",), q.get, ()) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + # Test a failing timeout put + q.fail_next_put = True + try: + _doExceptionalBlockingTest(q.put, ("full", True, 10), q.get, (), + FailingQueueException) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + verify(q.full(), "Queue should be full") + q.get() + verify(not q.full(), "Queue should not be full") + q.put("last") + verify(q.full(), "Queue should be full") + # Test a blocking put + _doBlockingTest( q.put, ("full",), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + verify(q.empty(), "Queue should be empty") + q.put("first") + q.fail_next_get = True + try: + q.get() + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + verify(not q.empty(), "Queue should not be empty") + q.fail_next_get = True + try: + q.get(timeout=0.1) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + verify(not q.empty(), "Queue should not be empty") + q.get() + verify(q.empty(), "Queue should be empty") + q.fail_next_get = True + try: + _doExceptionalBlockingTest(q.get, (), q.put, ('empty',), + FailingQueueException) + raise TestFailed("The queue didn't fail when it should have") + except FailingQueueException: + pass + # put succeeded, but get failed. + verify(not q.empty(), "Queue should not be empty") + q.get() + verify(q.empty(), "Queue should be empty") + +def SimpleQueueTest(q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + # I guess we better check things actually queue correctly a little :) + q.put(111) + q.put(222) + verify(q.get() == 111 and q.get() == 222, + "Didn't seem to queue the correct data!") + for i in range(QUEUE_SIZE-1): + q.put(i) + verify(not q.empty(), "Queue should not be empty") + verify(not q.full(), "Queue should not be full") + q.put("last") + verify(q.full(), "Queue should be full") + try: + q.put("full", block=0) + raise TestFailed("Didn't appear to block with a full queue") + except Queue.Full: + pass + try: + q.put("full", timeout=0.01) + raise TestFailed("Didn't appear to time-out with a full queue") + except Queue.Full: + pass + # Test a blocking put + _doBlockingTest(q.put, ("full",), q.get, ()) + _doBlockingTest(q.put, ("full", True, 10), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + verify(q.empty(), "Queue should be empty") + try: + q.get(block=0) + raise TestFailed("Didn't appear to block with an empty queue") + except Queue.Empty: + pass + try: + q.get(timeout=0.01) + raise TestFailed("Didn't appear to time-out with an empty queue") + except Queue.Empty: + pass + # Test a blocking get + _doBlockingTest(q.get, (), q.put, ('empty',)) + _doBlockingTest(q.get, (True, 10), q.put, ('empty',)) + +cum = 0 +cumlock = threading.Lock() + +def worker(q): + global cum + while True: + x = q.get() + if x is None: + q.task_done() + return + cumlock.acquire() + try: + cum += x + finally: + cumlock.release() + q.task_done() + +def QueueJoinTest(q): + global cum + cum = 0 + for i in (0,1): + threading.Thread(target=worker, args=(q,)).start() + for i in xrange(100): + q.put(i) + q.join() + verify(cum==sum(range(100)), "q.join() did not block until all tasks were done") + for i in (0,1): + q.put(None) # instruct the threads to close + q.join() # verify that you can join twice + +def QueueTaskDoneTest(q): + try: + q.task_done() + except ValueError: + pass + else: + raise TestFailed("Did not detect task count going negative") + +def test(): + q = Queue.Queue() + QueueTaskDoneTest(q) + QueueJoinTest(q) + QueueJoinTest(q) + QueueTaskDoneTest(q) + + q = Queue.Queue(QUEUE_SIZE) + # Do it a couple of times on the same queue + SimpleQueueTest(q) + SimpleQueueTest(q) + if verbose: + print "Simple Queue tests seemed to work" + q = FailingQueue(QUEUE_SIZE) + FailingQueueTest(q) + FailingQueueTest(q) + if verbose: + print "Failing Queue tests seemed to work" + +test() diff -Nru python-gevent-0.13.7/greentest/2.5/test_select.py python-gevent-1.0/greentest/2.5/test_select.py --- python-gevent-0.13.7/greentest/2.5/test_select.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_select.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,70 @@ +# Testing select module +from test.test_support import verbose, reap_children +import select +import os + +# test some known error conditions +try: + rfd, wfd, xfd = select.select(1, 2, 3) +except TypeError: + pass +else: + print 'expected TypeError exception not raised' + +class Nope: + pass + +class Almost: + def fileno(self): + return 'fileno' + +try: + rfd, wfd, xfd = select.select([Nope()], [], []) +except TypeError: + pass +else: + print 'expected TypeError exception not raised' + +try: + rfd, wfd, xfd = select.select([Almost()], [], []) +except TypeError: + pass +else: + print 'expected TypeError exception not raised' + +try: + rfd, wfd, xfd = select.select([], [], [], 'not a number') +except TypeError: + pass +else: + print 'expected TypeError exception not raised' + + +def test(): + import sys + if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): + if verbose: + print "Can't test select easily on", sys.platform + return + cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done' + p = os.popen(cmd, 'r') + for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10: + if verbose: + print 'timeout =', tout + rfd, wfd, xfd = select.select([p], [], [], tout) + if (rfd, wfd, xfd) == ([], [], []): + continue + if (rfd, wfd, xfd) == ([p], [], []): + line = p.readline() + if verbose: + print repr(line) + if not line: + if verbose: + print 'EOF' + break + continue + print 'Unexpected return values from select():', rfd, wfd, xfd + p.close() + reap_children() + +test() diff -Nru python-gevent-0.13.7/greentest/2.5/test_signal.py python-gevent-1.0/greentest/2.5/test_signal.py --- python-gevent-0.13.7/greentest/2.5/test_signal.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_signal.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,167 @@ +# Test the signal module +from test.test_support import verbose, TestSkipped, TestFailed, vereq +import signal +import os, sys, time + +if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': + raise TestSkipped, "Can't test signal on %s" % sys.platform + +MAX_DURATION = 20 # Entire test should last at most 20 sec. + +if verbose: + x = '-x' +else: + x = '+x' + +pid = os.getpid() +if verbose: + print "test runner's pid is", pid + +# Shell script that will send us asynchronous signals +script = """ + ( + set %(x)s + sleep 2 + kill -HUP %(pid)d + sleep 2 + kill -USR1 %(pid)d + sleep 2 + kill -USR2 %(pid)d + ) & +""" % vars() + +a_called = b_called = False + +def handlerA(*args): + global a_called + a_called = True + if verbose: + print "handlerA invoked", args + +class HandlerBCalled(Exception): + pass + +def handlerB(*args): + global b_called + b_called = True + if verbose: + print "handlerB invoked", args + raise HandlerBCalled, args + +# Set up a child to send signals to us (the parent) after waiting long +# enough to receive the alarm. It seems we miss the alarm for some +# reason. This will hopefully stop the hangs on Tru64/Alpha. +# Alas, it doesn't. Tru64 appears to miss all the signals at times, or +# seemingly random subsets of them, and nothing done in force_test_exit +# so far has actually helped. +def force_test_exit(): + # Sigh, both imports seem necessary to avoid errors. + import os + fork_pid = os.fork() + if fork_pid: + # In parent. + return fork_pid + + # In child. + import os, time + try: + # Wait 5 seconds longer than the expected alarm to give enough + # time for the normal sequence of events to occur. This is + # just a stop-gap to try to prevent the test from hanging. + time.sleep(MAX_DURATION + 5) + print >> sys.__stdout__, ' child should not have to kill parent' + for signame in "SIGHUP", "SIGUSR1", "SIGUSR2", "SIGALRM": + os.kill(pid, getattr(signal, signame)) + print >> sys.__stdout__, " child sent", signame, "to", pid + time.sleep(1) + finally: + os._exit(0) + +# Install handlers. +hup = signal.signal(signal.SIGHUP, handlerA) +usr1 = signal.signal(signal.SIGUSR1, handlerB) +usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN) +alrm = signal.signal(signal.SIGALRM, signal.default_int_handler) + +try: + + signal.alarm(MAX_DURATION) + vereq(signal.getsignal(signal.SIGHUP), handlerA) + vereq(signal.getsignal(signal.SIGUSR1), handlerB) + vereq(signal.getsignal(signal.SIGUSR2), signal.SIG_IGN) + vereq(signal.getsignal(signal.SIGALRM), signal.default_int_handler) + + # Try to ensure this test exits even if there is some problem with alarm. + # Tru64/Alpha often hangs and is ultimately killed by the buildbot. + fork_pid = force_test_exit() + + try: + signal.getsignal(4242) + raise TestFailed('expected ValueError for invalid signal # to ' + 'getsignal()') + except ValueError: + pass + + try: + signal.signal(4242, handlerB) + raise TestFailed('expected ValueError for invalid signal # to ' + 'signal()') + except ValueError: + pass + + try: + signal.signal(signal.SIGUSR1, None) + raise TestFailed('expected TypeError for non-callable') + except TypeError: + pass + + # Launch an external script to send us signals. + # We expect the external script to: + # send HUP, which invokes handlerA to set a_called + # send USR1, which invokes handlerB to set b_called and raise + # HandlerBCalled + # send USR2, which is ignored + # + # Then we expect the alarm to go off, and its handler raises + # KeyboardInterrupt, finally getting us out of the loop. + os.system(script) + try: + print "starting pause() loop..." + while 1: + try: + if verbose: + print "call pause()..." + signal.pause() + if verbose: + print "pause() returned" + except HandlerBCalled: + if verbose: + print "HandlerBCalled exception caught" + + except KeyboardInterrupt: + if verbose: + print "KeyboardInterrupt (the alarm() went off)" + + if not a_called: + print 'HandlerA not called' + + if not b_called: + print 'HandlerB not called' + +finally: + # Forcibly kill the child we created to ping us if there was a test error. + try: + # Make sure we don't kill ourself if there was a fork error. + if fork_pid > 0: + os.kill(fork_pid, signal.SIGKILL) + except: + # If the child killed us, it has probably exited. Killing a + # non-existent process will raise an error which we don't care about. + pass + + # Restore handlers. + signal.alarm(0) # cancel alarm in case we died early + signal.signal(signal.SIGHUP, hup) + signal.signal(signal.SIGUSR1, usr1) + signal.signal(signal.SIGUSR2, usr2) + signal.signal(signal.SIGALRM, alrm) diff -Nru python-gevent-0.13.7/greentest/2.5/test_socket.py python-gevent-1.0/greentest/2.5/test_socket.py --- python-gevent-0.13.7/greentest/2.5/test_socket.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_socket.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1026 @@ +#!/usr/bin/env python + +import unittest +from test import test_support + +import socket +import select +import time +import thread, threading +import Queue +import sys +import array +from weakref import proxy +import signal + +PORT = 50007 +HOST = 'localhost' +MSG = 'Michael Gilfix was here\n' + +class SocketTCPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + global PORT + PORT = test_support.bind_port(self.serv, HOST, PORT) + self.serv.listen(1) + + def tearDown(self): + self.serv.close() + self.serv = None + +class SocketUDPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + global PORT + PORT = test_support.bind_port(self.serv, HOST, PORT) + + def tearDown(self): + self.serv.close() + self.serv = None + +class ThreadableTest: + """Threadable Test class + + The ThreadableTest class makes it easy to create a threaded + client/server pair from an existing unit test. To create a + new threaded class from an existing unit test, use multiple + inheritance: + + class NewClass (OldClass, ThreadableTest): + pass + + This class defines two new fixture functions with obvious + purposes for overriding: + + clientSetUp () + clientTearDown () + + Any new test functions within the class must then define + tests in pairs, where the test name is preceeded with a + '_' to indicate the client portion of the test. Ex: + + def testFoo(self): + # Server portion + + def _testFoo(self): + # Client portion + + Any exceptions raised by the clients during their tests + are caught and transferred to the main thread to alert + the testing framework. + + Note, the server setup function cannot call any blocking + functions that rely on the client thread during setup, + unless serverExplicityReady() is called just before + the blocking call (such as in setting up a client/server + connection and performing the accept() in setUp(). + """ + + def __init__(self): + # Swap the true setup function + self.__setUp = self.setUp + self.__tearDown = self.tearDown + self.setUp = self._setUp + self.tearDown = self._tearDown + + def serverExplicitReady(self): + """This method allows the server to explicitly indicate that + it wants the client thread to proceed. This is useful if the + server is about to execute a blocking routine that is + dependent upon the client thread during its setup routine.""" + self.server_ready.set() + + def _setUp(self): + self.server_ready = threading.Event() + self.client_ready = threading.Event() + self.done = threading.Event() + self.queue = Queue.Queue(1) + + # Do some munging to start the client test. + methodname = self.id() + i = methodname.rfind('.') + methodname = methodname[i+1:] + test_method = getattr(self, '_' + methodname) + self.client_thread = thread.start_new_thread( + self.clientRun, (test_method,)) + + self.__setUp() + if not self.server_ready.isSet(): + self.server_ready.set() + self.client_ready.wait() + + def _tearDown(self): + self.__tearDown() + self.done.wait() + + if not self.queue.empty(): + msg = self.queue.get() + self.fail(msg) + + def clientRun(self, test_func): + self.server_ready.wait() + self.client_ready.set() + self.clientSetUp() + if not callable(test_func): + raise TypeError, "test_func must be a callable function" + try: + test_func() + except Exception, strerror: + self.queue.put(strerror) + self.clientTearDown() + + def clientSetUp(self): + raise NotImplementedError, "clientSetUp must be implemented." + + def clientTearDown(self): + self.done.set() + thread.exit() + +class ThreadedTCPSocketTest(SocketTCPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketTCPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + +class ThreadedUDPSocketTest(SocketUDPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketUDPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + +class SocketConnectedTest(ThreadedTCPSocketTest): + + def __init__(self, methodName='runTest'): + ThreadedTCPSocketTest.__init__(self, methodName=methodName) + + def setUp(self): + ThreadedTCPSocketTest.setUp(self) + # Indicate explicitly we're ready for the client thread to + # proceed and then perform the blocking call to accept + self.serverExplicitReady() + conn, addr = self.serv.accept() + self.cli_conn = conn + + def tearDown(self): + self.cli_conn.close() + self.cli_conn = None + ThreadedTCPSocketTest.tearDown(self) + + def clientSetUp(self): + ThreadedTCPSocketTest.clientSetUp(self) + self.cli.connect((HOST, PORT)) + self.serv_conn = self.cli + + def clientTearDown(self): + self.serv_conn.close() + self.serv_conn = None + ThreadedTCPSocketTest.clientTearDown(self) + +class SocketPairTest(unittest.TestCase, ThreadableTest): + + def __init__(self, methodName='runTest'): + unittest.TestCase.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def setUp(self): + self.serv, self.cli = socket.socketpair() + + def tearDown(self): + self.serv.close() + self.serv = None + + def clientSetUp(self): + pass + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + + +####################################################################### +## Begin Tests + +class GeneralModuleTests(unittest.TestCase): + + def test_weakref(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + p = proxy(s) + self.assertEqual(p.fileno(), s.fileno()) + s.close() + s = None + try: + p.fileno() + except ReferenceError: + pass + else: + self.fail('Socket proxy still exists') + + def testSocketError(self): + # Testing socket module exceptions + def raise_error(*args, **kwargs): + raise socket.error + def raise_herror(*args, **kwargs): + raise socket.herror + def raise_gaierror(*args, **kwargs): + raise socket.gaierror + self.failUnlessRaises(socket.error, raise_error, + "Error raising socket exception.") + self.failUnlessRaises(socket.error, raise_herror, + "Error raising socket exception.") + self.failUnlessRaises(socket.error, raise_gaierror, + "Error raising socket exception.") + + def testCrucialConstants(self): + # Testing for mission critical constants + socket.AF_INET + socket.SOCK_STREAM + socket.SOCK_DGRAM + socket.SOCK_RAW + socket.SOCK_RDM + socket.SOCK_SEQPACKET + socket.SOL_SOCKET + socket.SO_REUSEADDR + + def testHostnameRes(self): + # Testing hostname resolution mechanisms + hostname = socket.gethostname() + try: + ip = socket.gethostbyname(hostname) + except socket.error: + # Probably name lookup wasn't set up right; skip this test + return + self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") + try: + hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + except socket.error: + # Probably a similar problem as above; skip this test + return + all_host_names = [hostname, hname] + aliases + fqhn = socket.getfqdn(ip) + if not fqhn in all_host_names: + self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) + + def testRefCountGetNameInfo(self): + # Testing reference count for getnameinfo + import sys + if hasattr(sys, "getrefcount"): + try: + # On some versions, this loses a reference + orig = sys.getrefcount(__name__) + socket.getnameinfo(__name__,0) + except SystemError: + if sys.getrefcount(__name__) <> orig: + self.fail("socket.getnameinfo loses a reference") + + def testInterpreterCrash(self): + # Making sure getnameinfo doesn't crash the interpreter + try: + # On some versions, this crashes the interpreter. + socket.getnameinfo(('x', 0, 0, 0), 0) + except socket.error: + pass + + def testNtoH(self): + # This just checks that htons etc. are their own inverse, + # when looking at the lower 16 or 32 bits. + sizes = {socket.htonl: 32, socket.ntohl: 32, + socket.htons: 16, socket.ntohs: 16} + for func, size in sizes.items(): + mask = (1L<>sys.__stderr__, \ + ' WARNING: failed to listen on port %d, trying another' % port + +tcpservers = [ForgivingTCPServer, ThreadingTCPServer] +if hasattr(os, 'fork') and os.name not in ('os2',): + tcpservers.append(ForkingTCPServer) +udpservers = [UDPServer, ThreadingUDPServer] +if hasattr(os, 'fork') and os.name not in ('os2',): + udpservers.append(ForkingUDPServer) + +if not hasattr(socket, 'AF_UNIX'): + streamservers = [] + dgramservers = [] +else: + class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass + streamservers = [UnixStreamServer, ThreadingUnixStreamServer] + if hasattr(os, 'fork') and os.name not in ('os2',): + streamservers.append(ForkingUnixStreamServer) + class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass + dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer] + if hasattr(os, 'fork') and os.name not in ('os2',): + dgramservers.append(ForkingUnixDatagramServer) + +def sloppy_cleanup(): + # See http://python.org/sf/1540386 + # We need to reap children here otherwise a child from one server + # can be left running for the next server and cause a test failure. + time.sleep(DELAY) + reap_children() + +def testall(): + testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream) + sloppy_cleanup() + testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram) + if hasattr(socket, 'AF_UNIX'): + sloppy_cleanup() + testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream) + # Alas, on Linux (at least) recvfrom() doesn't return a meaningful + # client address so this cannot work: + ##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram) + +def test_main(): + import imp + if imp.lock_held(): + # If the import lock is held, the threads will hang. + raise TestSkipped("can't run when import lock is held") + + try: + testall() + finally: + cleanup() + reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_socket_ssl.py python-gevent-1.0/greentest/2.5/test_socket_ssl.py --- python-gevent-0.13.7/greentest/2.5/test_socket_ssl.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_socket_ssl.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,131 @@ +# Test just the SSL support in the socket module, in a moderately bogus way. + +import sys +from test import test_support +import socket +import errno + +# Optionally test SSL support. This requires the 'network' resource as given +# on the regrtest command line. +skip_expected = not (test_support.is_resource_enabled('network') and + hasattr(socket, "ssl")) + +def test_basic(): + test_support.requires('network') + + import urllib + + if test_support.verbose: + print "test_basic ..." + + socket.RAND_status() + try: + socket.RAND_egd(1) + except TypeError: + pass + else: + print "didn't raise TypeError" + socket.RAND_add("this is a random string", 75.0) + + try: + f = urllib.urlopen('https://sf.net') + except IOError, exc: + if exc.errno == errno.ETIMEDOUT: + raise test_support.ResourceDenied('HTTPS connection is timing out') + else: + raise + buf = f.read() + f.close() + +def test_timeout(): + test_support.requires('network') + + def error_msg(extra_msg): + print >> sys.stderr, """\ + WARNING: an attempt to connect to %r %s, in + test_timeout. That may be legitimate, but is not the outcome we hoped + for. If this message is seen often, test_timeout should be changed to + use a more reliable address.""" % (ADDR, extra_msg) + + if test_support.verbose: + print "test_timeout ..." + + # A service which issues a welcome banner (without need to write + # anything). + ADDR = "pop.gmail.com", 995 + + s = socket.socket() + s.settimeout(30.0) + try: + s.connect(ADDR) + except socket.timeout: + error_msg('timed out') + return + except socket.error, exc: # In case connection is refused. + if exc.args[0] == errno.ECONNREFUSED: + error_msg('was refused') + return + else: + raise + + ss = socket.ssl(s) + # Read part of return welcome banner twice. + ss.read(1) + ss.read(1) + s.close() + +def test_rude_shutdown(): + if test_support.verbose: + print "test_rude_shutdown ..." + + try: + import threading + except ImportError: + return + + # Some random port to connect to. + PORT = [9934] + + listener_ready = threading.Event() + listener_gone = threading.Event() + + # `listener` runs in a thread. It opens a socket listening on PORT, and + # sits in an accept() until the main thread connects. Then it rudely + # closes the socket, and sets Event `listener_gone` to let the main thread + # know the socket is gone. + def listener(): + s = socket.socket() + PORT[0] = test_support.bind_port(s, '', PORT[0]) + s.listen(5) + listener_ready.set() + s.accept() + s = None # reclaim the socket object, which also closes it + listener_gone.set() + + def connector(): + listener_ready.wait() + s = socket.socket() + s.connect(('localhost', PORT[0])) + listener_gone.wait() + try: + ssl_sock = socket.ssl(s) + except socket.sslerror: + pass + else: + raise test_support.TestFailed( + 'connecting to closed SSL socket should have failed') + + t = threading.Thread(target=listener) + t.start() + connector() + t.join() + +def test_main(): + if not hasattr(socket, "ssl"): + raise test_support.TestSkipped("socket module has no ssl support") + test_rude_shutdown() + test_basic() + test_timeout() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_subprocess.py python-gevent-1.0/greentest/2.5/test_subprocess.py --- python-gevent-0.13.7/greentest/2.5/test_subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_subprocess.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,669 @@ +import unittest +from test import test_support +import subprocess +import sys +import signal +import os +import tempfile +import time +import re + +mswindows = (sys.platform == "win32") + +# +# Depends on the following external programs: Python +# + +if mswindows: + SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), ' + 'os.O_BINARY);') +else: + SETBINARY = '' + +# In a debug build, stuff like "[6580 refs]" is printed to stderr at +# shutdown time. That frustrates tests trying to check stderr produced +# from a spawned Python process. +def remove_stderr_debug_decorations(stderr): + return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) + +class ProcessTestCase(unittest.TestCase): + def setUp(self): + # Try to minimize the number of children we have so this test + # doesn't crash on some buildbots (Alphas in particular). + if hasattr(test_support, "reap_children"): + test_support.reap_children() + + def tearDown(self): + # Try to minimize the number of children we have so this test + # doesn't crash on some buildbots (Alphas in particular). + if hasattr(test_support, "reap_children"): + test_support.reap_children() + + def mkstemp(self): + """wrapper for mkstemp, calling mktemp if mkstemp is not available""" + if hasattr(tempfile, "mkstemp"): + return tempfile.mkstemp() + else: + fname = tempfile.mktemp() + return os.open(fname, os.O_RDWR|os.O_CREAT), fname + + # + # Generic tests + # + def test_call_seq(self): + # call() function with sequence argument + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + self.assertEqual(rc, 47) + + def test_check_call_zero(self): + # check_call() function with zero return code + rc = subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(0)"]) + self.assertEqual(rc, 0) + + def test_check_call_nonzero(self): + # check_call() function with non-zero return code + try: + subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + except subprocess.CalledProcessError, e: + self.assertEqual(e.returncode, 47) + else: + self.fail("Expected CalledProcessError") + + def test_call_kwargs(self): + # call() function with keyword args + newenv = os.environ.copy() + newenv["FRUIT"] = "banana" + rc = subprocess.call([sys.executable, "-c", + 'import sys, os;' \ + 'sys.exit(os.getenv("FRUIT")=="banana")'], + env=newenv) + self.assertEqual(rc, 1) + + def test_stdin_none(self): + # .stdin is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p.wait() + self.assertEqual(p.stdin, None) + + def test_stdout_none(self): + # .stdout is None when not redirected + p = subprocess.Popen([sys.executable, "-c", + 'print " this bit of output is from a ' + 'test of stdout in a different ' + 'process ..."'], + stdin=subprocess.PIPE, stderr=subprocess.PIPE) + p.wait() + self.assertEqual(p.stdout, None) + + def test_stderr_none(self): + # .stderr is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + p.wait() + self.assertEqual(p.stderr, None) + + def test_executable(self): + p = subprocess.Popen(["somethingyoudonthave", + "-c", "import sys; sys.exit(47)"], + executable=sys.executable) + p.wait() + self.assertEqual(p.returncode, 47) + + def test_stdin_pipe(self): + # stdin redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.stdin.write("pear") + p.stdin.close() + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_filedes(self): + # stdin is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + os.write(d, "pear") + os.lseek(d, 0, 0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=d) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_fileobj(self): + # stdin is set to open file object + tf = tempfile.TemporaryFile() + tf.write("pear") + tf.seek(0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=tf) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdout_pipe(self): + # stdout redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=subprocess.PIPE) + self.assertEqual(p.stdout.read(), "orange") + + def test_stdout_filedes(self): + # stdout is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=d) + p.wait() + os.lseek(d, 0, 0) + self.assertEqual(os.read(d, 1024), "orange") + + def test_stdout_fileobj(self): + # stdout is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=tf) + p.wait() + tf.seek(0) + self.assertEqual(tf.read(), "orange") + + def test_stderr_pipe(self): + # stderr redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=subprocess.PIPE) + self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()), + "strawberry") + + def test_stderr_filedes(self): + # stderr is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=d) + p.wait() + os.lseek(d, 0, 0) + self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)), + "strawberry") + + def test_stderr_fileobj(self): + # stderr is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=tf) + p.wait() + tf.seek(0) + self.assertEqual(remove_stderr_debug_decorations(tf.read()), + "strawberry") + + def test_stdout_stderr_pipe(self): + # capture stdout and stderr to the same pipe + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' \ + 'sys.stdout.write("apple");' \ + 'sys.stdout.flush();' \ + 'sys.stderr.write("orange")'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + output = p.stdout.read() + stripped = remove_stderr_debug_decorations(output) + self.assertEqual(stripped, "appleorange") + + def test_stdout_stderr_file(self): + # capture stdout and stderr to the same open file + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' \ + 'sys.stdout.write("apple");' \ + 'sys.stdout.flush();' \ + 'sys.stderr.write("orange")'], + stdout=tf, + stderr=tf) + p.wait() + tf.seek(0) + output = tf.read() + stripped = remove_stderr_debug_decorations(output) + self.assertEqual(stripped, "appleorange") + + def test_stdout_filedes_of_stdout(self): + # stdout is set to 1 (#1531862). + cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), '.\n'))" + rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) + self.assertEquals(rc, 2) + + def test_cwd(self): + tmpdir = os.getenv("TEMP", "/tmp") + # We cannot use os.path.realpath to canonicalize the path, + # since it doesn't expand Tru64 {memb} strings. See bug 1063571. + cwd = os.getcwd() + os.chdir(tmpdir) + tmpdir = os.getcwd() + os.chdir(cwd) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getcwd())'], + stdout=subprocess.PIPE, + cwd=tmpdir) + normcase = os.path.normcase + self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir)) + + def test_env(self): + newenv = os.environ.copy() + newenv["FRUIT"] = "orange" + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read(), "orange") + + def test_communicate_stdin(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.communicate("pear") + self.assertEqual(p.returncode, 1) + + def test_communicate_stdout(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("pineapple")'], + stdout=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, "pineapple") + self.assertEqual(stderr, None) + + def test_communicate_stderr(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("pineapple")'], + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + # When running with a pydebug build, the # of references is outputted + # to stderr, so just check if stderr at least started with "pinapple" + self.assert_(stderr.startswith("pineapple")) + + def test_communicate(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stderr.write("pineapple");' \ + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate("banana") + self.assertEqual(stdout, "banana") + self.assertEqual(remove_stderr_debug_decorations(stderr), + "pineapple") + + # This test is Linux specific for simplicity to at least have + # some coverage. It is not a platform specific bug. + if os.path.isdir('/proc/%d/fd' % os.getpid()): + # Test for the fd leak reported in http://bugs.python.org/issue2791. + def test_communicate_pipe_fd_leak(self): + fd_directory = '/proc/%d/fd' % os.getpid() + num_fds_before_popen = len(os.listdir(fd_directory)) + p = subprocess.Popen([sys.executable, '-c', 'print()'], + stdout=subprocess.PIPE) + p.communicate() + num_fds_after_communicate = len(os.listdir(fd_directory)) + del p + num_fds_after_destruction = len(os.listdir(fd_directory)) + self.assertEqual(num_fds_before_popen, num_fds_after_destruction) + self.assertEqual(num_fds_before_popen, num_fds_after_communicate) + + def test_communicate_returns(self): + # communicate() should return None if no redirection is active + p = subprocess.Popen([sys.executable, "-c", + "import sys; sys.exit(47)"]) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + self.assertEqual(stderr, None) + + def test_communicate_pipe_buf(self): + # communicate() with writes larger than pipe_buf + # This test will probably deadlock rather than fail, if + # communicate() does not work properly. + x, y = os.pipe() + if mswindows: + pipe_buf = 512 + else: + pipe_buf = os.fpathconf(x, "PC_PIPE_BUF") + os.close(x) + os.close(y) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(sys.stdin.read(47));' \ + 'sys.stderr.write("xyz"*%d);' \ + 'sys.stdout.write(sys.stdin.read())' % pipe_buf], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + string_to_write = "abc"*pipe_buf + (stdout, stderr) = p.communicate(string_to_write) + self.assertEqual(stdout, string_to_write) + + def test_writes_before_communicate(self): + # stdin.write before communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + p.stdin.write("banana") + (stdout, stderr) = p.communicate("split") + self.assertEqual(stdout, "bananasplit") + self.assertEqual(remove_stderr_debug_decorations(stderr), "") + + def test_universal_newlines(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, + universal_newlines=1) + stdout = p.stdout.read() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_universal_newlines_communicate(self): + # universal newlines through communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=1) + (stdout, stderr) = p.communicate() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_no_leaking(self): + # Make sure we leak no resources + if not hasattr(test_support, "is_resource_enabled") \ + or test_support.is_resource_enabled("subprocess") and not mswindows: + max_handles = 1026 # too much for most UNIX systems + else: + max_handles = 65 + for i in range(max_handles): + p = subprocess.Popen([sys.executable, "-c", + "import sys;sys.stdout.write(sys.stdin.read())"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + data = p.communicate("lime")[0] + self.assertEqual(data, "lime") + + + def test_list2cmdline(self): + self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']), + '"a b c" d e') + self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']), + 'ab\\"c \\ d') + self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']), + 'a\\\\\\b "de fg" h') + self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']), + 'a\\\\\\"b c d') + self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']), + '"a\\\\b c" d e') + self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']), + '"a\\\\b\\ c" d e') + self.assertEqual(subprocess.list2cmdline(['ab', '']), + 'ab ""') + + + def test_poll(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(1)"]) + count = 0 + while p.poll() is None: + time.sleep(0.1) + count += 1 + # We expect that the poll loop probably went around about 10 times, + # but, based on system scheduling we can't control, it's possible + # poll() never returned None. It "should be" very rare that it + # didn't go around at least twice. + self.assert_(count >= 2) + # Subsequent invocations should just return the returncode + self.assertEqual(p.poll(), 0) + + + def test_wait(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(2)"]) + self.assertEqual(p.wait(), 0) + # Subsequent invocations should just return the returncode + self.assertEqual(p.wait(), 0) + + + def test_invalid_bufsize(self): + # an invalid type of the bufsize argument should raise + # TypeError. + try: + subprocess.Popen([sys.executable, "-c", "pass"], "orange") + except TypeError: + pass + else: + self.fail("Expected TypeError") + + # + # POSIX tests + # + if not mswindows: + def test_exceptions(self): + # catched & re-raised exceptions + try: + p = subprocess.Popen([sys.executable, "-c", ""], + cwd="/this/path/does/not/exist") + except OSError, e: + # The attribute child_traceback should contain "os.chdir" + # somewhere. + self.assertNotEqual(e.child_traceback.find("os.chdir"), -1) + else: + self.fail("Expected OSError") + + def _suppress_core_files(self): + """Try to prevent core files from being created. + Returns previous ulimit if successful, else None. + """ + try: + import resource + old_limit = resource.getrlimit(resource.RLIMIT_CORE) + resource.setrlimit(resource.RLIMIT_CORE, (0,0)) + return old_limit + except (ImportError, ValueError, resource.error): + return None + + def _unsuppress_core_files(self, old_limit): + """Return core file behavior to default.""" + if old_limit is None: + return + try: + import resource + resource.setrlimit(resource.RLIMIT_CORE, old_limit) + except (ImportError, ValueError, resource.error): + return + + def test_run_abort(self): + # returncode handles signal termination + old_limit = self._suppress_core_files() + try: + p = subprocess.Popen([sys.executable, + "-c", "import os; os.abort()"]) + finally: + self._unsuppress_core_files(old_limit) + p.wait() + self.assertEqual(-p.returncode, signal.SIGABRT) + + def test_preexec(self): + # preexec function + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + preexec_fn=lambda: os.putenv("FRUIT", "apple")) + self.assertEqual(p.stdout.read(), "apple") + + def test_args_string(self): + # args is a string + f, fname = self.mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0700) + p = subprocess.Popen(fname) + p.wait() + os.remove(fname) + self.assertEqual(p.returncode, 47) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + startupinfo=47) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + creationflags=47) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen(["echo $FRUIT"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen("echo $FRUIT", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_call_string(self): + # call() function with string argument on UNIX + f, fname = self.mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0700) + rc = subprocess.call(fname) + os.remove(fname) + self.assertEqual(rc, 47) + + + # + # Windows tests + # + if mswindows: + def test_startupinfo(self): + # startupinfo argument + # We uses hardcoded constants, because we do not want to + # depend on win32all. + STARTF_USESHOWWINDOW = 1 + SW_MAXIMIZE = 3 + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags = STARTF_USESHOWWINDOW + startupinfo.wShowWindow = SW_MAXIMIZE + # Since Python is a console process, it won't be affected + # by wShowWindow, but the argument should be silently + # ignored + subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"], + startupinfo=startupinfo) + + def test_creationflags(self): + # creationflags argument + CREATE_NEW_CONSOLE = 16 + sys.stderr.write(" a DOS box should flash briefly ...\n") + subprocess.call(sys.executable + + ' -c "import time; time.sleep(0.25)"', + creationflags=CREATE_NEW_CONSOLE) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + preexec_fn=lambda: 1) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + close_fds=True) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen(["set"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertNotEqual(p.stdout.read().find("physalis"), -1) + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen("set", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertNotEqual(p.stdout.read().find("physalis"), -1) + + def test_call_string(self): + # call() function with string argument on Windows + rc = subprocess.call(sys.executable + + ' -c "import sys; sys.exit(47)"') + self.assertEqual(rc, 47) + + +def test_main(): + test_support.run_unittest(ProcessTestCase) + if hasattr(test_support, "reap_children"): + test_support.reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_threading_local.py python-gevent-1.0/greentest/2.5/test_threading_local.py --- python-gevent-0.13.7/greentest/2.5/test_threading_local.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_threading_local.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,94 @@ +import gc +import threading +import unittest +from doctest import DocTestSuite +from test import test_support + +class ThreadingLocalTest(unittest.TestCase): + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import time + class Local(threading.local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_derived_cycle_dealloc(self): + # http://bugs.python.org/issue6990 + class Local(threading.local): + pass + locals = None + passed = [False] + e1 = threading.Event() + e2 = threading.Event() + + def f(): + # 1) Involve Local in a cycle + cycle = [Local()] + cycle.append(cycle) + cycle[0].foo = 'bar' + + # 2) GC the cycle (triggers threadmodule.c::local_clear + # before local_dealloc) + del cycle + gc.collect() + e1.set() + e2.wait() + + # 4) New Locals should be empty + passed[0] = all(not hasattr(local, 'foo') for local in locals) + + t = threading.Thread(target=f) + t.start() + e1.wait() + + # 3) New Locals should recycle the original's address. Creating + # them in the thread overwrites the thread state and avoids the + # bug + locals = [Local() for i in range(10)] + e2.set() + t.join() + + self.assertTrue(passed[0]) + + +def test_main(): + suite = DocTestSuite('_threading_local') + + try: + from thread import _local + except ImportError: + pass + else: + import _threading_local + local_orig = _threading_local.local + def setUp(test): + _threading_local.local = _local + def tearDown(test): + _threading_local.local = local_orig + suite.addTest(DocTestSuite('_threading_local', + setUp=setUp, tearDown=tearDown) + ) + suite.addTest(unittest.makeSuite(ThreadingLocalTest)) + + test_support.run_suite(suite) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_threading.py python-gevent-1.0/greentest/2.5/test_threading.py --- python-gevent-0.13.7/greentest/2.5/test_threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,311 @@ +# Very rudimentary test of threading module + +import test.test_support +from test.test_support import verbose +import random +import sys +import threading +import thread +import time +import unittest + +# A trivial mutable counter. +class Counter(object): + def __init__(self): + self.value = 0 + def inc(self): + self.value += 1 + def dec(self): + self.value -= 1 + def get(self): + return self.value + +class TestThread(threading.Thread): + def __init__(self, name, testcase, sema, mutex, nrunning): + threading.Thread.__init__(self, name=name) + self.testcase = testcase + self.sema = sema + self.mutex = mutex + self.nrunning = nrunning + + def run(self): + delay = random.random() * 2 + if verbose: + print 'task', self.getName(), 'will run for', delay, 'sec' + + self.sema.acquire() + + self.mutex.acquire() + self.nrunning.inc() + if verbose: + print self.nrunning.get(), 'tasks are running' + self.testcase.assert_(self.nrunning.get() <= 3) + self.mutex.release() + + time.sleep(delay) + if verbose: + print 'task', self.getName(), 'done' + + self.mutex.acquire() + self.nrunning.dec() + self.testcase.assert_(self.nrunning.get() >= 0) + if verbose: + print self.getName(), 'is finished.', self.nrunning.get(), \ + 'tasks are running' + self.mutex.release() + + self.sema.release() + +class ThreadTests(unittest.TestCase): + + # Create a bunch of threads, let each do some work, wait until all are + # done. + def test_various_ops(self): + # This takes about n/3 seconds to run (about n/3 clumps of tasks, + # times about 1 second per clump). + NUMTASKS = 10 + + # no more than 3 of the 10 can run at once + sema = threading.BoundedSemaphore(value=3) + mutex = threading.RLock() + numrunning = Counter() + + threads = [] + + for i in range(NUMTASKS): + t = TestThread(""%i, self, sema, mutex, numrunning) + threads.append(t) + t.start() + + if verbose: + print 'waiting for all tasks to complete' + for t in threads: + t.join(NUMTASKS) + self.assert_(not t.isAlive()) + if verbose: + print 'all tasks done' + self.assertEqual(numrunning.get(), 0) + + # run with a small(ish) thread stack size (256kB) + def test_various_ops_small_stack(self): + if verbose: + print 'with 256kB thread stack size...' + try: + threading.stack_size(262144) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + # run with a large thread stack size (1MB) + def test_various_ops_large_stack(self): + if verbose: + print 'with 1MB thread stack size...' + try: + threading.stack_size(0x100000) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + def test_foreign_thread(self): + # Check that a "foreign" thread can use the threading module. + def f(mutex): + # Acquiring an RLock forces an entry for the foreign + # thread to get made in the threading._active map. + r = threading.RLock() + r.acquire() + r.release() + mutex.release() + + mutex = threading.Lock() + mutex.acquire() + tid = thread.start_new_thread(f, (mutex,)) + # Wait for the thread to finish. + mutex.acquire() + self.assert_(tid in threading._active) + self.assert_(isinstance(threading._active[tid], + threading._DummyThread)) + del threading._active[tid] + + # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) + # exposed at the Python level. This test relies on ctypes to get at it. + def test_PyThreadState_SetAsyncExc(self): + try: + import ctypes + except ImportError: + if verbose: + print "test_PyThreadState_SetAsyncExc can't import ctypes" + return # can't do anything + + set_async_exc = ctypes.pythonapi.PyThreadState_SetAsyncExc + + class AsyncExc(Exception): + pass + + exception = ctypes.py_object(AsyncExc) + + # `worker_started` is set by the thread when it's inside a try/except + # block waiting to catch the asynchronously set AsyncExc exception. + # `worker_saw_exception` is set by the thread upon catching that + # exception. + worker_started = threading.Event() + worker_saw_exception = threading.Event() + + class Worker(threading.Thread): + def run(self): + self.id = thread.get_ident() + self.finished = False + + try: + while True: + worker_started.set() + time.sleep(0.1) + except AsyncExc: + self.finished = True + worker_saw_exception.set() + + t = Worker() + t.setDaemon(True) # so if this fails, we don't hang Python at shutdown + t.start() + if verbose: + print " started worker thread" + + # Try a thread id that doesn't make sense. + if verbose: + print " trying nonsensical thread id" + result = set_async_exc(ctypes.c_long(-1), exception) + self.assertEqual(result, 0) # no thread states modified + + # Now raise an exception in the worker thread. + if verbose: + print " waiting for worker thread to get started" + worker_started.wait() + if verbose: + print " verifying worker hasn't exited" + self.assert_(not t.finished) + if verbose: + print " attempting to raise asynch exception in worker" + result = set_async_exc(ctypes.c_long(t.id), exception) + self.assertEqual(result, 1) # one thread state modified + if verbose: + print " waiting for worker to say it caught the exception" + worker_saw_exception.wait(timeout=10) + self.assert_(t.finished) + if verbose: + print " all OK -- joining worker" + if t.finished: + t.join() + # else the thread is still running, and we have no way to kill it + + def test_enumerate_after_join(self): + # Try hard to trigger #1703448: a thread is still returned in + # threading.enumerate() after it has been join()ed. + enum = threading.enumerate + old_interval = sys.getcheckinterval() + sys.setcheckinterval(1) + try: + for i in xrange(1, 1000): + t = threading.Thread(target=lambda: None) + t.start() + t.join() + l = enum() + self.assertFalse(t in l, + "#1703448 triggered after %d trials: %s" % (i, l)) + finally: + sys.setcheckinterval(old_interval) + + +class ThreadJoinOnShutdown(unittest.TestCase): + + def _run_and_join(self, script): + script = """if 1: + import sys, os, time, threading + + # a thread, which waits for the main program to terminate + def joiningfunc(mainthread): + mainthread.join() + print 'end of thread' + \n""" + script + + import subprocess + p = subprocess.Popen([sys.executable, "-c", script], stdout=subprocess.PIPE) + rc = p.wait() + data = p.stdout.read().replace('\r', '') + self.assertEqual(data, "end of main\nend of thread\n") + self.failIf(rc == 2, "interpreter was blocked") + self.failUnless(rc == 0, "Unexpected error") + + def test_1_join_on_shutdown(self): + # The usual case: on exit, wait for a non-daemon thread + script = """if 1: + import os + t = threading.Thread(target=joiningfunc, + args=(threading.currentThread(),)) + t.start() + time.sleep(0.1) + print 'end of main' + """ + self._run_and_join(script) + + + def test_2_join_in_forked_process(self): + # Like the test above, but from a forked interpreter + import os + if not hasattr(os, 'fork'): + return + script = """if 1: + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(threading.currentThread(),)) + t.start() + print 'end of main' + """ + self._run_and_join(script) + + def test_3_join_in_forked_from_thread(self): + # Like the test above, but fork() was called from a worker thread + # In the forked process, the main Thread object must be marked as stopped. + import os + if not hasattr(os, 'fork'): + return + # Skip platforms with known problems forking from a worker thread. + # See http://bugs.python.org/issue3863. + if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): + print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread' + ' due to known OS bugs on'), sys.platform + return + script = """if 1: + main_thread = threading.currentThread() + def worker(): + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(main_thread,)) + print 'end of main' + t.start() + t.join() # Should not block: main_thread is already stopped + + w = threading.Thread(target=worker) + w.start() + """ + self._run_and_join(script) + + +def test_main(): + test.test_support.run_unittest(ThreadTests, + ThreadJoinOnShutdown) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_thread.py python-gevent-1.0/greentest/2.5/test_thread.py --- python-gevent-0.13.7/greentest/2.5/test_thread.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_thread.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,160 @@ +# Very rudimentary test of thread module + +# Create a bunch of threads, let each do some work, wait until all are done + +from test.test_support import verbose +import random +import thread +import time + +mutex = thread.allocate_lock() +rmutex = thread.allocate_lock() # for calls to random +running = 0 +done = thread.allocate_lock() +done.acquire() + +numtasks = 10 + +def task(ident): + global running + rmutex.acquire() + delay = random.random() * numtasks / 10. + rmutex.release() + if verbose: + print 'task', ident, 'will run for', round(delay, 1), 'sec' + time.sleep(delay) + if verbose: + print 'task', ident, 'done' + mutex.acquire() + running = running - 1 + if running == 0: + done.release() + mutex.release() + +next_ident = 0 +def newtask(): + global next_ident, running + mutex.acquire() + next_ident = next_ident + 1 + if verbose: + print 'creating task', next_ident + thread.start_new_thread(task, (next_ident,)) + running = running + 1 + mutex.release() + +for i in range(numtasks): + newtask() + +print 'waiting for all tasks to complete' +done.acquire() +print 'all tasks done' + +class barrier: + def __init__(self, n): + self.n = n + self.waiting = 0 + self.checkin = thread.allocate_lock() + self.checkout = thread.allocate_lock() + self.checkout.acquire() + + def enter(self): + checkin, checkout = self.checkin, self.checkout + + checkin.acquire() + self.waiting = self.waiting + 1 + if self.waiting == self.n: + self.waiting = self.n - 1 + checkout.release() + return + checkin.release() + + checkout.acquire() + self.waiting = self.waiting - 1 + if self.waiting == 0: + checkin.release() + return + checkout.release() + +numtrips = 3 +def task2(ident): + global running + for i in range(numtrips): + if ident == 0: + # give it a good chance to enter the next + # barrier before the others are all out + # of the current one + delay = 0.001 + else: + rmutex.acquire() + delay = random.random() * numtasks / 10. + rmutex.release() + if verbose: + print 'task', ident, 'will run for', round(delay, 1), 'sec' + time.sleep(delay) + if verbose: + print 'task', ident, 'entering barrier', i + bar.enter() + if verbose: + print 'task', ident, 'leaving barrier', i + mutex.acquire() + running -= 1 + # Must release mutex before releasing done, else the main thread can + # exit and set mutex to None as part of global teardown; then + # mutex.release() raises AttributeError. + finished = running == 0 + mutex.release() + if finished: + done.release() + +print '\n*** Barrier Test ***' +if done.acquire(0): + raise ValueError, "'done' should have remained acquired" +bar = barrier(numtasks) +running = numtasks +for i in range(numtasks): + thread.start_new_thread(task2, (i,)) +done.acquire() +print 'all tasks done' + +# not all platforms support changing thread stack size +print '\n*** Changing thread stack size ***' +if thread.stack_size() != 0: + raise ValueError, "initial stack_size not 0" + +thread.stack_size(0) +if thread.stack_size() != 0: + raise ValueError, "stack_size not reset to default" + +from os import name as os_name +if os_name in ("nt", "os2", "posix"): + + tss_supported = 1 + try: + thread.stack_size(4096) + except ValueError: + print 'caught expected ValueError setting stack_size(4096)' + except thread.error: + tss_supported = 0 + print 'platform does not support changing thread stack size' + + if tss_supported: + failed = lambda s, e: s != e + fail_msg = "stack_size(%d) failed - should succeed" + for tss in (262144, 0x100000, 0): + thread.stack_size(tss) + if failed(thread.stack_size(), tss): + raise ValueError, fail_msg % tss + print 'successfully set stack_size(%d)' % tss + + for tss in (262144, 0x100000): + print 'trying stack_size = %d' % tss + next_ident = 0 + for i in range(numtasks): + newtask() + + print 'waiting for all tasks to complete' + done.acquire() + print 'all tasks done' + + # reset stack size to default + thread.stack_size(0) diff -Nru python-gevent-0.13.7/greentest/2.5/test_timeout.py python-gevent-1.0/greentest/2.5/test_timeout.py --- python-gevent-0.13.7/greentest/2.5/test_timeout.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,198 @@ +"""Unit tests for socket timeout feature.""" + +import unittest +from test import test_support + +# This requires the 'network' resource as given on the regrtest command line. +skip_expected = not test_support.is_resource_enabled('network') + +import time +import socket + + +class CreationTestCase(unittest.TestCase): + """Test case for socket.gettimeout() and socket.settimeout()""" + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def tearDown(self): + self.sock.close() + + def testObjectCreation(self): + # Test Socket creation + self.assertEqual(self.sock.gettimeout(), None, + "timeout not disabled by default") + + def testFloatReturnValue(self): + # Test return value of gettimeout() + self.sock.settimeout(7.345) + self.assertEqual(self.sock.gettimeout(), 7.345) + + self.sock.settimeout(3) + self.assertEqual(self.sock.gettimeout(), 3) + + self.sock.settimeout(None) + self.assertEqual(self.sock.gettimeout(), None) + + def testReturnType(self): + # Test return type of gettimeout() + self.sock.settimeout(1) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + self.sock.settimeout(3.9) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + def testTypeCheck(self): + # Test type checking by settimeout() + self.sock.settimeout(0) + self.sock.settimeout(0L) + self.sock.settimeout(0.0) + self.sock.settimeout(None) + self.assertRaises(TypeError, self.sock.settimeout, "") + self.assertRaises(TypeError, self.sock.settimeout, u"") + self.assertRaises(TypeError, self.sock.settimeout, ()) + self.assertRaises(TypeError, self.sock.settimeout, []) + self.assertRaises(TypeError, self.sock.settimeout, {}) + self.assertRaises(TypeError, self.sock.settimeout, 0j) + + def testRangeCheck(self): + # Test range checking by settimeout() + self.assertRaises(ValueError, self.sock.settimeout, -1) + self.assertRaises(ValueError, self.sock.settimeout, -1L) + self.assertRaises(ValueError, self.sock.settimeout, -1.0) + + def testTimeoutThenBlocking(self): + # Test settimeout() followed by setblocking() + self.sock.settimeout(10) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + + self.sock.settimeout(10) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + + def testBlockingThenTimeout(self): + # Test setblocking() followed by settimeout() + self.sock.setblocking(0) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + self.sock.setblocking(1) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + +class TimeoutTestCase(unittest.TestCase): + """Test case for socket.socket() timeout functions""" + + # There are a number of tests here trying to make sure that an operation + # doesn't take too much longer than expected. But competing machine + # activity makes it inevitable that such tests will fail at times. + # When fuzz was at 1.0, I (tim) routinely saw bogus failures on Win2K + # and Win98SE. Boosting it to 2.0 helped a lot, but isn't a real + # solution. + fuzz = 2.0 + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.addr_remote = ('www.python.org.', 80) + self.addr_local = ('127.0.0.1', 25339) + + def tearDown(self): + self.sock.close() + + def testConnectTimeout(self): + # Test connect() timeout + _timeout = 0.001 + self.sock.settimeout(_timeout) + + # If we are too close to www.python.org, this test will fail. + # Pick a host that should be farther away. + if (socket.getfqdn().split('.')[-2:] == ['python', 'org'] or + socket.getfqdn().split('.')[-2:-1] == ['xs4all']): + self.addr_remote = ('tut.fi', 80) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.connect, + self.addr_remote) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is more than %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvTimeout(self): + # Test recv() timeout + _timeout = 0.02 + self.sock.connect(self.addr_remote) + self.sock.settimeout(_timeout) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.recv, 1024) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testAcceptTimeout(self): + # Test accept() timeout + _timeout = 2 + self.sock.settimeout(_timeout) + self.sock.bind(self.addr_local) + self.sock.listen(5) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.accept) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvfromTimeout(self): + # Test recvfrom() timeout + _timeout = 2 + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.sock.settimeout(_timeout) + self.sock.bind(self.addr_local) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.recvfrom, 8192) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testSend(self): + # Test send() timeout + # couldn't figure out how to test it + pass + + def testSendto(self): + # Test sendto() timeout + # couldn't figure out how to test it + pass + + def testSendall(self): + # Test sendall() timeout + # couldn't figure out how to test it + pass + + +def test_main(): + test_support.requires('network') + test_support.run_unittest(CreationTestCase, TimeoutTestCase) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_urllib2_localnet.py python-gevent-1.0/greentest/2.5/test_urllib2_localnet.py --- python-gevent-0.13.7/greentest/2.5/test_urllib2_localnet.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_urllib2_localnet.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,301 @@ +#!/usr/bin/env python + +import sys +import threading +import urlparse +import urllib2 +import BaseHTTPServer +import unittest +import hashlib +from test import test_support + +# Loopback http server infrastructure + +class LoopbackHttpServer(BaseHTTPServer.HTTPServer): + """HTTP server w/ a few modifications that make it useful for + loopback testing purposes. + """ + + def __init__(self, server_address, RequestHandlerClass): + BaseHTTPServer.HTTPServer.__init__(self, + server_address, + RequestHandlerClass) + + # Set the timeout of our listening socket really low so + # that we can stop the server easily. + self.socket.settimeout(0.1) + + def get_request(self): + """BaseHTTPServer method, overridden.""" + + request, client_address = self.socket.accept() + + # It's a loopback connection, so setting the timeout + # really low shouldn't affect anything, but should make + # deadlocks less likely to occur. + request.settimeout(1.0) + + return (request, client_address) + +class LoopbackHttpServerThread(threading.Thread): + """Stoppable thread that runs a loopback http server.""" + + def __init__(self, port, RequestHandlerClass): + threading.Thread.__init__(self) + self._RequestHandlerClass = RequestHandlerClass + self._stop = False + self._port = port + self._server_address = ('127.0.0.1', self._port) + self.ready = threading.Event() + + def stop(self): + """Stops the webserver if it's currently running.""" + + # Set the stop flag. + self._stop = True + + self.join() + + def run(self): + protocol = "HTTP/1.0" + + self._RequestHandlerClass.protocol_version = protocol + httpd = LoopbackHttpServer(self._server_address, + self._RequestHandlerClass) + + sa = httpd.socket.getsockname() + #print "Serving HTTP on", sa[0], "port", sa[1], "..." + + self.ready.set() + while not self._stop: + httpd.handle_request() + +# Authentication infrastructure + +class DigestAuthHandler: + """Handler for performing digest authentication.""" + + def __init__(self): + self._request_num = 0 + self._nonces = [] + self._users = {} + self._realm_name = "Test Realm" + self._qop = "auth" + + def set_qop(self, qop): + self._qop = qop + + def set_users(self, users): + assert isinstance(users, dict) + self._users = users + + def set_realm(self, realm): + self._realm_name = realm + + def _generate_nonce(self): + self._request_num += 1 + nonce = hashlib.md5(str(self._request_num)).hexdigest() + self._nonces.append(nonce) + return nonce + + def _create_auth_dict(self, auth_str): + first_space_index = auth_str.find(" ") + auth_str = auth_str[first_space_index+1:] + + parts = auth_str.split(",") + + auth_dict = {} + for part in parts: + name, value = part.split("=") + name = name.strip() + if value[0] == '"' and value[-1] == '"': + value = value[1:-1] + else: + value = value.strip() + auth_dict[name] = value + return auth_dict + + def _validate_auth(self, auth_dict, password, method, uri): + final_dict = {} + final_dict.update(auth_dict) + final_dict["password"] = password + final_dict["method"] = method + final_dict["uri"] = uri + HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict + HA1 = hashlib.md5(HA1_str).hexdigest() + HA2_str = "%(method)s:%(uri)s" % final_dict + HA2 = hashlib.md5(HA2_str).hexdigest() + final_dict["HA1"] = HA1 + final_dict["HA2"] = HA2 + response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ + "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict + response = hashlib.md5(response_str).hexdigest() + + return response == auth_dict["response"] + + def _return_auth_challenge(self, request_handler): + request_handler.send_response(407, "Proxy Authentication Required") + request_handler.send_header("Content-Type", "text/html") + request_handler.send_header( + 'Proxy-Authenticate', 'Digest realm="%s", ' + 'qop="%s",' + 'nonce="%s", ' % \ + (self._realm_name, self._qop, self._generate_nonce())) + # XXX: Not sure if we're supposed to add this next header or + # not. + #request_handler.send_header('Connection', 'close') + request_handler.end_headers() + request_handler.wfile.write("Proxy Authentication Required.") + return False + + def handle_request(self, request_handler): + """Performs digest authentication on the given HTTP request + handler. Returns True if authentication was successful, False + otherwise. + + If no users have been set, then digest auth is effectively + disabled and this method will always return True. + """ + + if len(self._users) == 0: + return True + + if not request_handler.headers.has_key('Proxy-Authorization'): + return self._return_auth_challenge(request_handler) + else: + auth_dict = self._create_auth_dict( + request_handler.headers['Proxy-Authorization'] + ) + if self._users.has_key(auth_dict["username"]): + password = self._users[ auth_dict["username"] ] + else: + return self._return_auth_challenge(request_handler) + if not auth_dict.get("nonce") in self._nonces: + return self._return_auth_challenge(request_handler) + else: + self._nonces.remove(auth_dict["nonce"]) + + auth_validated = False + + # MSIE uses short_path in its validation, but Python's + # urllib2 uses the full path, so we're going to see if + # either of them works here. + + for path in [request_handler.path, request_handler.short_path]: + if self._validate_auth(auth_dict, + password, + request_handler.command, + path): + auth_validated = True + + if not auth_validated: + return self._return_auth_challenge(request_handler) + return True + +# Proxy test infrastructure + +class FakeProxyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + """This is a 'fake proxy' that makes it look like the entire + internet has gone down due to a sudden zombie invasion. It main + utility is in providing us with authentication support for + testing. + """ + + digest_auth_handler = DigestAuthHandler() + + def log_message(self, format, *args): + # Uncomment the next line for debugging. + #sys.stderr.write(format % args) + pass + + def do_GET(self): + (scm, netloc, path, params, query, fragment) = urlparse.urlparse( + self.path, 'http') + self.short_path = path + if self.digest_auth_handler.handle_request(self): + self.send_response(200, "OK") + self.send_header("Content-Type", "text/html") + self.end_headers() + self.wfile.write("You've reached %s!
" % self.path) + self.wfile.write("Our apologies, but our server is down due to " + "a sudden zombie invasion.") + +# Test cases + +class ProxyAuthTests(unittest.TestCase): + URL = "http://www.foo.com" + + PORT = 8080 + USER = "tester" + PASSWD = "test123" + REALM = "TestRealm" + + PROXY_URL = "http://127.0.0.1:%d" % PORT + + def setUp(self): + FakeProxyHandler.digest_auth_handler.set_users({ + self.USER : self.PASSWD + }) + FakeProxyHandler.digest_auth_handler.set_realm(self.REALM) + + self.server = LoopbackHttpServerThread(self.PORT, FakeProxyHandler) + self.server.start() + self.server.ready.wait() + + handler = urllib2.ProxyHandler({"http" : self.PROXY_URL}) + self._digest_auth_handler = urllib2.ProxyDigestAuthHandler() + self.opener = urllib2.build_opener(handler, self._digest_auth_handler) + + def tearDown(self): + self.server.stop() + + def test_proxy_with_bad_password_raises_httperror(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD+"bad") + FakeProxyHandler.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_with_no_password_raises_httperror(self): + FakeProxyHandler.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_qop_auth_works(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + FakeProxyHandler.digest_auth_handler.set_qop("auth") + result = self.opener.open(self.URL) + while result.read(): + pass + result.close() + + def test_proxy_qop_auth_int_works_or_throws_urlerror(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + FakeProxyHandler.digest_auth_handler.set_qop("auth-int") + try: + result = self.opener.open(self.URL) + except urllib2.URLError: + # It's okay if we don't support auth-int, but we certainly + # shouldn't receive any kind of exception here other than + # a URLError. + result = None + if result: + while result.read(): + pass + result.close() + +def test_main(): + # We will NOT depend on the network resource flag + # (Lib/test/regrtest.py -u network) since all tests here are only + # localhost. However, if this is a bad rationale, then uncomment + # the next line. + #test_support.requires("network") + + test_support.run_unittest(ProxyAuthTests) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_urllib2net.py python-gevent-1.0/greentest/2.5/test_urllib2net.py --- python-gevent-0.13.7/greentest/2.5/test_urllib2net.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_urllib2net.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,295 @@ +#!/usr/bin/env python + +import unittest +from test import test_support +from test_urllib2 import sanepathname2url + +import socket +import urllib2 +import sys +import os +import mimetools + +class URLTimeoutTest(unittest.TestCase): + + TIMEOUT = 10.0 + + def setUp(self): + socket.setdefaulttimeout(self.TIMEOUT) + + def tearDown(self): + socket.setdefaulttimeout(None) + + def testURLread(self): + f = urllib2.urlopen("http://www.python.org/") + x = f.read() + + +class AuthTests(unittest.TestCase): + """Tests urllib2 authentication features.""" + +## Disabled at the moment since there is no page under python.org which +## could be used to HTTP authentication. +# +# def test_basic_auth(self): +# import httplib +# +# test_url = "http://www.python.org/test/test_urllib2/basic_auth" +# test_hostport = "www.python.org" +# test_realm = 'Test Realm' +# test_user = 'test.test_urllib2net' +# test_password = 'blah' +# +# # failure +# try: +# urllib2.urlopen(test_url) +# except urllib2.HTTPError, exc: +# self.assertEqual(exc.code, 401) +# else: +# self.fail("urlopen() should have failed with 401") +# +# # success +# auth_handler = urllib2.HTTPBasicAuthHandler() +# auth_handler.add_password(test_realm, test_hostport, +# test_user, test_password) +# opener = urllib2.build_opener(auth_handler) +# f = opener.open('http://localhost/') +# response = urllib2.urlopen("http://www.python.org/") +# +# # The 'userinfo' URL component is deprecated by RFC 3986 for security +# # reasons, let's not implement it! (it's already implemented for proxy +# # specification strings (that is, URLs or authorities specifying a +# # proxy), so we must keep that) +# self.assertRaises(httplib.InvalidURL, +# urllib2.urlopen, "http://evil:thing@example.com") + + +class CloseSocketTest(unittest.TestCase): + + def test_close(self): + import socket, httplib, gc + + # calling .close() on urllib2's response objects should close the + # underlying socket + + # delve deep into response to fetch socket._socketobject + response = urllib2.urlopen("http://www.python.org/") + abused_fileobject = response.fp + self.assert_(abused_fileobject.__class__ is socket._fileobject) + httpresponse = abused_fileobject._sock + self.assert_(httpresponse.__class__ is httplib.HTTPResponse) + fileobject = httpresponse.fp + self.assert_(fileobject.__class__ is socket._fileobject) + + self.assert_(not fileobject.closed) + response.close() + self.assert_(fileobject.closed) + +class urlopenNetworkTests(unittest.TestCase): + """Tests urllib2.urlopen using the network. + + These tests are not exhaustive. Assuming that testing using files does a + good job overall of some of the basic interface features. There are no + tests exercising the optional 'data' and 'proxies' arguments. No tests + for transparent redirection have been written. + + setUp is not used for always constructing a connection to + http://www.python.org/ since there a few tests that don't use that address + and making a connection is expensive enough to warrant minimizing unneeded + connections. + + """ + + def test_basic(self): + # Simple test expected to pass. + open_url = urllib2.urlopen("http://www.python.org/") + for attr in ("read", "close", "info", "geturl"): + self.assert_(hasattr(open_url, attr), "object returned from " + "urlopen lacks the %s attribute" % attr) + try: + self.assert_(open_url.read(), "calling 'read' failed") + finally: + open_url.close() + + def test_info(self): + # Test 'info'. + open_url = urllib2.urlopen("http://www.python.org/") + try: + info_obj = open_url.info() + finally: + open_url.close() + self.assert_(isinstance(info_obj, mimetools.Message), + "object returned by 'info' is not an instance of " + "mimetools.Message") + self.assertEqual(info_obj.getsubtype(), "html") + + def test_geturl(self): + # Make sure same URL as opened is returned by geturl. + URL = "http://www.python.org/" + open_url = urllib2.urlopen(URL) + try: + gotten_url = open_url.geturl() + finally: + open_url.close() + self.assertEqual(gotten_url, URL) + + def test_bad_address(self): + # Make sure proper exception is raised when connecting to a bogus + # address. + self.assertRaises(IOError, + # SF patch 809915: In Sep 2003, VeriSign started + # highjacking invalid .com and .net addresses to + # boost traffic to their own site. This test + # started failing then. One hopes the .invalid + # domain will be spared to serve its defined + # purpose. + # urllib2.urlopen, "http://www.sadflkjsasadf.com/") + urllib2.urlopen, "http://www.python.invalid./") + + +class OtherNetworkTests(unittest.TestCase): + def setUp(self): + if 0: # for debugging + import logging + logger = logging.getLogger("test_urllib2net") + logger.addHandler(logging.StreamHandler()) + + def test_range (self): + req = urllib2.Request("http://www.python.org", + headers={'Range': 'bytes=20-39'}) + result = urllib2.urlopen(req) + data = result.read() + self.assertEqual(len(data), 20) + + # XXX The rest of these tests aren't very good -- they don't check much. + # They do sometimes catch some major disasters, though. + + def test_ftp(self): + urls = [ + 'ftp://www.python.org/pub/python/misc/sousa.au', + 'ftp://www.python.org/pub/tmp/blat', + 'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC' + '/research-reports/00README-Legal-Rules-Regs', + ] + self._test_urls(urls, self._extra_handlers()) + + def test_gopher(self): + import warnings + warnings.filterwarnings("ignore", + "the gopherlib module is deprecated", + DeprecationWarning, + "urllib2$") + urls = [ + # Thanks to Fred for finding these! + 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex', + 'gopher://gopher.vt.edu.:10010/10/33', + ] + self._test_urls(urls, self._extra_handlers()) + + def test_file(self): + TESTFN = test_support.TESTFN + f = open(TESTFN, 'w') + try: + f.write('hi there\n') + f.close() + urls = [ + 'file:'+sanepathname2url(os.path.abspath(TESTFN)), + + # XXX bug, should raise URLError + #('file://nonsensename/etc/passwd', None, urllib2.URLError) + ('file://nonsensename/etc/passwd', None, (EnvironmentError, socket.error)) + ] + self._test_urls(urls, self._extra_handlers()) + finally: + os.remove(TESTFN) + + def test_http(self): + urls = [ + 'http://www.espn.com/', # redirect + 'http://www.python.org/Spanish/Inquistion/', + ('http://www.python.org/cgi-bin/faqw.py', + 'query=pythonistas&querytype=simple&casefold=yes&req=search', None), + 'http://www.python.org/', + ] + self._test_urls(urls, self._extra_handlers()) + + # XXX Following test depends on machine configurations that are internal + # to CNRI. Need to set up a public server with the right authentication + # configuration for test purposes. + +## def test_cnri(self): +## if socket.gethostname() == 'bitdiddle': +## localhost = 'bitdiddle.cnri.reston.va.us' +## elif socket.gethostname() == 'bitdiddle.concentric.net': +## localhost = 'localhost' +## else: +## localhost = None +## if localhost is not None: +## urls = [ +## 'file://%s/etc/passwd' % localhost, +## 'http://%s/simple/' % localhost, +## 'http://%s/digest/' % localhost, +## 'http://%s/not/found.h' % localhost, +## ] + +## bauth = HTTPBasicAuthHandler() +## bauth.add_password('basic_test_realm', localhost, 'jhylton', +## 'password') +## dauth = HTTPDigestAuthHandler() +## dauth.add_password('digest_test_realm', localhost, 'jhylton', +## 'password') + +## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) + + def _test_urls(self, urls, handlers): + import socket + import time + import logging + debug = logging.getLogger("test_urllib2").debug + + urllib2.install_opener(urllib2.build_opener(*handlers)) + + for url in urls: + if isinstance(url, tuple): + url, req, expected_err = url + else: + req = expected_err = None + debug(url) + try: + f = urllib2.urlopen(url, req) + except (IOError, socket.error, OSError), err: + debug(err) + if expected_err: + msg = ("Didn't get expected error(s) %s for %s %s, got %s" % + (expected_err, url, req, err)) + self.assert_(isinstance(err, expected_err), msg) + else: + buf = f.read() + f.close() + debug("read %d bytes" % len(buf)) + debug("******** next url coming up...") + time.sleep(0.1) + + def _extra_handlers(self): + handlers = [] + + handlers.append(urllib2.GopherHandler) + + cfh = urllib2.CacheFTPHandler() + cfh.setTimeout(1) + handlers.append(cfh) + + return handlers + + +def test_main(): + test_support.requires("network") + test_support.run_unittest(URLTimeoutTest, + urlopenNetworkTests, + AuthTests, + OtherNetworkTests, + CloseSocketTest, + ) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_urllib2.py python-gevent-1.0/greentest/2.5/test_urllib2.py --- python-gevent-0.13.7/greentest/2.5/test_urllib2.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_urllib2.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1087 @@ +import unittest +from test import test_support + +import os, socket +import StringIO + +import urllib2 +from urllib2 import Request, OpenerDirector + +# XXX +# Request +# CacheFTPHandler (hard to write) +# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler + +class TrivialTests(unittest.TestCase): + def test_trivial(self): + # A couple trivial tests + + self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') + + # XXX Name hacking to get this to work on Windows. + fname = os.path.abspath(urllib2.__file__).replace('\\', '/') + if fname[1:2] == ":": + fname = fname[2:] + # And more hacking to get it to work on MacOS. This assumes + # urllib.pathname2url works, unfortunately... + if os.name == 'mac': + fname = '/' + fname.replace(':', '/') + elif os.name == 'riscos': + import string + fname = os.expand(fname) + fname = fname.translate(string.maketrans("/.", "./")) + + file_url = "file://%s" % fname + f = urllib2.urlopen(file_url) + + buf = f.read() + f.close() + + def test_parse_http_list(self): + tests = [('a,b,c', ['a', 'b', 'c']), + ('path"o,l"og"i"cal, example', ['path"o,l"og"i"cal', 'example']), + ('a, b, "c", "d", "e,f", g, h', ['a', 'b', '"c"', '"d"', '"e,f"', 'g', 'h']), + ('a="b\\"c", d="e\\,f", g="h\\\\i"', ['a="b"c"', 'd="e,f"', 'g="h\\i"'])] + for string, list in tests: + self.assertEquals(urllib2.parse_http_list(string), list) + + +def test_request_headers_dict(): + """ + The Request.headers dictionary is not a documented interface. It should + stay that way, because the complete set of headers are only accessible + through the .get_header(), .has_header(), .header_items() interface. + However, .headers pre-dates those methods, and so real code will be using + the dictionary. + + The introduction in 2.4 of those methods was a mistake for the same reason: + code that previously saw all (urllib2 user)-provided headers in .headers + now sees only a subset (and the function interface is ugly and incomplete). + A better change would have been to replace .headers dict with a dict + subclass (or UserDict.DictMixin instance?) that preserved the .headers + interface and also provided access to the "unredirected" headers. It's + probably too late to fix that, though. + + + Check .capitalize() case normalization: + + >>> url = "http://example.com" + >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"] + 'blah' + >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"] + 'blah' + + Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError, + but that could be changed in future. + + """ + +def test_request_headers_methods(): + """ + Note the case normalization of header names here, to .capitalize()-case. + This should be preserved for backwards-compatibility. (In the HTTP case, + normalization to .title()-case is done by urllib2 before sending headers to + httplib). + + >>> url = "http://example.com" + >>> r = Request(url, headers={"Spam-eggs": "blah"}) + >>> r.has_header("Spam-eggs") + True + >>> r.header_items() + [('Spam-eggs', 'blah')] + >>> r.add_header("Foo-Bar", "baz") + >>> items = r.header_items() + >>> items.sort() + >>> items + [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')] + + Note that e.g. r.has_header("spam-EggS") is currently False, and + r.get_header("spam-EggS") returns None, but that could be changed in + future. + + >>> r.has_header("Not-there") + False + >>> print r.get_header("Not-there") + None + >>> r.get_header("Not-there", "default") + 'default' + + """ + + +def test_password_manager(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + >>> add("Some Realm", "http://example.com/", "joe", "password") + >>> add("Some Realm", "http://example.com/ni", "ni", "ni") + >>> add("c", "http://example.com/foo", "foo", "ni") + >>> add("c", "http://example.com/bar", "bar", "nini") + >>> add("b", "http://example.com/", "first", "blah") + >>> add("b", "http://example.com/", "second", "spam") + >>> add("a", "http://example.com", "1", "a") + >>> add("Some Realm", "http://c.example.com:3128", "3", "c") + >>> add("Some Realm", "d.example.com", "4", "d") + >>> add("Some Realm", "e.example.com:3128", "5", "e") + + >>> mgr.find_user_password("Some Realm", "example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam") + ('joe', 'password') + >>> mgr.find_user_password("c", "http://example.com/foo") + ('foo', 'ni') + >>> mgr.find_user_password("c", "http://example.com/bar") + ('bar', 'nini') + + Actually, this is really undefined ATM +## Currently, we use the highest-level path where more than one match: + +## >>> mgr.find_user_password("Some Realm", "http://example.com/ni") +## ('joe', 'password') + + Use latest add_password() in case of conflict: + + >>> mgr.find_user_password("b", "http://example.com/") + ('second', 'spam') + + No special relationship between a.example.com and example.com: + + >>> mgr.find_user_password("a", "http://example.com/") + ('1', 'a') + >>> mgr.find_user_password("a", "http://a.example.com/") + (None, None) + + Ports: + + >>> mgr.find_user_password("Some Realm", "c.example.com") + (None, None) + >>> mgr.find_user_password("Some Realm", "c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "d.example.com") + ('4', 'd') + >>> mgr.find_user_password("Some Realm", "e.example.com:3128") + ('5', 'e') + + """ + pass + + +def test_password_manager_default_port(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + + The point to note here is that we can't guess the default port if there's + no scheme. This applies to both add_password and find_user_password. + + >>> add("f", "http://g.example.com:80", "10", "j") + >>> add("g", "http://h.example.com", "11", "k") + >>> add("h", "i.example.com:80", "12", "l") + >>> add("i", "j.example.com", "13", "m") + >>> mgr.find_user_password("f", "g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "g.example.com") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "http://g.example.com") + ('10', 'j') + >>> mgr.find_user_password("g", "h.example.com") + ('11', 'k') + >>> mgr.find_user_password("g", "h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("g", "http://h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("h", "i.example.com") + (None, None) + >>> mgr.find_user_password("h", "i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("h", "http://i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("i", "j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "j.example.com:80") + (None, None) + >>> mgr.find_user_password("i", "http://j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "http://j.example.com:80") + (None, None) + + """ + +class MockOpener: + addheaders = [] + def open(self, req, data=None): + self.req, self.data = req, data + def error(self, proto, *args): + self.proto, self.args = proto, args + +class MockFile: + def read(self, count=None): pass + def readline(self, count=None): pass + def close(self): pass + +class MockHeaders(dict): + def getheaders(self, name): + return self.values() + +class MockResponse(StringIO.StringIO): + def __init__(self, code, msg, headers, data, url=None): + StringIO.StringIO.__init__(self, data) + self.code, self.msg, self.headers, self.url = code, msg, headers, url + def info(self): + return self.headers + def geturl(self): + return self.url + +class MockCookieJar: + def add_cookie_header(self, request): + self.ach_req = request + def extract_cookies(self, response, request): + self.ec_req, self.ec_r = request, response + +class FakeMethod: + def __init__(self, meth_name, action, handle): + self.meth_name = meth_name + self.handle = handle + self.action = action + def __call__(self, *args): + return self.handle(self.meth_name, self.action, *args) + +class MockHandler: + # useful for testing handler machinery + # see add_ordered_mock_handlers() docstring + handler_order = 500 + def __init__(self, methods): + self._define_methods(methods) + def _define_methods(self, methods): + for spec in methods: + if len(spec) == 2: name, action = spec + else: name, action = spec, None + meth = FakeMethod(name, action, self.handle) + setattr(self.__class__, name, meth) + def handle(self, fn_name, action, *args, **kwds): + self.parent.calls.append((self, fn_name, args, kwds)) + if action is None: + return None + elif action == "return self": + return self + elif action == "return response": + res = MockResponse(200, "OK", {}, "") + return res + elif action == "return request": + return Request("http://blah/") + elif action.startswith("error"): + code = action[action.rfind(" ")+1:] + try: + code = int(code) + except ValueError: + pass + res = MockResponse(200, "OK", {}, "") + return self.parent.error("http", args[0], res, code, "", {}) + elif action == "raise": + raise urllib2.URLError("blah") + assert False + def close(self): pass + def add_parent(self, parent): + self.parent = parent + self.parent.calls = [] + def __lt__(self, other): + if not hasattr(other, "handler_order"): + # No handler_order, leave in original order. Yuck. + return True + return self.handler_order < other.handler_order + +def add_ordered_mock_handlers(opener, meth_spec): + """Create MockHandlers and add them to an OpenerDirector. + + meth_spec: list of lists of tuples and strings defining methods to define + on handlers. eg: + + [["http_error", "ftp_open"], ["http_open"]] + + defines methods .http_error() and .ftp_open() on one handler, and + .http_open() on another. These methods just record their arguments and + return None. Using a tuple instead of a string causes the method to + perform some action (see MockHandler.handle()), eg: + + [["http_error"], [("http_open", "return request")]] + + defines .http_error() on one handler (which simply returns None), and + .http_open() on another handler, which returns a Request object. + + """ + handlers = [] + count = 0 + for meths in meth_spec: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order += count + h.add_parent(opener) + count = count + 1 + handlers.append(h) + opener.add_handler(h) + return handlers + +def build_test_opener(*handler_instances): + opener = OpenerDirector() + for h in handler_instances: + opener.add_handler(h) + return opener + +class MockHTTPHandler(urllib2.BaseHandler): + # useful for testing redirections and auth + # sends supplied headers and code as first response + # sends 200 OK as second response + def __init__(self, code, headers): + self.code = code + self.headers = headers + self.reset() + def reset(self): + self._count = 0 + self.requests = [] + def http_open(self, req): + import mimetools, httplib, copy + from StringIO import StringIO + self.requests.append(copy.deepcopy(req)) + if self._count == 0: + self._count = self._count + 1 + name = httplib.responses[self.code] + msg = mimetools.Message(StringIO(self.headers)) + return self.parent.error( + "http", req, MockFile(), self.code, name, msg) + else: + self.req = req + msg = mimetools.Message(StringIO("\r\n\r\n")) + return MockResponse(200, "OK", msg, "", req.get_full_url()) + +class MockPasswordManager: + def add_password(self, realm, uri, user, password): + self.realm = realm + self.url = uri + self.user = user + self.password = password + def find_user_password(self, realm, authuri): + self.target_realm = realm + self.target_url = authuri + return self.user, self.password + + +class OpenerDirectorTests(unittest.TestCase): + + def test_add_non_handler(self): + class NonHandler(object): + pass + self.assertRaises(TypeError, + OpenerDirector().add_handler, NonHandler()) + + def test_badly_named_methods(self): + # test work-around for three methods that accidentally follow the + # naming conventions for handler methods + # (*_open() / *_request() / *_response()) + + # These used to call the accidentally-named methods, causing a + # TypeError in real code; here, returning self from these mock + # methods would either cause no exception, or AttributeError. + + from urllib2 import URLError + + o = OpenerDirector() + meth_spec = [ + [("do_open", "return self"), ("proxy_open", "return self")], + [("redirect_request", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + o.add_handler(urllib2.UnknownHandler()) + for scheme in "do", "proxy", "redirect": + self.assertRaises(URLError, o.open, scheme+"://example.com/") + + def test_handled(self): + # handler returning non-None means no more handlers will be called + o = OpenerDirector() + meth_spec = [ + ["http_open", "ftp_open", "http_error_302"], + ["ftp_open"], + [("http_open", "return self")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # Second .http_open() gets called, third doesn't, since second returned + # non-None. Handlers without .http_open() never get any methods called + # on them. + # In fact, second mock handler defining .http_open() returns self + # (instead of response), which becomes the OpenerDirector's return + # value. + self.assertEqual(r, handlers[2]) + calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] + for expected, got in zip(calls, o.calls): + handler, name, args, kwds = got + self.assertEqual((handler, name), expected) + self.assertEqual(args, (req,)) + + def test_handler_order(self): + o = OpenerDirector() + handlers = [] + for meths, handler_order in [ + ([("http_open", "return self")], 500), + (["http_open"], 0), + ]: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order = handler_order + handlers.append(h) + o.add_handler(h) + + r = o.open("http://example.com/") + # handlers called in reverse order, thanks to their sort order + self.assertEqual(o.calls[0][0], handlers[1]) + self.assertEqual(o.calls[1][0], handlers[0]) + + def test_raise(self): + # raising URLError stops processing of request + o = OpenerDirector() + meth_spec = [ + [("http_open", "raise")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + self.assertRaises(urllib2.URLError, o.open, req) + self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) + +## def test_error(self): +## # XXX this doesn't actually seem to be used in standard library, +## # but should really be tested anyway... + + def test_http_error(self): + # XXX http_error_default + # http errors are a special case + o = OpenerDirector() + meth_spec = [ + [("http_open", "error 302")], + [("http_error_400", "raise"), "http_open"], + [("http_error_302", "return response"), "http_error_303", + "http_error"], + [("http_error_302")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + class Unknown: + def __eq__(self, other): return True + + req = Request("http://example.com/") + r = o.open(req) + assert len(o.calls) == 2 + calls = [(handlers[0], "http_open", (req,)), + (handlers[2], "http_error_302", + (req, Unknown(), 302, "", {}))] + for expected, got in zip(calls, o.calls): + handler, method_name, args = expected + self.assertEqual((handler, method_name), got[:2]) + self.assertEqual(args, got[2]) + + def test_processors(self): + # *_request / *_response methods get called appropriately + o = OpenerDirector() + meth_spec = [ + [("http_request", "return request"), + ("http_response", "return response")], + [("http_request", "return request"), + ("http_response", "return response")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # processor methods are called on *all* handlers that define them, + # not just the first handler that handles the request + calls = [ + (handlers[0], "http_request"), (handlers[1], "http_request"), + (handlers[0], "http_response"), (handlers[1], "http_response")] + + for i, (handler, name, args, kwds) in enumerate(o.calls): + if i < 2: + # *_request + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 1) + self.assert_(isinstance(args[0], Request)) + else: + # *_response + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 2) + self.assert_(isinstance(args[0], Request)) + # response from opener.open is None, because there's no + # handler that defines http_open to handle it + self.assert_(args[1] is None or + isinstance(args[1], MockResponse)) + + +def sanepathname2url(path): + import urllib + urlpath = urllib.pathname2url(path) + if os.name == "nt" and urlpath.startswith("///"): + urlpath = urlpath[2:] + # XXX don't ask me about the mac... + return urlpath + +class HandlerTests(unittest.TestCase): + + def test_ftp(self): + class MockFTPWrapper: + def __init__(self, data): self.data = data + def retrfile(self, filename, filetype): + self.filename, self.filetype = filename, filetype + return StringIO.StringIO(self.data), len(self.data) + + class NullFTPHandler(urllib2.FTPHandler): + def __init__(self, data): self.data = data + def connect_ftp(self, user, passwd, host, port, dirs): + self.user, self.passwd = user, passwd + self.host, self.port = host, port + self.dirs = dirs + self.ftpwrapper = MockFTPWrapper(self.data) + return self.ftpwrapper + + import ftplib, socket + data = "rheum rhaponicum" + h = NullFTPHandler(data) + o = h.parent = MockOpener() + + for url, host, port, type_, dirs, filename, mimetype in [ + ("ftp://localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://localhost:80/foo/bar/", + "localhost", 80, "D", + ["foo", "bar"], "", None), + ("ftp://localhost/baz.gif;type=a", + "localhost", ftplib.FTP_PORT, "A", + [], "baz.gif", None), # XXX really this should guess image/gif + ]: + r = h.ftp_open(Request(url)) + # ftp authentication not yet implemented by FTPHandler + self.assert_(h.user == h.passwd == "") + self.assertEqual(h.host, socket.gethostbyname(host)) + self.assertEqual(h.port, port) + self.assertEqual(h.dirs, dirs) + self.assertEqual(h.ftpwrapper.filename, filename) + self.assertEqual(h.ftpwrapper.filetype, type_) + headers = r.info() + self.assertEqual(headers.get("Content-type"), mimetype) + self.assertEqual(int(headers["Content-length"]), len(data)) + + def test_file(self): + import time, rfc822, socket + h = urllib2.FileHandler() + o = h.parent = MockOpener() + + TESTFN = test_support.TESTFN + urlpath = sanepathname2url(os.path.abspath(TESTFN)) + towrite = "hello, world\n" + urls = [ + "file://localhost%s" % urlpath, + "file://%s" % urlpath, + "file://%s%s" % (socket.gethostbyname('localhost'), urlpath), + ] + try: + localaddr = socket.gethostbyname(socket.gethostname()) + except socket.gaierror: + localaddr = '' + if localaddr: + urls.append("file://%s%s" % (localaddr, urlpath)) + + for url in urls: + f = open(TESTFN, "wb") + try: + try: + f.write(towrite) + finally: + f.close() + + r = h.file_open(Request(url)) + try: + data = r.read() + headers = r.info() + newurl = r.geturl() + finally: + r.close() + stats = os.stat(TESTFN) + modified = rfc822.formatdate(stats.st_mtime) + finally: + os.remove(TESTFN) + self.assertEqual(data, towrite) + self.assertEqual(headers["Content-type"], "text/plain") + self.assertEqual(headers["Content-length"], "13") + self.assertEqual(headers["Last-modified"], modified) + + for url in [ + "file://localhost:80%s" % urlpath, +# XXXX bug: these fail with socket.gaierror, should be URLError +## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), +## os.getcwd(), TESTFN), +## "file://somerandomhost.ontheinternet.com%s/%s" % +## (os.getcwd(), TESTFN), + ]: + try: + f = open(TESTFN, "wb") + try: + f.write(towrite) + finally: + f.close() + + self.assertRaises(urllib2.URLError, + h.file_open, Request(url)) + finally: + os.remove(TESTFN) + + h = urllib2.FileHandler() + o = h.parent = MockOpener() + # XXXX why does // mean ftp (and /// mean not ftp!), and where + # is file: scheme specified? I think this is really a bug, and + # what was intended was to distinguish between URLs like: + # file:/blah.txt (a file) + # file://localhost/blah.txt (a file) + # file:///blah.txt (a file) + # file://ftp.example.com/blah.txt (an ftp URL) + for url, ftp in [ + ("file://ftp.example.com//foo.txt", True), + ("file://ftp.example.com///foo.txt", False), +# XXXX bug: fails with OSError, should be URLError + ("file://ftp.example.com/foo.txt", False), + ]: + req = Request(url) + try: + h.file_open(req) + # XXXX remove OSError when bug fixed + except (urllib2.URLError, OSError): + self.assert_(not ftp) + else: + self.assert_(o.req is req) + self.assertEqual(req.type, "ftp") + + def test_http(self): + class MockHTTPResponse: + def __init__(self, fp, msg, status, reason): + self.fp = fp + self.msg = msg + self.status = status + self.reason = reason + def read(self): + return '' + class MockHTTPClass: + def __init__(self): + self.req_headers = [] + self.data = None + self.raise_on_endheaders = False + def __call__(self, host): + self.host = host + return self + def set_debuglevel(self, level): + self.level = level + def request(self, method, url, body=None, headers={}): + self.method = method + self.selector = url + self.req_headers += headers.items() + self.req_headers.sort() + if body: + self.data = body + if self.raise_on_endheaders: + import socket + raise socket.error() + def getresponse(self): + return MockHTTPResponse(MockFile(), {}, 200, "OK") + + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + url = "http://example.com/" + for method, data in [("GET", None), ("POST", "blah")]: + req = Request(url, data, {"Foo": "bar"}) + req.add_unredirected_header("Spam", "eggs") + http = MockHTTPClass() + r = h.do_open(http, req) + + # result attributes + r.read; r.readline # wrapped MockFile methods + r.info; r.geturl # addinfourl methods + r.code, r.msg == 200, "OK" # added from MockHTTPClass.getreply() + hdrs = r.info() + hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() + self.assertEqual(r.geturl(), url) + + self.assertEqual(http.host, "example.com") + self.assertEqual(http.level, 0) + self.assertEqual(http.method, method) + self.assertEqual(http.selector, "/") + self.assertEqual(http.req_headers, + [("Connection", "close"), + ("Foo", "bar"), ("Spam", "eggs")]) + self.assertEqual(http.data, data) + + # check socket.error converted to URLError + http.raise_on_endheaders = True + self.assertRaises(urllib2.URLError, h.do_open, http, req) + + # check adding of standard headers + o.addheaders = [("Spam", "eggs")] + for data in "", None: # POST, GET + req = Request("http://example.com/", data) + r = MockResponse(200, "OK", {}, "") + newreq = h.do_request_(req) + if data is None: # GET + self.assert_("Content-length" not in req.unredirected_hdrs) + self.assert_("Content-type" not in req.unredirected_hdrs) + else: # POST + self.assertEqual(req.unredirected_hdrs["Content-length"], "0") + self.assertEqual(req.unredirected_hdrs["Content-type"], + "application/x-www-form-urlencoded") + # XXX the details of Host could be better tested + self.assertEqual(req.unredirected_hdrs["Host"], "example.com") + self.assertEqual(req.unredirected_hdrs["Spam"], "eggs") + + # don't clobber existing headers + req.add_unredirected_header("Content-length", "foo") + req.add_unredirected_header("Content-type", "bar") + req.add_unredirected_header("Host", "baz") + req.add_unredirected_header("Spam", "foo") + newreq = h.do_request_(req) + self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") + self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") + self.assertEqual(req.unredirected_hdrs["Host"], "baz") + self.assertEqual(req.unredirected_hdrs["Spam"], "foo") + + def test_errors(self): + h = urllib2.HTTPErrorProcessor() + o = h.parent = MockOpener() + + url = "http://example.com/" + req = Request(url) + # 200 OK is passed through + r = MockResponse(200, "OK", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called + # anything else calls o.error (and MockOpener returns None, here) + r = MockResponse(201, "Created", {}, "", url) + self.assert_(h.http_response(req, r) is None) + self.assertEqual(o.proto, "http") # o.error called + self.assertEqual(o.args, (req, r, 201, "Created", {})) + + def test_cookies(self): + cj = MockCookieJar() + h = urllib2.HTTPCookieProcessor(cj) + o = h.parent = MockOpener() + + req = Request("http://example.com/") + r = MockResponse(200, "OK", {}, "") + newreq = h.http_request(req) + self.assert_(cj.ach_req is req is newreq) + self.assertEquals(req.get_origin_req_host(), "example.com") + self.assert_(not req.is_unverifiable()) + newr = h.http_response(req, r) + self.assert_(cj.ec_req is req) + self.assert_(cj.ec_r is r is newr) + + def test_redirect(self): + from_url = "http://example.com/a.html" + to_url = "http://example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + + # ordinary redirect behaviour + for code in 301, 302, 303, 307: + for data in None, "blah\nblah\n": + method = getattr(h, "http_error_%s" % code) + req = Request(from_url, data) + req.add_header("Nonsense", "viking=withhold") + req.add_unredirected_header("Spam", "spam") + try: + method(req, MockFile(), code, "Blah", + MockHeaders({"location": to_url})) + except urllib2.HTTPError: + # 307 in response to POST requires user OK + self.assert_(code == 307 and data is not None) + self.assertEqual(o.req.get_full_url(), to_url) + try: + self.assertEqual(o.req.get_method(), "GET") + except AttributeError: + self.assert_(not o.req.has_data()) + self.assertEqual(o.req.headers["Nonsense"], + "viking=withhold") + self.assert_("Spam" not in o.req.headers) + self.assert_("Spam" not in o.req.unredirected_hdrs) + + # loop detection + req = Request(from_url) + def redirect(h, req, url=to_url): + h.http_error_302(req, MockFile(), 302, "Blah", + MockHeaders({"location": url})) + # Note that the *original* request shares the same record of + # redirections with the sub-requests caused by the redirections. + + # detect infinite loop redirect of a URL to itself + req = Request(from_url, origin_req_host="example.com") + count = 0 + try: + while 1: + redirect(h, req, "http://example.com/") + count = count + 1 + except urllib2.HTTPError: + # don't stop until max_repeats, because cookies may introduce state + self.assertEqual(count, urllib2.HTTPRedirectHandler.max_repeats) + + # detect endless non-repeating chain of redirects + req = Request(from_url, origin_req_host="example.com") + count = 0 + try: + while 1: + redirect(h, req, "http://example.com/%d" % count) + count = count + 1 + except urllib2.HTTPError: + self.assertEqual(count, + urllib2.HTTPRedirectHandler.max_redirections) + + def test_invalid_redirect(self): + from_url = "http://example.com/a.html" + valid_schemes = ['http', 'https', 'ftp'] + invalid_schemes = ['file', 'imap', 'ldap'] + schemeless_url = "example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + req = Request(from_url) + + for scheme in invalid_schemes: + invalid_url = scheme + '://' + schemeless_url + self.assertRaises(urllib2.HTTPError, h.http_error_302, + req, MockFile(), 302, "Security Loophole", + MockHeaders({"location": invalid_url})) + + for scheme in valid_schemes: + valid_url = scheme + '://' + schemeless_url + h.http_error_302(req, MockFile(), 302, "That's fine", + MockHeaders({"location": valid_url})) + self.assertEqual(o.req.get_full_url(), valid_url) + + def test_cookie_redirect(self): + # cookies shouldn't leak into redirected requests + from cookielib import CookieJar + + from test_cookielib import interact_netscape + + cj = CookieJar() + interact_netscape(cj, "http://www.example.com/", "spam=eggs") + hh = MockHTTPHandler(302, "Location: http://www.cracker.com/\r\n\r\n") + hdeh = urllib2.HTTPDefaultErrorHandler() + hrh = urllib2.HTTPRedirectHandler() + cp = urllib2.HTTPCookieProcessor(cj) + o = build_test_opener(hh, hdeh, hrh, cp) + o.open("http://www.example.com/") + self.assert_(not hh.req.has_header("Cookie")) + + def test_proxy(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + o.add_handler(ph) + meth_spec = [ + [("http_open", "return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://acme.example.com/") + self.assertEqual(req.get_host(), "acme.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + + self.assertEqual([(handlers[0], "http_open")], + [tup[0:2] for tup in o.calls]) + + def test_basic_auth(self): + opener = OpenerDirector() + password_manager = MockPasswordManager() + auth_handler = urllib2.HTTPBasicAuthHandler(password_manager) + realm = "ACME Widget Store" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + + def test_proxy_basic_auth(self): + opener = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + opener.add_handler(ph) + password_manager = MockPasswordManager() + auth_handler = urllib2.ProxyBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Proxy-authorization", + realm, http_handler, password_manager, + "http://acme.example.com:3128/protected", + "proxy.example.com:3128", + ) + + def test_basic_and_digest_auth_handlers(self): + # HTTPDigestAuthHandler threw an exception if it couldn't handle a 40* + # response (http://python.org/sf/1479302), where it should instead + # return None to allow another handler (especially + # HTTPBasicAuthHandler) to handle the response. + + # Also (http://python.org/sf/14797027, RFC 2617 section 1.2), we must + # try digest first (since it's the strongest auth scheme), so we record + # order of calls here to check digest comes first: + class RecordingOpenerDirector(OpenerDirector): + def __init__(self): + OpenerDirector.__init__(self) + self.recorded = [] + def record(self, info): + self.recorded.append(info) + class TestDigestAuthHandler(urllib2.HTTPDigestAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("digest") + urllib2.HTTPDigestAuthHandler.http_error_401(self, + *args, **kwds) + class TestBasicAuthHandler(urllib2.HTTPBasicAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("basic") + urllib2.HTTPBasicAuthHandler.http_error_401(self, + *args, **kwds) + + opener = RecordingOpenerDirector() + password_manager = MockPasswordManager() + digest_handler = TestDigestAuthHandler(password_manager) + basic_handler = TestBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(basic_handler) + opener.add_handler(digest_handler) + opener.add_handler(http_handler) + + # check basic auth isn't blocked by digest handler failing + self._test_basic_auth(opener, basic_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + # check digest was tried before basic (twice, because + # _test_basic_auth called .open() twice) + self.assertEqual(opener.recorded, ["digest", "basic"]*2) + + def _test_basic_auth(self, opener, auth_handler, auth_header, + realm, http_handler, password_manager, + request_url, protected_url): + import base64, httplib + user, password = "wile", "coyote" + + # .add_password() fed through to password manager + auth_handler.add_password(realm, request_url, user, password) + self.assertEqual(realm, password_manager.realm) + self.assertEqual(request_url, password_manager.url) + self.assertEqual(user, password_manager.user) + self.assertEqual(password, password_manager.password) + + r = opener.open(request_url) + + # should have asked the password manager for the username/password + self.assertEqual(password_manager.target_realm, realm) + self.assertEqual(password_manager.target_url, protected_url) + + # expect one request without authorization, then one with + self.assertEqual(len(http_handler.requests), 2) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + userpass = '%s:%s' % (user, password) + auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip() + self.assertEqual(http_handler.requests[1].get_header(auth_header), + auth_hdr_value) + + # if the password manager can't find a password, the handler won't + # handle the HTTP auth error + password_manager.user = password_manager.password = None + http_handler.reset() + r = opener.open(request_url) + self.assertEqual(len(http_handler.requests), 1) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + + +class MiscTests(unittest.TestCase): + + def test_build_opener(self): + class MyHTTPHandler(urllib2.HTTPHandler): pass + class FooHandler(urllib2.BaseHandler): + def foo_open(self): pass + class BarHandler(urllib2.BaseHandler): + def bar_open(self): pass + + build_opener = urllib2.build_opener + + o = build_opener(FooHandler, BarHandler) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # can take a mix of classes and instances + o = build_opener(FooHandler, BarHandler()) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # subclasses of default handlers override default handlers + o = build_opener(MyHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + + # a particular case of overriding: default handlers can be passed + # in explicitly + o = build_opener() + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler) + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler()) + self.opener_has_handler(o, urllib2.HTTPHandler) + + # Issue2670: multiple handlers sharing the same base class + class MyOtherHTTPHandler(urllib2.HTTPHandler): pass + o = build_opener(MyHTTPHandler, MyOtherHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + self.opener_has_handler(o, MyOtherHTTPHandler) + + def opener_has_handler(self, opener, handler_class): + for h in opener.handlers: + if h.__class__ == handler_class: + break + else: + self.assert_(False) + + +def test_main(verbose=None): + import test_urllib2 + test_support.run_doctest(test_urllib2, verbose) + test_support.run_doctest(urllib2, verbose) + tests = (TrivialTests, + OpenerDirectorTests, + HandlerTests, + MiscTests) + test_support.run_unittest(*tests) + +if __name__ == "__main__": + test_main(verbose=True) diff -Nru python-gevent-0.13.7/greentest/2.5/test_urllib.py python-gevent-1.0/greentest/2.5/test_urllib.py --- python-gevent-0.13.7/greentest/2.5/test_urllib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_urllib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,574 @@ +"""Regresssion tests for urllib""" + +import urllib +import httplib +import unittest +from test import test_support +import os +import mimetools +import tempfile +import StringIO + +def hexescape(char): + """Escape char as RFC 2396 specifies""" + hex_repr = hex(ord(char))[2:].upper() + if len(hex_repr) == 1: + hex_repr = "0%s" % hex_repr + return "%" + hex_repr + +class urlopen_FileTests(unittest.TestCase): + """Test urlopen() opening a temporary file. + + Try to test as much functionality as possible so as to cut down on reliance + on connecting to the Net for testing. + + """ + + def setUp(self): + """Setup of a temp file to use for testing""" + self.text = "test_urllib: %s\n" % self.__class__.__name__ + FILE = file(test_support.TESTFN, 'wb') + try: + FILE.write(self.text) + finally: + FILE.close() + self.pathname = test_support.TESTFN + self.returned_obj = urllib.urlopen("file:%s" % self.pathname) + + def tearDown(self): + """Shut down the open object""" + self.returned_obj.close() + os.remove(test_support.TESTFN) + + def test_interface(self): + # Make sure object returned by urlopen() has the specified methods + for attr in ("read", "readline", "readlines", "fileno", + "close", "info", "geturl", "__iter__"): + self.assert_(hasattr(self.returned_obj, attr), + "object returned by urlopen() lacks %s attribute" % + attr) + + def test_read(self): + self.assertEqual(self.text, self.returned_obj.read()) + + def test_readline(self): + self.assertEqual(self.text, self.returned_obj.readline()) + self.assertEqual('', self.returned_obj.readline(), + "calling readline() after exhausting the file did not" + " return an empty string") + + def test_readlines(self): + lines_list = self.returned_obj.readlines() + self.assertEqual(len(lines_list), 1, + "readlines() returned the wrong number of lines") + self.assertEqual(lines_list[0], self.text, + "readlines() returned improper text") + + def test_fileno(self): + file_num = self.returned_obj.fileno() + self.assert_(isinstance(file_num, int), + "fileno() did not return an int") + self.assertEqual(os.read(file_num, len(self.text)), self.text, + "Reading on the file descriptor returned by fileno() " + "did not return the expected text") + + def test_close(self): + # Test close() by calling it hear and then having it be called again + # by the tearDown() method for the test + self.returned_obj.close() + + def test_info(self): + self.assert_(isinstance(self.returned_obj.info(), mimetools.Message)) + + def test_geturl(self): + self.assertEqual(self.returned_obj.geturl(), self.pathname) + + def test_iter(self): + # Test iterator + # Don't need to count number of iterations since test would fail the + # instant it returned anything beyond the first line from the + # comparison + for line in self.returned_obj.__iter__(): + self.assertEqual(line, self.text) + +class urlopen_HttpTests(unittest.TestCase): + """Test urlopen() opening a fake http connection.""" + + def fakehttp(self, fakedata): + class FakeSocket(StringIO.StringIO): + def sendall(self, str): pass + def makefile(self, mode, name): return self + def read(self, amt=None): + if self.closed: return '' + return StringIO.StringIO.read(self, amt) + def readline(self, length=None): + if self.closed: return '' + return StringIO.StringIO.readline(self, length) + class FakeHTTPConnection(httplib.HTTPConnection): + def connect(self): + self.sock = FakeSocket(fakedata) + assert httplib.HTTP._connection_class == httplib.HTTPConnection + httplib.HTTP._connection_class = FakeHTTPConnection + + def unfakehttp(self): + httplib.HTTP._connection_class = httplib.HTTPConnection + + def test_read(self): + self.fakehttp('Hello!') + try: + fp = urllib.urlopen("http://python.org/") + self.assertEqual(fp.readline(), 'Hello!') + self.assertEqual(fp.readline(), '') + finally: + self.unfakehttp() + + def test_invalid_redirect(self): + # urlopen() should raise IOError for many error codes. + self.fakehttp("""HTTP/1.1 302 Found +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Location: file:README +Connection: close +Content-Type: text/html; charset=iso-8859-1 +""") + try: + self.assertRaises(IOError, urllib.urlopen, "http://python.org/") + finally: + self.unfakehttp() + + def test_empty_socket(self): + """urlopen() raises IOError if the underlying socket does not send any + data. (#1680230) """ + self.fakehttp('') + try: + self.assertRaises(IOError, urllib.urlopen, 'http://something') + finally: + self.unfakehttp() + +class urlretrieve_FileTests(unittest.TestCase): + """Test urllib.urlretrieve() on local files""" + + def setUp(self): + # Create a list of temporary files. Each item in the list is a file + # name (absolute path or relative to the current working directory). + # All files in this list will be deleted in the tearDown method. Note, + # this only helps to makes sure temporary files get deleted, but it + # does nothing about trying to close files that may still be open. It + # is the responsibility of the developer to properly close files even + # when exceptional conditions occur. + self.tempFiles = [] + + # Create a temporary file. + self.registerFileForCleanUp(test_support.TESTFN) + self.text = 'testing urllib.urlretrieve' + try: + FILE = file(test_support.TESTFN, 'wb') + FILE.write(self.text) + FILE.close() + finally: + try: FILE.close() + except: pass + + def tearDown(self): + # Delete the temporary files. + for each in self.tempFiles: + try: os.remove(each) + except: pass + + def constructLocalFileUrl(self, filePath): + return "file://%s" % urllib.pathname2url(os.path.abspath(filePath)) + + def createNewTempFile(self, data=""): + """Creates a new temporary file containing the specified data, + registers the file for deletion during the test fixture tear down, and + returns the absolute path of the file.""" + + newFd, newFilePath = tempfile.mkstemp() + try: + self.registerFileForCleanUp(newFilePath) + newFile = os.fdopen(newFd, "wb") + newFile.write(data) + newFile.close() + finally: + try: newFile.close() + except: pass + return newFilePath + + def registerFileForCleanUp(self, fileName): + self.tempFiles.append(fileName) + + def test_basic(self): + # Make sure that a local file just gets its own location returned and + # a headers value is returned. + result = urllib.urlretrieve("file:%s" % test_support.TESTFN) + self.assertEqual(result[0], test_support.TESTFN) + self.assert_(isinstance(result[1], mimetools.Message), + "did not get a mimetools.Message instance as second " + "returned value") + + def test_copy(self): + # Test that setting the filename argument works. + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + result = urllib.urlretrieve(self.constructLocalFileUrl( + test_support.TESTFN), second_temp) + self.assertEqual(second_temp, result[0]) + self.assert_(os.path.exists(second_temp), "copy of the file was not " + "made") + FILE = file(second_temp, 'rb') + try: + text = FILE.read() + FILE.close() + finally: + try: FILE.close() + except: pass + self.assertEqual(self.text, text) + + def test_reporthook(self): + # Make sure that the reporthook works. + def hooktester(count, block_size, total_size, count_holder=[0]): + self.assert_(isinstance(count, int)) + self.assert_(isinstance(block_size, int)) + self.assert_(isinstance(total_size, int)) + self.assertEqual(count, count_holder[0]) + count_holder[0] = count_holder[0] + 1 + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), + second_temp, hooktester) + + def test_reporthook_0_bytes(self): + # Test on zero length file. Should call reporthook only 1 time. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile() + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 1) + self.assertEqual(report[0][2], 0) + + def test_reporthook_5_bytes(self): + # Test on 5 byte file. Should call reporthook only 2 times (once when + # the "network connection" is established and once when the block is + # read). Since the block size is 8192 bytes, only one block read is + # required to read the entire file. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 5) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 2) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 5) + + def test_reporthook_8193_bytes(self): + # Test on 8193 byte file. Should call reporthook only 3 times (once + # when the "network connection" is established, once for the next 8192 + # bytes, and once for the last byte). + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 8193) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 3) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 8193) + +class QuotingTests(unittest.TestCase): + """Tests for urllib.quote() and urllib.quote_plus() + + According to RFC 2396 ("Uniform Resource Identifiers), to escape a + character you write it as '%' + <2 character US-ASCII hex value>. The Python + code of ``'%' + hex(ord())[2:]`` escapes a character properly. + Case does not matter on the hex letters. + + The various character sets specified are: + + Reserved characters : ";/?:@&=+$," + Have special meaning in URIs and must be escaped if not being used for + their special meaning + Data characters : letters, digits, and "-_.!~*'()" + Unreserved and do not need to be escaped; can be, though, if desired + Control characters : 0x00 - 0x1F, 0x7F + Have no use in URIs so must be escaped + space : 0x20 + Must be escaped + Delimiters : '<>#%"' + Must be escaped + Unwise : "{}|\^[]`" + Must be escaped + + """ + + def test_never_quote(self): + # Make sure quote() does not quote letters, digits, and "_,.-" + do_not_quote = '' .join(["ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "abcdefghijklmnopqrstuvwxyz", + "0123456789", + "_.-"]) + result = urllib.quote(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote(): %s != %s" % (do_not_quote, result)) + result = urllib.quote_plus(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote_plus(): %s != %s" % (do_not_quote, result)) + + def test_default_safe(self): + # Test '/' is default value for 'safe' parameter + self.assertEqual(urllib.quote.func_defaults[0], '/') + + def test_safe(self): + # Test setting 'safe' parameter does what it should do + quote_by_default = "<>" + result = urllib.quote(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote(): %s != %s" % (quote_by_default, result)) + result = urllib.quote_plus(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote_plus(): %s != %s" % + (quote_by_default, result)) + + def test_default_quoting(self): + # Make sure all characters that should be quoted are by default sans + # space (separate test for that). + should_quote = [chr(num) for num in range(32)] # For 0x00 - 0x1F + should_quote.append('<>#%"{}|\^[]`') + should_quote.append(chr(127)) # For 0x7F + should_quote = ''.join(should_quote) + for char in should_quote: + result = urllib.quote(char) + self.assertEqual(hexescape(char), result, + "using quote(): %s should be escaped to %s, not %s" % + (char, hexescape(char), result)) + result = urllib.quote_plus(char) + self.assertEqual(hexescape(char), result, + "using quote_plus(): " + "%s should be escapes to %s, not %s" % + (char, hexescape(char), result)) + del should_quote + partial_quote = "ab[]cd" + expected = "ab%5B%5Dcd" + result = urllib.quote(partial_quote) + self.assertEqual(expected, result, + "using quote(): %s != %s" % (expected, result)) + self.assertEqual(expected, result, + "using quote_plus(): %s != %s" % (expected, result)) + + def test_quoting_space(self): + # Make sure quote() and quote_plus() handle spaces as specified in + # their unique way + result = urllib.quote(' ') + self.assertEqual(result, hexescape(' '), + "using quote(): %s != %s" % (result, hexescape(' '))) + result = urllib.quote_plus(' ') + self.assertEqual(result, '+', + "using quote_plus(): %s != +" % result) + given = "a b cd e f" + expect = given.replace(' ', hexescape(' ')) + result = urllib.quote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + expect = given.replace(' ', '+') + result = urllib.quote_plus(given) + self.assertEqual(expect, result, + "using quote_plus(): %s != %s" % (expect, result)) + + def test_quoting_plus(self): + self.assertEqual(urllib.quote_plus('alpha+beta gamma'), + 'alpha%2Bbeta+gamma') + self.assertEqual(urllib.quote_plus('alpha+beta gamma', '+'), + 'alpha+beta+gamma') + +class UnquotingTests(unittest.TestCase): + """Tests for unquote() and unquote_plus() + + See the doc string for quoting_Tests for details on quoting and such. + + """ + + def test_unquoting(self): + # Make sure unquoting of all ASCII values works + escape_list = [] + for num in range(128): + given = hexescape(chr(num)) + expect = chr(num) + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % + (expect, result)) + escape_list.append(given) + escape_string = ''.join(escape_list) + del escape_list + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using quote(): not all characters escaped; %s" % + result) + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using unquote(): not all characters escaped: " + "%s" % result) + + def test_unquoting_parts(self): + # Make sure unquoting works when have non-quoted characters + # interspersed + given = 'ab%sd' % hexescape('c') + expect = "abcd" + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquoting_plus(self): + # Test difference between unquote() and unquote_plus() + given = "are+there+spaces..." + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + expect = given.replace('+', ' ') + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquote_with_unicode(self): + r = urllib.unquote(u'br%C3%BCckner_sapporo_20050930.doc') + self.assertEqual(r, u'br\xc3\xbcckner_sapporo_20050930.doc') + +class urlencode_Tests(unittest.TestCase): + """Tests for urlencode()""" + + def help_inputtype(self, given, test_type): + """Helper method for testing different input types. + + 'given' must lead to only the pairs: + * 1st, 1 + * 2nd, 2 + * 3rd, 3 + + Test cannot assume anything about order. Docs make no guarantee and + have possible dictionary input. + + """ + expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] + result = urllib.urlencode(given) + for expected in expect_somewhere: + self.assert_(expected in result, + "testing %s: %s not found in %s" % + (test_type, expected, result)) + self.assertEqual(result.count('&'), 2, + "testing %s: expected 2 '&'s; got %s" % + (test_type, result.count('&'))) + amp_location = result.index('&') + on_amp_left = result[amp_location - 1] + on_amp_right = result[amp_location + 1] + self.assert_(on_amp_left.isdigit() and on_amp_right.isdigit(), + "testing %s: '&' not located in proper place in %s" % + (test_type, result)) + self.assertEqual(len(result), (5 * 3) + 2, #5 chars per thing and amps + "testing %s: " + "unexpected number of characters: %s != %s" % + (test_type, len(result), (5 * 3) + 2)) + + def test_using_mapping(self): + # Test passing in a mapping object as an argument. + self.help_inputtype({"1st":'1', "2nd":'2', "3rd":'3'}, + "using dict as input type") + + def test_using_sequence(self): + # Test passing in a sequence of two-item sequences as an argument. + self.help_inputtype([('1st', '1'), ('2nd', '2'), ('3rd', '3')], + "using sequence of two-item tuples as input") + + def test_quoting(self): + # Make sure keys and values are quoted using quote_plus() + given = {"&":"="} + expect = "%s=%s" % (hexescape('&'), hexescape('=')) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + given = {"key name":"A bunch of pluses"} + expect = "key+name=A+bunch+of+pluses" + result = urllib.urlencode(given) + self.assertEqual(expect, result) + + def test_doseq(self): + # Test that passing True for 'doseq' parameter works correctly + given = {'sequence':['1', '2', '3']} + expect = "sequence=%s" % urllib.quote_plus(str(['1', '2', '3'])) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + result = urllib.urlencode(given, True) + for value in given["sequence"]: + expect = "sequence=%s" % value + self.assert_(expect in result, + "%s not found in %s" % (expect, result)) + self.assertEqual(result.count('&'), 2, + "Expected 2 '&'s, got %s" % result.count('&')) + +class Pathname_Tests(unittest.TestCase): + """Test pathname2url() and url2pathname()""" + + def test_basic(self): + # Make sure simple tests pass + expected_path = os.path.join("parts", "of", "a", "path") + expected_url = "parts/of/a/path" + result = urllib.pathname2url(expected_path) + self.assertEqual(expected_url, result, + "pathname2url() failed; %s != %s" % + (result, expected_url)) + result = urllib.url2pathname(expected_url) + self.assertEqual(expected_path, result, + "url2pathame() failed; %s != %s" % + (result, expected_path)) + + def test_quoting(self): + # Test automatic quoting and unquoting works for pathnam2url() and + # url2pathname() respectively + given = os.path.join("needs", "quot=ing", "here") + expect = "needs/%s/here" % urllib.quote("quot=ing") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + expect = given + result = urllib.url2pathname(result) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + given = os.path.join("make sure", "using_quote") + expect = "%s/using_quote" % urllib.quote("make sure") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + given = "make+sure/using_unquote" + expect = os.path.join("make+sure", "using_unquote") + result = urllib.url2pathname(given) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + + + +def test_main(): + test_support.run_unittest( + urlopen_FileTests, + urlopen_HttpTests, + urlretrieve_FileTests, + QuotingTests, + UnquotingTests, + urlencode_Tests, + Pathname_Tests + ) + + + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.5/test_wsgiref.py python-gevent-1.0/greentest/2.5/test_wsgiref.py --- python-gevent-0.13.7/greentest/2.5/test_wsgiref.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/test_wsgiref.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,615 @@ +from __future__ import nested_scopes # Backward compat for 2.1 +from unittest import TestSuite, TestCase, makeSuite +from wsgiref.util import setup_testing_defaults +from wsgiref.headers import Headers +from wsgiref.handlers import BaseHandler, BaseCGIHandler +from wsgiref import util +from wsgiref.validate import validator +from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app +from wsgiref.simple_server import make_server +from StringIO import StringIO +from SocketServer import BaseServer +import re, sys + + +class MockServer(WSGIServer): + """Non-socket HTTP server""" + + def __init__(self, server_address, RequestHandlerClass): + BaseServer.__init__(self, server_address, RequestHandlerClass) + self.server_bind() + + def server_bind(self): + host, port = self.server_address + self.server_name = host + self.server_port = port + self.setup_environ() + + +class MockHandler(WSGIRequestHandler): + """Non-socket HTTP handler""" + def setup(self): + self.connection = self.request + self.rfile, self.wfile = self.connection + + def finish(self): + pass + + + + + +def hello_app(environ,start_response): + start_response("200 OK", [ + ('Content-Type','text/plain'), + ('Date','Mon, 05 Jun 2006 18:49:54 GMT') + ]) + return ["Hello, world!"] + +def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"): + server = make_server("", 80, app, MockServer, MockHandler) + inp, out, err, olderr = StringIO(data), StringIO(), StringIO(), sys.stderr + sys.stderr = err + + try: + server.finish_request((inp,out), ("127.0.0.1",8888)) + finally: + sys.stderr = olderr + + return out.getvalue(), err.getvalue() + + + + + + + + + + + + + + + + + + + + + + + +def compare_generic_iter(make_it,match): + """Utility to compare a generic 2.1/2.2+ iterator with an iterable + + If running under Python 2.2+, this tests the iterator using iter()/next(), + as well as __getitem__. 'make_it' must be a function returning a fresh + iterator to be tested (since this may test the iterator twice).""" + + it = make_it() + n = 0 + for item in match: + if not it[n]==item: raise AssertionError + n+=1 + try: + it[n] + except IndexError: + pass + else: + raise AssertionError("Too many items from __getitem__",it) + + try: + iter, StopIteration + except NameError: + pass + else: + # Only test iter mode under 2.2+ + it = make_it() + if not iter(it) is it: raise AssertionError + for item in match: + if not it.next()==item: raise AssertionError + try: + it.next() + except StopIteration: + pass + else: + raise AssertionError("Too many items from .next()",it) + + + + + + +class IntegrationTests(TestCase): + + def check_hello(self, out, has_length=True): + self.assertEqual(out, + "HTTP/1.0 200 OK\r\n" + "Server: WSGIServer/0.1 Python/"+sys.version.split()[0]+"\r\n" + "Content-Type: text/plain\r\n" + "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + + (has_length and "Content-Length: 13\r\n" or "") + + "\r\n" + "Hello, world!" + ) + + def test_plain_hello(self): + out, err = run_amock() + self.check_hello(out) + + def test_validated_hello(self): + out, err = run_amock(validator(hello_app)) + # the middleware doesn't support len(), so content-length isn't there + self.check_hello(out, has_length=False) + + def test_simple_validation_error(self): + def bad_app(environ,start_response): + start_response("200 OK", ('Content-Type','text/plain')) + return ["Hello, world!"] + out, err = run_amock(validator(bad_app)) + self.failUnless(out.endswith( + "A server error occurred. Please contact the administrator." + )) + self.assertEqual( + err.splitlines()[-2], + "AssertionError: Headers (('Content-Type', 'text/plain')) must" + " be of type list: " + ) + + + + + + +class UtilityTests(TestCase): + + def checkShift(self,sn_in,pi_in,part,sn_out,pi_out): + env = {'SCRIPT_NAME':sn_in,'PATH_INFO':pi_in} + util.setup_testing_defaults(env) + self.assertEqual(util.shift_path_info(env),part) + self.assertEqual(env['PATH_INFO'],pi_out) + self.assertEqual(env['SCRIPT_NAME'],sn_out) + return env + + def checkDefault(self, key, value, alt=None): + # Check defaulting when empty + env = {} + util.setup_testing_defaults(env) + if isinstance(value,StringIO): + self.failUnless(isinstance(env[key],StringIO)) + else: + self.assertEqual(env[key],value) + + # Check existing value + env = {key:alt} + util.setup_testing_defaults(env) + self.failUnless(env[key] is alt) + + def checkCrossDefault(self,key,value,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(kw[key],value) + + def checkAppURI(self,uri,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.application_uri(kw),uri) + + def checkReqURI(self,uri,query=1,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.request_uri(kw,query),uri) + + + + + + + def checkFW(self,text,size,match): + + def make_it(text=text,size=size): + return util.FileWrapper(StringIO(text),size) + + compare_generic_iter(make_it,match) + + it = make_it() + self.failIf(it.filelike.closed) + + for item in it: + pass + + self.failIf(it.filelike.closed) + + it.close() + self.failUnless(it.filelike.closed) + + + def testSimpleShifts(self): + self.checkShift('','/', '', '/', '') + self.checkShift('','/x', 'x', '/x', '') + self.checkShift('/','', None, '/', '') + self.checkShift('/a','/x/y', 'x', '/a/x', '/y') + self.checkShift('/a','/x/', 'x', '/a/x', '/') + + + def testNormalizedShifts(self): + self.checkShift('/a/b', '/../y', '..', '/a', '/y') + self.checkShift('', '/../y', '..', '', '/y') + self.checkShift('/a/b', '//y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '//y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '/./y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '/./y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '///./..//y/.//', '..', '/a', '/y/') + self.checkShift('/a/b', '///', '', '/a/b/', '') + self.checkShift('/a/b', '/.//', '', '/a/b/', '') + self.checkShift('/a/b', '/x//', 'x', '/a/b/x', '/') + self.checkShift('/a/b', '/.', None, '/a/b', '') + + + def testDefaults(self): + for key, value in [ + ('SERVER_NAME','127.0.0.1'), + ('SERVER_PORT', '80'), + ('SERVER_PROTOCOL','HTTP/1.0'), + ('HTTP_HOST','127.0.0.1'), + ('REQUEST_METHOD','GET'), + ('SCRIPT_NAME',''), + ('PATH_INFO','/'), + ('wsgi.version', (1,0)), + ('wsgi.run_once', 0), + ('wsgi.multithread', 0), + ('wsgi.multiprocess', 0), + ('wsgi.input', StringIO("")), + ('wsgi.errors', StringIO()), + ('wsgi.url_scheme','http'), + ]: + self.checkDefault(key,value) + + + def testCrossDefaults(self): + self.checkCrossDefault('HTTP_HOST',"foo.bar",SERVER_NAME="foo.bar") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="on") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="1") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="yes") + self.checkCrossDefault('wsgi.url_scheme',"http",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"80",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"443",HTTPS="on") + + + def testGuessScheme(self): + self.assertEqual(util.guess_scheme({}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https") + + + + + + def testAppURIs(self): + self.checkAppURI("http://127.0.0.1/") + self.checkAppURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkAppURI("http://spam.example.com:2071/", + HTTP_HOST="spam.example.com:2071", SERVER_PORT="2071") + self.checkAppURI("http://spam.example.com/", + SERVER_NAME="spam.example.com") + self.checkAppURI("http://127.0.0.1/", + HTTP_HOST="127.0.0.1", SERVER_NAME="spam.example.com") + self.checkAppURI("https://127.0.0.1/", HTTPS="on") + self.checkAppURI("http://127.0.0.1:8000/", SERVER_PORT="8000", + HTTP_HOST=None) + + def testReqURIs(self): + self.checkReqURI("http://127.0.0.1/") + self.checkReqURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam", + SCRIPT_NAME="/spammity", PATH_INFO="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni", + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + self.checkReqURI("http://127.0.0.1/spammity/spam", 0, + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + + def testFileWrapper(self): + self.checkFW("xyz"*50, 120, ["xyz"*40,"xyz"*10]) + + def testHopByHop(self): + for hop in ( + "Connection Keep-Alive Proxy-Authenticate Proxy-Authorization " + "TE Trailers Transfer-Encoding Upgrade" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.failUnless(util.is_hop_by_hop(alt)) + + # Not comprehensive, just a few random header names + for hop in ( + "Accept Cache-Control Date Pragma Trailer Via Warning" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.failIf(util.is_hop_by_hop(alt)) + +class HeaderTests(TestCase): + + def testMappingInterface(self): + test = [('x','y')] + self.assertEqual(len(Headers([])),0) + self.assertEqual(len(Headers(test[:])),1) + self.assertEqual(Headers(test[:]).keys(), ['x']) + self.assertEqual(Headers(test[:]).values(), ['y']) + self.assertEqual(Headers(test[:]).items(), test) + self.failIf(Headers(test).items() is test) # must be copy! + + h=Headers([]) + del h['foo'] # should not raise an error + + h['Foo'] = 'bar' + for m in h.has_key, h.__contains__, h.get, h.get_all, h.__getitem__: + self.failUnless(m('foo')) + self.failUnless(m('Foo')) + self.failUnless(m('FOO')) + self.failIf(m('bar')) + + self.assertEqual(h['foo'],'bar') + h['foo'] = 'baz' + self.assertEqual(h['FOO'],'baz') + self.assertEqual(h.get_all('foo'),['baz']) + + self.assertEqual(h.get("foo","whee"), "baz") + self.assertEqual(h.get("zoo","whee"), "whee") + self.assertEqual(h.setdefault("foo","whee"), "baz") + self.assertEqual(h.setdefault("zoo","whee"), "whee") + self.assertEqual(h["foo"],"baz") + self.assertEqual(h["zoo"],"whee") + + def testRequireList(self): + self.assertRaises(TypeError, Headers, "foo") + + + def testExtras(self): + h = Headers([]) + self.assertEqual(str(h),'\r\n') + + h.add_header('foo','bar',baz="spam") + self.assertEqual(h['foo'], 'bar; baz="spam"') + self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n') + + h.add_header('Foo','bar',cheese=None) + self.assertEqual(h.get_all('foo'), + ['bar; baz="spam"', 'bar; cheese']) + + self.assertEqual(str(h), + 'foo: bar; baz="spam"\r\n' + 'Foo: bar; cheese\r\n' + '\r\n' + ) + + +class ErrorHandler(BaseCGIHandler): + """Simple handler subclass for testing BaseHandler""" + + def __init__(self,**kw): + setup_testing_defaults(kw) + BaseCGIHandler.__init__( + self, StringIO(''), StringIO(), StringIO(), kw, + multithread=True, multiprocess=True + ) + +class TestHandler(ErrorHandler): + """Simple handler subclass for testing BaseHandler, w/error passthru""" + + def handle_error(self): + raise # for testing, we want to see what's happening + + + + + + + + + + + +class HandlerTests(TestCase): + + def checkEnvironAttrs(self, handler): + env = handler.environ + for attr in [ + 'version','multithread','multiprocess','run_once','file_wrapper' + ]: + if attr=='file_wrapper' and handler.wsgi_file_wrapper is None: + continue + self.assertEqual(getattr(handler,'wsgi_'+attr),env['wsgi.'+attr]) + + def checkOSEnviron(self,handler): + empty = {}; setup_testing_defaults(empty) + env = handler.environ + from os import environ + for k,v in environ.items(): + if not empty.has_key(k): + self.assertEqual(env[k],v) + for k,v in empty.items(): + self.failUnless(env.has_key(k)) + + def testEnviron(self): + h = TestHandler(X="Y") + h.setup_environ() + self.checkEnvironAttrs(h) + self.checkOSEnviron(h) + self.assertEqual(h.environ["X"],"Y") + + def testCGIEnviron(self): + h = BaseCGIHandler(None,None,None,{}) + h.setup_environ() + for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors': + self.assert_(h.environ.has_key(key)) + + def testScheme(self): + h=TestHandler(HTTPS="on"); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'https') + h=TestHandler(); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'http') + + + def testAbstractMethods(self): + h = BaseHandler() + for name in [ + '_flush','get_stdin','get_stderr','add_cgi_vars' + ]: + self.assertRaises(NotImplementedError, getattr(h,name)) + self.assertRaises(NotImplementedError, h._write, "test") + + + def testContentLength(self): + # Demo one reason iteration is better than write()... ;) + + def trivial_app1(e,s): + s('200 OK',[]) + return [e['wsgi.url_scheme']] + + def trivial_app2(e,s): + s('200 OK',[])(e['wsgi.url_scheme']) + return [] + + h = TestHandler() + h.run(trivial_app1) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 4\r\n" + "\r\n" + "http") + + h = TestHandler() + h.run(trivial_app2) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n" + "http") + + + + + + + + def testBasicErrorOutput(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + def error_app(e,s): + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(non_error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 0\r\n" + "\r\n") + self.assertEqual(h.stderr.getvalue(),"") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: %s\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: %d\r\n" + "\r\n%s" % (h.error_status,len(h.error_body),h.error_body)) + + self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1) + + def testErrorAfterOutput(self): + MSG = "Some output has been sent" + def error_app(e,s): + s("200 OK",[])(MSG) + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n"+MSG) + self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1) + + + def testHeaderFormats(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + stdpat = ( + r"HTTP/%s 200 OK\r\n" + r"Date: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n" + r"%s" r"Content-Length: 0\r\n" r"\r\n" + ) + shortpat = ( + "Status: 200 OK\r\n" "Content-Length: 0\r\n" "\r\n" + ) + + for ssw in "FooBar/1.0", None: + sw = ssw and "Server: %s\r\n" % ssw or "" + + for version in "1.0", "1.1": + for proto in "HTTP/0.9", "HTTP/1.0", "HTTP/1.1": + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = False + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + self.assertEqual(shortpat,h.stdout.getvalue()) + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = True + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + if proto=="HTTP/0.9": + self.assertEqual(h.stdout.getvalue(),"") + else: + self.failUnless( + re.match(stdpat%(version,sw), h.stdout.getvalue()), + (stdpat%(version,sw), h.stdout.getvalue()) + ) + +# This epilogue is needed for compatibility with the Python 2.5 regrtest module + +def test_main(): + import unittest + from test.test_support import run_suite + run_suite( + unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) + ) + +if __name__ == "__main__": + test_main() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# the above lines intentionally left blank diff -Nru python-gevent-0.13.7/greentest/2.5/version python-gevent-1.0/greentest/2.5/version --- python-gevent-0.13.7/greentest/2.5/version 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.5/version 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1 @@ +2.5.6 diff -Nru python-gevent-0.13.7/greentest/2.6/badcert.pem python-gevent-1.0/greentest/2.6/badcert.pem --- python-gevent-0.13.7/greentest/2.6/badcert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/badcert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,36 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +Just bad cert data +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +Just bad cert data +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.6/badkey.pem python-gevent-1.0/greentest/2.6/badkey.pem --- python-gevent-0.13.7/greentest/2.6/badkey.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/badkey.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,40 @@ +-----BEGIN RSA PRIVATE KEY----- +Bad Key, though the cert should be OK +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +Bad Key, though the cert should be OK +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.6/https_svn_python_org_root.pem python-gevent-1.0/greentest/2.6/https_svn_python_org_root.pem --- python-gevent-0.13.7/greentest/2.6/https_svn_python_org_root.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/https_svn_python_org_root.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,41 @@ +-----BEGIN CERTIFICATE----- +MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290 +IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB +IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA +Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO +BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi +MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ +ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ +8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6 +zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y +fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7 +w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc +G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k +epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q +laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ +QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU +fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826 +YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w +ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY +gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe +MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0 +IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy +dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw +czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0 +dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl +aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC +AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg +b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB +ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc +nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg +18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c +gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl +Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY +sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T +SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF +CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum +GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk +zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW +omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.6/keycert.pem python-gevent-1.0/greentest/2.6/keycert.pem --- python-gevent-0.13.7/greentest/2.6/keycert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/keycert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.6/lock_tests.py python-gevent-1.0/greentest/2.6/lock_tests.py --- python-gevent-0.13.7/greentest/2.6/lock_tests.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/lock_tests.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,550 @@ +""" +Various tests for synchronization primitives. +""" + +import sys +import time +from thread import start_new_thread, get_ident +import threading +import unittest + +from test import test_support as support + + +def _wait(): + # A crude wait/yield function not relying on synchronization primitives. + time.sleep(0.01) + +class Bunch(object): + """ + A bunch of threads. + """ + def __init__(self, f, n, wait_before_exit=False): + """ + Construct a bunch of `n` threads running the same function `f`. + If `wait_before_exit` is True, the threads won't terminate until + do_finish() is called. + """ + self.f = f + self.n = n + self.started = [] + self.finished = [] + self._can_exit = not wait_before_exit + def task(): + tid = get_ident() + self.started.append(tid) + try: + f() + finally: + self.finished.append(tid) + while not self._can_exit: + _wait() + for i in range(n): + start_new_thread(task, ()) + + def wait_for_started(self): + while len(self.started) < self.n: + _wait() + + def wait_for_finished(self): + while len(self.finished) < self.n: + _wait() + + def do_finish(self): + self._can_exit = True + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = support.threading_setup() + + def tearDown(self): + support.threading_cleanup(*self._threads) + support.reap_children() + + +class BaseLockTests(BaseTestCase): + """ + Tests for both recursive and non-recursive locks. + """ + + def test_constructor(self): + lock = self.locktype() + del lock + + def test_acquire_destroy(self): + lock = self.locktype() + lock.acquire() + del lock + + def test_acquire_release(self): + lock = self.locktype() + lock.acquire() + lock.release() + del lock + + def test_try_acquire(self): + lock = self.locktype() + self.assertTrue(lock.acquire(False)) + lock.release() + + def test_try_acquire_contended(self): + lock = self.locktype() + lock.acquire() + result = [] + def f(): + result.append(lock.acquire(False)) + Bunch(f, 1).wait_for_finished() + self.assertFalse(result[0]) + lock.release() + + def test_acquire_contended(self): + lock = self.locktype() + lock.acquire() + N = 5 + def f(): + lock.acquire() + lock.release() + + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(len(b.finished), 0) + lock.release() + b.wait_for_finished() + self.assertEqual(len(b.finished), N) + + def test_with(self): + lock = self.locktype() + def f(): + lock.acquire() + lock.release() + def _with(err=None): + with lock: + if err is not None: + raise err + _with() + # Check the lock is unacquired + Bunch(f, 1).wait_for_finished() + self.assertRaises(TypeError, _with, TypeError) + # Check the lock is unacquired + Bunch(f, 1).wait_for_finished() + + def test_thread_leak(self): + # The lock shouldn't leak a Thread instance when used from a foreign + # (non-threading) thread. + lock = self.locktype() + def f(): + lock.acquire() + lock.release() + n = len(threading.enumerate()) + # We run many threads in the hope that existing threads ids won't + # be recycled. + Bunch(f, 15).wait_for_finished() + self.assertEqual(n, len(threading.enumerate())) + + +class LockTests(BaseLockTests): + """ + Tests for non-recursive, weak locks + (which can be acquired and released from different threads). + """ + def test_reacquire(self): + # Lock needs to be released before re-acquiring. + lock = self.locktype() + phase = [] + def f(): + lock.acquire() + phase.append(None) + lock.acquire() + phase.append(None) + start_new_thread(f, ()) + while len(phase) == 0: + _wait() + _wait() + self.assertEqual(len(phase), 1) + lock.release() + while len(phase) == 1: + _wait() + self.assertEqual(len(phase), 2) + + def test_different_thread(self): + # Lock can be released from a different thread. + lock = self.locktype() + lock.acquire() + def f(): + lock.release() + b = Bunch(f, 1) + b.wait_for_finished() + lock.acquire() + lock.release() + + +class RLockTests(BaseLockTests): + """ + Tests for recursive locks. + """ + def test_reacquire(self): + lock = self.locktype() + lock.acquire() + lock.acquire() + lock.release() + lock.acquire() + lock.release() + lock.release() + + def test_release_unacquired(self): + # Cannot release an unacquired lock + lock = self.locktype() + self.assertRaises(RuntimeError, lock.release) + lock.acquire() + lock.acquire() + lock.release() + lock.acquire() + lock.release() + lock.release() + self.assertRaises(RuntimeError, lock.release) + + def test_different_thread(self): + # Cannot release from a different thread + lock = self.locktype() + def f(): + lock.acquire() + b = Bunch(f, 1, True) + try: + self.assertRaises(RuntimeError, lock.release) + finally: + b.do_finish() + + def test__is_owned(self): + lock = self.locktype() + self.assertFalse(lock._is_owned()) + lock.acquire() + self.assertTrue(lock._is_owned()) + lock.acquire() + self.assertTrue(lock._is_owned()) + result = [] + def f(): + result.append(lock._is_owned()) + Bunch(f, 1).wait_for_finished() + self.assertFalse(result[0]) + lock.release() + self.assertTrue(lock._is_owned()) + lock.release() + self.assertFalse(lock._is_owned()) + + +class EventTests(BaseTestCase): + """ + Tests for Event objects. + """ + + def test_is_set(self): + evt = self.eventtype() + self.assertFalse(evt.is_set()) + evt.set() + self.assertTrue(evt.is_set()) + evt.set() + self.assertTrue(evt.is_set()) + evt.clear() + self.assertFalse(evt.is_set()) + evt.clear() + self.assertFalse(evt.is_set()) + + def _check_notify(self, evt): + # All threads get notified + N = 5 + results1 = [] + results2 = [] + def f(): + evt.wait() + results1.append(evt.is_set()) + evt.wait() + results2.append(evt.is_set()) + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(len(results1), 0) + evt.set() + b.wait_for_finished() + self.assertEqual(results1, [True] * N) + self.assertEqual(results2, [True] * N) + + def test_notify(self): + evt = self.eventtype() + self._check_notify(evt) + # Another time, after an explicit clear() + evt.set() + evt.clear() + self._check_notify(evt) + + def test_timeout(self): + evt = self.eventtype() + results1 = [] + results2 = [] + N = 5 + def f(): + evt.wait(0.0) + results1.append(evt.is_set()) + t1 = time.time() + evt.wait(0.2) + r = evt.is_set() + t2 = time.time() + results2.append((r, t2 - t1)) + Bunch(f, N).wait_for_finished() + self.assertEqual(results1, [False] * N) + for r, dt in results2: + self.assertFalse(r) + self.assertTrue(dt >= 0.2, dt) + # The event is set + results1 = [] + results2 = [] + evt.set() + Bunch(f, N).wait_for_finished() + self.assertEqual(results1, [True] * N) + for r, dt in results2: + self.assertTrue(r) + + +class ConditionTests(BaseTestCase): + """ + Tests for condition variables. + """ + + def test_acquire(self): + cond = self.condtype() + # Be default we have an RLock: the condition can be acquired multiple + # times. + cond.acquire() + cond.acquire() + cond.release() + cond.release() + lock = threading.Lock() + cond = self.condtype(lock) + cond.acquire() + self.assertFalse(lock.acquire(False)) + cond.release() + self.assertTrue(lock.acquire(False)) + self.assertFalse(cond.acquire(False)) + lock.release() + with cond: + self.assertFalse(lock.acquire(False)) + + def test_unacquired_wait(self): + cond = self.condtype() + self.assertRaises(RuntimeError, cond.wait) + + def test_unacquired_notify(self): + cond = self.condtype() + self.assertRaises(RuntimeError, cond.notify) + + def _check_notify(self, cond): + N = 5 + results1 = [] + results2 = [] + phase_num = 0 + def f(): + cond.acquire() + cond.wait() + cond.release() + results1.append(phase_num) + cond.acquire() + cond.wait() + cond.release() + results2.append(phase_num) + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(results1, []) + # Notify 3 threads at first + cond.acquire() + cond.notify(3) + _wait() + phase_num = 1 + cond.release() + while len(results1) < 3: + _wait() + self.assertEqual(results1, [1] * 3) + self.assertEqual(results2, []) + # Notify 5 threads: they might be in their first or second wait + cond.acquire() + cond.notify(5) + _wait() + phase_num = 2 + cond.release() + while len(results1) + len(results2) < 8: + _wait() + self.assertEqual(results1, [1] * 3 + [2] * 2) + self.assertEqual(results2, [2] * 3) + # Notify all threads: they are all in their second wait + cond.acquire() + cond.notify_all() + _wait() + phase_num = 3 + cond.release() + while len(results2) < 5: + _wait() + self.assertEqual(results1, [1] * 3 + [2] * 2) + self.assertEqual(results2, [2] * 3 + [3] * 2) + b.wait_for_finished() + + def test_notify(self): + cond = self.condtype() + self._check_notify(cond) + # A second time, to check internal state is still ok. + self._check_notify(cond) + + def test_timeout(self): + cond = self.condtype() + results = [] + N = 5 + def f(): + cond.acquire() + t1 = time.time() + cond.wait(0.2) + t2 = time.time() + cond.release() + results.append(t2 - t1) + Bunch(f, N).wait_for_finished() + self.assertEqual(len(results), 5) + for dt in results: + self.assertTrue(dt >= 0.2, dt) + + +class BaseSemaphoreTests(BaseTestCase): + """ + Common tests for {bounded, unbounded} semaphore objects. + """ + + def test_constructor(self): + self.assertRaises(ValueError, self.semtype, value = -1) + self.assertRaises(ValueError, self.semtype, value = -sys.maxint) + + def test_acquire(self): + sem = self.semtype(1) + sem.acquire() + sem.release() + sem = self.semtype(2) + sem.acquire() + sem.acquire() + sem.release() + sem.release() + + def test_acquire_destroy(self): + sem = self.semtype() + sem.acquire() + del sem + + def test_acquire_contended(self): + sem = self.semtype(7) + sem.acquire() + N = 10 + results1 = [] + results2 = [] + phase_num = 0 + def f(): + sem.acquire() + results1.append(phase_num) + sem.acquire() + results2.append(phase_num) + b = Bunch(f, 10) + b.wait_for_started() + while len(results1) + len(results2) < 6: + _wait() + self.assertEqual(results1 + results2, [0] * 6) + phase_num = 1 + for i in range(7): + sem.release() + while len(results1) + len(results2) < 13: + _wait() + self.assertEqual(sorted(results1 + results2), [0] * 6 + [1] * 7) + phase_num = 2 + for i in range(6): + sem.release() + while len(results1) + len(results2) < 19: + _wait() + self.assertEqual(sorted(results1 + results2), [0] * 6 + [1] * 7 + [2] * 6) + # The semaphore is still locked + self.assertFalse(sem.acquire(False)) + # Final release, to let the last thread finish + sem.release() + b.wait_for_finished() + + def test_try_acquire(self): + sem = self.semtype(2) + self.assertTrue(sem.acquire(False)) + self.assertTrue(sem.acquire(False)) + self.assertFalse(sem.acquire(False)) + sem.release() + self.assertTrue(sem.acquire(False)) + + def test_try_acquire_contended(self): + sem = self.semtype(4) + sem.acquire() + results = [] + def f(): + results.append(sem.acquire(False)) + results.append(sem.acquire(False)) + Bunch(f, 5).wait_for_finished() + # There can be a thread switch between acquiring the semaphore and + # appending the result, therefore results will not necessarily be + # ordered. + self.assertEqual(sorted(results), [False] * 7 + [True] * 3 ) + + def test_default_value(self): + # The default initial value is 1. + sem = self.semtype() + sem.acquire() + def f(): + sem.acquire() + sem.release() + b = Bunch(f, 1) + b.wait_for_started() + _wait() + self.assertFalse(b.finished) + sem.release() + b.wait_for_finished() + + def test_with(self): + sem = self.semtype(2) + def _with(err=None): + with sem: + self.assertTrue(sem.acquire(False)) + sem.release() + with sem: + self.assertFalse(sem.acquire(False)) + if err: + raise err + _with() + self.assertTrue(sem.acquire(False)) + sem.release() + self.assertRaises(TypeError, _with, TypeError) + self.assertTrue(sem.acquire(False)) + sem.release() + +class SemaphoreTests(BaseSemaphoreTests): + """ + Tests for unbounded semaphores. + """ + + def test_release_unacquired(self): + # Unbounded releases are allowed and increment the semaphore's value + sem = self.semtype(1) + sem.release() + sem.acquire() + sem.acquire() + sem.release() + + +class BoundedSemaphoreTests(BaseSemaphoreTests): + """ + Tests for bounded semaphores. + """ + + def test_release_unacquired(self): + # Cannot go past the initial value + sem = self.semtype() + self.assertRaises(ValueError, sem.release) + sem.acquire() + sem.release() + self.assertRaises(ValueError, sem.release) diff -Nru python-gevent-0.13.7/greentest/2.6/sha256.pem python-gevent-1.0/greentest/2.6/sha256.pem --- python-gevent-0.13.7/greentest/2.6/sha256.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/sha256.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFxzCCA6+gAwIBAgIJALnlnf5uzTkIMA0GCSqGSIb3DQEBCwUAMEsxCzAJBgNV +BAYTAkRFMRcwFQYDVQQKEw5zY2hva29rZWtzLm9yZzEjMCEGCSqGSIb3DQEJARYU +aGFubm9Ac2Nob2tva2Vrcy5vcmcwHhcNMTAwMTI3MDAyMTI1WhcNMjAwMTI1MDAy +MTI1WjBLMQswCQYDVQQGEwJERTEXMBUGA1UEChMOc2Nob2tva2Vrcy5vcmcxIzAh +BgkqhkiG9w0BCQEWFGhhbm5vQHNjaG9rb2tla3Mub3JnMIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEApJ4ODPwEooMW35dQPlBqdvcfkEvjhcsA7jmJfFqN +e/1T34zT44X9+KnMBSG2InacbD7eyFgjfaENFsZ87YkEBDIFZ/SHotLJZORQ8PUj +YoxPG4mjKN+yL2WthNcYbRyJreTbbDroNMuw6tkTSxeSXyYFQrKMCUfErVbZa/d5 +RvfFVk+Au9dVUFhed/Stn5cv+a0ffvpyA7ygihm1kMFICbvPeI0846tmC2Ph7rM5 +pYQyNBDOVpULODTk5Wu6jiiJJygvJWCZ1FdpsdBs5aKWHWdRhX++quGuflTTjH5d +qaIka4op9H7XksYphTDXmV+qHnva5jbPogwutDQcVsGBQcJaLmQqhsQK13bf4khE +iWJvfBLfHn8OOpY25ZwwuigJIwifNCxQeeT1FrLmyuYNhz2phPpzx065kqSUSR+A +Iw8DPE6e65UqMDKqZnID3dQeiQaFrHEV+Ibo0U/tD0YSBw5p33TMh0Es33IBWMac +m7x4hIFWdhl8W522u6qOrTswY3s8vB7blNWqMc9n7oWH8ybFf7EgKeDVtEN9AyBE +0WotXIEZWI+WvDbU1ACJXau9sQhYP/eerg7Zwr3iGUy4IQ5oUJibnjtcE+z8zmDN +pE6YcMCLJyLjXiQ3iHG9mNXzw7wPnslTbEEEukrfSlHGgW8Dm+VrNyW0JUM1bntx +vbMCAwEAAaOBrTCBqjAdBgNVHQ4EFgQUCedv7pDTuXtCxm4HTw9hUtrTvsowewYD +VR0jBHQwcoAUCedv7pDTuXtCxm4HTw9hUtrTvsqhT6RNMEsxCzAJBgNVBAYTAkRF +MRcwFQYDVQQKEw5zY2hva29rZWtzLm9yZzEjMCEGCSqGSIb3DQEJARYUaGFubm9A +c2Nob2tva2Vrcy5vcmeCCQC55Z3+bs05CDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4ICAQBHKAxA7WA/MEFjet03K8ouzEOr6Jrk2fZOuRhoDZ+9gr4FtaJB +P3Hh5D00kuSOvDnwsvCohxeNd1KTMAwVmVoH+NZkHERn3UXniUENlp18koI1ehlr +CZbXbzzE9Te9BelliSFA63q0cq0yJN1x9GyabU34XkAouCAmOqfSpKNZWZHGBHPF +bbYnZrHEMcsye6vKeTOcg1GqUHGrQM2WK0QaOwnCQv2RblI9VN+SeRoUJ44qTXdW +TwIYStsIPesacNcAQTStnHgKqIPx4zCwdx5xo8zONbXJfocqwyFqiAofvb9dN1nW +g1noVBcXB+oRBZW5CjFw87U88itq39i9+BWl835DWLBW2pVmx1QTLGv0RNgs/xVx +mWnjH4nNHvrjn6pRmqHZTk/SS0Hkl2qtDsynVxIl8EiMTfWSU3DBTuD2J/RSzuOE +eKtAbaoXkXE31jCl4FEZLITIZd8UkXacb9rN304tAK92L76JOAV+xOZxFRipmvx4 ++A9qQXgLhtP4VaDajb44V/kCKPSA0Vm3apehke9Wl8dDtagfos1e6MxSu3EVLXRF +SP2U777V77pdMSd0f/7cerKn5FjrxW1v1FaP1oIGniMk4qQNTgA/jvvhjybsPlVA +jsfnhWGbh1voJa0RQcMiRMsxpw2P1KNOEu37W2eq/vFghVztZJQUmb5iNw== +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.6/test_asyncore.py python-gevent-1.0/greentest/2.6/test_asyncore.py --- python-gevent-0.13.7/greentest/2.6/test_asyncore.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_asyncore.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,436 @@ +import asyncore +import unittest +import select +import os +import socket +import threading +import sys +import time +import errno + +from test import test_support +from test.test_support import TESTFN, run_unittest, unlink +from StringIO import StringIO + +HOST = test_support.HOST + +class dummysocket: + def __init__(self): + self.closed = False + + def close(self): + self.closed = True + + def fileno(self): + return 42 + +class dummychannel: + def __init__(self): + self.socket = dummysocket() + + def close(self): + self.socket.close() + +class exitingdummy: + def __init__(self): + pass + + def handle_read_event(self): + raise asyncore.ExitNow() + + handle_write_event = handle_read_event + handle_close = handle_read_event + handle_expt_event = handle_read_event + +class crashingdummy: + def __init__(self): + self.error_handled = False + + def handle_read_event(self): + raise Exception() + + handle_write_event = handle_read_event + handle_close = handle_read_event + handle_expt_event = handle_read_event + + def handle_error(self): + self.error_handled = True + +# used when testing senders; just collects what it gets until newline is sent +def capture_server(evt, buf, serv): + try: + serv.listen(5) + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 200 + while n > 0: + r, w, e = select.select([conn], [], []) + if r: + data = conn.recv(10) + # keep everything except for the newline terminator + buf.write(data.replace('\n', '')) + if '\n' in data: + break + n -= 1 + time.sleep(0.01) + + conn.close() + finally: + serv.close() + evt.set() + + +class HelperFunctionTests(unittest.TestCase): + def test_readwriteexc(self): + # Check exception handling behavior of read, write and _exception + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore read/write/_exception calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) + self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) + self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.read(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore.write(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore._exception(tr2) + self.assertEqual(tr2.error_handled, True) + + # asyncore.readwrite uses constants in the select module that + # are not present in Windows systems (see this thread: + # http://mail.python.org/pipermail/python-list/2001-October/109973.html) + # These constants should be present as long as poll is available + + if hasattr(select, 'poll'): + def test_readwrite(self): + # Check that correct methods are called by readwrite() + + attributes = ('read', 'expt', 'write', 'closed', 'error_handled') + + expected = ( + (select.POLLIN, 'read'), + (select.POLLPRI, 'expt'), + (select.POLLOUT, 'write'), + (select.POLLERR, 'closed'), + (select.POLLHUP, 'closed'), + (select.POLLNVAL, 'closed'), + ) + + class testobj: + def __init__(self): + self.read = False + self.write = False + self.closed = False + self.expt = False + self.error_handled = False + + def handle_read_event(self): + self.read = True + + def handle_write_event(self): + self.write = True + + def handle_close(self): + self.closed = True + + def handle_expt_event(self): + self.expt = True + + def handle_error(self): + self.error_handled = True + + for flag, expectedattr in expected: + tobj = testobj() + self.assertEqual(getattr(tobj, expectedattr), False) + asyncore.readwrite(tobj, flag) + + # Only the attribute modified by the routine we expect to be + # called should be True. + for attr in attributes: + self.assertEqual(getattr(tobj, attr), attr==expectedattr) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + self.assertEqual(tr2.error_handled, False) + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + def test_closeall(self): + self.closeall_check(False) + + def test_closeall_default(self): + self.closeall_check(True) + + def closeall_check(self, usedefault): + # Check that close_all() closes everything in a given map + + l = [] + testmap = {} + for i in range(10): + c = dummychannel() + l.append(c) + self.assertEqual(c.socket.closed, False) + testmap[i] = c + + if usedefault: + socketmap = asyncore.socket_map + try: + asyncore.socket_map = testmap + asyncore.close_all() + finally: + testmap, asyncore.socket_map = asyncore.socket_map, socketmap + else: + asyncore.close_all(testmap) + + self.assertEqual(len(testmap), 0) + + for c in l: + self.assertEqual(c.socket.closed, True) + + def test_compact_traceback(self): + try: + raise Exception("I don't like spam!") + except: + real_t, real_v, real_tb = sys.exc_info() + r = asyncore.compact_traceback() + else: + self.fail("Expected exception") + + (f, function, line), t, v, info = r + self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') + self.assertEqual(function, 'test_compact_traceback') + self.assertEqual(t, real_t) + self.assertEqual(v, real_v) + self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) + + +class DispatcherTests(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_basic(self): + d = asyncore.dispatcher() + self.assertEqual(d.readable(), True) + self.assertEqual(d.writable(), True) + + def test_repr(self): + d = asyncore.dispatcher() + self.assertEqual(repr(d), '' % id(d)) + + def test_log(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log() (to stderr) + fp = StringIO() + stderr = sys.stderr + l1 = "Lovely spam! Wonderful spam!" + l2 = "I don't like spam!" + try: + sys.stderr = fp + d.log(l1) + d.log(l2) + finally: + sys.stderr = stderr + + lines = fp.getvalue().splitlines() + self.assertEquals(lines, ['log: %s' % l1, 'log: %s' % l2]) + + def test_log_info(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + l1 = "Have you got anything without spam?" + l2 = "Why can't she have egg bacon spam and sausage?" + l3 = "THAT'S got spam in it!" + try: + sys.stdout = fp + d.log_info(l1, 'EGGS') + d.log_info(l2) + d.log_info(l3, 'SPAM') + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] + + self.assertEquals(lines, expected) + + def test_unhandled(self): + d = asyncore.dispatcher() + d.ignore_log_types = () + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + try: + sys.stdout = fp + d.handle_expt() + d.handle_read() + d.handle_write() + d.handle_connect() + d.handle_accept() + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['warning: unhandled incoming priority event', + 'warning: unhandled read event', + 'warning: unhandled write event', + 'warning: unhandled connect event', + 'warning: unhandled accept event'] + self.assertEquals(lines, expected) + + def test_issue_8594(self): + d = asyncore.dispatcher(socket.socket()) + # make sure the error message no longer refers to the socket + # object but the dispatcher instance instead + try: + d.foo + except AttributeError, err: + self.assertTrue('dispatcher instance' in str(err)) + else: + self.fail("exception not raised") + # test cheap inheritance with the underlying socket + self.assertEqual(d.family, socket.AF_INET) + + def test_strerror(self): + # refers to bug #8573 + err = asyncore._strerror(errno.EPERM) + if hasattr(os, 'strerror'): + self.assertEqual(err, os.strerror(errno.EPERM)) + err = asyncore._strerror(-1) + self.assertTrue("unknown error" in err.lower()) + + +class dispatcherwithsend_noread(asyncore.dispatcher_with_send): + def readable(self): + return False + + def handle_connect(self): + pass + +class DispatcherWithSendTests(unittest.TestCase): + usepoll = False + + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_send(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(3) + self.port = test_support.bind_port(self.sock) + + cap = StringIO() + args = (self.evt, cap, self.sock) + threading.Thread(target=capture_server, args=args).start() + + # wait a little longer for the server to initialize (it sometimes + # refuses connections on slow machines without this wait) + time.sleep(0.2) + + data = "Suppose there isn't a 16-ton weight?" + d = dispatcherwithsend_noread() + d.create_socket(socket.AF_INET, socket.SOCK_STREAM) + d.connect((HOST, self.port)) + + # give time for socket to connect + time.sleep(0.1) + + d.send(data) + d.send(data) + d.send('\n') + + n = 1000 + while d.out_buffer and n > 0: + asyncore.poll() + n -= 1 + + self.evt.wait() + + self.assertEqual(cap.getvalue(), data*2) + + +class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): + usepoll = True + +if hasattr(asyncore, 'file_wrapper'): + class FileWrapperTest(unittest.TestCase): + def setUp(self): + self.d = "It's not dead, it's sleeping!" + file(TESTFN, 'w').write(self.d) + + def tearDown(self): + unlink(TESTFN) + + def test_recv(self): + fd = os.open(TESTFN, os.O_RDONLY) + w = asyncore.file_wrapper(fd) + os.close(fd) + + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) + self.assertEqual(w.recv(13), "It's not dead") + self.assertEqual(w.read(6), ", it's") + w.close() + self.assertRaises(OSError, w.read, 1) + + def test_send(self): + d1 = "Come again?" + d2 = "I want to buy some cheese." + fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) + w = asyncore.file_wrapper(fd) + os.close(fd) + + w.write(d1) + w.send(d2) + w.close() + self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) + + def test_dispatcher(self): + fd = os.open(TESTFN, os.O_RDONLY) + data = [] + class FileDispatcher(asyncore.file_dispatcher): + def handle_read(self): + data.append(self.recv(29)) + s = FileDispatcher(fd) + os.close(fd) + asyncore.loop(timeout=0.01, use_poll=True, count=2) + self.assertEqual("".join(data), self.d) + + +def test_main(): + tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, + DispatcherWithSendTests_UsePoll] + if hasattr(asyncore, 'file_wrapper'): + tests.append(FileWrapperTest) + + run_unittest(*tests) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_ftplib.py python-gevent-1.0/greentest/2.6/test_ftplib.py --- python-gevent-0.13.7/greentest/2.6/test_ftplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_ftplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,511 @@ +"""Test script for ftplib module.""" + +# Modified by Giampaolo Rodola' to test FTP class and IPv6 environment + +import ftplib +import threading +import asyncore +import asynchat +import socket +import StringIO + +from unittest import TestCase +from test import test_support +from test.test_support import HOST + + +# the dummy data returned by server over the data channel when +# RETR, LIST and NLST commands are issued +RETR_DATA = 'abcde12345\r\n' * 1000 +LIST_DATA = 'foo\r\nbar\r\n' +NLST_DATA = 'foo\r\nbar\r\n' + + +class DummyDTPHandler(asynchat.async_chat): + + def __init__(self, conn, baseclass): + asynchat.async_chat.__init__(self, conn) + self.baseclass = baseclass + self.baseclass.last_received_data = '' + + def handle_read(self): + self.baseclass.last_received_data += self.recv(1024) + + def handle_close(self): + self.baseclass.push('226 transfer complete') + self.close() + + +class DummyFTPHandler(asynchat.async_chat): + + def __init__(self, conn): + asynchat.async_chat.__init__(self, conn) + self.set_terminator("\r\n") + self.in_buffer = [] + self.dtp = None + self.last_received_cmd = None + self.last_received_data = '' + self.next_response = '' + self.push('220 welcome') + + def collect_incoming_data(self, data): + self.in_buffer.append(data) + + def found_terminator(self): + line = ''.join(self.in_buffer) + self.in_buffer = [] + if self.next_response: + self.push(self.next_response) + self.next_response = '' + cmd = line.split(' ')[0].lower() + self.last_received_cmd = cmd + space = line.find(' ') + if space != -1: + arg = line[space + 1:] + else: + arg = "" + if hasattr(self, 'cmd_' + cmd): + method = getattr(self, 'cmd_' + cmd) + method(arg) + else: + self.push('550 command "%s" not understood.' %cmd) + + def handle_error(self): + raise + + def push(self, data): + asynchat.async_chat.push(self, data + '\r\n') + + def cmd_port(self, arg): + addr = map(int, arg.split(',')) + ip = '%d.%d.%d.%d' %tuple(addr[:4]) + port = (addr[4] * 256) + addr[5] + s = socket.create_connection((ip, port), timeout=2) + self.dtp = DummyDTPHandler(s, baseclass=self) + self.push('200 active data connection established') + + def cmd_pasv(self, arg): + sock = socket.socket() + sock.bind((self.socket.getsockname()[0], 0)) + sock.listen(5) + sock.settimeout(2) + ip, port = sock.getsockname()[:2] + ip = ip.replace('.', ',') + p1, p2 = divmod(port, 256) + self.push('227 entering passive mode (%s,%d,%d)' %(ip, p1, p2)) + conn, addr = sock.accept() + self.dtp = DummyDTPHandler(conn, baseclass=self) + + def cmd_eprt(self, arg): + af, ip, port = arg.split(arg[0])[1:-1] + port = int(port) + s = socket.create_connection((ip, port), timeout=2) + self.dtp = DummyDTPHandler(s, baseclass=self) + self.push('200 active data connection established') + + def cmd_epsv(self, arg): + sock = socket.socket(socket.AF_INET6) + sock.bind((self.socket.getsockname()[0], 0)) + sock.listen(5) + sock.settimeout(2) + port = sock.getsockname()[1] + self.push('229 entering extended passive mode (|||%d|)' %port) + conn, addr = sock.accept() + self.dtp = DummyDTPHandler(conn, baseclass=self) + + def cmd_echo(self, arg): + # sends back the received string (used by the test suite) + self.push(arg) + + def cmd_user(self, arg): + self.push('331 username ok') + + def cmd_pass(self, arg): + self.push('230 password ok') + + def cmd_acct(self, arg): + self.push('230 acct ok') + + def cmd_rnfr(self, arg): + self.push('350 rnfr ok') + + def cmd_rnto(self, arg): + self.push('250 rnto ok') + + def cmd_dele(self, arg): + self.push('250 dele ok') + + def cmd_cwd(self, arg): + self.push('250 cwd ok') + + def cmd_size(self, arg): + self.push('250 1000') + + def cmd_mkd(self, arg): + self.push('257 "%s"' %arg) + + def cmd_rmd(self, arg): + self.push('250 rmd ok') + + def cmd_pwd(self, arg): + self.push('257 "pwd ok"') + + def cmd_type(self, arg): + self.push('200 type ok') + + def cmd_quit(self, arg): + self.push('221 quit ok') + self.close() + + def cmd_stor(self, arg): + self.push('125 stor ok') + + def cmd_retr(self, arg): + self.push('125 retr ok') + self.dtp.push(RETR_DATA) + self.dtp.close_when_done() + + def cmd_list(self, arg): + self.push('125 list ok') + self.dtp.push(LIST_DATA) + self.dtp.close_when_done() + + def cmd_nlst(self, arg): + self.push('125 nlst ok') + self.dtp.push(NLST_DATA) + self.dtp.close_when_done() + + +class DummyFTPServer(asyncore.dispatcher, threading.Thread): + + handler = DummyFTPHandler + + def __init__(self, address, af=socket.AF_INET): + threading.Thread.__init__(self) + asyncore.dispatcher.__init__(self) + self.create_socket(af, socket.SOCK_STREAM) + self.bind(address) + self.listen(5) + self.active = False + self.active_lock = threading.Lock() + self.host, self.port = self.socket.getsockname()[:2] + + def start(self): + assert not self.active + self.__flag = threading.Event() + threading.Thread.start(self) + self.__flag.wait() + + def run(self): + self.active = True + self.__flag.set() + while self.active and asyncore.socket_map: + self.active_lock.acquire() + asyncore.loop(timeout=0.1, count=1) + self.active_lock.release() + asyncore.close_all(ignore_all=True) + + def stop(self): + assert self.active + self.active = False + self.join() + + def handle_accept(self): + conn, addr = self.accept() + self.handler = self.handler(conn) + self.close() + + def handle_connect(self): + self.close() + handle_read = handle_connect + + def writable(self): + return 0 + + def handle_error(self): + raise + + +class TestFTPClass(TestCase): + + def setUp(self): + self.server = DummyFTPServer((HOST, 0)) + self.server.start() + self.client = ftplib.FTP(timeout=2) + self.client.connect(self.server.host, self.server.port) + + def tearDown(self): + self.client.close() + self.server.stop() + + def test_getwelcome(self): + self.assertEqual(self.client.getwelcome(), '220 welcome') + + def test_sanitize(self): + self.assertEqual(self.client.sanitize('foo'), repr('foo')) + self.assertEqual(self.client.sanitize('pass 12345'), repr('pass *****')) + self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****')) + + def test_exceptions(self): + self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400') + self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499') + self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500') + self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 599') + self.assertRaises(ftplib.error_proto, self.client.sendcmd, 'echo 999') + + def test_all_errors(self): + exceptions = (ftplib.error_reply, ftplib.error_temp, ftplib.error_perm, + ftplib.error_proto, ftplib.Error, IOError, EOFError) + for x in exceptions: + try: + raise x('exception not included in all_errors set') + except ftplib.all_errors: + pass + + def test_set_pasv(self): + # passive mode is supposed to be enabled by default + self.assertTrue(self.client.passiveserver) + self.client.set_pasv(True) + self.assertTrue(self.client.passiveserver) + self.client.set_pasv(False) + self.assertFalse(self.client.passiveserver) + + def test_voidcmd(self): + self.client.voidcmd('echo 200') + self.client.voidcmd('echo 299') + self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 199') + self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300') + + def test_login(self): + self.client.login() + + def test_acct(self): + self.client.acct('passwd') + + def test_rename(self): + self.client.rename('a', 'b') + self.server.handler.next_response = '200' + self.assertRaises(ftplib.error_reply, self.client.rename, 'a', 'b') + + def test_delete(self): + self.client.delete('foo') + self.server.handler.next_response = '199' + self.assertRaises(ftplib.error_reply, self.client.delete, 'foo') + + def test_size(self): + self.client.size('foo') + + def test_mkd(self): + dir = self.client.mkd('/foo') + self.assertEqual(dir, '/foo') + + def test_rmd(self): + self.client.rmd('foo') + + def test_pwd(self): + dir = self.client.pwd() + self.assertEqual(dir, 'pwd ok') + + def test_quit(self): + self.assertEqual(self.client.quit(), '221 quit ok') + # Ensure the connection gets closed; sock attribute should be None + self.assertEqual(self.client.sock, None) + + def test_retrbinary(self): + received = [] + self.client.retrbinary('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA) + + def test_retrlines(self): + received = [] + self.client.retrlines('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA.replace('\r\n', '')) + + def test_storbinary(self): + f = StringIO.StringIO(RETR_DATA) + self.client.storbinary('stor', f) + self.assertEqual(self.server.handler.last_received_data, RETR_DATA) + # test new callback arg + flag = [] + f.seek(0) + self.client.storbinary('stor', f, callback=lambda x: flag.append(None)) + self.assertTrue(flag) + + def test_storlines(self): + f = StringIO.StringIO(RETR_DATA.replace('\r\n', '\n')) + self.client.storlines('stor', f) + self.assertEqual(self.server.handler.last_received_data, RETR_DATA) + # test new callback arg + flag = [] + f.seek(0) + self.client.storlines('stor foo', f, callback=lambda x: flag.append(None)) + self.assertTrue(flag) + + def test_nlst(self): + self.client.nlst() + self.assertEqual(self.client.nlst(), NLST_DATA.split('\r\n')[:-1]) + + def test_dir(self): + l = [] + self.client.dir(lambda x: l.append(x)) + self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', '')) + + def test_makeport(self): + self.client.makeport() + # IPv4 is in use, just make sure send_eprt has not been used + self.assertEqual(self.server.handler.last_received_cmd, 'port') + + def test_makepasv(self): + host, port = self.client.makepasv() + conn = socket.create_connection((host, port), 2) + conn.close() + # IPv4 is in use, just make sure send_epsv has not been used + self.assertEqual(self.server.handler.last_received_cmd, 'pasv') + + +class TestIPv6Environment(TestCase): + + def setUp(self): + self.server = DummyFTPServer((HOST, 0), af=socket.AF_INET6) + self.server.start() + self.client = ftplib.FTP() + self.client.connect(self.server.host, self.server.port) + + def tearDown(self): + self.client.close() + self.server.stop() + + def test_af(self): + self.assertEqual(self.client.af, socket.AF_INET6) + + def test_makeport(self): + self.client.makeport() + self.assertEqual(self.server.handler.last_received_cmd, 'eprt') + + def test_makepasv(self): + host, port = self.client.makepasv() + conn = socket.create_connection((host, port), 2) + conn.close() + self.assertEqual(self.server.handler.last_received_cmd, 'epsv') + + def test_transfer(self): + def retr(): + received = [] + self.client.retrbinary('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA) + self.client.set_pasv(True) + retr() + self.client.set_pasv(False) + retr() + + +class TestTimeouts(TestCase): + + def setUp(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(3) + self.port = test_support.bind_port(self.sock) + threading.Thread(target=self.server, args=(self.evt,self.sock)).start() + # Wait for the server to be ready. + self.evt.wait() + self.evt.clear() + ftplib.FTP.port = self.port + + def tearDown(self): + self.evt.wait() + + def server(self, evt, serv): + # This method sets the evt 3 times: + # 1) when the connection is ready to be accepted. + # 2) when it is safe for the caller to close the connection + # 3) when we have closed the socket + serv.listen(5) + # (1) Signal the caller that we are ready to accept the connection. + evt.set() + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + conn.send("1 Hola mundo\n") + # (2) Signal the caller that it is safe to close the socket. + evt.set() + conn.close() + finally: + serv.close() + # (3) Signal the caller that we are done. + evt.set() + + def testTimeoutDefault(self): + # default -- use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutNone(self): + # no timeout -- do not use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost", timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(ftp.sock.gettimeout() is None) + self.evt.wait() + ftp.close() + + def testTimeoutValue(self): + # a value + ftp = ftplib.FTP(HOST, timeout=30) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutConnect(self): + ftp = ftplib.FTP() + ftp.connect(HOST, timeout=30) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutDifferentOrder(self): + ftp = ftplib.FTP(timeout=30) + ftp.connect(HOST) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutDirectAccess(self): + ftp = ftplib.FTP() + ftp.timeout = 30 + ftp.connect(HOST) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + +def test_main(): + tests = [TestFTPClass, TestTimeouts] + if socket.has_ipv6: + try: + DummyFTPServer((HOST, 0), af=socket.AF_INET6) + except socket.error: + pass + else: + tests.append(TestIPv6Environment) + thread_info = test_support.threading_setup() + try: + test_support.run_unittest(*tests) + finally: + test_support.threading_cleanup(*thread_info) + + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_httplib.py python-gevent-1.0/greentest/2.6/test_httplib.py --- python-gevent-0.13.7/greentest/2.6/test_httplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_httplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,317 @@ +import array +import httplib +import StringIO +import socket + +from unittest import TestCase + +from test import test_support + +HOST = test_support.HOST + +class FakeSocket: + def __init__(self, text, fileclass=StringIO.StringIO): + self.text = text + self.fileclass = fileclass + self.data = '' + + def sendall(self, data): + self.data += ''.join(data) + + def makefile(self, mode, bufsize=None): + if mode != 'r' and mode != 'rb': + raise httplib.UnimplementedFileMode() + return self.fileclass(self.text) + +class NoEOFStringIO(StringIO.StringIO): + """Like StringIO, but raises AssertionError on EOF. + + This is used below to test that httplib doesn't try to read + more from the underlying file than it should. + """ + def read(self, n=-1): + data = StringIO.StringIO.read(self, n) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + def readline(self, length=None): + data = StringIO.StringIO.readline(self, length) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + +class HeaderTests(TestCase): + def test_auto_headers(self): + # Some headers are added automatically, but should not be added by + # .request() if they are explicitly set. + + import httplib + + class HeaderCountingBuffer(list): + def __init__(self): + self.count = {} + def append(self, item): + kv = item.split(':') + if len(kv) > 1: + # item is a 'Key: Value' header string + lcKey = kv[0].lower() + self.count.setdefault(lcKey, 0) + self.count[lcKey] += 1 + list.append(self, item) + + for explicit_header in True, False: + for header in 'Content-length', 'Host', 'Accept-encoding': + conn = httplib.HTTPConnection('example.com') + conn.sock = FakeSocket('blahblahblah') + conn._buffer = HeaderCountingBuffer() + + body = 'spamspamspam' + headers = {} + if explicit_header: + headers[header] = str(len(body)) + conn.request('POST', '/', body, headers) + self.assertEqual(conn._buffer.count[header.lower()], 1) + +class BasicTest(TestCase): + def test_status_lines(self): + # Test HTTP status lines + + body = "HTTP/1.1 200 Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + resp.begin() + self.assertEqual(resp.read(), 'Text') + self.assertTrue(resp.isclosed()) + + body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + self.assertRaises(httplib.BadStatusLine, resp.begin) + + def test_partial_reads(self): + # if we have a lenght, the system knows when to close itself + # same behaviour than when we read the whole thing with read() + body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + resp.begin() + self.assertEqual(resp.read(2), 'Te') + self.assertFalse(resp.isclosed()) + self.assertEqual(resp.read(2), 'xt') + self.assertTrue(resp.isclosed()) + + def test_host_port(self): + # Check invalid host_port + + for hp in ("www.python.org:abc", "www.python.org:"): + self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) + + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), + ("www.python.org:80", "www.python.org", 80), + ("www.python.org", "www.python.org", 80), + ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): + http = httplib.HTTP(hp) + c = http._conn + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + + def test_response_headers(self): + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE";' + ' Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + self.fail("multiple headers not combined properly") + + def test_read_head(self): + # Test that the library doesn't attempt to read any data + # from a HEAD request. (Tickles SF bug #622042.) + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 14432\r\n' + '\r\n', + NoEOFStringIO) + resp = httplib.HTTPResponse(sock, method="HEAD") + resp.begin() + if resp.read() != "": + self.fail("Did not expect response from HEAD request") + + def test_send_file(self): + expected = 'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \ + 'Accept-Encoding: identity\r\nContent-Length:' + + body = open(__file__, 'rb') + conn = httplib.HTTPConnection('example.com') + sock = FakeSocket(body) + conn.sock = sock + conn.request('GET', '/foo', body) + self.assertTrue(sock.data.startswith(expected)) + + def test_send(self): + expected = 'this is a test this is only a test' + conn = httplib.HTTPConnection('example.com') + sock = FakeSocket(None) + conn.sock = sock + conn.send(expected) + self.assertEquals(expected, sock.data) + sock.data = '' + conn.send(array.array('c', expected)) + self.assertEquals(expected, sock.data) + sock.data = '' + conn.send(StringIO.StringIO(expected)) + self.assertEquals(expected, sock.data) + + def test_chunked(self): + chunked_start = ( + 'HTTP/1.1 200 OK\r\n' + 'Transfer-Encoding: chunked\r\n\r\n' + 'a\r\n' + 'hello worl\r\n' + '1\r\n' + 'd\r\n' + ) + sock = FakeSocket(chunked_start + '0\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEquals(resp.read(), 'hello world') + resp.close() + + for x in ('', 'foo\r\n'): + sock = FakeSocket(chunked_start + x) + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + try: + resp.read() + except httplib.IncompleteRead, i: + self.assertEquals(i.partial, 'hello world') + self.assertEqual(repr(i),'IncompleteRead(11 bytes read)') + self.assertEqual(str(i),'IncompleteRead(11 bytes read)') + else: + self.fail('IncompleteRead expected') + finally: + resp.close() + + def test_chunked_head(self): + chunked_start = ( + 'HTTP/1.1 200 OK\r\n' + 'Transfer-Encoding: chunked\r\n\r\n' + 'a\r\n' + 'hello world\r\n' + '1\r\n' + 'd\r\n' + ) + sock = FakeSocket(chunked_start + '0\r\n') + resp = httplib.HTTPResponse(sock, method="HEAD") + resp.begin() + self.assertEquals(resp.read(), '') + self.assertEquals(resp.status, 200) + self.assertEquals(resp.reason, 'OK') + self.assertTrue(resp.isclosed()) + + def test_negative_content_length(self): + sock = FakeSocket('HTTP/1.1 200 OK\r\n' + 'Content-Length: -1\r\n\r\nHello\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEquals(resp.read(), 'Hello\r\n') + resp.close() + + def test_incomplete_read(self): + sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + try: + resp.read() + except httplib.IncompleteRead as i: + self.assertEquals(i.partial, 'Hello\r\n') + self.assertEqual(repr(i), + "IncompleteRead(7 bytes read, 3 more expected)") + self.assertEqual(str(i), + "IncompleteRead(7 bytes read, 3 more expected)") + else: + self.fail('IncompleteRead expected') + finally: + resp.close() + + +class OfflineTest(TestCase): + def test_responses(self): + self.assertEquals(httplib.responses[httplib.NOT_FOUND], "Not Found") + +class TimeoutTest(TestCase): + PORT = None + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + TimeoutTest.PORT = test_support.bind_port(self.serv) + self.serv.listen(5) + + def tearDown(self): + self.serv.close() + self.serv = None + + def testTimeoutAttribute(self): + '''This will prove that the timeout gets through + HTTPConnection and into the socket. + ''' + # default -- use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT) + httpConn.connect() + finally: + socket.setdefaulttimeout(None) + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + # no timeout -- do not use global socket default + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, + timeout=None) + httpConn.connect() + finally: + socket.setdefaulttimeout(None) + self.assertEqual(httpConn.sock.gettimeout(), None) + httpConn.close() + + # a value + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) + httpConn.connect() + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + +class HTTPSTimeoutTest(TestCase): +# XXX Here should be tests for HTTPS, there isn't any right now! + + def test_attributes(self): + # simple test to check it's storing it + if hasattr(httplib, 'HTTPSConnection'): + h = httplib.HTTPSConnection(HOST, TimeoutTest.PORT, timeout=30) + self.assertEqual(h.timeout, 30) + +def test_main(verbose=None): + test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, + HTTPSTimeoutTest) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_httpservers.py python-gevent-1.0/greentest/2.6/test_httpservers.py --- python-gevent-0.13.7/greentest/2.6/test_httpservers.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_httpservers.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,367 @@ +"""Unittests for the various HTTPServer modules. + +Written by Cody A.W. Somerville , +Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest. +""" + +from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +from SimpleHTTPServer import SimpleHTTPRequestHandler +from CGIHTTPServer import CGIHTTPRequestHandler + +import os +import sys +import base64 +import shutil +import urllib +import httplib +import tempfile +import threading + +import unittest +from test import test_support + + +class NoLogRequestHandler: + def log_message(self, *args): + # don't write log messages to stderr + pass + + +class TestServerThread(threading.Thread): + def __init__(self, test_object, request_handler): + threading.Thread.__init__(self) + self.request_handler = request_handler + self.test_object = test_object + + def run(self): + self.server = HTTPServer(('', 0), self.request_handler) + self.test_object.PORT = self.server.socket.getsockname()[1] + self.test_object.server_started.set() + self.test_object = None + try: + self.server.serve_forever(0.05) + finally: + self.server.server_close() + + def stop(self): + self.server.shutdown() + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self.server_started = threading.Event() + self.thread = TestServerThread(self, self.request_handler) + self.thread.start() + self.server_started.wait() + + def tearDown(self): + self.thread.stop() + + def request(self, uri, method='GET', body=None, headers={}): + self.connection = httplib.HTTPConnection('localhost', self.PORT) + self.connection.request(method, uri, body, headers) + return self.connection.getresponse() + + +class BaseHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, BaseHTTPRequestHandler): + protocol_version = 'HTTP/1.1' + default_request_version = 'HTTP/1.1' + + def do_TEST(self): + self.send_response(204) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'close') + self.end_headers() + + def do_KEEP(self): + self.send_response(204) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'keep-alive') + self.end_headers() + + def do_KEYERROR(self): + self.send_error(999) + + def do_CUSTOM(self): + self.send_response(999) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'close') + self.end_headers() + + def setUp(self): + BaseTestCase.setUp(self) + self.con = httplib.HTTPConnection('localhost', self.PORT) + self.con.connect() + + def test_command(self): + self.con.request('GET', '/') + res = self.con.getresponse() + self.assertEquals(res.status, 501) + + def test_request_line_trimming(self): + self.con._http_vsn_str = 'HTTP/1.1\n' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 501) + + def test_version_bogus(self): + self.con._http_vsn_str = 'FUBAR' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 400) + + def test_version_digits(self): + self.con._http_vsn_str = 'HTTP/9.9.9' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 400) + + def test_version_none_get(self): + self.con._http_vsn_str = '' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 501) + + def test_version_none(self): + self.con._http_vsn_str = '' + self.con.putrequest('PUT', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 400) + + def test_version_invalid(self): + self.con._http_vsn = 99 + self.con._http_vsn_str = 'HTTP/9.9' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 505) + + def test_send_blank(self): + self.con._http_vsn_str = '' + self.con.putrequest('', '') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 400) + + def test_header_close(self): + self.con.putrequest('GET', '/') + self.con.putheader('Connection', 'close') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 501) + + def test_head_keep_alive(self): + self.con._http_vsn_str = 'HTTP/1.1' + self.con.putrequest('GET', '/') + self.con.putheader('Connection', 'keep-alive') + self.con.endheaders() + res = self.con.getresponse() + self.assertEquals(res.status, 501) + + def test_handler(self): + self.con.request('TEST', '/') + res = self.con.getresponse() + self.assertEquals(res.status, 204) + + def test_return_header_keep_alive(self): + self.con.request('KEEP', '/') + res = self.con.getresponse() + self.assertEquals(res.getheader('Connection'), 'keep-alive') + self.con.request('TEST', '/') + + def test_internal_key_error(self): + self.con.request('KEYERROR', '/') + res = self.con.getresponse() + self.assertEquals(res.status, 999) + + def test_return_custom_status(self): + self.con.request('CUSTOM', '/') + res = self.con.getresponse() + self.assertEquals(res.status, 999) + + +class SimpleHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler): + pass + + def setUp(self): + BaseTestCase.setUp(self) + self.cwd = os.getcwd() + basetempdir = tempfile.gettempdir() + os.chdir(basetempdir) + self.data = 'We are the knights who say Ni!' + self.tempdir = tempfile.mkdtemp(dir=basetempdir) + self.tempdir_name = os.path.basename(self.tempdir) + temp = open(os.path.join(self.tempdir, 'test'), 'wb') + temp.write(self.data) + temp.close() + + def tearDown(self): + try: + os.chdir(self.cwd) + try: + shutil.rmtree(self.tempdir) + except: + pass + finally: + BaseTestCase.tearDown(self) + + def check_status_and_reason(self, response, status, data=None): + body = response.read() + self.assert_(response) + self.assertEquals(response.status, status) + self.assert_(response.reason != None) + if data: + self.assertEqual(data, body) + + def test_get(self): + #constructs the path relative to the root directory of the HTTPServer + response = self.request(self.tempdir_name + '/test') + self.check_status_and_reason(response, 200, data=self.data) + response = self.request(self.tempdir_name + '/') + self.check_status_and_reason(response, 200) + response = self.request(self.tempdir_name) + self.check_status_and_reason(response, 301) + response = self.request('/ThisDoesNotExist') + self.check_status_and_reason(response, 404) + response = self.request('/' + 'ThisDoesNotExist' + '/') + self.check_status_and_reason(response, 404) + f = open(os.path.join(self.tempdir_name, 'index.html'), 'w') + response = self.request('/' + self.tempdir_name + '/') + self.check_status_and_reason(response, 200) + if os.name == 'posix': + # chmod won't work as expected on Windows platforms + os.chmod(self.tempdir, 0) + response = self.request(self.tempdir_name + '/') + self.check_status_and_reason(response, 404) + os.chmod(self.tempdir, 0755) + + def test_head(self): + response = self.request( + self.tempdir_name + '/test', method='HEAD') + self.check_status_and_reason(response, 200) + self.assertEqual(response.getheader('content-length'), + str(len(self.data))) + self.assertEqual(response.getheader('content-type'), + 'application/octet-stream') + + def test_invalid_requests(self): + response = self.request('/', method='FOO') + self.check_status_and_reason(response, 501) + # requests must be case sensitive,so this should fail too + response = self.request('/', method='get') + self.check_status_and_reason(response, 501) + response = self.request('/', method='GETs') + self.check_status_and_reason(response, 501) + + +cgi_file1 = """\ +#!%s + +print "Content-type: text/html" +print +print "Hello World" +""" + +cgi_file2 = """\ +#!%s +import cgi + +print "Content-type: text/html" +print + +form = cgi.FieldStorage() +print "%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"),\ + form.getfirst("bacon")) +""" + +class CGIHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler): + pass + + def setUp(self): + BaseTestCase.setUp(self) + self.parent_dir = tempfile.mkdtemp() + self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') + os.mkdir(self.cgi_dir) + + # The shebang line should be pure ASCII: use symlink if possible. + # See issue #7668. + if hasattr(os, 'symlink'): + self.pythonexe = os.path.join(self.parent_dir, 'python') + os.symlink(sys.executable, self.pythonexe) + else: + self.pythonexe = sys.executable + + self.file1_path = os.path.join(self.cgi_dir, 'file1.py') + with open(self.file1_path, 'w') as file1: + file1.write(cgi_file1 % self.pythonexe) + os.chmod(self.file1_path, 0777) + + self.file2_path = os.path.join(self.cgi_dir, 'file2.py') + with open(self.file2_path, 'w') as file2: + file2.write(cgi_file2 % self.pythonexe) + os.chmod(self.file2_path, 0777) + + self.cwd = os.getcwd() + os.chdir(self.parent_dir) + + def tearDown(self): + try: + os.chdir(self.cwd) + if self.pythonexe != sys.executable: + os.remove(self.pythonexe) + os.remove(self.file1_path) + os.remove(self.file2_path) + os.rmdir(self.cgi_dir) + os.rmdir(self.parent_dir) + finally: + BaseTestCase.tearDown(self) + + def test_headers_and_content(self): + res = self.request('/cgi-bin/file1.py') + self.assertEquals(('Hello World\n', 'text/html', 200), \ + (res.read(), res.getheader('Content-type'), res.status)) + + def test_post(self): + params = urllib.urlencode({'spam' : 1, 'eggs' : 'python', 'bacon' : 123456}) + headers = {'Content-type' : 'application/x-www-form-urlencoded'} + res = self.request('/cgi-bin/file2.py', 'POST', params, headers) + + self.assertEquals(res.read(), '1, python, 123456\n') + + def test_invaliduri(self): + res = self.request('/cgi-bin/invalid') + res.read() + self.assertEquals(res.status, 404) + + def test_authorization(self): + headers = {'Authorization' : 'Basic %s' % \ + base64.b64encode('username:pass')} + res = self.request('/cgi-bin/file1.py', 'GET', headers=headers) + self.assertEquals(('Hello World\n', 'text/html', 200), \ + (res.read(), res.getheader('Content-type'), res.status)) + + +def test_main(verbose=None): + cwd = os.getcwd() + env = os.environ.copy() + try: + test_support.run_unittest(BaseHTTPServerTestCase, + SimpleHTTPServerTestCase, + CGIHTTPServerTestCase + ) + finally: + test_support.reap_children() + os.environ.clear() + os.environ.update(env) + os.chdir(cwd) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_queue.py python-gevent-1.0/greentest/2.6/test_queue.py --- python-gevent-0.13.7/greentest/2.6/test_queue.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,323 @@ +# Some simple queue module tests, plus some failure conditions +# to ensure the Queue locks remain stable. +import Queue +import sys +import threading +import time +import unittest +from test import test_support + +QUEUE_SIZE = 5 + +# A thread to run a function that unclogs a blocked Queue. +class _TriggerThread(threading.Thread): + def __init__(self, fn, args): + self.fn = fn + self.args = args + self.startedEvent = threading.Event() + threading.Thread.__init__(self) + + def run(self): + # The sleep isn't necessary, but is intended to give the blocking + # function in the main thread a chance at actually blocking before + # we unclog it. But if the sleep is longer than the timeout-based + # tests wait in their blocking functions, those tests will fail. + # So we give them much longer timeout values compared to the + # sleep here (I aimed at 10 seconds for blocking functions -- + # they should never actually wait that long - they should make + # progress as soon as we call self.fn()). + time.sleep(0.1) + self.startedEvent.set() + self.fn(*self.args) + + +# Execute a function that blocks, and in a separate thread, a function that +# triggers the release. Returns the result of the blocking function. Caution: +# block_func must guarantee to block until trigger_func is called, and +# trigger_func must guarantee to change queue state so that block_func can make +# enough progress to return. In particular, a block_func that just raises an +# exception regardless of whether trigger_func is called will lead to +# timing-dependent sporadic failures, and one of those went rarely seen but +# undiagnosed for years. Now block_func must be unexceptional. If block_func +# is supposed to raise an exception, call do_exceptional_blocking_test() +# instead. + +class BlockingTestMixin: + + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): + self.t = _TriggerThread(trigger_func, trigger_args) + self.t.start() + self.result = block_func(*block_args) + # If block_func returned before our thread made the call, we failed! + if not self.t.startedEvent.is_set(): + self.fail("blocking function '%r' appeared not to block" % + block_func) + self.t.join(10) # make sure the thread terminates + if self.t.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) + return self.result + + # Call this instead if block_func is supposed to raise an exception. + def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, + trigger_args, expected_exception_class): + self.t = _TriggerThread(trigger_func, trigger_args) + self.t.start() + try: + try: + block_func(*block_args) + except expected_exception_class: + raise + else: + self.fail("expected exception of kind %r" % + expected_exception_class) + finally: + self.t.join(10) # make sure the thread terminates + if self.t.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) + if not self.t.startedEvent.is_set(): + self.fail("trigger thread ended but event never set") + + +class BaseQueueTest(unittest.TestCase, BlockingTestMixin): + def setUp(self): + self.cum = 0 + self.cumlock = threading.Lock() + + def simple_queue_test(self, q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + # I guess we better check things actually queue correctly a little :) + q.put(111) + q.put(333) + q.put(222) + target_order = dict(Queue = [111, 333, 222], + LifoQueue = [222, 333, 111], + PriorityQueue = [111, 222, 333]) + actual_order = [q.get(), q.get(), q.get()] + self.assertEquals(actual_order, target_order[q.__class__.__name__], + "Didn't seem to queue the correct data!") + for i in range(QUEUE_SIZE-1): + q.put(i) + self.assert_(not q.empty(), "Queue should not be empty") + self.assert_(not q.full(), "Queue should not be full") + last = 2 * QUEUE_SIZE + full = 3 * 2 * QUEUE_SIZE + q.put(last) + self.assert_(q.full(), "Queue should be full") + try: + q.put(full, block=0) + self.fail("Didn't appear to block with a full queue") + except Queue.Full: + pass + try: + q.put(full, timeout=0.01) + self.fail("Didn't appear to time-out with a full queue") + except Queue.Full: + pass + # Test a blocking put + self.do_blocking_test(q.put, (full,), q.get, ()) + self.do_blocking_test(q.put, (full, True, 10), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + self.assert_(q.empty(), "Queue should be empty") + try: + q.get(block=0) + self.fail("Didn't appear to block with an empty queue") + except Queue.Empty: + pass + try: + q.get(timeout=0.01) + self.fail("Didn't appear to time-out with an empty queue") + except Queue.Empty: + pass + # Test a blocking get + self.do_blocking_test(q.get, (), q.put, ('empty',)) + self.do_blocking_test(q.get, (True, 10), q.put, ('empty',)) + + + def worker(self, q): + while True: + x = q.get() + if x is None: + q.task_done() + return + with self.cumlock: + self.cum += x + q.task_done() + + def queue_join_test(self, q): + self.cum = 0 + for i in (0,1): + threading.Thread(target=self.worker, args=(q,)).start() + for i in xrange(100): + q.put(i) + q.join() + self.assertEquals(self.cum, sum(range(100)), + "q.join() did not block until all tasks were done") + for i in (0,1): + q.put(None) # instruct the threads to close + q.join() # verify that you can join twice + + def test_queue_task_done(self): + # Test to make sure a queue task completed successfully. + q = self.type2test() + try: + q.task_done() + except ValueError: + pass + else: + self.fail("Did not detect task count going negative") + + def test_queue_join(self): + # Test that a queue join()s successfully, and before anything else + # (done twice for insurance). + q = self.type2test() + self.queue_join_test(q) + self.queue_join_test(q) + try: + q.task_done() + except ValueError: + pass + else: + self.fail("Did not detect task count going negative") + + def test_simple_queue(self): + # Do it a couple of times on the same queue. + # Done twice to make sure works with same instance reused. + q = self.type2test(QUEUE_SIZE) + self.simple_queue_test(q) + self.simple_queue_test(q) + + +class QueueTest(BaseQueueTest): + type2test = Queue.Queue + +class LifoQueueTest(BaseQueueTest): + type2test = Queue.LifoQueue + +class PriorityQueueTest(BaseQueueTest): + type2test = Queue.PriorityQueue + + + +# A Queue subclass that can provoke failure at a moment's notice :) +class FailingQueueException(Exception): + pass + +class FailingQueue(Queue.Queue): + def __init__(self, *args): + self.fail_next_put = False + self.fail_next_get = False + Queue.Queue.__init__(self, *args) + def _put(self, item): + if self.fail_next_put: + self.fail_next_put = False + raise FailingQueueException, "You Lose" + return Queue.Queue._put(self, item) + def _get(self): + if self.fail_next_get: + self.fail_next_get = False + raise FailingQueueException, "You Lose" + return Queue.Queue._get(self) + +class FailingQueueTest(unittest.TestCase, BlockingTestMixin): + + def failing_queue_test(self, q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + for i in range(QUEUE_SIZE-1): + q.put(i) + # Test a failing non-blocking put. + q.fail_next_put = True + try: + q.put("oops", block=0) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.fail_next_put = True + try: + q.put("oops", timeout=0.1) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.put("last") + self.assert_(q.full(), "Queue should be full") + # Test a failing blocking put + q.fail_next_put = True + try: + self.do_blocking_test(q.put, ("full",), q.get, ()) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + # Test a failing timeout put + q.fail_next_put = True + try: + self.do_exceptional_blocking_test(q.put, ("full", True, 10), q.get, (), + FailingQueueException) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + self.assert_(q.full(), "Queue should be full") + q.get() + self.assert_(not q.full(), "Queue should not be full") + q.put("last") + self.assert_(q.full(), "Queue should be full") + # Test a blocking put + self.do_blocking_test(q.put, ("full",), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + self.assert_(q.empty(), "Queue should be empty") + q.put("first") + q.fail_next_get = True + try: + q.get() + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + self.assert_(not q.empty(), "Queue should not be empty") + q.fail_next_get = True + try: + q.get(timeout=0.1) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + self.assert_(not q.empty(), "Queue should not be empty") + q.get() + self.assert_(q.empty(), "Queue should be empty") + q.fail_next_get = True + try: + self.do_exceptional_blocking_test(q.get, (), q.put, ('empty',), + FailingQueueException) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # put succeeded, but get failed. + self.assert_(not q.empty(), "Queue should not be empty") + q.get() + self.assert_(q.empty(), "Queue should be empty") + + def test_failing_queue(self): + # Test to make sure a queue is functioning correctly. + # Done twice to the same instance. + q = FailingQueue(QUEUE_SIZE) + self.failing_queue_test(q) + self.failing_queue_test(q) + + +def test_main(): + test_support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, + FailingQueueTest) + + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_select.py python-gevent-1.0/greentest/2.6/test_select.py --- python-gevent-0.13.7/greentest/2.6/test_select.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_select.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,64 @@ +from test import test_support +import unittest +import select +import os +import sys + +class SelectTestCase(unittest.TestCase): + + class Nope: + pass + + class Almost: + def fileno(self): + return 'fileno' + + def test_error_conditions(self): + self.assertRaises(TypeError, select.select, 1, 2, 3) + self.assertRaises(TypeError, select.select, [self.Nope()], [], []) + self.assertRaises(TypeError, select.select, [self.Almost()], [], []) + self.assertRaises(TypeError, select.select, [], [], [], "not a number") + + def test_returned_list_identity(self): + if sys.platform[:3] in ('win', 'mac', 'os2'): + if test_support.verbose: + print "can't easily test on this system" + return + # See issue #8329 + r, w, x = select.select([], [], [], 1) + self.assertFalse(r is w) + self.assertFalse(r is x) + self.assertFalse(w is x) + + def test_select(self): + if sys.platform[:3] in ('win', 'mac', 'os2'): + if test_support.verbose: + print "can't easily test on this system" + return + cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done' + p = os.popen(cmd, 'r') + for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10: + if test_support.verbose: + print 'timeout =', tout + rfd, wfd, xfd = select.select([p], [], [], tout) + if (rfd, wfd, xfd) == ([], [], []): + continue + if (rfd, wfd, xfd) == ([p], [], []): + line = p.readline() + if test_support.verbose: + print repr(line) + if not line: + if test_support.verbose: + print 'EOF' + break + continue + self.fail('Unexpected return values from select():', rfd, wfd, xfd) + p.close() + + +def test_main(): + test_support.run_unittest(SelectTestCase) + test_support.reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_signal.py python-gevent-1.0/greentest/2.6/test_signal.py --- python-gevent-0.13.7/greentest/2.6/test_signal.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_signal.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,497 @@ +import unittest +from test import test_support +from contextlib import closing, nested +import gc +import pickle +import select +import signal +import subprocess +import traceback +import sys, os, time, errno + +if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos': + raise test_support.TestSkipped("Can't test signal on %s" % \ + sys.platform) + + +class HandlerBCalled(Exception): + pass + + +def exit_subprocess(): + """Use os._exit(0) to exit the current subprocess. + + Otherwise, the test catches the SystemExit and continues executing + in parallel with the original test, so you wind up with an + exponential number of tests running concurrently. + """ + os._exit(0) + + +def ignoring_eintr(__func, *args, **kwargs): + try: + return __func(*args, **kwargs) + except EnvironmentError as e: + if e.errno != errno.EINTR: + raise + return None + + +class InterProcessSignalTests(unittest.TestCase): + MAX_DURATION = 20 # Entire test should last at most 20 sec. + + def setUp(self): + self.using_gc = gc.isenabled() + gc.disable() + + def tearDown(self): + if self.using_gc: + gc.enable() + + def format_frame(self, frame, limit=None): + return ''.join(traceback.format_stack(frame, limit=limit)) + + def handlerA(self, signum, frame): + self.a_called = True + if test_support.verbose: + print "handlerA invoked from signal %s at:\n%s" % ( + signum, self.format_frame(frame, limit=1)) + + def handlerB(self, signum, frame): + self.b_called = True + if test_support.verbose: + print "handlerB invoked from signal %s at:\n%s" % ( + signum, self.format_frame(frame, limit=1)) + raise HandlerBCalled(signum, self.format_frame(frame)) + + def wait(self, child): + """Wait for child to finish, ignoring EINTR.""" + while True: + try: + child.wait() + return + except OSError as e: + if e.errno != errno.EINTR: + raise + + def run_test(self): + # Install handlers. This function runs in a sub-process, so we + # don't worry about re-setting the default handlers. + signal.signal(signal.SIGHUP, self.handlerA) + signal.signal(signal.SIGUSR1, self.handlerB) + signal.signal(signal.SIGUSR2, signal.SIG_IGN) + signal.signal(signal.SIGALRM, signal.default_int_handler) + + # Variables the signals will modify: + self.a_called = False + self.b_called = False + + # Let the sub-processes know who to send signals to. + pid = os.getpid() + if test_support.verbose: + print "test runner's pid is", pid + + child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)]) + if child: + self.wait(child) + if not self.a_called: + time.sleep(1) # Give the signal time to be delivered. + self.assertTrue(self.a_called) + self.assertFalse(self.b_called) + self.a_called = False + + # Make sure the signal isn't delivered while the previous + # Popen object is being destroyed, because __del__ swallows + # exceptions. + del child + try: + child = subprocess.Popen(['kill', '-USR1', str(pid)]) + # This wait should be interrupted by the signal's exception. + self.wait(child) + time.sleep(1) # Give the signal time to be delivered. + self.fail('HandlerBCalled exception not thrown') + except HandlerBCalled: + self.assertTrue(self.b_called) + self.assertFalse(self.a_called) + if test_support.verbose: + print "HandlerBCalled exception caught" + + child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)]) + if child: + self.wait(child) # Nothing should happen. + + try: + signal.alarm(1) + # The race condition in pause doesn't matter in this case, + # since alarm is going to raise a KeyboardException, which + # will skip the call. + signal.pause() + # But if another signal arrives before the alarm, pause + # may return early. + time.sleep(1) + except KeyboardInterrupt: + if test_support.verbose: + print "KeyboardInterrupt (the alarm() went off)" + except: + self.fail("Some other exception woke us from pause: %s" % + traceback.format_exc()) + else: + self.fail("pause returned of its own accord, and the signal" + " didn't arrive after another second.") + + def test_main(self): + # Issue 3864, unknown if this affects earlier versions of freebsd also + if sys.platform=='freebsd6': + if test_support.verbose: + sys.stderr.write('skipping -- inter process signals not ' + 'reliable (do not mix well with threading) on freebsd6\n') + return + # This function spawns a child process to insulate the main + # test-running process from all the signals. It then + # communicates with that child process over a pipe and + # re-raises information about any exceptions the child + # throws. The real work happens in self.run_test(). + os_done_r, os_done_w = os.pipe() + with nested(closing(os.fdopen(os_done_r)), + closing(os.fdopen(os_done_w, 'w'))) as (done_r, done_w): + child = os.fork() + if child == 0: + # In the child process; run the test and report results + # through the pipe. + try: + done_r.close() + # Have to close done_w again here because + # exit_subprocess() will skip the enclosing with block. + with closing(done_w): + try: + self.run_test() + except: + pickle.dump(traceback.format_exc(), done_w) + else: + pickle.dump(None, done_w) + except: + print 'Uh oh, raised from pickle.' + traceback.print_exc() + finally: + exit_subprocess() + + done_w.close() + # Block for up to MAX_DURATION seconds for the test to finish. + r, w, x = select.select([done_r], [], [], self.MAX_DURATION) + if done_r in r: + tb = pickle.load(done_r) + if tb: + self.fail(tb) + else: + os.kill(child, signal.SIGKILL) + self.fail('Test deadlocked after %d seconds.' % + self.MAX_DURATION) + + +class BasicSignalTests(unittest.TestCase): + def trivial_signal_handler(self, *args): + pass + + def test_out_of_range_signal_number_raises_error(self): + self.assertRaises(ValueError, signal.getsignal, 4242) + + self.assertRaises(ValueError, signal.signal, 4242, + self.trivial_signal_handler) + + def test_setting_signal_handler_to_none_raises_error(self): + self.assertRaises(TypeError, signal.signal, + signal.SIGUSR1, None) + + def test_getsignal(self): + hup = signal.signal(signal.SIGHUP, self.trivial_signal_handler) + self.assertEquals(signal.getsignal(signal.SIGHUP), + self.trivial_signal_handler) + signal.signal(signal.SIGHUP, hup) + self.assertEquals(signal.getsignal(signal.SIGHUP), hup) + + +class WakeupSignalTests(unittest.TestCase): + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 + + def test_wakeup_fd_early(self): + import select + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the sleep, + # before select is called + time.sleep(self.TIMEOUT_FULL) + mid_time = time.time() + self.assert_(mid_time - before_time < self.TIMEOUT_HALF) + select.select([self.read], [], [], self.TIMEOUT_FULL) + after_time = time.time() + self.assert_(after_time - mid_time < self.TIMEOUT_HALF) + + def test_wakeup_fd_during(self): + import select + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the select call + self.assertRaises(select.error, select.select, + [self.read], [], [], self.TIMEOUT_FULL) + after_time = time.time() + self.assert_(after_time - before_time < self.TIMEOUT_HALF) + + def setUp(self): + import fcntl + + self.alrm = signal.signal(signal.SIGALRM, lambda x,y:None) + self.read, self.write = os.pipe() + flags = fcntl.fcntl(self.write, fcntl.F_GETFL, 0) + flags = flags | os.O_NONBLOCK + fcntl.fcntl(self.write, fcntl.F_SETFL, flags) + self.old_wakeup = signal.set_wakeup_fd(self.write) + + def tearDown(self): + signal.set_wakeup_fd(self.old_wakeup) + os.close(self.read) + os.close(self.write) + signal.signal(signal.SIGALRM, self.alrm) + +class SiginterruptTest(unittest.TestCase): + signum = signal.SIGUSR1 + + def setUp(self): + """Install a no-op signal handler that can be set to allow + interrupts or not, and arrange for the original signal handler to be + re-installed when the test is finished. + """ + self._cleanups = [] + oldhandler = signal.signal(self.signum, lambda x,y: None) + self.addCleanup(signal.signal, self.signum, oldhandler) + + + def tearDown(self): + """Run any cleanup functions which have been registered. + """ + for (f, a) in self._cleanups: + f(*a) + + + def addCleanup(self, f, *a): + """Register a function to be called at the end of the test method + run. + """ + self._cleanups.append((f, a)) + + + def readpipe_interrupted(self): + """Perform a read during which a signal will arrive. Return True if the + read is interrupted by the signal and raises an exception. Return False + if it returns normally. + """ + # Create a pipe that can be used for the read. Also clean it up + # when the test is over, since nothing else will (but see below for + # the write end). + r, w = os.pipe() + self.addCleanup(os.close, r) + + # Create another process which can send a signal to this one to try + # to interrupt the read. + ppid = os.getpid() + pid = os.fork() + + if pid == 0: + # Child code: sleep to give the parent enough time to enter the + # read() call (there's a race here, but it's really tricky to + # eliminate it); then signal the parent process. Also, sleep + # again to make it likely that the signal is delivered to the + # parent process before the child exits. If the child exits + # first, the write end of the pipe will be closed and the test + # is invalid. + try: + time.sleep(0.2) + os.kill(ppid, self.signum) + time.sleep(0.2) + finally: + # No matter what, just exit as fast as possible now. + exit_subprocess() + else: + # Parent code. + # Make sure the child is eventually reaped, else it'll be a + # zombie for the rest of the test suite run. + self.addCleanup(os.waitpid, pid, 0) + + # Close the write end of the pipe. The child has a copy, so + # it's not really closed until the child exits. We need it to + # close when the child exits so that in the non-interrupt case + # the read eventually completes, otherwise we could just close + # it *after* the test. + os.close(w) + + # Try the read and report whether it is interrupted or not to + # the caller. + try: + d = os.read(r, 1) + return False + except OSError, err: + if err.errno != errno.EINTR: + raise + return True + + def test_without_siginterrupt(self): + """If a signal handler is installed and siginterrupt is not called + at all, when that signal arrives, it interrupts a syscall that's in + progress. + """ + i = self.readpipe_interrupted() + self.assertTrue(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertTrue(i) + + def test_siginterrupt_on(self): + """If a signal handler is installed and siginterrupt is called with + a true value for the second argument, when that signal arrives, it + interrupts a syscall that's in progress. + """ + signal.siginterrupt(self.signum, 1) + i = self.readpipe_interrupted() + self.assertTrue(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertTrue(i) + + def test_siginterrupt_off(self): + """If a signal handler is installed and siginterrupt is called with + a false value for the second argument, when that signal arrives, it + does not interrupt a syscall that's in progress. + """ + signal.siginterrupt(self.signum, 0) + i = self.readpipe_interrupted() + self.assertFalse(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertFalse(i) + + + +class ItimerTest(unittest.TestCase): + def setUp(self): + self.hndl_called = False + self.hndl_count = 0 + self.itimer = None + self.old_alarm = signal.signal(signal.SIGALRM, self.sig_alrm) + + def tearDown(self): + signal.signal(signal.SIGALRM, self.old_alarm) + if self.itimer is not None: # test_itimer_exc doesn't change this attr + # just ensure that itimer is stopped + signal.setitimer(self.itimer, 0) + + def sig_alrm(self, *args): + self.hndl_called = True + if test_support.verbose: + print("SIGALRM handler invoked", args) + + def sig_vtalrm(self, *args): + self.hndl_called = True + + if self.hndl_count > 3: + # it shouldn't be here, because it should have been disabled. + raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL " + "timer.") + elif self.hndl_count == 3: + # disable ITIMER_VIRTUAL, this function shouldn't be called anymore + signal.setitimer(signal.ITIMER_VIRTUAL, 0) + if test_support.verbose: + print("last SIGVTALRM handler call") + + self.hndl_count += 1 + + if test_support.verbose: + print("SIGVTALRM handler invoked", args) + + def sig_prof(self, *args): + self.hndl_called = True + signal.setitimer(signal.ITIMER_PROF, 0) + + if test_support.verbose: + print("SIGPROF handler invoked", args) + + def test_itimer_exc(self): + # XXX I'm assuming -1 is an invalid itimer, but maybe some platform + # defines it ? + self.assertRaises(signal.ItimerError, signal.setitimer, -1, 0) + # Negative times are treated as zero on some platforms. + if 0: + self.assertRaises(signal.ItimerError, + signal.setitimer, signal.ITIMER_REAL, -1) + + def test_itimer_real(self): + self.itimer = signal.ITIMER_REAL + signal.setitimer(self.itimer, 1.0) + if test_support.verbose: + print("\ncall pause()...") + signal.pause() + + self.assertEqual(self.hndl_called, True) + + def test_itimer_virtual(self): + # Issue 3864, unknown if this affects earlier versions of freebsd also + if sys.platform=='freebsd6': + if test_support.verbose: + sys.stderr.write('skipping -- itimer not reliable (does not ' + 'mix well with threading) on freebsd6\n') + return + self.itimer = signal.ITIMER_VIRTUAL + signal.signal(signal.SIGVTALRM, self.sig_vtalrm) + signal.setitimer(self.itimer, 0.3, 0.2) + + start_time = time.time() + while time.time() - start_time < 60.0: + # use up some virtual time by doing real work + _ = pow(12345, 67890, 10000019) + if signal.getitimer(self.itimer) == (0.0, 0.0): + break # sig_vtalrm handler stopped this itimer + else: # Issue 8424 + sys.stderr.write("test_itimer_virtual: timeout: likely cause: " + "machine too slow or load too high.\n") + return + + # virtual itimer should be (0.0, 0.0) now + self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) + # and the handler should have been called + self.assertEquals(self.hndl_called, True) + + def test_itimer_prof(self): + # Issue 3864, unknown if this affects earlier versions of freebsd also + if sys.platform=='freebsd6': + if test_support.verbose: + sys.stderr.write('skipping -- itimer not reliable (does not ' + 'mix well with threading) on freebsd6\n') + return + self.itimer = signal.ITIMER_PROF + signal.signal(signal.SIGPROF, self.sig_prof) + signal.setitimer(self.itimer, 0.2, 0.2) + + start_time = time.time() + while time.time() - start_time < 60.0: + # do some work + _ = pow(12345, 67890, 10000019) + if signal.getitimer(self.itimer) == (0.0, 0.0): + break # sig_prof handler stopped this itimer + else: # Issue 8424 + sys.stdout.write("test_itimer_prof: timeout: likely cause: " + "machine too slow or load too high.\n") + return + + # profiling itimer should be (0.0, 0.0) now + self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) + # and the handler should have been called + self.assertEqual(self.hndl_called, True) + +def test_main(): + test_support.run_unittest(BasicSignalTests, InterProcessSignalTests, + WakeupSignalTests, SiginterruptTest, ItimerTest) + + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_smtplib.py python-gevent-1.0/greentest/2.6/test_smtplib.py --- python-gevent-0.13.7/greentest/2.6/test_smtplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_smtplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,488 @@ +import asyncore +import email.utils +import socket +import threading +import smtpd +import smtplib +import StringIO +import sys +import time +import select + +from unittest import TestCase +from test import test_support + +HOST = test_support.HOST + +def server(evt, buf, serv): + serv.listen(5) + evt.set() + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 500 + while buf and n > 0: + r, w, e = select.select([], [conn], []) + if w: + sent = conn.send(buf) + buf = buf[sent:] + + n -= 1 + + conn.close() + finally: + serv.close() + evt.set() + +class GeneralTests(TestCase): + + def setUp(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(15) + self.port = test_support.bind_port(self.sock) + servargs = (self.evt, "220 Hola mundo\n", self.sock) + threading.Thread(target=server, args=servargs).start() + self.evt.wait() + self.evt.clear() + + def tearDown(self): + self.evt.wait() + + def testBasic1(self): + # connects + smtp = smtplib.SMTP(HOST, self.port) + smtp.close() + + def testBasic2(self): + # connects, include port in host name + smtp = smtplib.SMTP("%s:%s" % (HOST, self.port)) + smtp.close() + + def testLocalHostName(self): + # check that supplied local_hostname is used + smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost") + self.assertEqual(smtp.local_hostname, "testhost") + smtp.close() + + def testTimeoutDefault(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + smtp = smtplib.SMTP(HOST, self.port) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(smtp.sock.gettimeout(), 30) + smtp.close() + + def testTimeoutNone(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + smtp = smtplib.SMTP(HOST, self.port, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(smtp.sock.gettimeout() is None) + smtp.close() + + def testTimeoutValue(self): + smtp = smtplib.SMTP(HOST, self.port, timeout=30) + self.assertEqual(smtp.sock.gettimeout(), 30) + smtp.close() + + +# Test server thread using the specified SMTP server class +def debugging_server(serv, serv_evt, client_evt): + serv_evt.set() + + try: + if hasattr(select, 'poll'): + poll_fun = asyncore.poll2 + else: + poll_fun = asyncore.poll + + n = 1000 + while asyncore.socket_map and n > 0: + poll_fun(0.01, asyncore.socket_map) + + # when the client conversation is finished, it will + # set client_evt, and it's then ok to kill the server + if client_evt.is_set(): + serv.close() + break + + n -= 1 + + except socket.timeout: + pass + finally: + if not client_evt.is_set(): + # allow some time for the client to read the result + time.sleep(0.5) + serv.close() + asyncore.close_all() + serv_evt.set() + +MSG_BEGIN = '---------- MESSAGE FOLLOWS ----------\n' +MSG_END = '------------ END MESSAGE ------------\n' + +# NOTE: Some SMTP objects in the tests below are created with a non-default +# local_hostname argument to the constructor, since (on some systems) the FQDN +# lookup caused by the default local_hostname sometimes takes so long that the +# test server times out, causing the test to fail. + +# Test behavior of smtpd.DebuggingServer +class DebuggingServerTests(TestCase): + + def setUp(self): + # temporarily replace sys.stdout to capture DebuggingServer output + self.old_stdout = sys.stdout + self.output = StringIO.StringIO() + sys.stdout = self.output + + self.serv_evt = threading.Event() + self.client_evt = threading.Event() + # Pick a random unused port by passing 0 for the port number + self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1)) + # Keep a note of what port was assigned + self.port = self.serv.socket.getsockname()[1] + serv_args = (self.serv, self.serv_evt, self.client_evt) + threading.Thread(target=debugging_server, args=serv_args).start() + + # wait until server thread has assigned a port number + self.serv_evt.wait() + self.serv_evt.clear() + + def tearDown(self): + # indicate that the client is finished + self.client_evt.set() + # wait for the server thread to terminate + self.serv_evt.wait() + # restore sys.stdout + sys.stdout = self.old_stdout + + def testBasic(self): + # connect + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.quit() + + def testNOOP(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (250, 'Ok') + self.assertEqual(smtp.noop(), expected) + smtp.quit() + + def testRSET(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (250, 'Ok') + self.assertEqual(smtp.rset(), expected) + smtp.quit() + + def testNotImplemented(self): + # EHLO isn't implemented in DebuggingServer + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (502, 'Error: command "EHLO" not implemented') + self.assertEqual(smtp.ehlo(), expected) + smtp.quit() + + def testVRFY(self): + # VRFY isn't implemented in DebuggingServer + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (502, 'Error: command "VRFY" not implemented') + self.assertEqual(smtp.vrfy('nobody@nowhere.com'), expected) + self.assertEqual(smtp.verify('nobody@nowhere.com'), expected) + smtp.quit() + + def testSecondHELO(self): + # check that a second HELO returns a message that it's a duplicate + # (this behavior is specific to smtpd.SMTPChannel) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.helo() + expected = (503, 'Duplicate HELO/EHLO') + self.assertEqual(smtp.helo(), expected) + smtp.quit() + + def testHELP(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + self.assertEqual(smtp.help(), 'Error: command "HELP" not implemented') + smtp.quit() + + def testSend(self): + # connect and send mail + m = 'A test message' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.sendmail('John', 'Sally', m) + # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor + # in asyncore. This sleep might help, but should really be fixed + # properly by using an Event variable. + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + + +class NonConnectingTests(TestCase): + + def testNotConnected(self): + # Test various operations on an unconnected SMTP object that + # should raise exceptions (at present the attempt in SMTP.send + # to reference the nonexistent 'sock' attribute of the SMTP object + # causes an AttributeError) + smtp = smtplib.SMTP() + self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo) + self.assertRaises(smtplib.SMTPServerDisconnected, + smtp.send, 'test msg') + + def testNonnumericPort(self): + # check that non-numeric port raises socket.error + self.assertRaises(socket.error, smtplib.SMTP, + "localhost", "bogus") + self.assertRaises(socket.error, smtplib.SMTP, + "localhost:bogus") + + +# test response of client to a non-successful HELO message +class BadHELOServerTests(TestCase): + + def setUp(self): + self.old_stdout = sys.stdout + self.output = StringIO.StringIO() + sys.stdout = self.output + + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(15) + self.port = test_support.bind_port(self.sock) + servargs = (self.evt, "199 no hello for you!\n", self.sock) + threading.Thread(target=server, args=servargs).start() + self.evt.wait() + self.evt.clear() + + def tearDown(self): + self.evt.wait() + sys.stdout = self.old_stdout + + def testFailingHELO(self): + self.assertRaises(smtplib.SMTPConnectError, smtplib.SMTP, + HOST, self.port, 'localhost', 3) + + +sim_users = {'Mr.A@somewhere.com':'John A', + 'Ms.B@somewhere.com':'Sally B', + 'Mrs.C@somewhereesle.com':'Ruth C', + } + +sim_auth = ('Mr.A@somewhere.com', 'somepassword') +sim_cram_md5_challenge = ('PENCeUxFREJoU0NnbmhNWitOMjNGNn' + 'dAZWx3b29kLmlubm9zb2Z0LmNvbT4=') +sim_auth_credentials = { + 'login': 'TXIuQUBzb21ld2hlcmUuY29t', + 'plain': 'AE1yLkFAc29tZXdoZXJlLmNvbQBzb21lcGFzc3dvcmQ=', + 'cram-md5': ('TXIUQUBZB21LD2HLCMUUY29TIDG4OWQ0MJ' + 'KWZGQ4ODNMNDA4NTGXMDRLZWMYZJDMODG1'), + } +sim_auth_login_password = 'C29TZXBHC3N3B3JK' + +sim_lists = {'list-1':['Mr.A@somewhere.com','Mrs.C@somewhereesle.com'], + 'list-2':['Ms.B@somewhere.com',], + } + +# Simulated SMTP channel & server +class SimSMTPChannel(smtpd.SMTPChannel): + + def __init__(self, extra_features, *args, **kw): + self._extrafeatures = ''.join( + [ "250-{0}\r\n".format(x) for x in extra_features ]) + smtpd.SMTPChannel.__init__(self, *args, **kw) + + def smtp_EHLO(self, arg): + resp = ('250-testhost\r\n' + '250-EXPN\r\n' + '250-SIZE 20000000\r\n' + '250-STARTTLS\r\n' + '250-DELIVERBY\r\n') + resp = resp + self._extrafeatures + '250 HELP' + self.push(resp) + + def smtp_VRFY(self, arg): + raw_addr = email.utils.parseaddr(arg)[1] + quoted_addr = smtplib.quoteaddr(arg) + if raw_addr in sim_users: + self.push('250 %s %s' % (sim_users[raw_addr], quoted_addr)) + else: + self.push('550 No such user: %s' % arg) + + def smtp_EXPN(self, arg): + list_name = email.utils.parseaddr(arg)[1].lower() + if list_name in sim_lists: + user_list = sim_lists[list_name] + for n, user_email in enumerate(user_list): + quoted_addr = smtplib.quoteaddr(user_email) + if n < len(user_list) - 1: + self.push('250-%s %s' % (sim_users[user_email], quoted_addr)) + else: + self.push('250 %s %s' % (sim_users[user_email], quoted_addr)) + else: + self.push('550 No access for you!') + + def smtp_AUTH(self, arg): + if arg.strip().lower()=='cram-md5': + self.push('334 {0}'.format(sim_cram_md5_challenge)) + return + mech, auth = arg.split() + mech = mech.lower() + if mech not in sim_auth_credentials: + self.push('504 auth type unimplemented') + return + if mech == 'plain' and auth==sim_auth_credentials['plain']: + self.push('235 plain auth ok') + elif mech=='login' and auth==sim_auth_credentials['login']: + self.push('334 Password:') + else: + self.push('550 No access for you!') + + +class SimSMTPServer(smtpd.SMTPServer): + + def __init__(self, *args, **kw): + self._extra_features = [] + smtpd.SMTPServer.__init__(self, *args, **kw) + + def handle_accept(self): + conn, addr = self.accept() + self._SMTPchannel = SimSMTPChannel(self._extra_features, + self, conn, addr) + + def process_message(self, peer, mailfrom, rcpttos, data): + pass + + def add_feature(self, feature): + self._extra_features.append(feature) + + +# Test various SMTP & ESMTP commands/behaviors that require a simulated server +# (i.e., something with more features than DebuggingServer) +class SMTPSimTests(TestCase): + + def setUp(self): + self.serv_evt = threading.Event() + self.client_evt = threading.Event() + # Pick a random unused port by passing 0 for the port number + self.serv = SimSMTPServer((HOST, 0), ('nowhere', -1)) + # Keep a note of what port was assigned + self.port = self.serv.socket.getsockname()[1] + serv_args = (self.serv, self.serv_evt, self.client_evt) + threading.Thread(target=debugging_server, args=serv_args).start() + + # wait until server thread has assigned a port number + self.serv_evt.wait() + self.serv_evt.clear() + + def tearDown(self): + # indicate that the client is finished + self.client_evt.set() + # wait for the server thread to terminate + self.serv_evt.wait() + + def testBasic(self): + # smoke test + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.quit() + + def testEHLO(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + # no features should be present before the EHLO + self.assertEqual(smtp.esmtp_features, {}) + + # features expected from the test server + expected_features = {'expn':'', + 'size': '20000000', + 'starttls': '', + 'deliverby': '', + 'help': '', + } + + smtp.ehlo() + self.assertEqual(smtp.esmtp_features, expected_features) + for k in expected_features: + self.assertTrue(smtp.has_extn(k)) + self.assertFalse(smtp.has_extn('unsupported-feature')) + smtp.quit() + + def testVRFY(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + for email, name in sim_users.items(): + expected_known = (250, '%s %s' % (name, smtplib.quoteaddr(email))) + self.assertEqual(smtp.vrfy(email), expected_known) + + u = 'nobody@nowhere.com' + expected_unknown = (550, 'No such user: %s' % smtplib.quoteaddr(u)) + self.assertEqual(smtp.vrfy(u), expected_unknown) + smtp.quit() + + def testEXPN(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + for listname, members in sim_lists.items(): + users = [] + for m in members: + users.append('%s %s' % (sim_users[m], smtplib.quoteaddr(m))) + expected_known = (250, '\n'.join(users)) + self.assertEqual(smtp.expn(listname), expected_known) + + u = 'PSU-Members-List' + expected_unknown = (550, 'No access for you!') + self.assertEqual(smtp.expn(u), expected_unknown) + smtp.quit() + + def testAUTH_PLAIN(self): + self.serv.add_feature("AUTH PLAIN") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + expected_auth_ok = (235, b'plain auth ok') + self.assertEqual(smtp.login(sim_auth[0], sim_auth[1]), expected_auth_ok) + + # SimSMTPChannel doesn't fully support LOGIN or CRAM-MD5 auth because they + # require a synchronous read to obtain the credentials...so instead smtpd + # sees the credential sent by smtplib's login method as an unknown command, + # which results in smtplib raising an auth error. Fortunately the error + # message contains the encoded credential, so we can partially check that it + # was generated correctly (partially, because the 'word' is uppercased in + # the error message). + + def testAUTH_LOGIN(self): + self.serv.add_feature("AUTH LOGIN") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + try: smtp.login(sim_auth[0], sim_auth[1]) + except smtplib.SMTPAuthenticationError as err: + if sim_auth_login_password not in str(err): + raise "expected encoded password not found in error message" + + def testAUTH_CRAM_MD5(self): + self.serv.add_feature("AUTH CRAM-MD5") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + try: smtp.login(sim_auth[0], sim_auth[1]) + except smtplib.SMTPAuthenticationError as err: + if sim_auth_credentials['cram-md5'] not in str(err): + raise "expected encoded credentials not found in error message" + + #TODO: add tests for correct AUTH method fallback now that the + #test infrastructure can support it. + + +def test_main(verbose=None): + test_support.run_unittest(GeneralTests, DebuggingServerTests, + NonConnectingTests, + BadHELOServerTests, SMTPSimTests) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_socket.py python-gevent-1.0/greentest/2.6/test_socket.py --- python-gevent-0.13.7/greentest/2.6/test_socket.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_socket.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1357 @@ +#!/usr/bin/env python + +import unittest +from test import test_support + +import errno +import socket +import select +import thread, threading +import time +import traceback +import Queue +import sys +import os +import array +from weakref import proxy +import signal + +HOST = test_support.HOST +MSG = 'Michael Gilfix was here\n' + +class SocketTCPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.serv) + self.serv.listen(1) + + def tearDown(self): + self.serv.close() + self.serv = None + +class SocketUDPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.port = test_support.bind_port(self.serv) + + def tearDown(self): + self.serv.close() + self.serv = None + +class ThreadableTest: + """Threadable Test class + + The ThreadableTest class makes it easy to create a threaded + client/server pair from an existing unit test. To create a + new threaded class from an existing unit test, use multiple + inheritance: + + class NewClass (OldClass, ThreadableTest): + pass + + This class defines two new fixture functions with obvious + purposes for overriding: + + clientSetUp () + clientTearDown () + + Any new test functions within the class must then define + tests in pairs, where the test name is preceeded with a + '_' to indicate the client portion of the test. Ex: + + def testFoo(self): + # Server portion + + def _testFoo(self): + # Client portion + + Any exceptions raised by the clients during their tests + are caught and transferred to the main thread to alert + the testing framework. + + Note, the server setup function cannot call any blocking + functions that rely on the client thread during setup, + unless serverExplicitReady() is called just before + the blocking call (such as in setting up a client/server + connection and performing the accept() in setUp(). + """ + + def __init__(self): + # Swap the true setup function + self.__setUp = self.setUp + self.__tearDown = self.tearDown + self.setUp = self._setUp + self.tearDown = self._tearDown + + def serverExplicitReady(self): + """This method allows the server to explicitly indicate that + it wants the client thread to proceed. This is useful if the + server is about to execute a blocking routine that is + dependent upon the client thread during its setup routine.""" + self.server_ready.set() + + def _setUp(self): + self.server_ready = threading.Event() + self.client_ready = threading.Event() + self.done = threading.Event() + self.queue = Queue.Queue(1) + + # Do some munging to start the client test. + methodname = self.id() + i = methodname.rfind('.') + methodname = methodname[i+1:] + test_method = getattr(self, '_' + methodname) + self.client_thread = thread.start_new_thread( + self.clientRun, (test_method,)) + + self.__setUp() + if not self.server_ready.is_set(): + self.server_ready.set() + self.client_ready.wait() + + def _tearDown(self): + self.__tearDown() + self.done.wait() + + if not self.queue.empty(): + msg = self.queue.get() + self.fail(msg) + + def clientRun(self, test_func): + self.server_ready.wait() + self.client_ready.set() + self.clientSetUp() + with test_support._check_py3k_warnings(): + if not callable(test_func): + raise TypeError("test_func must be a callable function.") + try: + test_func() + except Exception, strerror: + self.queue.put(strerror) + self.clientTearDown() + + def clientSetUp(self): + raise NotImplementedError("clientSetUp must be implemented.") + + def clientTearDown(self): + self.done.set() + thread.exit() + +class ThreadedTCPSocketTest(SocketTCPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketTCPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + +class ThreadedUDPSocketTest(SocketUDPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketUDPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + +class SocketConnectedTest(ThreadedTCPSocketTest): + + def __init__(self, methodName='runTest'): + ThreadedTCPSocketTest.__init__(self, methodName=methodName) + + def setUp(self): + ThreadedTCPSocketTest.setUp(self) + # Indicate explicitly we're ready for the client thread to + # proceed and then perform the blocking call to accept + self.serverExplicitReady() + conn, addr = self.serv.accept() + self.cli_conn = conn + + def tearDown(self): + self.cli_conn.close() + self.cli_conn = None + ThreadedTCPSocketTest.tearDown(self) + + def clientSetUp(self): + ThreadedTCPSocketTest.clientSetUp(self) + self.cli.connect((HOST, self.port)) + self.serv_conn = self.cli + + def clientTearDown(self): + self.serv_conn.close() + self.serv_conn = None + ThreadedTCPSocketTest.clientTearDown(self) + +class SocketPairTest(unittest.TestCase, ThreadableTest): + + def __init__(self, methodName='runTest'): + unittest.TestCase.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def setUp(self): + self.serv, self.cli = socket.socketpair() + + def tearDown(self): + self.serv.close() + self.serv = None + + def clientSetUp(self): + pass + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + + +####################################################################### +## Begin Tests + +class GeneralModuleTests(unittest.TestCase): + + def test_weakref(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + p = proxy(s) + self.assertEqual(p.fileno(), s.fileno()) + s.close() + s = None + try: + p.fileno() + except ReferenceError: + pass + else: + self.fail('Socket proxy still exists') + + def testSocketError(self): + # Testing socket module exceptions + def raise_error(*args, **kwargs): + raise socket.error + def raise_herror(*args, **kwargs): + raise socket.herror + def raise_gaierror(*args, **kwargs): + raise socket.gaierror + self.failUnlessRaises(socket.error, raise_error, + "Error raising socket exception.") + self.failUnlessRaises(socket.error, raise_herror, + "Error raising socket exception.") + self.failUnlessRaises(socket.error, raise_gaierror, + "Error raising socket exception.") + + def testCrucialConstants(self): + # Testing for mission critical constants + socket.AF_INET + socket.SOCK_STREAM + socket.SOCK_DGRAM + socket.SOCK_RAW + socket.SOCK_RDM + socket.SOCK_SEQPACKET + socket.SOL_SOCKET + socket.SO_REUSEADDR + + def testHostnameRes(self): + # Testing hostname resolution mechanisms + hostname = socket.gethostname() + try: + ip = socket.gethostbyname(hostname) + except socket.error: + # Probably name lookup wasn't set up right; skip this test + return + self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") + try: + hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + except socket.error: + # Probably a similar problem as above; skip this test + return + all_host_names = [hostname, hname] + aliases + fqhn = socket.getfqdn(ip) + if not fqhn in all_host_names: + self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) + + def testRefCountGetNameInfo(self): + # Testing reference count for getnameinfo + if hasattr(sys, "getrefcount"): + try: + # On some versions, this loses a reference + orig = sys.getrefcount(__name__) + socket.getnameinfo(__name__,0) + except TypeError: + self.assertEqual(sys.getrefcount(__name__), orig, + "socket.getnameinfo loses a reference") + + def testInterpreterCrash(self): + # Making sure getnameinfo doesn't crash the interpreter + try: + # On some versions, this crashes the interpreter. + socket.getnameinfo(('x', 0, 0, 0), 0) + except socket.error: + pass + + def testNtoH(self): + # This just checks that htons etc. are their own inverse, + # when looking at the lower 16 or 32 bits. + sizes = {socket.htonl: 32, socket.ntohl: 32, + socket.htons: 16, socket.ntohs: 16} + for func, size in sizes.items(): + mask = (1L< 0: + self.handle_read_event() + return True + + def _do_ssl_handshake(self): + try: + self.socket.do_handshake() + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return + elif err.args[0] == ssl.SSL_ERROR_EOF: + return self.handle_close() + raise + except socket.error, err: + if err.args[0] == errno.ECONNABORTED: + return self.handle_close() + else: + self._ssl_accepting = False + + def handle_read(self): + if self._ssl_accepting: + self._do_ssl_handshake() + else: + data = self.recv(1024) + if data and data.strip() != 'over': + self.send(data.lower()) + + def handle_close(self): + self.close() + if test_support.verbose: + sys.stdout.write(" server: closed connection %s\n" % self.socket) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.certfile = certfile + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.socket) + self.listen(5) + + def handle_accept(self): + sock_obj, addr = self.accept() + if test_support.verbose: + sys.stdout.write(" server: new connection from %s:%s\n" %addr) + self.ConnectionHandler(sock_obj, self.certfile) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.flag = None + self.active = False + self.server = self.EchoServer(certfile) + self.port = self.server.port + threading.Thread.__init__(self) + self.daemon = True + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + self.active = True + if self.flag: + self.flag.set() + while self.active: + asyncore.loop(0.05) + + def stop(self): + self.active = False + self.server.close() + + class SocketServerHTTPSServer(threading.Thread): + + class HTTPSServer(HTTPServer): + + def __init__(self, server_address, RequestHandlerClass, certfile): + HTTPServer.__init__(self, server_address, RequestHandlerClass) + # we assume the certfile contains both private key and certificate + self.certfile = certfile + self.allow_reuse_address = True + + def __str__(self): + return ('<%s %s:%s>' % + (self.__class__.__name__, + self.server_name, + self.server_port)) + + def get_request(self): + # override this to wrap socket with SSL + sock, addr = self.socket.accept() + sslconn = ssl.wrap_socket(sock, server_side=True, + certfile=self.certfile) + return sslconn, addr + + class RootedHTTPRequestHandler(SimpleHTTPRequestHandler): + # need to override translate_path to get a known root, + # instead of using os.curdir, since the test could be + # run from anywhere + + server_version = "TestHTTPS/1.0" + + root = None + + def translate_path(self, path): + """Translate a /-separated PATH to the local filename syntax. + + Components that mean special things to the local file system + (e.g. drive or directory names) are ignored. (XXX They should + probably be diagnosed.) + + """ + # abandon query parameters + path = urlparse.urlparse(path)[2] + path = os.path.normpath(urllib.unquote(path)) + words = path.split('/') + words = filter(None, words) + path = self.root + for word in words: + drive, word = os.path.splitdrive(word) + head, word = os.path.split(word) + if word in self.root: continue + path = os.path.join(path, word) + return path + + def log_message(self, format, *args): + + # we override this to suppress logging unless "verbose" + + if test_support.verbose: + sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" % + (self.server.server_address, + self.server.server_port, + self.request.cipher(), + self.log_date_time_string(), + format%args)) + + + def __init__(self, certfile): + self.flag = None + self.RootedHTTPRequestHandler.root = os.path.split(CERTFILE)[0] + self.server = self.HTTPSServer( + (HOST, 0), self.RootedHTTPRequestHandler, certfile) + self.port = self.server.server_port + threading.Thread.__init__(self) + self.daemon = True + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + if self.flag: + self.flag.set() + self.server.serve_forever(0.05) + + def stop(self): + self.server.shutdown() + + + def bad_cert_test(certfile): + """ + Launch a server with CERT_REQUIRED, and check that trying to + connect to it with the given client certificate fails. + """ + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_REQUIRED, + cacerts=CERTFILE, chatty=False) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + try: + s = ssl.wrap_socket(socket.socket(), + certfile=certfile, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + except ssl.SSLError, x: + if test_support.verbose: + sys.stdout.write("\nSSLError is %s\n" % x[1]) + except socket.error, x: + if test_support.verbose: + sys.stdout.write("\nsocket.error is %s\n" % x[1]) + else: + self.fail("Use of invalid cert should have failed!") + finally: + server.stop() + server.join() + + def server_params_test(certfile, protocol, certreqs, cacertsfile, + client_certfile, client_protocol=None, indata="FOO\n", + chatty=True, connectionchatty=False, + wrap_accepting_socket=False): + """ + Launch a server, connect a client to it and try various reads + and writes. + """ + server = ThreadedEchoServer(certfile, + certreqs=certreqs, + ssl_version=protocol, + cacerts=cacertsfile, + chatty=chatty, + connectionchatty=connectionchatty, + wrap_accepting_socket=wrap_accepting_socket) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + if client_protocol is None: + client_protocol = protocol + try: + s = ssl.wrap_socket(socket.socket(), + certfile=client_certfile, + ca_certs=cacertsfile, + cert_reqs=certreqs, + ssl_version=client_protocol) + s.connect((HOST, server.port)) + if connectionchatty: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(indata))) + s.write(indata) + outdata = s.read() + if connectionchatty: + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + self.fail( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if connectionchatty: + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + finally: + server.stop() + server.join() + + def try_protocol_combo(server_protocol, + client_protocol, + expect_success, + certsreqs=None): + if certsreqs is None: + certsreqs = ssl.CERT_NONE + certtype = { + ssl.CERT_NONE: "CERT_NONE", + ssl.CERT_OPTIONAL: "CERT_OPTIONAL", + ssl.CERT_REQUIRED: "CERT_REQUIRED", + }[certsreqs] + if test_support.verbose: + formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n" + sys.stdout.write(formatstr % + (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol), + certtype)) + try: + server_params_test(CERTFILE, server_protocol, certsreqs, + CERTFILE, CERTFILE, client_protocol, + chatty=False) + # Protocol mismatch can result in either an SSLError, or a + # "Connection reset by peer" error. + except ssl.SSLError: + if expect_success: + raise + except socket.error as e: + if expect_success or e.errno != errno.ECONNRESET: + raise + else: + if not expect_success: + raise AssertionError( + "Client protocol %s succeeded with server protocol %s!" + % (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol))) + + + class ThreadedTests(unittest.TestCase): + + def test_rude_shutdown(self): + """A brutal shutdown of an SSL server should raise an IOError + in the client when attempting handshake. + """ + listener_ready = threading.Event() + listener_gone = threading.Event() + + s = socket.socket() + port = test_support.bind_port(s, HOST) + + # `listener` runs in a thread. It sits in an accept() until + # the main thread connects. Then it rudely closes the socket, + # and sets Event `listener_gone` to let the main thread know + # the socket is gone. + def listener(): + s.listen(5) + listener_ready.set() + s.accept() + s.close() + listener_gone.set() + + def connector(): + listener_ready.wait() + c = socket.socket() + c.connect((HOST, port)) + listener_gone.wait() + try: + ssl_sock = ssl.wrap_socket(c) + except IOError: + pass + else: + self.fail('connecting to closed SSL socket should have failed') + + t = threading.Thread(target=listener) + t.start() + try: + connector() + finally: + t.join() + + def test_echo(self): + """Basic test of an SSL client connecting to a server""" + if test_support.verbose: + sys.stdout.write("\n") + server_params_test(CERTFILE, ssl.PROTOCOL_TLSv1, ssl.CERT_NONE, + CERTFILE, CERTFILE, ssl.PROTOCOL_TLSv1, + chatty=True, connectionchatty=True) + + def test_getpeercert(self): + if test_support.verbose: + sys.stdout.write("\n") + s2 = socket.socket() + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_SSLv23, + cacerts=CERTFILE, + chatty=False) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + s = ssl.wrap_socket(socket.socket(), + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_REQUIRED, + ssl_version=ssl.PROTOCOL_SSLv23) + s.connect((HOST, server.port)) + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") + cipher = s.cipher() + if test_support.verbose: + sys.stdout.write(pprint.pformat(cert) + '\n') + sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') + if 'subject' not in cert: + self.fail("No subject field in certificate: %s." % + pprint.pformat(cert)) + if ((('organizationName', 'Python Software Foundation'),) + not in cert['subject']): + self.fail( + "Missing or invalid 'organizationName' field in certificate subject; " + "should be 'Python Software Foundation'.") + s.close() + finally: + server.stop() + server.join() + + def test_empty_cert(self): + """Connecting with an empty cert file""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "nullcert.pem")) + def test_malformed_cert(self): + """Connecting with a badly formatted certificate (syntax error)""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "badcert.pem")) + def test_nonexisting_cert(self): + """Connecting with a non-existing cert file""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "wrongcert.pem")) + def test_malformed_key(self): + """Connecting with a badly formatted key (syntax error)""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "badkey.pem")) + + def test_protocol_sslv2(self): + """Connecting to an SSLv2 server with various client options""" + if test_support.verbose: + sys.stdout.write("\ntest_protocol_sslv2 disabled, " + "as it fails on OpenSSL 1.0.0+") + return + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, True) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) + + def test_protocol_sslv23(self): + """Connecting to an SSLv23 server with various client options""" + if test_support.verbose: + sys.stdout.write("\ntest_protocol_sslv23 disabled, " + "as it fails on OpenSSL 1.0.0+") + return + try: + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) + except (ssl.SSLError, socket.error), x: + # this fails on some older versions of OpenSSL (0.9.7l, for instance) + if test_support.verbose: + sys.stdout.write( + " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" + % str(x)) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) + + def test_protocol_sslv3(self): + """Connecting to an SSLv3 server with various client options""" + if test_support.verbose: + sys.stdout.write("\ntest_protocol_sslv3 disabled, " + "as it fails on OpenSSL 1.0.0+") + return + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) + + def test_protocol_tlsv1(self): + """Connecting to a TLSv1 server with various client options""" + if test_support.verbose: + sys.stdout.write("\ntest_protocol_tlsv1 disabled, " + "as it fails on OpenSSL 1.0.0+") + return + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False) + + def test_starttls(self): + """Switching from clear text to encrypted and back again.""" + msgs = ("msg 1", "MSG 2", "STARTTLS", "MSG 3", "msg 4", "ENDTLS", "msg 5", "msg 6") + + server = ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_TLSv1, + starttls_server=True, + chatty=True, + connectionchatty=True) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + wrapped = False + try: + s = socket.socket() + s.setblocking(1) + s.connect((HOST, server.port)) + if test_support.verbose: + sys.stdout.write("\n") + for indata in msgs: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % repr(indata)) + if wrapped: + conn.write(indata) + outdata = conn.read() + else: + s.send(indata) + outdata = s.recv(1024) + if (indata == "STARTTLS" and + outdata.strip().lower().startswith("ok")): + # STARTTLS ok, switch to secure mode + if test_support.verbose: + sys.stdout.write( + " client: read %s from server, starting TLS...\n" + % repr(outdata)) + conn = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) + wrapped = True + elif (indata == "ENDTLS" and + outdata.strip().lower().startswith("ok")): + # ENDTLS ok, switch back to clear text + if test_support.verbose: + sys.stdout.write( + " client: read %s from server, ending TLS...\n" + % repr(outdata)) + s = conn.unwrap() + wrapped = False + else: + if test_support.verbose: + sys.stdout.write( + " client: read %s from server\n" % repr(outdata)) + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + if wrapped: + conn.write("over\n") + else: + s.send("over\n") + s.close() + finally: + server.stop() + server.join() + + def test_socketserver(self): + """Using a SocketServer to create and manage SSL connections.""" + server = SocketServerHTTPSServer(CERTFILE) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + if test_support.verbose: + sys.stdout.write('\n') + with open(CERTFILE, 'rb') as f: + d1 = f.read() + d2 = '' + # now fetch the same data from the HTTPS server + url = 'https://127.0.0.1:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) + with test_support._check_py3k_warnings(): + f = urllib.urlopen(url) + dlen = f.info().getheader("content-length") + if dlen and (int(dlen) > 0): + d2 = f.read(int(dlen)) + if test_support.verbose: + sys.stdout.write( + " client: read %d bytes from remote server '%s'\n" + % (len(d2), server)) + f.close() + self.assertEqual(d1, d2) + finally: + server.stop() + server.join() + + def test_wrapped_accept(self): + """Check the accept() method on SSL sockets.""" + if test_support.verbose: + sys.stdout.write("\n") + server_params_test(CERTFILE, ssl.PROTOCOL_SSLv23, ssl.CERT_REQUIRED, + CERTFILE, CERTFILE, ssl.PROTOCOL_SSLv23, + chatty=True, connectionchatty=True, + wrap_accepting_socket=True) + + def test_asyncore_server(self): + """Check the example asyncore integration.""" + indata = "TEST MESSAGE of mixed case\n" + + if test_support.verbose: + sys.stdout.write("\n") + server = AsyncoreEchoServer(CERTFILE) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + s = ssl.wrap_socket(socket.socket()) + s.connect(('127.0.0.1', server.port)) + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(indata))) + s.write(indata) + outdata = s.read() + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + self.fail( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + finally: + server.stop() + # wait for server thread to end + server.join() + + def test_recv_send(self): + """Test recv(), send() and friends.""" + if test_support.verbose: + sys.stdout.write("\n") + + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + s = ssl.wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + try: + # helper methods for standardising recv* method signatures + def _recv_into(): + b = bytearray("\0"*100) + count = s.recv_into(b) + return b[:count] + + def _recvfrom_into(): + b = bytearray("\0"*100) + count, addr = s.recvfrom_into(b) + return b[:count] + + # (name, method, whether to expect success, *args) + send_methods = [ + ('send', s.send, True, []), + ('sendto', s.sendto, False, ["some.address"]), + ('sendall', s.sendall, True, []), + ] + recv_methods = [ + ('recv', s.recv, True, []), + ('recvfrom', s.recvfrom, False, ["some.address"]), + ('recv_into', _recv_into, True, []), + ('recvfrom_into', _recvfrom_into, False, []), + ] + data_prefix = u"PREFIX_" + + for meth_name, send_meth, expect_success, args in send_methods: + indata = data_prefix + meth_name + try: + send_meth(indata.encode('ASCII', 'strict'), *args) + outdata = s.read() + outdata = outdata.decode('ASCII', 'strict') + if outdata != indata.lower(): + raise support.TestFailed( + "While sending with <<%s>> bad data " + "<<%r>> (%d) received; " + "expected <<%r>> (%d)\n" % ( + meth_name, outdata[:20], len(outdata), + indata[:20], len(indata) + ) + ) + except ValueError as e: + if expect_success: + raise support.TestFailed( + "Failed to send with method <<%s>>; " + "expected to succeed.\n" % (meth_name,) + ) + if not str(e).startswith(meth_name): + raise support.TestFailed( + "Method <<%s>> failed with unexpected " + "exception message: %s\n" % ( + meth_name, e + ) + ) + + for meth_name, recv_meth, expect_success, args in recv_methods: + indata = data_prefix + meth_name + try: + s.send(indata.encode('ASCII', 'strict')) + outdata = recv_meth(*args) + outdata = outdata.decode('ASCII', 'strict') + if outdata != indata.lower(): + raise support.TestFailed( + "While receiving with <<%s>> bad data " + "<<%r>> (%d) received; " + "expected <<%r>> (%d)\n" % ( + meth_name, outdata[:20], len(outdata), + indata[:20], len(indata) + ) + ) + except ValueError as e: + if expect_success: + raise support.TestFailed( + "Failed to receive with method <<%s>>; " + "expected to succeed.\n" % (meth_name,) + ) + if not str(e).startswith(meth_name): + raise support.TestFailed( + "Method <<%s>> failed with unexpected " + "exception message: %s\n" % ( + meth_name, e + ) + ) + # consume data + s.read() + + s.write("over\n".encode("ASCII", "strict")) + s.close() + finally: + server.stop() + server.join() + + def test_handshake_timeout(self): + # Issue #5103: SSL handshake must respect the socket timeout + server = socket.socket(socket.AF_INET) + host = "127.0.0.1" + port = test_support.bind_port(server) + started = threading.Event() + finish = False + + def serve(): + server.listen(5) + started.set() + conns = [] + while not finish: + r, w, e = select.select([server], [], [], 0.1) + if server in r: + # Let the socket hang around rather than having + # it closed by garbage collection. + conns.append(server.accept()[0]) + + t = threading.Thread(target=serve) + t.start() + started.wait() + + try: + try: + c = socket.socket(socket.AF_INET) + c.settimeout(0.2) + c.connect((host, port)) + # Will attempt handshake and time out + try: + ssl.wrap_socket(c) + except ssl.SSLError, e: + self.assertTrue("timed out" in str(e), str(e)) + else: + self.fail("SSLError wasn't raised") + finally: + c.close() + try: + c = socket.socket(socket.AF_INET) + c.settimeout(0.2) + c = ssl.wrap_socket(c) + # Will attempt handshake and time out + try: + c.connect((host, port)) + except ssl.SSLError, e: + self.assertTrue("timed out" in str(e), str(e)) + else: + self.fail("SSLError wasn't raised") + finally: + c.close() + finally: + finish = True + t.join() + server.close() + + +def test_main(verbose=False): + if skip_expected: + raise test_support.TestSkipped("No SSL support") + + global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT + CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, + "keycert.pem") + SVN_PYTHON_ORG_ROOT_CERT = os.path.join( + os.path.dirname(__file__) or os.curdir, + "https_svn_python_org_root.pem") + + if (not os.path.exists(CERTFILE) or + not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)): + raise test_support.TestFailed("Can't read certificate files!") + + tests = [BasicTests] + + if test_support.is_resource_enabled('network'): + tests.append(NetworkedTests) + + if _have_threads: + thread_info = test_support.threading_setup() + if thread_info and test_support.is_resource_enabled('network'): + tests.append(ThreadedTests) + + try: + test_support.run_unittest(*tests) + finally: + if _have_threads: + test_support.threading_cleanup(*thread_info) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_subprocess.py python-gevent-1.0/greentest/2.6/test_subprocess.py --- python-gevent-0.13.7/greentest/2.6/test_subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_subprocess.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,795 @@ +import unittest +from test import test_support +import subprocess +import sys +import signal +import os +import errno +import tempfile +import time +import re + +mswindows = (sys.platform == "win32") + +# +# Depends on the following external programs: Python +# + +if mswindows: + SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), ' + 'os.O_BINARY);') +else: + SETBINARY = '' + +# In a debug build, stuff like "[6580 refs]" is printed to stderr at +# shutdown time. That frustrates tests trying to check stderr produced +# from a spawned Python process. +def remove_stderr_debug_decorations(stderr): + return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) + +class ProcessTestCase(unittest.TestCase): + def setUp(self): + # Try to minimize the number of children we have so this test + # doesn't crash on some buildbots (Alphas in particular). + if hasattr(test_support, "reap_children"): + test_support.reap_children() + + def tearDown(self): + # Try to minimize the number of children we have so this test + # doesn't crash on some buildbots (Alphas in particular). + if hasattr(test_support, "reap_children"): + test_support.reap_children() + + def mkstemp(self): + """wrapper for mkstemp, calling mktemp if mkstemp is not available""" + if hasattr(tempfile, "mkstemp"): + return tempfile.mkstemp() + else: + fname = tempfile.mktemp() + return os.open(fname, os.O_RDWR|os.O_CREAT), fname + + # + # Generic tests + # + def test_call_seq(self): + # call() function with sequence argument + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + self.assertEqual(rc, 47) + + def test_check_call_zero(self): + # check_call() function with zero return code + rc = subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(0)"]) + self.assertEqual(rc, 0) + + def test_check_call_nonzero(self): + # check_call() function with non-zero return code + try: + subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + except subprocess.CalledProcessError, e: + self.assertEqual(e.returncode, 47) + else: + self.fail("Expected CalledProcessError") + + def test_call_kwargs(self): + # call() function with keyword args + newenv = os.environ.copy() + newenv["FRUIT"] = "banana" + rc = subprocess.call([sys.executable, "-c", + 'import sys, os;' \ + 'sys.exit(os.getenv("FRUIT")=="banana")'], + env=newenv) + self.assertEqual(rc, 1) + + def test_stdin_none(self): + # .stdin is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p.wait() + self.assertEqual(p.stdin, None) + + def test_stdout_none(self): + # .stdout is None when not redirected + p = subprocess.Popen([sys.executable, "-c", + 'print " this bit of output is from a ' + 'test of stdout in a different ' + 'process ..."'], + stdin=subprocess.PIPE, stderr=subprocess.PIPE) + p.wait() + self.assertEqual(p.stdout, None) + + def test_stderr_none(self): + # .stderr is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + p.wait() + self.assertEqual(p.stderr, None) + + def test_executable(self): + p = subprocess.Popen(["somethingyoudonthave", + "-c", "import sys; sys.exit(47)"], + executable=sys.executable) + p.wait() + self.assertEqual(p.returncode, 47) + + def test_stdin_pipe(self): + # stdin redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.stdin.write("pear") + p.stdin.close() + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_filedes(self): + # stdin is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + os.write(d, "pear") + os.lseek(d, 0, 0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=d) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_fileobj(self): + # stdin is set to open file object + tf = tempfile.TemporaryFile() + tf.write("pear") + tf.seek(0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=tf) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdout_pipe(self): + # stdout redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=subprocess.PIPE) + self.assertEqual(p.stdout.read(), "orange") + + def test_stdout_filedes(self): + # stdout is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=d) + p.wait() + os.lseek(d, 0, 0) + self.assertEqual(os.read(d, 1024), "orange") + + def test_stdout_fileobj(self): + # stdout is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=tf) + p.wait() + tf.seek(0) + self.assertEqual(tf.read(), "orange") + + def test_stderr_pipe(self): + # stderr redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=subprocess.PIPE) + self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()), + "strawberry") + + def test_stderr_filedes(self): + # stderr is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=d) + p.wait() + os.lseek(d, 0, 0) + self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)), + "strawberry") + + def test_stderr_fileobj(self): + # stderr is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=tf) + p.wait() + tf.seek(0) + self.assertEqual(remove_stderr_debug_decorations(tf.read()), + "strawberry") + + def test_stdout_stderr_pipe(self): + # capture stdout and stderr to the same pipe + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' \ + 'sys.stdout.write("apple");' \ + 'sys.stdout.flush();' \ + 'sys.stderr.write("orange")'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + output = p.stdout.read() + stripped = remove_stderr_debug_decorations(output) + self.assertEqual(stripped, "appleorange") + + def test_stdout_stderr_file(self): + # capture stdout and stderr to the same open file + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' \ + 'sys.stdout.write("apple");' \ + 'sys.stdout.flush();' \ + 'sys.stderr.write("orange")'], + stdout=tf, + stderr=tf) + p.wait() + tf.seek(0) + output = tf.read() + stripped = remove_stderr_debug_decorations(output) + self.assertEqual(stripped, "appleorange") + + def test_stdout_filedes_of_stdout(self): + # stdout is set to 1 (#1531862). + cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), '.\n'))" + rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) + self.assertEquals(rc, 2) + + def test_cwd(self): + tmpdir = tempfile.gettempdir() + # We cannot use os.path.realpath to canonicalize the path, + # since it doesn't expand Tru64 {memb} strings. See bug 1063571. + cwd = os.getcwd() + os.chdir(tmpdir) + tmpdir = os.getcwd() + os.chdir(cwd) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getcwd())'], + stdout=subprocess.PIPE, + cwd=tmpdir) + normcase = os.path.normcase + self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir)) + + def test_env(self): + newenv = os.environ.copy() + newenv["FRUIT"] = "orange" + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read(), "orange") + + def test_communicate_stdin(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.communicate("pear") + self.assertEqual(p.returncode, 1) + + def test_communicate_stdout(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("pineapple")'], + stdout=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, "pineapple") + self.assertEqual(stderr, None) + + def test_communicate_stderr(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("pineapple")'], + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple") + + def test_communicate(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stderr.write("pineapple");' + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate("banana") + self.assertEqual(stdout, "banana") + self.assertEqual(remove_stderr_debug_decorations(stderr), + "pineapple") + + # This test is Linux specific for simplicity to at least have + # some coverage. It is not a platform specific bug. + if os.path.isdir('/proc/%d/fd' % os.getpid()): + # Test for the fd leak reported in http://bugs.python.org/issue2791. + def test_communicate_pipe_fd_leak(self): + fd_directory = '/proc/%d/fd' % os.getpid() + num_fds_before_popen = len(os.listdir(fd_directory)) + p = subprocess.Popen([sys.executable, '-c', 'print()'], + stdout=subprocess.PIPE) + p.communicate() + num_fds_after_communicate = len(os.listdir(fd_directory)) + del p + num_fds_after_destruction = len(os.listdir(fd_directory)) + self.assertEqual(num_fds_before_popen, num_fds_after_destruction) + self.assertEqual(num_fds_before_popen, num_fds_after_communicate) + + def test_communicate_returns(self): + # communicate() should return None if no redirection is active + p = subprocess.Popen([sys.executable, "-c", + "import sys; sys.exit(47)"]) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + self.assertEqual(stderr, None) + + def test_communicate_pipe_buf(self): + # communicate() with writes larger than pipe_buf + # This test will probably deadlock rather than fail, if + # communicate() does not work properly. + x, y = os.pipe() + if mswindows: + pipe_buf = 512 + else: + pipe_buf = os.fpathconf(x, "PC_PIPE_BUF") + os.close(x) + os.close(y) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(sys.stdin.read(47));' \ + 'sys.stderr.write("xyz"*%d);' \ + 'sys.stdout.write(sys.stdin.read())' % pipe_buf], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + string_to_write = "abc"*pipe_buf + (stdout, stderr) = p.communicate(string_to_write) + self.assertEqual(stdout, string_to_write) + + def test_writes_before_communicate(self): + # stdin.write before communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + p.stdin.write("banana") + (stdout, stderr) = p.communicate("split") + self.assertEqual(stdout, "bananasplit") + self.assertEqual(remove_stderr_debug_decorations(stderr), "") + + def test_universal_newlines(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, + universal_newlines=1) + stdout = p.stdout.read() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_universal_newlines_communicate(self): + # universal newlines through communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=1) + (stdout, stderr) = p.communicate() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_no_leaking(self): + # Make sure we leak no resources + if not hasattr(test_support, "is_resource_enabled") \ + or test_support.is_resource_enabled("subprocess") and not mswindows: + max_handles = 1026 # too much for most UNIX systems + else: + max_handles = 65 + for i in range(max_handles): + p = subprocess.Popen([sys.executable, "-c", + "import sys;sys.stdout.write(sys.stdin.read())"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + data = p.communicate("lime")[0] + self.assertEqual(data, "lime") + + + def test_list2cmdline(self): + self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']), + '"a b c" d e') + self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']), + 'ab\\"c \\ d') + self.assertEqual(subprocess.list2cmdline(['ab"c', ' \\', 'd']), + 'ab\\"c " \\\\" d') + self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']), + 'a\\\\\\b "de fg" h') + self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']), + 'a\\\\\\"b c d') + self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']), + '"a\\\\b c" d e') + self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']), + '"a\\\\b\\ c" d e') + self.assertEqual(subprocess.list2cmdline(['ab', '']), + 'ab ""') + + + def test_poll(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(1)"]) + count = 0 + while p.poll() is None: + time.sleep(0.1) + count += 1 + # We expect that the poll loop probably went around about 10 times, + # but, based on system scheduling we can't control, it's possible + # poll() never returned None. It "should be" very rare that it + # didn't go around at least twice. + self.assert_(count >= 2) + # Subsequent invocations should just return the returncode + self.assertEqual(p.poll(), 0) + + + def test_wait(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(2)"]) + self.assertEqual(p.wait(), 0) + # Subsequent invocations should just return the returncode + self.assertEqual(p.wait(), 0) + + + def test_invalid_bufsize(self): + # an invalid type of the bufsize argument should raise + # TypeError. + try: + subprocess.Popen([sys.executable, "-c", "pass"], "orange") + except TypeError: + pass + else: + self.fail("Expected TypeError") + + def test_leaking_fds_on_error(self): + # see bug #5179: Popen leaks file descriptors to PIPEs if + # the child fails to execute; this will eventually exhaust + # the maximum number of open fds. 1024 seems a very common + # value for that limit, but Windows has 2048, so we loop + # 1024 times (each call leaked two fds). + for i in range(1024): + try: + subprocess.Popen(['nonexisting_i_hope'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + # Windows raises IOError + except (IOError, OSError), err: + if err.errno != 2: # ignore "no such file" + raise + + # + # POSIX tests + # + if not mswindows: + def test_exceptions(self): + # catched & re-raised exceptions + try: + p = subprocess.Popen([sys.executable, "-c", ""], + cwd="/this/path/does/not/exist") + except OSError, e: + # The attribute child_traceback should contain "os.chdir" + # somewhere. + self.assertNotEqual(e.child_traceback.find("os.chdir"), -1) + else: + self.fail("Expected OSError") + + def _suppress_core_files(self): + """Try to prevent core files from being created. + Returns previous ulimit if successful, else None. + """ + if sys.platform == 'darwin': + # Check if the 'Crash Reporter' on OSX was configured + # in 'Developer' mode and warn that it will get triggered + # when it is. + # + # This assumes that this context manager is used in tests + # that might trigger the next manager. + value = subprocess.Popen(['/usr/bin/defaults', 'read', + 'com.apple.CrashReporter', 'DialogType'], + stdout=subprocess.PIPE).communicate()[0] + if value.strip() == b'developer': + print "this tests triggers the Crash Reporter, that is intentional" + sys.stdout.flush() + + try: + import resource + old_limit = resource.getrlimit(resource.RLIMIT_CORE) + resource.setrlimit(resource.RLIMIT_CORE, (0,0)) + return old_limit + except (ImportError, ValueError, resource.error): + return None + + def _unsuppress_core_files(self, old_limit): + """Return core file behavior to default.""" + if old_limit is None: + return + try: + import resource + resource.setrlimit(resource.RLIMIT_CORE, old_limit) + except (ImportError, ValueError, resource.error): + return + + def test_run_abort(self): + # returncode handles signal termination + old_limit = self._suppress_core_files() + try: + p = subprocess.Popen([sys.executable, + "-c", "import os; os.abort()"]) + finally: + self._unsuppress_core_files(old_limit) + p.wait() + self.assertEqual(-p.returncode, signal.SIGABRT) + + def test_preexec(self): + # preexec function + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' \ + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + preexec_fn=lambda: os.putenv("FRUIT", "apple")) + self.assertEqual(p.stdout.read(), "apple") + + def test_args_string(self): + # args is a string + f, fname = self.mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec '%s' -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0700) + p = subprocess.Popen(fname) + p.wait() + os.remove(fname) + self.assertEqual(p.returncode, 47) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + startupinfo=47) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + creationflags=47) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen(["echo $FRUIT"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen("echo $FRUIT", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_call_string(self): + # call() function with string argument on UNIX + f, fname = self.mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec '%s' -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0700) + rc = subprocess.call(fname) + os.remove(fname) + self.assertEqual(rc, 47) + + def test_specific_shell(self): + # Issue #9265: Incorrect name passed as arg[0]. + shells = [] + for prefix in ['/bin', '/usr/bin/', '/usr/local/bin']: + for name in ['bash', 'ksh']: + sh = os.path.join(prefix, name) + if os.path.isfile(sh): + shells.append(sh) + if not shells: # Will probably work for any shell but csh. + return # skip test + sh = '/bin/sh' + if os.path.isfile(sh) and not os.path.islink(sh): + # Test will fail if /bin/sh is a symlink to csh. + shells.append(sh) + for sh in shells: + p = subprocess.Popen("echo $0", executable=sh, shell=True, + stdout=subprocess.PIPE) + self.assertEqual(p.stdout.read().strip(), sh) + + def DISABLED_test_send_signal(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.send_signal(signal.SIGINT) + self.assertNotEqual(p.wait(), 0) + + def DISABLED_test_kill(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.kill() + self.assertEqual(p.wait(), -signal.SIGKILL) + + def DISABLED_test_terminate(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.terminate() + self.assertEqual(p.wait(), -signal.SIGTERM) + + # + # Windows tests + # + if mswindows: + def test_startupinfo(self): + # startupinfo argument + # We uses hardcoded constants, because we do not want to + # depend on win32all. + STARTF_USESHOWWINDOW = 1 + SW_MAXIMIZE = 3 + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags = STARTF_USESHOWWINDOW + startupinfo.wShowWindow = SW_MAXIMIZE + # Since Python is a console process, it won't be affected + # by wShowWindow, but the argument should be silently + # ignored + subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"], + startupinfo=startupinfo) + + def test_creationflags(self): + # creationflags argument + CREATE_NEW_CONSOLE = 16 + sys.stderr.write(" a DOS box should flash briefly ...\n") + subprocess.call(sys.executable + + ' -c "import time; time.sleep(0.25)"', + creationflags=CREATE_NEW_CONSOLE) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + preexec_fn=lambda: 1) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, + "-c", "import sys; sys.exit(47)"], + stdout=subprocess.PIPE, + close_fds=True) + + def test_close_fds(self): + # close file descriptors + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"], + close_fds=True) + self.assertEqual(rc, 47) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen(["set"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertNotEqual(p.stdout.read().find("physalis"), -1) + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen("set", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertNotEqual(p.stdout.read().find("physalis"), -1) + + def test_call_string(self): + # call() function with string argument on Windows + rc = subprocess.call(sys.executable + + ' -c "import sys; sys.exit(47)"') + self.assertEqual(rc, 47) + + def DISABLED_test_send_signal(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.send_signal(signal.SIGTERM) + self.assertNotEqual(p.wait(), 0) + + def DISABLED_test_kill(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.kill() + self.assertNotEqual(p.wait(), 0) + + def DISABLED_test_terminate(self): + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assert_(p.poll() is None, p.poll()) + p.terminate() + self.assertNotEqual(p.wait(), 0) + +class HelperFunctionTests(unittest.TestCase): + def _test_eintr_retry_call(self): + record_calls = [] + def fake_os_func(*args): + record_calls.append(args) + if len(record_calls) == 2: + raise OSError(errno.EINTR, "fake interrupted system call") + return tuple(reversed(args)) + + self.assertEqual((999, 256), + subprocess._eintr_retry_call(fake_os_func, 256, 999)) + self.assertEqual([(256, 999)], record_calls) + # This time there will be an EINTR so it will loop once. + self.assertEqual((666,), + subprocess._eintr_retry_call(fake_os_func, 666)) + self.assertEqual([(256, 999), (666,), (666,)], record_calls) + + if not mswindows: + test_eintr_retry_call = _test_eintr_retry_call + + +def test_main(): + test_support.run_unittest(ProcessTestCase, + HelperFunctionTests) + if hasattr(test_support, "reap_children"): + test_support.reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_telnetlib.py python-gevent-1.0/greentest/2.6/test_telnetlib.py --- python-gevent-0.13.7/greentest/2.6/test_telnetlib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_telnetlib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,79 @@ +import socket +import threading +import telnetlib +import time + +from unittest import TestCase +from test import test_support + +HOST = test_support.HOST + +def server(evt, serv): + serv.listen(5) + evt.set() + try: + conn, addr = serv.accept() + except socket.timeout: + pass + finally: + serv.close() + evt.set() + +class GeneralTests(TestCase): + + def setUp(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(3) + self.port = test_support.bind_port(self.sock) + threading.Thread(target=server, args=(self.evt,self.sock)).start() + self.evt.wait() + self.evt.clear() + time.sleep(.1) + + def tearDown(self): + self.evt.wait() + + def testBasic(self): + # connects + telnet = telnetlib.Telnet(HOST, self.port) + telnet.sock.close() + + def testTimeoutDefault(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet("localhost", self.port) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + + def testTimeoutNone(self): + # None, having other default + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet(HOST, self.port, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(telnet.sock.gettimeout() is None) + telnet.sock.close() + + def testTimeoutValue(self): + telnet = telnetlib.Telnet("localhost", self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + + def testTimeoutOpen(self): + telnet = telnetlib.Telnet() + telnet.open("localhost", self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + + +def test_main(verbose=None): + test_support.run_unittest(GeneralTests) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_threading_local.py python-gevent-1.0/greentest/2.6/test_threading_local.py --- python-gevent-0.13.7/greentest/2.6/test_threading_local.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_threading_local.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,132 @@ +import unittest +from doctest import DocTestSuite +from test import test_support +import threading +import weakref +import gc + +class Weak(object): + pass + +def target(local, weaklist): + weak = Weak() + local.weak = weak + weaklist.append(weakref.ref(weak)) + +class ThreadingLocalTest(unittest.TestCase): + + def test_local_refs(self): + self._local_refs(20) + self._local_refs(50) + self._local_refs(100) + + def _local_refs(self, n): + local = threading.local() + weaklist = [] + for i in range(n): + t = threading.Thread(target=target, args=(local, weaklist)) + t.start() + t.join() + del t + + gc.collect() + self.assertEqual(len(weaklist), n) + + # XXX threading.local keeps the local of the last stopped thread alive. + deadlist = [weak for weak in weaklist if weak() is None] + self.assertEqual(len(deadlist), n-1) + + # Assignment to the same thread local frees it sometimes (!) + local.someothervar = None + gc.collect() + deadlist = [weak for weak in weaklist if weak() is None] + self.assert_(len(deadlist) in (n-1, n), (n, len(deadlist))) + + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import time + class Local(threading.local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_derived_cycle_dealloc(self): + # http://bugs.python.org/issue6990 + class Local(threading.local): + pass + locals = None + passed = [False] + e1 = threading.Event() + e2 = threading.Event() + + def f(): + # 1) Involve Local in a cycle + cycle = [Local()] + cycle.append(cycle) + cycle[0].foo = 'bar' + + # 2) GC the cycle (triggers threadmodule.c::local_clear + # before local_dealloc) + del cycle + gc.collect() + e1.set() + e2.wait() + + # 4) New Locals should be empty + passed[0] = all(not hasattr(local, 'foo') for local in locals) + + t = threading.Thread(target=f) + t.start() + e1.wait() + + # 3) New Locals should recycle the original's address. Creating + # them in the thread overwrites the thread state and avoids the + # bug + locals = [Local() for i in range(10)] + e2.set() + t.join() + + self.assertTrue(passed[0]) + + +def test_main(): + suite = unittest.TestSuite() + suite.addTest(DocTestSuite('_threading_local')) + suite.addTest(unittest.makeSuite(ThreadingLocalTest)) + + try: + from thread import _local + except ImportError: + pass + else: + import _threading_local + local_orig = _threading_local.local + def setUp(test): + _threading_local.local = _local + def tearDown(test): + _threading_local.local = local_orig + suite.addTest(DocTestSuite('_threading_local', + setUp=setUp, tearDown=tearDown) + ) + + test_support.run_unittest(suite) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_threading.py python-gevent-1.0/greentest/2.6/test_threading.py --- python-gevent-0.13.7/greentest/2.6/test_threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,518 @@ +# Very rudimentary test of threading module + +import test.test_support +from test.test_support import verbose +import random +import re +import sys +import threading +import thread +import time +import unittest +import weakref + +import lock_tests + +# A trivial mutable counter. +class Counter(object): + def __init__(self): + self.value = 0 + def inc(self): + self.value += 1 + def dec(self): + self.value -= 1 + def get(self): + return self.value + +class TestThread(threading.Thread): + def __init__(self, name, testcase, sema, mutex, nrunning): + threading.Thread.__init__(self, name=name) + self.testcase = testcase + self.sema = sema + self.mutex = mutex + self.nrunning = nrunning + + def run(self): + delay = random.random() / 10000.0 + if verbose: + print 'task %s will run for %.1f usec' % ( + self.name, delay * 1e6) + + with self.sema: + with self.mutex: + self.nrunning.inc() + if verbose: + print self.nrunning.get(), 'tasks are running' + self.testcase.assert_(self.nrunning.get() <= 3) + + time.sleep(delay) + if verbose: + print 'task', self.name, 'done' + + with self.mutex: + self.nrunning.dec() + self.testcase.assert_(self.nrunning.get() >= 0) + if verbose: + print '%s is finished. %d tasks are running' % ( + self.name, self.nrunning.get()) + +class ThreadTests(unittest.TestCase): + + # Create a bunch of threads, let each do some work, wait until all are + # done. + def test_various_ops(self): + # This takes about n/3 seconds to run (about n/3 clumps of tasks, + # times about 1 second per clump). + NUMTASKS = 10 + + # no more than 3 of the 10 can run at once + sema = threading.BoundedSemaphore(value=3) + mutex = threading.RLock() + numrunning = Counter() + + threads = [] + + for i in range(NUMTASKS): + t = TestThread(""%i, self, sema, mutex, numrunning) + threads.append(t) + self.failUnlessEqual(t.ident, None) + self.assert_(re.match('', repr(t))) + t.start() + + if verbose: + print 'waiting for all tasks to complete' + for t in threads: + t.join(NUMTASKS) + self.assert_(not t.is_alive()) + self.failIfEqual(t.ident, 0) + self.assertFalse(t.ident is None) + self.assert_(re.match('', repr(t))) + if verbose: + print 'all tasks done' + self.assertEqual(numrunning.get(), 0) + + def test_ident_of_no_threading_threads(self): + # The ident still must work for the main thread and dummy threads. + self.assertFalse(threading.currentThread().ident is None) + def f(): + ident.append(threading.currentThread().ident) + done.set() + done = threading.Event() + ident = [] + thread.start_new_thread(f, ()) + done.wait() + self.assertFalse(ident[0] is None) + # Kill the "immortal" _DummyThread + del threading._active[ident[0]] + + # run with a small(ish) thread stack size (256kB) + def test_various_ops_small_stack(self): + if verbose: + print 'with 256kB thread stack size...' + try: + threading.stack_size(262144) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + # run with a large thread stack size (1MB) + def test_various_ops_large_stack(self): + if verbose: + print 'with 1MB thread stack size...' + try: + threading.stack_size(0x100000) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + def test_foreign_thread(self): + # Check that a "foreign" thread can use the threading module. + def f(mutex): + # Calling current_thread() forces an entry for the foreign + # thread to get made in the threading._active map. + threading.current_thread() + mutex.release() + + mutex = threading.Lock() + mutex.acquire() + tid = thread.start_new_thread(f, (mutex,)) + # Wait for the thread to finish. + mutex.acquire() + self.assert_(tid in threading._active) + self.assert_(isinstance(threading._active[tid], + threading._DummyThread)) + del threading._active[tid] + + # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) + # exposed at the Python level. This test relies on ctypes to get at it. + def test_PyThreadState_SetAsyncExc(self): + try: + import ctypes + except ImportError: + if verbose: + print "test_PyThreadState_SetAsyncExc can't import ctypes" + return # can't do anything + + set_async_exc = ctypes.pythonapi.PyThreadState_SetAsyncExc + + class AsyncExc(Exception): + pass + + exception = ctypes.py_object(AsyncExc) + + # `worker_started` is set by the thread when it's inside a try/except + # block waiting to catch the asynchronously set AsyncExc exception. + # `worker_saw_exception` is set by the thread upon catching that + # exception. + worker_started = threading.Event() + worker_saw_exception = threading.Event() + + class Worker(threading.Thread): + def run(self): + self.id = thread.get_ident() + self.finished = False + + try: + while True: + worker_started.set() + time.sleep(0.1) + except AsyncExc: + self.finished = True + worker_saw_exception.set() + + t = Worker() + t.daemon = True # so if this fails, we don't hang Python at shutdown + t.start() + if verbose: + print " started worker thread" + + # Try a thread id that doesn't make sense. + if verbose: + print " trying nonsensical thread id" + result = set_async_exc(ctypes.c_long(-1), exception) + self.assertEqual(result, 0) # no thread states modified + + # Now raise an exception in the worker thread. + if verbose: + print " waiting for worker thread to get started" + worker_started.wait() + if verbose: + print " verifying worker hasn't exited" + self.assert_(not t.finished) + if verbose: + print " attempting to raise asynch exception in worker" + result = set_async_exc(ctypes.c_long(t.id), exception) + self.assertEqual(result, 1) # one thread state modified + if verbose: + print " waiting for worker to say it caught the exception" + worker_saw_exception.wait(timeout=10) + self.assert_(t.finished) + if verbose: + print " all OK -- joining worker" + if t.finished: + t.join() + # else the thread is still running, and we have no way to kill it + + def test_limbo_cleanup(self): + # Issue 7481: Failure to start thread should cleanup the limbo map. + def fail_new_thread(*args): + raise thread.error() + _start_new_thread = threading._start_new_thread + threading._start_new_thread = fail_new_thread + try: + t = threading.Thread(target=lambda: None) + self.assertRaises(thread.error, t.start) + self.assertFalse( + t in threading._limbo, + "Failed to cleanup _limbo map on failure of Thread.start().") + finally: + threading._start_new_thread = _start_new_thread + + def test_finalize_runnning_thread(self): + # Issue 1402: the PyGILState_Ensure / _Release functions may be called + # very late on python exit: on deallocation of a running thread for + # example. + try: + import ctypes + except ImportError: + if verbose: + print("test_finalize_with_runnning_thread can't import ctypes") + return # can't do anything + + import subprocess + rc = subprocess.call([sys.executable, "-c", """if 1: + import ctypes, sys, time, thread + + # This lock is used as a simple event variable. + ready = thread.allocate_lock() + ready.acquire() + + # Module globals are cleared before __del__ is run + # So we save the functions in class dict + class C: + ensure = ctypes.pythonapi.PyGILState_Ensure + release = ctypes.pythonapi.PyGILState_Release + def __del__(self): + state = self.ensure() + self.release(state) + + def waitingThread(): + x = C() + ready.release() + time.sleep(100) + + thread.start_new_thread(waitingThread, ()) + ready.acquire() # Be sure the other thread is waiting. + sys.exit(42) + """]) + self.assertEqual(rc, 42) + + def test_finalize_with_trace(self): + # Issue1733757 + # Avoid a deadlock when sys.settrace steps into threading._shutdown + import subprocess + rc = subprocess.call([sys.executable, "-c", """if 1: + import sys, threading + + # A deadlock-killer, to prevent the + # testsuite to hang forever + def killer(): + import os, time + time.sleep(2) + print 'program blocked; aborting' + os._exit(2) + t = threading.Thread(target=killer) + t.daemon = True + t.start() + + # This is the trace function + def func(frame, event, arg): + threading.current_thread() + return func + + sys.settrace(func) + """]) + self.failIf(rc == 2, "interpreted was blocked") + self.failUnless(rc == 0, "Unexpected error") + + def test_join_nondaemon_on_shutdown(self): + # Issue 1722344 + # Raising SystemExit skipped threading._shutdown + import subprocess + p = subprocess.Popen([sys.executable, "-c", """if 1: + import threading + from time import sleep + + def child(): + sleep(1) + # As a non-daemon thread we SHOULD wake up and nothing + # should be torn down yet + print "Woke up, sleep function is:", sleep + + threading.Thread(target=child).start() + raise SystemExit + """], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = p.communicate() + self.assertEqual(stdout.strip(), + "Woke up, sleep function is: ") + stderr = re.sub(r"^\[\d+ refs\]", "", stderr, re.MULTILINE).strip() + self.assertEqual(stderr, "") + + def test_enumerate_after_join(self): + # Try hard to trigger #1703448: a thread is still returned in + # threading.enumerate() after it has been join()ed. + enum = threading.enumerate + old_interval = sys.getcheckinterval() + try: + for i in xrange(1, 100): + # Try a couple times at each thread-switching interval + # to get more interleavings. + sys.setcheckinterval(i // 5) + t = threading.Thread(target=lambda: None) + t.start() + t.join() + l = enum() + self.assertFalse(t in l, + "#1703448 triggered after %d trials: %s" % (i, l)) + finally: + sys.setcheckinterval(old_interval) + + def test_no_refcycle_through_target(self): + class RunSelfFunction(object): + def __init__(self, should_raise): + # The links in this refcycle from Thread back to self + # should be cleaned up when the thread completes. + self.should_raise = should_raise + self.thread = threading.Thread(target=self._run, + args=(self,), + kwargs={'yet_another':self}) + self.thread.start() + + def _run(self, other_ref, yet_another): + if self.should_raise: + raise SystemExit + + cyclic_object = RunSelfFunction(should_raise=False) + weak_cyclic_object = weakref.ref(cyclic_object) + cyclic_object.thread.join() + del cyclic_object + self.assertEquals(None, weak_cyclic_object(), + msg=('%d references still around' % + sys.getrefcount(weak_cyclic_object()))) + + raising_cyclic_object = RunSelfFunction(should_raise=True) + weak_raising_cyclic_object = weakref.ref(raising_cyclic_object) + raising_cyclic_object.thread.join() + del raising_cyclic_object + self.assertEquals(None, weak_raising_cyclic_object(), + msg=('%d references still around' % + sys.getrefcount(weak_raising_cyclic_object()))) + + +class ThreadJoinOnShutdown(unittest.TestCase): + + def _run_and_join(self, script): + script = """if 1: + import sys, os, time, threading + + # a thread, which waits for the main program to terminate + def joiningfunc(mainthread): + mainthread.join() + print 'end of thread' + \n""" + script + + import subprocess + p = subprocess.Popen([sys.executable, "-c", script], stdout=subprocess.PIPE) + rc = p.wait() + data = p.stdout.read().replace('\r', '') + self.assertEqual(data, "end of main\nend of thread\n") + self.failIf(rc == 2, "interpreter was blocked") + self.failUnless(rc == 0, "Unexpected error") + + def test_1_join_on_shutdown(self): + # The usual case: on exit, wait for a non-daemon thread + script = """if 1: + import os + t = threading.Thread(target=joiningfunc, + args=(threading.current_thread(),)) + t.start() + time.sleep(0.1) + print 'end of main' + """ + self._run_and_join(script) + + + def test_2_join_in_forked_process(self): + # Like the test above, but from a forked interpreter + import os + if not hasattr(os, 'fork'): + return + script = """if 1: + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(threading.current_thread(),)) + t.start() + print 'end of main' + """ + self._run_and_join(script) + + def test_3_join_in_forked_from_thread(self): + # Like the test above, but fork() was called from a worker thread + # In the forked process, the main Thread object must be marked as stopped. + import os + if not hasattr(os, 'fork'): + return + # Skip platforms with known problems forking from a worker thread. + # See http://bugs.python.org/issue3863. + if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): + print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread' + ' due to known OS bugs on'), sys.platform + return + script = """if 1: + main_thread = threading.current_thread() + def worker(): + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(main_thread,)) + print 'end of main' + t.start() + t.join() # Should not block: main_thread is already stopped + + w = threading.Thread(target=worker) + w.start() + """ + self._run_and_join(script) + + +class ThreadingExceptionTests(unittest.TestCase): + # A RuntimeError should be raised if Thread.start() is called + # multiple times. + def test_start_thread_again(self): + thread = threading.Thread() + thread.start() + self.assertRaises(RuntimeError, thread.start) + + def test_joining_current_thread(self): + current_thread = threading.current_thread() + self.assertRaises(RuntimeError, current_thread.join); + + def test_joining_inactive_thread(self): + thread = threading.Thread() + self.assertRaises(RuntimeError, thread.join) + + def test_daemonize_active_thread(self): + thread = threading.Thread() + thread.start() + self.assertRaises(RuntimeError, setattr, thread, "daemon", True) + + +class LockTests(lock_tests.LockTests): + locktype = staticmethod(threading.Lock) + +class RLockTests(lock_tests.RLockTests): + locktype = staticmethod(threading.RLock) + +class EventTests(lock_tests.EventTests): + eventtype = staticmethod(threading.Event) + +class ConditionAsRLockTests(lock_tests.RLockTests): + # An Condition uses an RLock by default and exports its API. + locktype = staticmethod(threading.Condition) + +class ConditionTests(lock_tests.ConditionTests): + condtype = staticmethod(threading.Condition) + +class SemaphoreTests(lock_tests.SemaphoreTests): + semtype = staticmethod(threading.Semaphore) + +class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests): + semtype = staticmethod(threading.BoundedSemaphore) + + +def test_main(): + test.test_support.run_unittest(LockTests, RLockTests, EventTests, + ConditionAsRLockTests, ConditionTests, + SemaphoreTests, BoundedSemaphoreTests, + ThreadTests, + ThreadJoinOnShutdown, + ThreadingExceptionTests, + ) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_thread.py python-gevent-1.0/greentest/2.6/test_thread.py --- python-gevent-0.13.7/greentest/2.6/test_thread.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_thread.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,215 @@ +import os +import unittest +import random +from test import test_support +import thread +import time +import sys + +import lock_tests + +NUMTASKS = 10 +NUMTRIPS = 3 + + +_print_mutex = thread.allocate_lock() + +def verbose_print(arg): + """Helper function for printing out debugging output.""" + if test_support.verbose: + with _print_mutex: + print arg + + +class BasicThreadTest(unittest.TestCase): + + def setUp(self): + self.done_mutex = thread.allocate_lock() + self.done_mutex.acquire() + self.running_mutex = thread.allocate_lock() + self.random_mutex = thread.allocate_lock() + self.created = 0 + self.running = 0 + self.next_ident = 0 + + +class ThreadRunningTests(BasicThreadTest): + + def newtask(self): + with self.running_mutex: + self.next_ident += 1 + verbose_print("creating task %s" % self.next_ident) + thread.start_new_thread(self.task, (self.next_ident,)) + self.created += 1 + self.running += 1 + + def task(self, ident): + with self.random_mutex: + delay = random.random() / 10000.0 + verbose_print("task %s will run for %sus" % (ident, round(delay*1e6))) + time.sleep(delay) + verbose_print("task %s done" % ident) + with self.running_mutex: + self.running -= 1 + if self.created == NUMTASKS and self.running == 0: + self.done_mutex.release() + + def test_starting_threads(self): + # Basic test for thread creation. + for i in range(NUMTASKS): + self.newtask() + verbose_print("waiting for tasks to complete...") + self.done_mutex.acquire() + verbose_print("all tasks done") + + def test_stack_size(self): + # Various stack size tests. + self.assertEquals(thread.stack_size(), 0, "intial stack size is not 0") + + thread.stack_size(0) + self.assertEquals(thread.stack_size(), 0, "stack_size not reset to default") + + if os.name not in ("nt", "os2", "posix"): + return + + tss_supported = True + try: + thread.stack_size(4096) + except ValueError: + verbose_print("caught expected ValueError setting " + "stack_size(4096)") + except thread.error: + tss_supported = False + verbose_print("platform does not support changing thread stack " + "size") + + if tss_supported: + fail_msg = "stack_size(%d) failed - should succeed" + for tss in (262144, 0x100000, 0): + thread.stack_size(tss) + self.assertEquals(thread.stack_size(), tss, fail_msg % tss) + verbose_print("successfully set stack_size(%d)" % tss) + + for tss in (262144, 0x100000): + verbose_print("trying stack_size = (%d)" % tss) + self.next_ident = 0 + self.created = 0 + for i in range(NUMTASKS): + self.newtask() + + verbose_print("waiting for all tasks to complete") + self.done_mutex.acquire() + verbose_print("all tasks done") + + thread.stack_size(0) + + +class Barrier: + def __init__(self, num_threads): + self.num_threads = num_threads + self.waiting = 0 + self.checkin_mutex = thread.allocate_lock() + self.checkout_mutex = thread.allocate_lock() + self.checkout_mutex.acquire() + + def enter(self): + self.checkin_mutex.acquire() + self.waiting = self.waiting + 1 + if self.waiting == self.num_threads: + self.waiting = self.num_threads - 1 + self.checkout_mutex.release() + return + self.checkin_mutex.release() + + self.checkout_mutex.acquire() + self.waiting = self.waiting - 1 + if self.waiting == 0: + self.checkin_mutex.release() + return + self.checkout_mutex.release() + + +class BarrierTest(BasicThreadTest): + + def test_barrier(self): + self.bar = Barrier(NUMTASKS) + self.running = NUMTASKS + for i in range(NUMTASKS): + thread.start_new_thread(self.task2, (i,)) + verbose_print("waiting for tasks to end") + self.done_mutex.acquire() + verbose_print("tasks done") + + def task2(self, ident): + for i in range(NUMTRIPS): + if ident == 0: + # give it a good chance to enter the next + # barrier before the others are all out + # of the current one + delay = 0 + else: + with self.random_mutex: + delay = random.random() / 10000.0 + verbose_print("task %s will run for %sus" % + (ident, round(delay * 1e6))) + time.sleep(delay) + verbose_print("task %s entering %s" % (ident, i)) + self.bar.enter() + verbose_print("task %s leaving barrier" % ident) + with self.running_mutex: + self.running -= 1 + # Must release mutex before releasing done, else the main thread can + # exit and set mutex to None as part of global teardown; then + # mutex.release() raises AttributeError. + finished = self.running == 0 + if finished: + self.done_mutex.release() + + +class LockTests(lock_tests.LockTests): + locktype = thread.allocate_lock + + +class TestForkInThread(unittest.TestCase): + def setUp(self): + self.read_fd, self.write_fd = os.pipe() + + def _test_forkinthread(self): + def thread1(): + try: + pid = os.fork() # fork in a thread + except RuntimeError: + sys.exit(0) # exit the child + + if pid == 0: # child + os.close(self.read_fd) + os.write(self.write_fd, "OK") + sys.exit(0) + else: # parent + os.close(self.write_fd) + + thread.start_new_thread(thread1, ()) + self.assertEqual(os.read(self.read_fd, 2), "OK", + "Unable to fork() in thread") + + if not sys.platform.startswith('win'): + test_forkinthread = _test_forkinthread + + def tearDown(self): + try: + os.close(self.read_fd) + except OSError: + pass + + try: + os.close(self.write_fd) + except OSError: + pass + + +def test_main(): + test_support.run_unittest(ThreadRunningTests, BarrierTest, LockTests, + TestForkInThread) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_timeout.py python-gevent-1.0/greentest/2.6/test_timeout.py --- python-gevent-0.13.7/greentest/2.6/test_timeout.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,200 @@ +"""Unit tests for socket timeout feature.""" + +import unittest +from test import test_support + +# This requires the 'network' resource as given on the regrtest command line. +skip_expected = not test_support.is_resource_enabled('network') + +import time +import socket + + +class CreationTestCase(unittest.TestCase): + """Test case for socket.gettimeout() and socket.settimeout()""" + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def tearDown(self): + self.sock.close() + + def testObjectCreation(self): + # Test Socket creation + self.assertEqual(self.sock.gettimeout(), None, + "timeout not disabled by default") + + def testFloatReturnValue(self): + # Test return value of gettimeout() + self.sock.settimeout(7.345) + self.assertEqual(self.sock.gettimeout(), 7.345) + + self.sock.settimeout(3) + self.assertEqual(self.sock.gettimeout(), 3) + + self.sock.settimeout(None) + self.assertEqual(self.sock.gettimeout(), None) + + def testReturnType(self): + # Test return type of gettimeout() + self.sock.settimeout(1) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + self.sock.settimeout(3.9) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + def testTypeCheck(self): + # Test type checking by settimeout() + self.sock.settimeout(0) + self.sock.settimeout(0L) + self.sock.settimeout(0.0) + self.sock.settimeout(None) + self.assertRaises(TypeError, self.sock.settimeout, "") + self.assertRaises(TypeError, self.sock.settimeout, u"") + self.assertRaises(TypeError, self.sock.settimeout, ()) + self.assertRaises(TypeError, self.sock.settimeout, []) + self.assertRaises(TypeError, self.sock.settimeout, {}) + self.assertRaises(TypeError, self.sock.settimeout, 0j) + + def testRangeCheck(self): + # Test range checking by settimeout() + self.assertRaises(ValueError, self.sock.settimeout, -1) + self.assertRaises(ValueError, self.sock.settimeout, -1L) + self.assertRaises(ValueError, self.sock.settimeout, -1.0) + + def testTimeoutThenBlocking(self): + # Test settimeout() followed by setblocking() + self.sock.settimeout(10) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + + self.sock.settimeout(10) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + + def testBlockingThenTimeout(self): + # Test setblocking() followed by settimeout() + self.sock.setblocking(0) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + self.sock.setblocking(1) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + +class TimeoutTestCase(unittest.TestCase): + """Test case for socket.socket() timeout functions""" + + # There are a number of tests here trying to make sure that an operation + # doesn't take too much longer than expected. But competing machine + # activity makes it inevitable that such tests will fail at times. + # When fuzz was at 1.0, I (tim) routinely saw bogus failures on Win2K + # and Win98SE. Boosting it to 2.0 helped a lot, but isn't a real + # solution. + fuzz = 2.0 + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.addr_remote = ('www.python.org.', 80) + self.localhost = '127.0.0.1' + + def tearDown(self): + self.sock.close() + + def testConnectTimeout(self): + # Choose a private address that is unlikely to exist to prevent + # failures due to the connect succeeding before the timeout. + # Use a dotted IP address to avoid including the DNS lookup time + # with the connect time. This avoids failing the assertion that + # the timeout occurred fast enough. + addr = ('10.0.0.0', 12345) + + # Test connect() timeout + _timeout = 0.001 + self.sock.settimeout(_timeout) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.connect, addr) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is more than %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvTimeout(self): + # Test recv() timeout + _timeout = 0.02 + self.sock.connect(self.addr_remote) + self.sock.settimeout(_timeout) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.recv, 1024) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testAcceptTimeout(self): + # Test accept() timeout + _timeout = 2 + self.sock.settimeout(_timeout) + # Prevent "Address already in use" socket exceptions + test_support.bind_port(self.sock, self.localhost) + self.sock.listen(5) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.accept) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvfromTimeout(self): + # Test recvfrom() timeout + _timeout = 2 + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.sock.settimeout(_timeout) + # Prevent "Address already in use" socket exceptions + test_support.bind_port(self.sock, self.localhost) + + _t1 = time.time() + self.failUnlessRaises(socket.error, self.sock.recvfrom, 8192) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assert_(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testSend(self): + # Test send() timeout + # couldn't figure out how to test it + pass + + def testSendto(self): + # Test sendto() timeout + # couldn't figure out how to test it + pass + + def testSendall(self): + # Test sendall() timeout + # couldn't figure out how to test it + pass + + +def test_main(): + test_support.requires('network') + test_support.run_unittest(CreationTestCase, TimeoutTestCase) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_urllib2_localnet.py python-gevent-1.0/greentest/2.6/test_urllib2_localnet.py --- python-gevent-0.13.7/greentest/2.6/test_urllib2_localnet.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_urllib2_localnet.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,501 @@ +#!/usr/bin/env python + +import threading +import urlparse +import urllib2 +import BaseHTTPServer +import unittest +import hashlib +from test import test_support +mimetools = test_support.import_module('mimetools', deprecated=True) + +# Loopback http server infrastructure + +class LoopbackHttpServer(BaseHTTPServer.HTTPServer): + """HTTP server w/ a few modifications that make it useful for + loopback testing purposes. + """ + + def __init__(self, server_address, RequestHandlerClass): + BaseHTTPServer.HTTPServer.__init__(self, + server_address, + RequestHandlerClass) + + # Set the timeout of our listening socket really low so + # that we can stop the server easily. + self.socket.settimeout(0.1) + + def get_request(self): + """BaseHTTPServer method, overridden.""" + + request, client_address = self.socket.accept() + + # It's a loopback connection, so setting the timeout + # really low shouldn't affect anything, but should make + # deadlocks less likely to occur. + request.settimeout(1.0) + + return (request, client_address) + +class LoopbackHttpServerThread(threading.Thread): + """Stoppable thread that runs a loopback http server.""" + + def __init__(self, request_handler): + threading.Thread.__init__(self) + self._stop = False + self.ready = threading.Event() + request_handler.protocol_version = "HTTP/1.0" + self.httpd = LoopbackHttpServer(('127.0.0.1', 0), + request_handler) + #print "Serving HTTP on %s port %s" % (self.httpd.server_name, + # self.httpd.server_port) + self.port = self.httpd.server_port + + def stop(self): + """Stops the webserver if it's currently running.""" + + # Set the stop flag. + self._stop = True + + self.join() + + def run(self): + self.ready.set() + while not self._stop: + self.httpd.handle_request() + +# Authentication infrastructure + +class DigestAuthHandler: + """Handler for performing digest authentication.""" + + def __init__(self): + self._request_num = 0 + self._nonces = [] + self._users = {} + self._realm_name = "Test Realm" + self._qop = "auth" + + def set_qop(self, qop): + self._qop = qop + + def set_users(self, users): + assert isinstance(users, dict) + self._users = users + + def set_realm(self, realm): + self._realm_name = realm + + def _generate_nonce(self): + self._request_num += 1 + nonce = hashlib.md5(str(self._request_num)).hexdigest() + self._nonces.append(nonce) + return nonce + + def _create_auth_dict(self, auth_str): + first_space_index = auth_str.find(" ") + auth_str = auth_str[first_space_index+1:] + + parts = auth_str.split(",") + + auth_dict = {} + for part in parts: + name, value = part.split("=") + name = name.strip() + if value[0] == '"' and value[-1] == '"': + value = value[1:-1] + else: + value = value.strip() + auth_dict[name] = value + return auth_dict + + def _validate_auth(self, auth_dict, password, method, uri): + final_dict = {} + final_dict.update(auth_dict) + final_dict["password"] = password + final_dict["method"] = method + final_dict["uri"] = uri + HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict + HA1 = hashlib.md5(HA1_str).hexdigest() + HA2_str = "%(method)s:%(uri)s" % final_dict + HA2 = hashlib.md5(HA2_str).hexdigest() + final_dict["HA1"] = HA1 + final_dict["HA2"] = HA2 + response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ + "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict + response = hashlib.md5(response_str).hexdigest() + + return response == auth_dict["response"] + + def _return_auth_challenge(self, request_handler): + request_handler.send_response(407, "Proxy Authentication Required") + request_handler.send_header("Content-Type", "text/html") + request_handler.send_header( + 'Proxy-Authenticate', 'Digest realm="%s", ' + 'qop="%s",' + 'nonce="%s", ' % \ + (self._realm_name, self._qop, self._generate_nonce())) + # XXX: Not sure if we're supposed to add this next header or + # not. + #request_handler.send_header('Connection', 'close') + request_handler.end_headers() + request_handler.wfile.write("Proxy Authentication Required.") + return False + + def handle_request(self, request_handler): + """Performs digest authentication on the given HTTP request + handler. Returns True if authentication was successful, False + otherwise. + + If no users have been set, then digest auth is effectively + disabled and this method will always return True. + """ + + if len(self._users) == 0: + return True + + if 'Proxy-Authorization' not in request_handler.headers: + return self._return_auth_challenge(request_handler) + else: + auth_dict = self._create_auth_dict( + request_handler.headers['Proxy-Authorization'] + ) + if auth_dict["username"] in self._users: + password = self._users[ auth_dict["username"] ] + else: + return self._return_auth_challenge(request_handler) + if not auth_dict.get("nonce") in self._nonces: + return self._return_auth_challenge(request_handler) + else: + self._nonces.remove(auth_dict["nonce"]) + + auth_validated = False + + # MSIE uses short_path in its validation, but Python's + # urllib2 uses the full path, so we're going to see if + # either of them works here. + + for path in [request_handler.path, request_handler.short_path]: + if self._validate_auth(auth_dict, + password, + request_handler.command, + path): + auth_validated = True + + if not auth_validated: + return self._return_auth_challenge(request_handler) + return True + +# Proxy test infrastructure + +class FakeProxyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + """This is a 'fake proxy' that makes it look like the entire + internet has gone down due to a sudden zombie invasion. It main + utility is in providing us with authentication support for + testing. + """ + + digest_auth_handler = DigestAuthHandler() + + def log_message(self, format, *args): + # Uncomment the next line for debugging. + #sys.stderr.write(format % args) + pass + + def do_GET(self): + (scm, netloc, path, params, query, fragment) = urlparse.urlparse( + self.path, 'http') + self.short_path = path + if self.digest_auth_handler.handle_request(self): + self.send_response(200, "OK") + self.send_header("Content-Type", "text/html") + self.end_headers() + self.wfile.write("You've reached %s!
" % self.path) + self.wfile.write("Our apologies, but our server is down due to " + "a sudden zombie invasion.") + +# Test cases + +class ProxyAuthTests(unittest.TestCase): + URL = "http://localhost" + + USER = "tester" + PASSWD = "test123" + REALM = "TestRealm" + + def setUp(self): + FakeProxyHandler.digest_auth_handler.set_users({ + self.USER : self.PASSWD + }) + FakeProxyHandler.digest_auth_handler.set_realm(self.REALM) + + self.server = LoopbackHttpServerThread(FakeProxyHandler) + self.server.start() + self.server.ready.wait() + proxy_url = "http://127.0.0.1:%d" % self.server.port + handler = urllib2.ProxyHandler({"http" : proxy_url}) + self._digest_auth_handler = urllib2.ProxyDigestAuthHandler() + self.opener = urllib2.build_opener(handler, self._digest_auth_handler) + + def tearDown(self): + self.server.stop() + + def test_proxy_with_bad_password_raises_httperror(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD+"bad") + FakeProxyHandler.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_with_no_password_raises_httperror(self): + FakeProxyHandler.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_qop_auth_works(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + FakeProxyHandler.digest_auth_handler.set_qop("auth") + result = self.opener.open(self.URL) + while result.read(): + pass + result.close() + + def test_proxy_qop_auth_int_works_or_throws_urlerror(self): + self._digest_auth_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + FakeProxyHandler.digest_auth_handler.set_qop("auth-int") + try: + result = self.opener.open(self.URL) + except urllib2.URLError: + # It's okay if we don't support auth-int, but we certainly + # shouldn't receive any kind of exception here other than + # a URLError. + result = None + if result: + while result.read(): + pass + result.close() + + +def GetRequestHandler(responses): + + class FakeHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): + + server_version = "TestHTTP/" + requests = [] + headers_received = [] + port = 80 + + def do_GET(self): + body = self.send_head() + if body: + self.wfile.write(body) + + def do_POST(self): + content_length = self.headers['Content-Length'] + post_data = self.rfile.read(int(content_length)) + self.do_GET() + self.requests.append(post_data) + + def send_head(self): + FakeHTTPRequestHandler.headers_received = self.headers + self.requests.append(self.path) + response_code, headers, body = responses.pop(0) + + self.send_response(response_code) + + for (header, value) in headers: + self.send_header(header, value % self.port) + if body: + self.send_header('Content-type', 'text/plain') + self.end_headers() + return body + self.end_headers() + + def log_message(self, *args): + pass + + + return FakeHTTPRequestHandler + + +class TestUrlopen(unittest.TestCase): + """Tests urllib2.urlopen using the network. + + These tests are not exhaustive. Assuming that testing using files does a + good job overall of some of the basic interface features. There are no + tests exercising the optional 'data' and 'proxies' arguments. No tests + for transparent redirection have been written. + """ + + def start_server(self, responses): + handler = GetRequestHandler(responses) + + self.server = LoopbackHttpServerThread(handler) + self.server.start() + self.server.ready.wait() + port = self.server.port + handler.port = port + return handler + + + def test_redirection(self): + expected_response = 'We got here...' + responses = [ + (302, [('Location', 'http://localhost:%s/somewhere_else')], ''), + (200, [], expected_response) + ] + + handler = self.start_server(responses) + + try: + f = urllib2.urlopen('http://localhost:%s/' % handler.port) + data = f.read() + f.close() + + self.assertEquals(data, expected_response) + self.assertEquals(handler.requests, ['/', '/somewhere_else']) + finally: + self.server.stop() + + + def test_404(self): + expected_response = 'Bad bad bad...' + handler = self.start_server([(404, [], expected_response)]) + + try: + try: + urllib2.urlopen('http://localhost:%s/weeble' % handler.port) + except urllib2.URLError, f: + pass + else: + self.fail('404 should raise URLError') + + data = f.read() + f.close() + + self.assertEquals(data, expected_response) + self.assertEquals(handler.requests, ['/weeble']) + finally: + self.server.stop() + + + def test_200(self): + expected_response = 'pycon 2008...' + handler = self.start_server([(200, [], expected_response)]) + + try: + f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port) + data = f.read() + f.close() + + self.assertEquals(data, expected_response) + self.assertEquals(handler.requests, ['/bizarre']) + finally: + self.server.stop() + + def test_200_with_parameters(self): + expected_response = 'pycon 2008...' + handler = self.start_server([(200, [], expected_response)]) + + try: + f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port, 'get=with_feeling') + data = f.read() + f.close() + + self.assertEquals(data, expected_response) + self.assertEquals(handler.requests, ['/bizarre', 'get=with_feeling']) + finally: + self.server.stop() + + + def test_sending_headers(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + req = urllib2.Request("http://localhost:%s/" % handler.port, + headers={'Range': 'bytes=20-39'}) + urllib2.urlopen(req) + self.assertEqual(handler.headers_received['Range'], 'bytes=20-39') + finally: + self.server.stop() + + def test_basic(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + for attr in ("read", "close", "info", "geturl"): + self.assert_(hasattr(open_url, attr), "object returned from " + "urlopen lacks the %s attribute" % attr) + try: + self.assert_(open_url.read(), "calling 'read' failed") + finally: + open_url.close() + finally: + self.server.stop() + + def test_info(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + info_obj = open_url.info() + self.assert_(isinstance(info_obj, mimetools.Message), + "object returned by 'info' is not an instance of " + "mimetools.Message") + self.assertEqual(info_obj.getsubtype(), "plain") + finally: + self.server.stop() + + def test_geturl(self): + # Make sure same URL as opened is returned by geturl. + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + url = open_url.geturl() + self.assertEqual(url, "http://localhost:%s" % handler.port) + finally: + self.server.stop() + + + def test_bad_address(self): + # Make sure proper exception is raised when connecting to a bogus + # address. + self.assertRaises(IOError, + # Given that both VeriSign and various ISPs have in + # the past or are presently hijacking various invalid + # domain name requests in an attempt to boost traffic + # to their own sites, finding a domain name to use + # for this test is difficult. RFC2606 leads one to + # believe that '.invalid' should work, but experience + # seemed to indicate otherwise. Single character + # TLDs are likely to remain invalid, so this seems to + # be the best choice. The trailing '.' prevents a + # related problem: The normal DNS resolver appends + # the domain names from the search path if there is + # no '.' the end and, and if one of those domains + # implements a '*' rule a result is returned. + # However, none of this will prevent the test from + # failing if the ISP hijacks all invalid domain + # requests. The real solution would be to be able to + # parameterize the framework with a mock resolver. + urllib2.urlopen, "http://sadflkjsasf.i.nvali.d./") + + +def test_main(): + # We will NOT depend on the network resource flag + # (Lib/test/regrtest.py -u network) since all tests here are only + # localhost. However, if this is a bad rationale, then uncomment + # the next line. + #test_support.requires("network") + + test_support.run_unittest(ProxyAuthTests) + test_support.run_unittest(TestUrlopen) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_urllib2net.py python-gevent-1.0/greentest/2.6/test_urllib2net.py --- python-gevent-0.13.7/greentest/2.6/test_urllib2net.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_urllib2net.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,276 @@ +#!/usr/bin/env python + +import unittest +from test import test_support +from test_urllib2 import sanepathname2url + +import socket +import urllib2 +import sys +import os +import sys + +TIMEOUT = 60 # seconds + + +def _retry_thrice(func, exc, *args, **kwargs): + for i in range(3): + try: + return func(*args, **kwargs) + except exc, last_exc: + continue + except: + raise + raise last_exc + +def _wrap_with_retry_thrice(func, exc): + def wrapped(*args, **kwargs): + return _retry_thrice(func, exc, *args, **kwargs) + return wrapped + +# Connecting to remote hosts is flaky. Make it more robust by retrying +# the connection several times. +_urlopen_with_retry = _wrap_with_retry_thrice(urllib2.urlopen, urllib2.URLError) + + +class AuthTests(unittest.TestCase): + """Tests urllib2 authentication features.""" + +## Disabled at the moment since there is no page under python.org which +## could be used to HTTP authentication. +# +# def test_basic_auth(self): +# import httplib +# +# test_url = "http://www.python.org/test/test_urllib2/basic_auth" +# test_hostport = "www.python.org" +# test_realm = 'Test Realm' +# test_user = 'test.test_urllib2net' +# test_password = 'blah' +# +# # failure +# try: +# _urlopen_with_retry(test_url) +# except urllib2.HTTPError, exc: +# self.assertEqual(exc.code, 401) +# else: +# self.fail("urlopen() should have failed with 401") +# +# # success +# auth_handler = urllib2.HTTPBasicAuthHandler() +# auth_handler.add_password(test_realm, test_hostport, +# test_user, test_password) +# opener = urllib2.build_opener(auth_handler) +# f = opener.open('http://localhost/') +# response = _urlopen_with_retry("http://www.python.org/") +# +# # The 'userinfo' URL component is deprecated by RFC 3986 for security +# # reasons, let's not implement it! (it's already implemented for proxy +# # specification strings (that is, URLs or authorities specifying a +# # proxy), so we must keep that) +# self.assertRaises(httplib.InvalidURL, +# urllib2.urlopen, "http://evil:thing@example.com") + + +class CloseSocketTest(unittest.TestCase): + + def test_close(self): + import socket, httplib, gc + + # calling .close() on urllib2's response objects should close the + # underlying socket + + # delve deep into response to fetch socket._socketobject + response = _urlopen_with_retry("http://www.python.org/") + abused_fileobject = response.fp + self.assert_(abused_fileobject.__class__ is socket._fileobject) + httpresponse = abused_fileobject._sock + self.assert_(httpresponse.__class__ is httplib.HTTPResponse) + fileobject = httpresponse.fp + self.assert_(fileobject.__class__ is socket._fileobject) + + self.assert_(not fileobject.closed) + response.close() + self.assert_(fileobject.closed) + +class OtherNetworkTests(unittest.TestCase): + def setUp(self): + if 0: # for debugging + import logging + logger = logging.getLogger("test_urllib2net") + logger.addHandler(logging.StreamHandler()) + + # XXX The rest of these tests aren't very good -- they don't check much. + # They do sometimes catch some major disasters, though. + + def test_ftp(self): + urls = [ + 'ftp://ftp.kernel.org/pub/linux/kernel/README', + 'ftp://ftp.kernel.org/pub/linux/kernel/non-existent-file', + #'ftp://ftp.kernel.org/pub/leenox/kernel/test', + 'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC' + '/research-reports/00README-Legal-Rules-Regs', + ] + self._test_urls(urls, self._extra_handlers()) + + def test_file(self): + TESTFN = test_support.TESTFN + f = open(TESTFN, 'w') + try: + f.write('hi there\n') + f.close() + urls = [ + 'file:'+sanepathname2url(os.path.abspath(TESTFN)), + ('file:///nonsensename/etc/passwd', None, urllib2.URLError), + ] + self._test_urls(urls, self._extra_handlers(), retry=True) + finally: + os.remove(TESTFN) + + # XXX Following test depends on machine configurations that are internal + # to CNRI. Need to set up a public server with the right authentication + # configuration for test purposes. + +## def test_cnri(self): +## if socket.gethostname() == 'bitdiddle': +## localhost = 'bitdiddle.cnri.reston.va.us' +## elif socket.gethostname() == 'bitdiddle.concentric.net': +## localhost = 'localhost' +## else: +## localhost = None +## if localhost is not None: +## urls = [ +## 'file://%s/etc/passwd' % localhost, +## 'http://%s/simple/' % localhost, +## 'http://%s/digest/' % localhost, +## 'http://%s/not/found.h' % localhost, +## ] + +## bauth = HTTPBasicAuthHandler() +## bauth.add_password('basic_test_realm', localhost, 'jhylton', +## 'password') +## dauth = HTTPDigestAuthHandler() +## dauth.add_password('digest_test_realm', localhost, 'jhylton', +## 'password') + +## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) + + def _test_urls(self, urls, handlers, retry=True): + import socket + import time + import logging + debug = logging.getLogger("test_urllib2").debug + + urlopen = urllib2.build_opener(*handlers).open + if retry: + urlopen = _wrap_with_retry_thrice(urlopen, urllib2.URLError) + + for url in urls: + if isinstance(url, tuple): + url, req, expected_err = url + else: + req = expected_err = None + debug(url) + try: + f = urlopen(url, req, TIMEOUT) + except EnvironmentError, err: + debug(err) + if expected_err: + msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" % + (expected_err, url, req, type(err), err)) + self.assert_(isinstance(err, expected_err), msg) + except urllib2.URLError as err: + if isinstance(err[0], socket.timeout): + print >>sys.stderr, "" % url + continue + else: + raise + else: + try: + with test_support.transient_internet(): + buf = f.read() + debug("read %d bytes" % len(buf)) + except socket.timeout: + print >>sys.stderr, "" % url + f.close() + debug("******** next url coming up...") + time.sleep(0.1) + + def _extra_handlers(self): + handlers = [] + + cfh = urllib2.CacheFTPHandler() + cfh.setTimeout(1) + handlers.append(cfh) + + return handlers + + +class TimeoutTest(unittest.TestCase): + def test_http_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) + u = _urlopen_with_retry("http://www.python.org") + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) + + def test_http_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry("http://www.python.org") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) + + def test_http_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry("http://www.python.org", timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) + + def test_http_timeout(self): + u = _urlopen_with_retry("http://www.python.org", timeout=120) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) + + FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/" + + def test_ftp_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) + u = _urlopen_with_retry(self.FTP_HOST) + self.assertTrue(u.fp.fp._sock.gettimeout() is None) + + def test_ftp_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + + def test_ftp_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(u.fp.fp._sock.gettimeout() is None) + + def test_ftp_timeout(self): + u = _urlopen_with_retry(self.FTP_HOST, timeout=60) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + + +def test_main(): + test_support.requires("network") + test_support.run_unittest(AuthTests, + OtherNetworkTests, + CloseSocketTest, + TimeoutTest, + ) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_urllib2.py python-gevent-1.0/greentest/2.6/test_urllib2.py --- python-gevent-0.13.7/greentest/2.6/test_urllib2.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_urllib2.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1277 @@ +import unittest +import test_support + +import os +import socket +import StringIO + +import urllib2 +from urllib2 import Request, OpenerDirector + +# XXX +# Request +# CacheFTPHandler (hard to write) +# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler + +class TrivialTests(unittest.TestCase): + def test_trivial(self): + # A couple trivial tests + + self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') + + # XXX Name hacking to get this to work on Windows. + fname = os.path.abspath(urllib2.__file__).replace('\\', '/') + + # And more hacking to get it to work on MacOS. This assumes + # urllib.pathname2url works, unfortunately... + if os.name == 'mac': + fname = '/' + fname.replace(':', '/') + elif os.name == 'riscos': + import string + fname = os.expand(fname) + fname = fname.translate(string.maketrans("/.", "./")) + + if os.name == 'nt': + file_url = "file:///%s" % fname + else: + file_url = "file://%s" % fname + + f = urllib2.urlopen(file_url) + + buf = f.read() + f.close() + + def test_parse_http_list(self): + tests = [('a,b,c', ['a', 'b', 'c']), + ('path"o,l"og"i"cal, example', ['path"o,l"og"i"cal', 'example']), + ('a, b, "c", "d", "e,f", g, h', ['a', 'b', '"c"', '"d"', '"e,f"', 'g', 'h']), + ('a="b\\"c", d="e\\,f", g="h\\\\i"', ['a="b"c"', 'd="e,f"', 'g="h\\i"'])] + for string, list in tests: + self.assertEquals(urllib2.parse_http_list(string), list) + + +def test_request_headers_dict(): + """ + The Request.headers dictionary is not a documented interface. It should + stay that way, because the complete set of headers are only accessible + through the .get_header(), .has_header(), .header_items() interface. + However, .headers pre-dates those methods, and so real code will be using + the dictionary. + + The introduction in 2.4 of those methods was a mistake for the same reason: + code that previously saw all (urllib2 user)-provided headers in .headers + now sees only a subset (and the function interface is ugly and incomplete). + A better change would have been to replace .headers dict with a dict + subclass (or UserDict.DictMixin instance?) that preserved the .headers + interface and also provided access to the "unredirected" headers. It's + probably too late to fix that, though. + + + Check .capitalize() case normalization: + + >>> url = "http://example.com" + >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"] + 'blah' + >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"] + 'blah' + + Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError, + but that could be changed in future. + + """ + +def test_request_headers_methods(): + """ + Note the case normalization of header names here, to .capitalize()-case. + This should be preserved for backwards-compatibility. (In the HTTP case, + normalization to .title()-case is done by urllib2 before sending headers to + httplib). + + >>> url = "http://example.com" + >>> r = Request(url, headers={"Spam-eggs": "blah"}) + >>> r.has_header("Spam-eggs") + True + >>> r.header_items() + [('Spam-eggs', 'blah')] + >>> r.add_header("Foo-Bar", "baz") + >>> items = r.header_items() + >>> items.sort() + >>> items + [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')] + + Note that e.g. r.has_header("spam-EggS") is currently False, and + r.get_header("spam-EggS") returns None, but that could be changed in + future. + + >>> r.has_header("Not-there") + False + >>> print r.get_header("Not-there") + None + >>> r.get_header("Not-there", "default") + 'default' + + """ + + +def test_password_manager(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + >>> add("Some Realm", "http://example.com/", "joe", "password") + >>> add("Some Realm", "http://example.com/ni", "ni", "ni") + >>> add("c", "http://example.com/foo", "foo", "ni") + >>> add("c", "http://example.com/bar", "bar", "nini") + >>> add("b", "http://example.com/", "first", "blah") + >>> add("b", "http://example.com/", "second", "spam") + >>> add("a", "http://example.com", "1", "a") + >>> add("Some Realm", "http://c.example.com:3128", "3", "c") + >>> add("Some Realm", "d.example.com", "4", "d") + >>> add("Some Realm", "e.example.com:3128", "5", "e") + + >>> mgr.find_user_password("Some Realm", "example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam") + ('joe', 'password') + >>> mgr.find_user_password("c", "http://example.com/foo") + ('foo', 'ni') + >>> mgr.find_user_password("c", "http://example.com/bar") + ('bar', 'nini') + + Actually, this is really undefined ATM +## Currently, we use the highest-level path where more than one match: + +## >>> mgr.find_user_password("Some Realm", "http://example.com/ni") +## ('joe', 'password') + + Use latest add_password() in case of conflict: + + >>> mgr.find_user_password("b", "http://example.com/") + ('second', 'spam') + + No special relationship between a.example.com and example.com: + + >>> mgr.find_user_password("a", "http://example.com/") + ('1', 'a') + >>> mgr.find_user_password("a", "http://a.example.com/") + (None, None) + + Ports: + + >>> mgr.find_user_password("Some Realm", "c.example.com") + (None, None) + >>> mgr.find_user_password("Some Realm", "c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "d.example.com") + ('4', 'd') + >>> mgr.find_user_password("Some Realm", "e.example.com:3128") + ('5', 'e') + + """ + pass + + +def test_password_manager_default_port(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + + The point to note here is that we can't guess the default port if there's + no scheme. This applies to both add_password and find_user_password. + + >>> add("f", "http://g.example.com:80", "10", "j") + >>> add("g", "http://h.example.com", "11", "k") + >>> add("h", "i.example.com:80", "12", "l") + >>> add("i", "j.example.com", "13", "m") + >>> mgr.find_user_password("f", "g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "g.example.com") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "http://g.example.com") + ('10', 'j') + >>> mgr.find_user_password("g", "h.example.com") + ('11', 'k') + >>> mgr.find_user_password("g", "h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("g", "http://h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("h", "i.example.com") + (None, None) + >>> mgr.find_user_password("h", "i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("h", "http://i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("i", "j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "j.example.com:80") + (None, None) + >>> mgr.find_user_password("i", "http://j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "http://j.example.com:80") + (None, None) + + """ + +class MockOpener: + addheaders = [] + def open(self, req, data=None,timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.req, self.data, self.timeout = req, data, timeout + def error(self, proto, *args): + self.proto, self.args = proto, args + +class MockFile: + def read(self, count=None): pass + def readline(self, count=None): pass + def close(self): pass + +class MockHeaders(dict): + def getheaders(self, name): + return self.values() + +class MockResponse(StringIO.StringIO): + def __init__(self, code, msg, headers, data, url=None): + StringIO.StringIO.__init__(self, data) + self.code, self.msg, self.headers, self.url = code, msg, headers, url + def info(self): + return self.headers + def geturl(self): + return self.url + +class MockCookieJar: + def add_cookie_header(self, request): + self.ach_req = request + def extract_cookies(self, response, request): + self.ec_req, self.ec_r = request, response + +class FakeMethod: + def __init__(self, meth_name, action, handle): + self.meth_name = meth_name + self.handle = handle + self.action = action + def __call__(self, *args): + return self.handle(self.meth_name, self.action, *args) + +class MockHTTPResponse: + def __init__(self, fp, msg, status, reason): + self.fp = fp + self.msg = msg + self.status = status + self.reason = reason + def read(self): + return '' + +class MockHTTPClass: + def __init__(self): + self.req_headers = [] + self.data = None + self.raise_on_endheaders = False + self._tunnel_headers = {} + + def __call__(self, host, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.host = host + self.timeout = timeout + return self + + def set_debuglevel(self, level): + self.level = level + + def _set_tunnel(self, host, port=None, headers=None): + self._tunnel_host = host + self._tunnel_port = port + if headers: + self._tunnel_headers = headers + else: + self._tunnel_headers.clear() + def request(self, method, url, body=None, headers=None): + self.method = method + self.selector = url + if headers is not None: + self.req_headers += headers.items() + self.req_headers.sort() + if body: + self.data = body + if self.raise_on_endheaders: + import socket + raise socket.error() + def getresponse(self): + return MockHTTPResponse(MockFile(), {}, 200, "OK") + +class MockHandler: + # useful for testing handler machinery + # see add_ordered_mock_handlers() docstring + handler_order = 500 + def __init__(self, methods): + self._define_methods(methods) + def _define_methods(self, methods): + for spec in methods: + if len(spec) == 2: name, action = spec + else: name, action = spec, None + meth = FakeMethod(name, action, self.handle) + setattr(self.__class__, name, meth) + def handle(self, fn_name, action, *args, **kwds): + self.parent.calls.append((self, fn_name, args, kwds)) + if action is None: + return None + elif action == "return self": + return self + elif action == "return response": + res = MockResponse(200, "OK", {}, "") + return res + elif action == "return request": + return Request("http://blah/") + elif action.startswith("error"): + code = action[action.rfind(" ")+1:] + try: + code = int(code) + except ValueError: + pass + res = MockResponse(200, "OK", {}, "") + return self.parent.error("http", args[0], res, code, "", {}) + elif action == "raise": + raise urllib2.URLError("blah") + assert False + def close(self): pass + def add_parent(self, parent): + self.parent = parent + self.parent.calls = [] + def __lt__(self, other): + if not hasattr(other, "handler_order"): + # No handler_order, leave in original order. Yuck. + return True + return self.handler_order < other.handler_order + +def add_ordered_mock_handlers(opener, meth_spec): + """Create MockHandlers and add them to an OpenerDirector. + + meth_spec: list of lists of tuples and strings defining methods to define + on handlers. eg: + + [["http_error", "ftp_open"], ["http_open"]] + + defines methods .http_error() and .ftp_open() on one handler, and + .http_open() on another. These methods just record their arguments and + return None. Using a tuple instead of a string causes the method to + perform some action (see MockHandler.handle()), eg: + + [["http_error"], [("http_open", "return request")]] + + defines .http_error() on one handler (which simply returns None), and + .http_open() on another handler, which returns a Request object. + + """ + handlers = [] + count = 0 + for meths in meth_spec: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order += count + h.add_parent(opener) + count = count + 1 + handlers.append(h) + opener.add_handler(h) + return handlers + +def build_test_opener(*handler_instances): + opener = OpenerDirector() + for h in handler_instances: + opener.add_handler(h) + return opener + +class MockHTTPHandler(urllib2.BaseHandler): + # useful for testing redirections and auth + # sends supplied headers and code as first response + # sends 200 OK as second response + def __init__(self, code, headers): + self.code = code + self.headers = headers + self.reset() + def reset(self): + self._count = 0 + self.requests = [] + def http_open(self, req): + import mimetools, httplib, copy + from StringIO import StringIO + self.requests.append(copy.deepcopy(req)) + if self._count == 0: + self._count = self._count + 1 + name = httplib.responses[self.code] + msg = mimetools.Message(StringIO(self.headers)) + return self.parent.error( + "http", req, MockFile(), self.code, name, msg) + else: + self.req = req + msg = mimetools.Message(StringIO("\r\n\r\n")) + return MockResponse(200, "OK", msg, "", req.get_full_url()) + +class MockHTTPSHandler(urllib2.AbstractHTTPHandler): + # Useful for testing the Proxy-Authorization request by verifying the + # properties of httpcon + + def __init__(self): + urllib2.AbstractHTTPHandler.__init__(self) + self.httpconn = MockHTTPClass() + + def https_open(self, req): + return self.do_open(self.httpconn, req) + +class MockPasswordManager: + def add_password(self, realm, uri, user, password): + self.realm = realm + self.url = uri + self.user = user + self.password = password + def find_user_password(self, realm, authuri): + self.target_realm = realm + self.target_url = authuri + return self.user, self.password + + +class OpenerDirectorTests(unittest.TestCase): + + def test_add_non_handler(self): + class NonHandler(object): + pass + self.assertRaises(TypeError, + OpenerDirector().add_handler, NonHandler()) + + def test_badly_named_methods(self): + # test work-around for three methods that accidentally follow the + # naming conventions for handler methods + # (*_open() / *_request() / *_response()) + + # These used to call the accidentally-named methods, causing a + # TypeError in real code; here, returning self from these mock + # methods would either cause no exception, or AttributeError. + + from urllib2 import URLError + + o = OpenerDirector() + meth_spec = [ + [("do_open", "return self"), ("proxy_open", "return self")], + [("redirect_request", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + o.add_handler(urllib2.UnknownHandler()) + for scheme in "do", "proxy", "redirect": + self.assertRaises(URLError, o.open, scheme+"://example.com/") + + def test_handled(self): + # handler returning non-None means no more handlers will be called + o = OpenerDirector() + meth_spec = [ + ["http_open", "ftp_open", "http_error_302"], + ["ftp_open"], + [("http_open", "return self")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # Second .http_open() gets called, third doesn't, since second returned + # non-None. Handlers without .http_open() never get any methods called + # on them. + # In fact, second mock handler defining .http_open() returns self + # (instead of response), which becomes the OpenerDirector's return + # value. + self.assertEqual(r, handlers[2]) + calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] + for expected, got in zip(calls, o.calls): + handler, name, args, kwds = got + self.assertEqual((handler, name), expected) + self.assertEqual(args, (req,)) + + def test_handler_order(self): + o = OpenerDirector() + handlers = [] + for meths, handler_order in [ + ([("http_open", "return self")], 500), + (["http_open"], 0), + ]: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order = handler_order + handlers.append(h) + o.add_handler(h) + + r = o.open("http://example.com/") + # handlers called in reverse order, thanks to their sort order + self.assertEqual(o.calls[0][0], handlers[1]) + self.assertEqual(o.calls[1][0], handlers[0]) + + def test_raise(self): + # raising URLError stops processing of request + o = OpenerDirector() + meth_spec = [ + [("http_open", "raise")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + self.assertRaises(urllib2.URLError, o.open, req) + self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) + +## def test_error(self): +## # XXX this doesn't actually seem to be used in standard library, +## # but should really be tested anyway... + + def test_http_error(self): + # XXX http_error_default + # http errors are a special case + o = OpenerDirector() + meth_spec = [ + [("http_open", "error 302")], + [("http_error_400", "raise"), "http_open"], + [("http_error_302", "return response"), "http_error_303", + "http_error"], + [("http_error_302")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + class Unknown: + def __eq__(self, other): return True + + req = Request("http://example.com/") + r = o.open(req) + assert len(o.calls) == 2 + calls = [(handlers[0], "http_open", (req,)), + (handlers[2], "http_error_302", + (req, Unknown(), 302, "", {}))] + for expected, got in zip(calls, o.calls): + handler, method_name, args = expected + self.assertEqual((handler, method_name), got[:2]) + self.assertEqual(args, got[2]) + + def test_processors(self): + # *_request / *_response methods get called appropriately + o = OpenerDirector() + meth_spec = [ + [("http_request", "return request"), + ("http_response", "return response")], + [("http_request", "return request"), + ("http_response", "return response")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # processor methods are called on *all* handlers that define them, + # not just the first handler that handles the request + calls = [ + (handlers[0], "http_request"), (handlers[1], "http_request"), + (handlers[0], "http_response"), (handlers[1], "http_response")] + + for i, (handler, name, args, kwds) in enumerate(o.calls): + if i < 2: + # *_request + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 1) + self.assert_(isinstance(args[0], Request)) + else: + # *_response + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 2) + self.assert_(isinstance(args[0], Request)) + # response from opener.open is None, because there's no + # handler that defines http_open to handle it + self.assert_(args[1] is None or + isinstance(args[1], MockResponse)) + + +def sanepathname2url(path): + import urllib + urlpath = urllib.pathname2url(path) + if os.name == "nt" and urlpath.startswith("///"): + urlpath = urlpath[2:] + # XXX don't ask me about the mac... + return urlpath + +class HandlerTests(unittest.TestCase): + + def test_ftp(self): + class MockFTPWrapper: + def __init__(self, data): self.data = data + def retrfile(self, filename, filetype): + self.filename, self.filetype = filename, filetype + return StringIO.StringIO(self.data), len(self.data) + + class NullFTPHandler(urllib2.FTPHandler): + def __init__(self, data): self.data = data + def connect_ftp(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.user, self.passwd = user, passwd + self.host, self.port = host, port + self.dirs = dirs + self.ftpwrapper = MockFTPWrapper(self.data) + return self.ftpwrapper + + import ftplib + data = "rheum rhaponicum" + h = NullFTPHandler(data) + o = h.parent = MockOpener() + + for url, host, port, type_, dirs, filename, mimetype in [ + ("ftp://localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://localhost:80/foo/bar/", + "localhost", 80, "D", + ["foo", "bar"], "", None), + ("ftp://localhost/baz.gif;type=a", + "localhost", ftplib.FTP_PORT, "A", + [], "baz.gif", None), # XXX really this should guess image/gif + ]: + req = Request(url) + req.timeout = None + r = h.ftp_open(req) + # ftp authentication not yet implemented by FTPHandler + self.assert_(h.user == h.passwd == "") + self.assertEqual(h.host, socket.gethostbyname(host)) + self.assertEqual(h.port, port) + self.assertEqual(h.dirs, dirs) + self.assertEqual(h.ftpwrapper.filename, filename) + self.assertEqual(h.ftpwrapper.filetype, type_) + headers = r.info() + self.assertEqual(headers.get("Content-type"), mimetype) + self.assertEqual(int(headers["Content-length"]), len(data)) + + def test_file(self): + import rfc822, socket + h = urllib2.FileHandler() + o = h.parent = MockOpener() + + TESTFN = test_support.TESTFN + urlpath = sanepathname2url(os.path.abspath(TESTFN)) + towrite = "hello, world\n" + urls = [ + "file://localhost%s" % urlpath, + "file://%s" % urlpath, + "file://%s%s" % (socket.gethostbyname('localhost'), urlpath), + ] + try: + localaddr = socket.gethostbyname(socket.gethostname()) + except socket.gaierror: + localaddr = '' + if localaddr: + urls.append("file://%s%s" % (localaddr, urlpath)) + + for url in urls: + f = open(TESTFN, "wb") + try: + try: + f.write(towrite) + finally: + f.close() + + r = h.file_open(Request(url)) + try: + data = r.read() + headers = r.info() + respurl = r.geturl() + finally: + r.close() + stats = os.stat(TESTFN) + modified = rfc822.formatdate(stats.st_mtime) + finally: + os.remove(TESTFN) + self.assertEqual(data, towrite) + self.assertEqual(headers["Content-type"], "text/plain") + self.assertEqual(headers["Content-length"], "13") + self.assertEqual(headers["Last-modified"], modified) + self.assertEqual(respurl, url) + + for url in [ + "file://localhost:80%s" % urlpath, + "file:///file_does_not_exist.txt", + "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), + os.getcwd(), TESTFN), + "file://somerandomhost.ontheinternet.com%s/%s" % + (os.getcwd(), TESTFN), + ]: + try: + f = open(TESTFN, "wb") + try: + f.write(towrite) + finally: + f.close() + + self.assertRaises(urllib2.URLError, + h.file_open, Request(url)) + finally: + os.remove(TESTFN) + + h = urllib2.FileHandler() + o = h.parent = MockOpener() + # XXXX why does // mean ftp (and /// mean not ftp!), and where + # is file: scheme specified? I think this is really a bug, and + # what was intended was to distinguish between URLs like: + # file:/blah.txt (a file) + # file://localhost/blah.txt (a file) + # file:///blah.txt (a file) + # file://ftp.example.com/blah.txt (an ftp URL) + for url, ftp in [ + ("file://ftp.example.com//foo.txt", True), + ("file://ftp.example.com///foo.txt", False), +# XXXX bug: fails with OSError, should be URLError + ("file://ftp.example.com/foo.txt", False), + ("file://somehost//foo/something.txt", True), + ("file://localhost//foo/something.txt", False), + ]: + req = Request(url) + try: + h.file_open(req) + # XXXX remove OSError when bug fixed + except (urllib2.URLError, OSError): + self.assert_(not ftp) + else: + self.assert_(o.req is req) + self.assertEqual(req.type, "ftp") + self.assertEqual(req.type is "ftp", ftp) + + def test_http(self): + + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + url = "http://example.com/" + for method, data in [("GET", None), ("POST", "blah")]: + req = Request(url, data, {"Foo": "bar"}) + req.timeout = None + req.add_unredirected_header("Spam", "eggs") + http = MockHTTPClass() + r = h.do_open(http, req) + + # result attributes + r.read; r.readline # wrapped MockFile methods + r.info; r.geturl # addinfourl methods + r.code, r.msg == 200, "OK" # added from MockHTTPClass.getreply() + hdrs = r.info() + hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() + self.assertEqual(r.geturl(), url) + + self.assertEqual(http.host, "example.com") + self.assertEqual(http.level, 0) + self.assertEqual(http.method, method) + self.assertEqual(http.selector, "/") + self.assertEqual(http.req_headers, + [("Connection", "close"), + ("Foo", "bar"), ("Spam", "eggs")]) + self.assertEqual(http.data, data) + + # check socket.error converted to URLError + http.raise_on_endheaders = True + self.assertRaises(urllib2.URLError, h.do_open, http, req) + + # check adding of standard headers + o.addheaders = [("Spam", "eggs")] + for data in "", None: # POST, GET + req = Request("http://example.com/", data) + r = MockResponse(200, "OK", {}, "") + newreq = h.do_request_(req) + if data is None: # GET + self.assert_("Content-length" not in req.unredirected_hdrs) + self.assert_("Content-type" not in req.unredirected_hdrs) + else: # POST + self.assertEqual(req.unredirected_hdrs["Content-length"], "0") + self.assertEqual(req.unredirected_hdrs["Content-type"], + "application/x-www-form-urlencoded") + # XXX the details of Host could be better tested + self.assertEqual(req.unredirected_hdrs["Host"], "example.com") + self.assertEqual(req.unredirected_hdrs["Spam"], "eggs") + + # don't clobber existing headers + req.add_unredirected_header("Content-length", "foo") + req.add_unredirected_header("Content-type", "bar") + req.add_unredirected_header("Host", "baz") + req.add_unredirected_header("Spam", "foo") + newreq = h.do_request_(req) + self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") + self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") + self.assertEqual(req.unredirected_hdrs["Host"], "baz") + self.assertEqual(req.unredirected_hdrs["Spam"], "foo") + + def test_http_doubleslash(self): + # Checks that the presence of an unnecessary double slash in a url doesn't break anything + # Previously, a double slash directly after the host could cause incorrect parsing of the url + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + data = "" + ds_urls = [ + "http://example.com/foo/bar/baz.html", + "http://example.com//foo/bar/baz.html", + "http://example.com/foo//bar/baz.html", + "http://example.com/foo/bar//baz.html", + ] + + for ds_url in ds_urls: + ds_req = Request(ds_url, data) + + # Check whether host is determined correctly if there is no proxy + np_ds_req = h.do_request_(ds_req) + self.assertEqual(np_ds_req.unredirected_hdrs["Host"],"example.com") + + # Check whether host is determined correctly if there is a proxy + ds_req.set_proxy("someproxy:3128",None) + p_ds_req = h.do_request_(ds_req) + self.assertEqual(p_ds_req.unredirected_hdrs["Host"],"example.com") + + def test_errors(self): + h = urllib2.HTTPErrorProcessor() + o = h.parent = MockOpener() + + url = "http://example.com/" + req = Request(url) + # all 2xx are passed through + r = MockResponse(200, "OK", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called + r = MockResponse(202, "Accepted", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called + r = MockResponse(206, "Partial content", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called + # anything else calls o.error (and MockOpener returns None, here) + r = MockResponse(502, "Bad gateway", {}, "", url) + self.assert_(h.http_response(req, r) is None) + self.assertEqual(o.proto, "http") # o.error called + self.assertEqual(o.args, (req, r, 502, "Bad gateway", {})) + + def test_cookies(self): + cj = MockCookieJar() + h = urllib2.HTTPCookieProcessor(cj) + o = h.parent = MockOpener() + + req = Request("http://example.com/") + r = MockResponse(200, "OK", {}, "") + newreq = h.http_request(req) + self.assert_(cj.ach_req is req is newreq) + self.assertEquals(req.get_origin_req_host(), "example.com") + self.assert_(not req.is_unverifiable()) + newr = h.http_response(req, r) + self.assert_(cj.ec_req is req) + self.assert_(cj.ec_r is r is newr) + + def test_redirect(self): + from_url = "http://example.com/a.html" + to_url = "http://example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + + # ordinary redirect behaviour + for code in 301, 302, 303, 307: + for data in None, "blah\nblah\n": + method = getattr(h, "http_error_%s" % code) + req = Request(from_url, data) + req.add_header("Nonsense", "viking=withhold") + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + if data is not None: + req.add_header("Content-Length", str(len(data))) + req.add_unredirected_header("Spam", "spam") + try: + method(req, MockFile(), code, "Blah", + MockHeaders({"location": to_url})) + except urllib2.HTTPError: + # 307 in response to POST requires user OK + self.assert_(code == 307 and data is not None) + self.assertEqual(o.req.get_full_url(), to_url) + try: + self.assertEqual(o.req.get_method(), "GET") + except AttributeError: + self.assert_(not o.req.has_data()) + + # now it's a GET, there should not be headers regarding content + # (possibly dragged from before being a POST) + headers = [x.lower() for x in o.req.headers] + self.assertTrue("content-length" not in headers) + self.assertTrue("content-type" not in headers) + + self.assertEqual(o.req.headers["Nonsense"], + "viking=withhold") + self.assert_("Spam" not in o.req.headers) + self.assert_("Spam" not in o.req.unredirected_hdrs) + + # loop detection + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + def redirect(h, req, url=to_url): + h.http_error_302(req, MockFile(), 302, "Blah", + MockHeaders({"location": url})) + # Note that the *original* request shares the same record of + # redirections with the sub-requests caused by the redirections. + + # detect infinite loop redirect of a URL to itself + req = Request(from_url, origin_req_host="example.com") + count = 0 + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + try: + while 1: + redirect(h, req, "http://example.com/") + count = count + 1 + except urllib2.HTTPError: + # don't stop until max_repeats, because cookies may introduce state + self.assertEqual(count, urllib2.HTTPRedirectHandler.max_repeats) + + # detect endless non-repeating chain of redirects + req = Request(from_url, origin_req_host="example.com") + count = 0 + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + try: + while 1: + redirect(h, req, "http://example.com/%d" % count) + count = count + 1 + except urllib2.HTTPError: + self.assertEqual(count, + urllib2.HTTPRedirectHandler.max_redirections) + + def test_invalid_redirect(self): + from_url = "http://example.com/a.html" + valid_schemes = ['http', 'https', 'ftp'] + invalid_schemes = ['file', 'imap', 'ldap'] + schemeless_url = "example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + + for scheme in invalid_schemes: + invalid_url = scheme + '://' + schemeless_url + self.assertRaises(urllib2.HTTPError, h.http_error_302, + req, MockFile(), 302, "Security Loophole", + MockHeaders({"location": invalid_url})) + + for scheme in valid_schemes: + valid_url = scheme + '://' + schemeless_url + h.http_error_302(req, MockFile(), 302, "That's fine", + MockHeaders({"location": valid_url})) + self.assertEqual(o.req.get_full_url(), valid_url) + + def test_cookie_redirect(self): + # cookies shouldn't leak into redirected requests + from cookielib import CookieJar + + from test_cookielib import interact_netscape + + cj = CookieJar() + interact_netscape(cj, "http://www.example.com/", "spam=eggs") + hh = MockHTTPHandler(302, "Location: http://www.cracker.com/\r\n\r\n") + hdeh = urllib2.HTTPDefaultErrorHandler() + hrh = urllib2.HTTPRedirectHandler() + cp = urllib2.HTTPCookieProcessor(cj) + o = build_test_opener(hh, hdeh, hrh, cp) + o.open("http://www.example.com/") + self.assert_(not hh.req.has_header("Cookie")) + + def test_proxy(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + o.add_handler(ph) + meth_spec = [ + [("http_open", "return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://acme.example.com/") + self.assertEqual(req.get_host(), "acme.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + + self.assertEqual([(handlers[0], "http_open")], + [tup[0:2] for tup in o.calls]) + + def test_proxy_no_proxy(self): + os.environ['no_proxy'] = 'python.org' + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com")) + o.add_handler(ph) + req = Request("http://www.perl.org/") + self.assertEqual(req.get_host(), "www.perl.org") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com") + req = Request("http://www.python.org") + self.assertEqual(req.get_host(), "www.python.org") + r = o.open(req) + self.assertEqual(req.get_host(), "www.python.org") + del os.environ['no_proxy'] + + + def test_proxy_https(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(https='proxy.example.com:3128')) + o.add_handler(ph) + meth_spec = [ + [("https_open","return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + req = Request("https://www.example.com/") + self.assertEqual(req.get_host(), "www.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + self.assertEqual([(handlers[0], "https_open")], + [tup[0:2] for tup in o.calls]) + + def test_proxy_https_proxy_authorization(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(https='proxy.example.com:3128')) + o.add_handler(ph) + https_handler = MockHTTPSHandler() + o.add_handler(https_handler) + req = Request("https://www.example.com/") + req.add_header("Proxy-Authorization","FooBar") + req.add_header("User-Agent","Grail") + self.assertEqual(req.get_host(), "www.example.com") + self.assertTrue(req._tunnel_host is None) + r = o.open(req) + # Verify Proxy-Authorization gets tunneled to request. + # httpsconn req_headers do not have the Proxy-Authorization header but + # the req will have. + self.assertFalse(("Proxy-Authorization","FooBar") in + https_handler.httpconn.req_headers) + self.assertTrue(("User-Agent","Grail") in + https_handler.httpconn.req_headers) + self.assertFalse(req._tunnel_host is None) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + self.assertEqual(req.get_header("Proxy-authorization"),"FooBar") + + def test_basic_auth(self, quote_char='"'): + opener = OpenerDirector() + password_manager = MockPasswordManager() + auth_handler = urllib2.HTTPBasicAuthHandler(password_manager) + realm = "ACME Widget Store" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm=%s%s%s\r\n\r\n' % + (quote_char, realm, quote_char) ) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + + def test_basic_auth_with_single_quoted_realm(self): + self.test_basic_auth(quote_char="'") + + def test_proxy_basic_auth(self): + opener = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + opener.add_handler(ph) + password_manager = MockPasswordManager() + auth_handler = urllib2.ProxyBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Proxy-authorization", + realm, http_handler, password_manager, + "http://acme.example.com:3128/protected", + "proxy.example.com:3128", + ) + + def test_basic_and_digest_auth_handlers(self): + # HTTPDigestAuthHandler threw an exception if it couldn't handle a 40* + # response (http://python.org/sf/1479302), where it should instead + # return None to allow another handler (especially + # HTTPBasicAuthHandler) to handle the response. + + # Also (http://python.org/sf/14797027, RFC 2617 section 1.2), we must + # try digest first (since it's the strongest auth scheme), so we record + # order of calls here to check digest comes first: + class RecordingOpenerDirector(OpenerDirector): + def __init__(self): + OpenerDirector.__init__(self) + self.recorded = [] + def record(self, info): + self.recorded.append(info) + class TestDigestAuthHandler(urllib2.HTTPDigestAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("digest") + urllib2.HTTPDigestAuthHandler.http_error_401(self, + *args, **kwds) + class TestBasicAuthHandler(urllib2.HTTPBasicAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("basic") + urllib2.HTTPBasicAuthHandler.http_error_401(self, + *args, **kwds) + + opener = RecordingOpenerDirector() + password_manager = MockPasswordManager() + digest_handler = TestDigestAuthHandler(password_manager) + basic_handler = TestBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(basic_handler) + opener.add_handler(digest_handler) + opener.add_handler(http_handler) + + # check basic auth isn't blocked by digest handler failing + self._test_basic_auth(opener, basic_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + # check digest was tried before basic (twice, because + # _test_basic_auth called .open() twice) + self.assertEqual(opener.recorded, ["digest", "basic"]*2) + + def _test_basic_auth(self, opener, auth_handler, auth_header, + realm, http_handler, password_manager, + request_url, protected_url): + import base64 + user, password = "wile", "coyote" + + # .add_password() fed through to password manager + auth_handler.add_password(realm, request_url, user, password) + self.assertEqual(realm, password_manager.realm) + self.assertEqual(request_url, password_manager.url) + self.assertEqual(user, password_manager.user) + self.assertEqual(password, password_manager.password) + + r = opener.open(request_url) + + # should have asked the password manager for the username/password + self.assertEqual(password_manager.target_realm, realm) + self.assertEqual(password_manager.target_url, protected_url) + + # expect one request without authorization, then one with + self.assertEqual(len(http_handler.requests), 2) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + userpass = '%s:%s' % (user, password) + auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip() + self.assertEqual(http_handler.requests[1].get_header(auth_header), + auth_hdr_value) + self.assertEqual(http_handler.requests[1].unredirected_hdrs[auth_header], + auth_hdr_value) + # if the password manager can't find a password, the handler won't + # handle the HTTP auth error + password_manager.user = password_manager.password = None + http_handler.reset() + r = opener.open(request_url) + self.assertEqual(len(http_handler.requests), 1) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + +class MiscTests(unittest.TestCase): + + def test_build_opener(self): + class MyHTTPHandler(urllib2.HTTPHandler): pass + class FooHandler(urllib2.BaseHandler): + def foo_open(self): pass + class BarHandler(urllib2.BaseHandler): + def bar_open(self): pass + + build_opener = urllib2.build_opener + + o = build_opener(FooHandler, BarHandler) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # can take a mix of classes and instances + o = build_opener(FooHandler, BarHandler()) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # subclasses of default handlers override default handlers + o = build_opener(MyHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + + # a particular case of overriding: default handlers can be passed + # in explicitly + o = build_opener() + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler) + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler()) + self.opener_has_handler(o, urllib2.HTTPHandler) + + # Issue2670: multiple handlers sharing the same base class + class MyOtherHTTPHandler(urllib2.HTTPHandler): pass + o = build_opener(MyHTTPHandler, MyOtherHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + self.opener_has_handler(o, MyOtherHTTPHandler) + + def opener_has_handler(self, opener, handler_class): + for h in opener.handlers: + if h.__class__ == handler_class: + break + else: + self.assert_(False) + +class RequestTests(unittest.TestCase): + + def setUp(self): + self.get = urllib2.Request("http://www.python.org/~jeremy/") + self.post = urllib2.Request("http://www.python.org/~jeremy/", + "data", + headers={"X-Test": "test"}) + + def test_method(self): + self.assertEqual("POST", self.post.get_method()) + self.assertEqual("GET", self.get.get_method()) + + def test_add_data(self): + self.assert_(not self.get.has_data()) + self.assertEqual("GET", self.get.get_method()) + self.get.add_data("spam") + self.assert_(self.get.has_data()) + self.assertEqual("POST", self.get.get_method()) + + def test_get_full_url(self): + self.assertEqual("http://www.python.org/~jeremy/", + self.get.get_full_url()) + + def test_selector(self): + self.assertEqual("/~jeremy/", self.get.get_selector()) + req = urllib2.Request("http://www.python.org/") + self.assertEqual("/", req.get_selector()) + + def test_get_type(self): + self.assertEqual("http", self.get.get_type()) + + def test_get_host(self): + self.assertEqual("www.python.org", self.get.get_host()) + + def test_get_host_unquote(self): + req = urllib2.Request("http://www.%70ython.org/") + self.assertEqual("www.python.org", req.get_host()) + + def test_proxy(self): + self.assert_(not self.get.has_proxy()) + self.get.set_proxy("www.perl.org", "http") + self.assert_(self.get.has_proxy()) + self.assertEqual("www.python.org", self.get.get_origin_req_host()) + self.assertEqual("www.perl.org", self.get.get_host()) + + +def test_main(verbose=None): + import test_urllib2 + test_support.run_doctest(test_urllib2, verbose) + test_support.run_doctest(urllib2, verbose) + tests = (TrivialTests, + OpenerDirectorTests, + HandlerTests, + MiscTests, + RequestTests) + test_support.run_unittest(*tests) + +if __name__ == "__main__": + test_main(verbose=True) diff -Nru python-gevent-0.13.7/greentest/2.6/test_urllib.py python-gevent-1.0/greentest/2.6/test_urllib.py --- python-gevent-0.13.7/greentest/2.6/test_urllib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_urllib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,741 @@ +"""Regresssion tests for urllib""" + +import urllib +import httplib +import unittest +from test import test_support +import os +import mimetools +import tempfile +import StringIO + +def hexescape(char): + """Escape char as RFC 2396 specifies""" + hex_repr = hex(ord(char))[2:].upper() + if len(hex_repr) == 1: + hex_repr = "0%s" % hex_repr + return "%" + hex_repr + +class urlopen_FileTests(unittest.TestCase): + """Test urlopen() opening a temporary file. + + Try to test as much functionality as possible so as to cut down on reliance + on connecting to the Net for testing. + + """ + + def setUp(self): + """Setup of a temp file to use for testing""" + self.text = "test_urllib: %s\n" % self.__class__.__name__ + FILE = file(test_support.TESTFN, 'wb') + try: + FILE.write(self.text) + finally: + FILE.close() + self.pathname = test_support.TESTFN + self.returned_obj = urllib.urlopen("file:%s" % self.pathname) + + def tearDown(self): + """Shut down the open object""" + self.returned_obj.close() + os.remove(test_support.TESTFN) + + def test_interface(self): + # Make sure object returned by urlopen() has the specified methods + for attr in ("read", "readline", "readlines", "fileno", + "close", "info", "geturl", "getcode", "__iter__"): + self.assert_(hasattr(self.returned_obj, attr), + "object returned by urlopen() lacks %s attribute" % + attr) + + def test_read(self): + self.assertEqual(self.text, self.returned_obj.read()) + + def test_readline(self): + self.assertEqual(self.text, self.returned_obj.readline()) + self.assertEqual('', self.returned_obj.readline(), + "calling readline() after exhausting the file did not" + " return an empty string") + + def test_readlines(self): + lines_list = self.returned_obj.readlines() + self.assertEqual(len(lines_list), 1, + "readlines() returned the wrong number of lines") + self.assertEqual(lines_list[0], self.text, + "readlines() returned improper text") + + def test_fileno(self): + file_num = self.returned_obj.fileno() + self.assert_(isinstance(file_num, int), + "fileno() did not return an int") + self.assertEqual(os.read(file_num, len(self.text)), self.text, + "Reading on the file descriptor returned by fileno() " + "did not return the expected text") + + def test_close(self): + # Test close() by calling it hear and then having it be called again + # by the tearDown() method for the test + self.returned_obj.close() + + def test_info(self): + self.assert_(isinstance(self.returned_obj.info(), mimetools.Message)) + + def test_geturl(self): + self.assertEqual(self.returned_obj.geturl(), self.pathname) + + def test_getcode(self): + self.assertEqual(self.returned_obj.getcode(), None) + + def test_iter(self): + # Test iterator + # Don't need to count number of iterations since test would fail the + # instant it returned anything beyond the first line from the + # comparison + for line in self.returned_obj.__iter__(): + self.assertEqual(line, self.text) + +class ProxyTests(unittest.TestCase): + + def setUp(self): + # Records changes to env vars + self.env = test_support.EnvironmentVarGuard() + # Delete all proxy related env vars + for k in os.environ.keys(): + if 'proxy' in k.lower(): + self.env.unset(k) + + def tearDown(self): + # Restore all proxy related env vars + self.env.__exit__() + del self.env + + def test_getproxies_environment_keep_no_proxies(self): + self.env.set('NO_PROXY', 'localhost') + proxies = urllib.getproxies_environment() + # getproxies_environment use lowered case truncated (no '_proxy') keys + self.assertEquals('localhost', proxies['no']) + + +class urlopen_HttpTests(unittest.TestCase): + """Test urlopen() opening a fake http connection.""" + + def fakehttp(self, fakedata): + class FakeSocket(StringIO.StringIO): + def sendall(self, str): pass + def makefile(self, mode, name): return self + def read(self, amt=None): + if self.closed: return '' + return StringIO.StringIO.read(self, amt) + def readline(self, length=None): + if self.closed: return '' + return StringIO.StringIO.readline(self, length) + class FakeHTTPConnection(httplib.HTTPConnection): + def connect(self): + self.sock = FakeSocket(fakedata) + assert httplib.HTTP._connection_class == httplib.HTTPConnection + httplib.HTTP._connection_class = FakeHTTPConnection + + def unfakehttp(self): + httplib.HTTP._connection_class = httplib.HTTPConnection + + def test_read(self): + self.fakehttp('Hello!') + try: + fp = urllib.urlopen("http://python.org/") + self.assertEqual(fp.readline(), 'Hello!') + self.assertEqual(fp.readline(), '') + self.assertEqual(fp.geturl(), 'http://python.org/') + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + def test_read_bogus(self): + # urlopen() should raise IOError for many error codes. + self.fakehttp('''HTTP/1.1 401 Authentication Required +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Connection: close +Content-Type: text/html; charset=iso-8859-1 +''') + try: + self.assertRaises(IOError, urllib.urlopen, "http://python.org/") + finally: + self.unfakehttp() + + def test_invalid_redirect(self): + # urlopen() should raise IOError for many error codes. + self.fakehttp("""HTTP/1.1 302 Found +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Location: file:README +Connection: close +Content-Type: text/html; charset=iso-8859-1 +""") + try: + self.assertRaises(IOError, urllib.urlopen, "http://python.org/") + finally: + self.unfakehttp() + + def test_empty_socket(self): + # urlopen() raises IOError if the underlying socket does not send any + # data. (#1680230) + self.fakehttp('') + try: + self.assertRaises(IOError, urllib.urlopen, 'http://something') + finally: + self.unfakehttp() + +class urlretrieve_FileTests(unittest.TestCase): + """Test urllib.urlretrieve() on local files""" + + def setUp(self): + # Create a list of temporary files. Each item in the list is a file + # name (absolute path or relative to the current working directory). + # All files in this list will be deleted in the tearDown method. Note, + # this only helps to makes sure temporary files get deleted, but it + # does nothing about trying to close files that may still be open. It + # is the responsibility of the developer to properly close files even + # when exceptional conditions occur. + self.tempFiles = [] + + # Create a temporary file. + self.registerFileForCleanUp(test_support.TESTFN) + self.text = 'testing urllib.urlretrieve' + try: + FILE = file(test_support.TESTFN, 'wb') + FILE.write(self.text) + FILE.close() + finally: + try: FILE.close() + except: pass + + def tearDown(self): + # Delete the temporary files. + for each in self.tempFiles: + try: os.remove(each) + except: pass + + def constructLocalFileUrl(self, filePath): + return "file://%s" % urllib.pathname2url(os.path.abspath(filePath)) + + def createNewTempFile(self, data=""): + """Creates a new temporary file containing the specified data, + registers the file for deletion during the test fixture tear down, and + returns the absolute path of the file.""" + + newFd, newFilePath = tempfile.mkstemp() + try: + self.registerFileForCleanUp(newFilePath) + newFile = os.fdopen(newFd, "wb") + newFile.write(data) + newFile.close() + finally: + try: newFile.close() + except: pass + return newFilePath + + def registerFileForCleanUp(self, fileName): + self.tempFiles.append(fileName) + + def test_basic(self): + # Make sure that a local file just gets its own location returned and + # a headers value is returned. + result = urllib.urlretrieve("file:%s" % test_support.TESTFN) + self.assertEqual(result[0], test_support.TESTFN) + self.assert_(isinstance(result[1], mimetools.Message), + "did not get a mimetools.Message instance as second " + "returned value") + + def test_copy(self): + # Test that setting the filename argument works. + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + result = urllib.urlretrieve(self.constructLocalFileUrl( + test_support.TESTFN), second_temp) + self.assertEqual(second_temp, result[0]) + self.assert_(os.path.exists(second_temp), "copy of the file was not " + "made") + FILE = file(second_temp, 'rb') + try: + text = FILE.read() + FILE.close() + finally: + try: FILE.close() + except: pass + self.assertEqual(self.text, text) + + def test_reporthook(self): + # Make sure that the reporthook works. + def hooktester(count, block_size, total_size, count_holder=[0]): + self.assert_(isinstance(count, int)) + self.assert_(isinstance(block_size, int)) + self.assert_(isinstance(total_size, int)) + self.assertEqual(count, count_holder[0]) + count_holder[0] = count_holder[0] + 1 + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), + second_temp, hooktester) + + def test_reporthook_0_bytes(self): + # Test on zero length file. Should call reporthook only 1 time. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile() + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 1) + self.assertEqual(report[0][2], 0) + + def test_reporthook_5_bytes(self): + # Test on 5 byte file. Should call reporthook only 2 times (once when + # the "network connection" is established and once when the block is + # read). Since the block size is 8192 bytes, only one block read is + # required to read the entire file. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 5) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 2) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 5) + + def test_reporthook_8193_bytes(self): + # Test on 8193 byte file. Should call reporthook only 3 times (once + # when the "network connection" is established, once for the next 8192 + # bytes, and once for the last byte). + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 8193) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 3) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 8193) + +class QuotingTests(unittest.TestCase): + """Tests for urllib.quote() and urllib.quote_plus() + + According to RFC 2396 ("Uniform Resource Identifiers), to escape a + character you write it as '%' + <2 character US-ASCII hex value>. The Python + code of ``'%' + hex(ord())[2:]`` escapes a character properly. + Case does not matter on the hex letters. + + The various character sets specified are: + + Reserved characters : ";/?:@&=+$," + Have special meaning in URIs and must be escaped if not being used for + their special meaning + Data characters : letters, digits, and "-_.!~*'()" + Unreserved and do not need to be escaped; can be, though, if desired + Control characters : 0x00 - 0x1F, 0x7F + Have no use in URIs so must be escaped + space : 0x20 + Must be escaped + Delimiters : '<>#%"' + Must be escaped + Unwise : "{}|\^[]`" + Must be escaped + + """ + + def test_never_quote(self): + # Make sure quote() does not quote letters, digits, and "_,.-" + do_not_quote = '' .join(["ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "abcdefghijklmnopqrstuvwxyz", + "0123456789", + "_.-"]) + result = urllib.quote(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote(): %s != %s" % (do_not_quote, result)) + result = urllib.quote_plus(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote_plus(): %s != %s" % (do_not_quote, result)) + + def test_default_safe(self): + # Test '/' is default value for 'safe' parameter + self.assertEqual(urllib.quote.func_defaults[0], '/') + + def test_safe(self): + # Test setting 'safe' parameter does what it should do + quote_by_default = "<>" + result = urllib.quote(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote(): %s != %s" % (quote_by_default, result)) + result = urllib.quote_plus(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote_plus(): %s != %s" % + (quote_by_default, result)) + + def test_default_quoting(self): + # Make sure all characters that should be quoted are by default sans + # space (separate test for that). + should_quote = [chr(num) for num in range(32)] # For 0x00 - 0x1F + should_quote.append('<>#%"{}|\^[]`') + should_quote.append(chr(127)) # For 0x7F + should_quote = ''.join(should_quote) + for char in should_quote: + result = urllib.quote(char) + self.assertEqual(hexescape(char), result, + "using quote(): %s should be escaped to %s, not %s" % + (char, hexescape(char), result)) + result = urllib.quote_plus(char) + self.assertEqual(hexescape(char), result, + "using quote_plus(): " + "%s should be escapes to %s, not %s" % + (char, hexescape(char), result)) + del should_quote + partial_quote = "ab[]cd" + expected = "ab%5B%5Dcd" + result = urllib.quote(partial_quote) + self.assertEqual(expected, result, + "using quote(): %s != %s" % (expected, result)) + self.assertEqual(expected, result, + "using quote_plus(): %s != %s" % (expected, result)) + + def test_quoting_space(self): + # Make sure quote() and quote_plus() handle spaces as specified in + # their unique way + result = urllib.quote(' ') + self.assertEqual(result, hexescape(' '), + "using quote(): %s != %s" % (result, hexescape(' '))) + result = urllib.quote_plus(' ') + self.assertEqual(result, '+', + "using quote_plus(): %s != +" % result) + given = "a b cd e f" + expect = given.replace(' ', hexescape(' ')) + result = urllib.quote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + expect = given.replace(' ', '+') + result = urllib.quote_plus(given) + self.assertEqual(expect, result, + "using quote_plus(): %s != %s" % (expect, result)) + + def test_quoting_plus(self): + self.assertEqual(urllib.quote_plus('alpha+beta gamma'), + 'alpha%2Bbeta+gamma') + self.assertEqual(urllib.quote_plus('alpha+beta gamma', '+'), + 'alpha+beta+gamma') + +class UnquotingTests(unittest.TestCase): + """Tests for unquote() and unquote_plus() + + See the doc string for quoting_Tests for details on quoting and such. + + """ + + def test_unquoting(self): + # Make sure unquoting of all ASCII values works + escape_list = [] + for num in range(128): + given = hexescape(chr(num)) + expect = chr(num) + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % + (expect, result)) + escape_list.append(given) + escape_string = ''.join(escape_list) + del escape_list + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using quote(): not all characters escaped; %s" % + result) + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using unquote(): not all characters escaped: " + "%s" % result) + + def test_unquoting_badpercent(self): + # Test unquoting on bad percent-escapes + given = '%xab' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + given = '%x' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + given = '%' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + + def test_unquoting_mixed_case(self): + # Test unquoting on mixed-case hex digits in the percent-escapes + given = '%Ab%eA' + expect = '\xab\xea' + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + + def test_unquoting_parts(self): + # Make sure unquoting works when have non-quoted characters + # interspersed + given = 'ab%sd' % hexescape('c') + expect = "abcd" + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquoting_plus(self): + # Test difference between unquote() and unquote_plus() + given = "are+there+spaces..." + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + expect = given.replace('+', ' ') + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquote_with_unicode(self): + r = urllib.unquote(u'br%C3%BCckner_sapporo_20050930.doc') + self.assertEqual(r, u'br\xc3\xbcckner_sapporo_20050930.doc') + +class urlencode_Tests(unittest.TestCase): + """Tests for urlencode()""" + + def help_inputtype(self, given, test_type): + """Helper method for testing different input types. + + 'given' must lead to only the pairs: + * 1st, 1 + * 2nd, 2 + * 3rd, 3 + + Test cannot assume anything about order. Docs make no guarantee and + have possible dictionary input. + + """ + expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] + result = urllib.urlencode(given) + for expected in expect_somewhere: + self.assert_(expected in result, + "testing %s: %s not found in %s" % + (test_type, expected, result)) + self.assertEqual(result.count('&'), 2, + "testing %s: expected 2 '&'s; got %s" % + (test_type, result.count('&'))) + amp_location = result.index('&') + on_amp_left = result[amp_location - 1] + on_amp_right = result[amp_location + 1] + self.assert_(on_amp_left.isdigit() and on_amp_right.isdigit(), + "testing %s: '&' not located in proper place in %s" % + (test_type, result)) + self.assertEqual(len(result), (5 * 3) + 2, #5 chars per thing and amps + "testing %s: " + "unexpected number of characters: %s != %s" % + (test_type, len(result), (5 * 3) + 2)) + + def test_using_mapping(self): + # Test passing in a mapping object as an argument. + self.help_inputtype({"1st":'1', "2nd":'2', "3rd":'3'}, + "using dict as input type") + + def test_using_sequence(self): + # Test passing in a sequence of two-item sequences as an argument. + self.help_inputtype([('1st', '1'), ('2nd', '2'), ('3rd', '3')], + "using sequence of two-item tuples as input") + + def test_quoting(self): + # Make sure keys and values are quoted using quote_plus() + given = {"&":"="} + expect = "%s=%s" % (hexescape('&'), hexescape('=')) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + given = {"key name":"A bunch of pluses"} + expect = "key+name=A+bunch+of+pluses" + result = urllib.urlencode(given) + self.assertEqual(expect, result) + + def test_doseq(self): + # Test that passing True for 'doseq' parameter works correctly + given = {'sequence':['1', '2', '3']} + expect = "sequence=%s" % urllib.quote_plus(str(['1', '2', '3'])) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + result = urllib.urlencode(given, True) + for value in given["sequence"]: + expect = "sequence=%s" % value + self.assert_(expect in result, + "%s not found in %s" % (expect, result)) + self.assertEqual(result.count('&'), 2, + "Expected 2 '&'s, got %s" % result.count('&')) + +class Pathname_Tests(unittest.TestCase): + """Test pathname2url() and url2pathname()""" + + def test_basic(self): + # Make sure simple tests pass + expected_path = os.path.join("parts", "of", "a", "path") + expected_url = "parts/of/a/path" + result = urllib.pathname2url(expected_path) + self.assertEqual(expected_url, result, + "pathname2url() failed; %s != %s" % + (result, expected_url)) + result = urllib.url2pathname(expected_url) + self.assertEqual(expected_path, result, + "url2pathame() failed; %s != %s" % + (result, expected_path)) + + def test_quoting(self): + # Test automatic quoting and unquoting works for pathnam2url() and + # url2pathname() respectively + given = os.path.join("needs", "quot=ing", "here") + expect = "needs/%s/here" % urllib.quote("quot=ing") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + expect = given + result = urllib.url2pathname(result) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + given = os.path.join("make sure", "using_quote") + expect = "%s/using_quote" % urllib.quote("make sure") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + given = "make+sure/using_unquote" + expect = os.path.join("make+sure", "using_unquote") + result = urllib.url2pathname(given) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + +class URLopener_Tests(unittest.TestCase): + """Testcase to test the open method of URLopener class.""" + def test_quoted_open(self): + class DummyURLopener(urllib.URLopener): + def open_spam(self, url): + return url + + self.assertEqual(DummyURLopener().open( + 'spam://example/ /'),'//example/%20/') + + # test the safe characters are not quoted by urlopen + self.assertEqual(DummyURLopener().open( + "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"), + "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/") + + +# Just commented them out. +# Can't really tell why keep failing in windows and sparc. +# Everywhere else they work ok, but on those machines, someteimes +# fail in one of the tests, sometimes in other. I have a linux, and +# the tests go ok. +# If anybody has one of the problematic enviroments, please help! +# . Facundo +# +# def server(evt): +# import socket, time +# serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +# serv.settimeout(3) +# serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +# serv.bind(("", 9093)) +# serv.listen(5) +# try: +# conn, addr = serv.accept() +# conn.send("1 Hola mundo\n") +# cantdata = 0 +# while cantdata < 13: +# data = conn.recv(13-cantdata) +# cantdata += len(data) +# time.sleep(.3) +# conn.send("2 No more lines\n") +# conn.close() +# except socket.timeout: +# pass +# finally: +# serv.close() +# evt.set() +# +# class FTPWrapperTests(unittest.TestCase): +# +# def setUp(self): +# import ftplib, time, threading +# ftplib.FTP.port = 9093 +# self.evt = threading.Event() +# threading.Thread(target=server, args=(self.evt,)).start() +# time.sleep(.1) +# +# def tearDown(self): +# self.evt.wait() +# +# def testBasic(self): +# # connects +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# ftp.close() +# +# def testTimeoutNone(self): +# # global default timeout is ignored +# import socket +# self.assert_(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() +# +# def testTimeoutDefault(self): +# # global default timeout is used +# import socket +# self.assert_(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() +# +# def testTimeoutValue(self): +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], +# timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() + + + +def test_main(): + import warnings + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', ".*urllib\.urlopen.*Python 3.0", + DeprecationWarning) + test_support.run_unittest( + urlopen_FileTests, + urlopen_HttpTests, + urlretrieve_FileTests, + ProxyTests, + QuotingTests, + UnquotingTests, + urlencode_Tests, + Pathname_Tests, + URLopener_Tests, + #FTPWrapperTests, + ) + + + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.6/test_wsgiref.py python-gevent-1.0/greentest/2.6/test_wsgiref.py --- python-gevent-0.13.7/greentest/2.6/test_wsgiref.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/test_wsgiref.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,621 @@ +from __future__ import nested_scopes # Backward compat for 2.1 +from unittest import TestCase +from wsgiref.util import setup_testing_defaults +from wsgiref.headers import Headers +from wsgiref.handlers import BaseHandler, BaseCGIHandler +from wsgiref import util +from wsgiref.validate import validator +from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app +from wsgiref.simple_server import make_server +from StringIO import StringIO +from SocketServer import BaseServer +import os +import re +import sys + +from test import test_support + +class MockServer(WSGIServer): + """Non-socket HTTP server""" + + def __init__(self, server_address, RequestHandlerClass): + BaseServer.__init__(self, server_address, RequestHandlerClass) + self.server_bind() + + def server_bind(self): + host, port = self.server_address + self.server_name = host + self.server_port = port + self.setup_environ() + + +class MockHandler(WSGIRequestHandler): + """Non-socket HTTP handler""" + def setup(self): + self.connection = self.request + self.rfile, self.wfile = self.connection + + def finish(self): + pass + + + + + +def hello_app(environ,start_response): + start_response("200 OK", [ + ('Content-Type','text/plain'), + ('Date','Mon, 05 Jun 2006 18:49:54 GMT') + ]) + return ["Hello, world!"] + +def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"): + server = make_server("", 80, app, MockServer, MockHandler) + inp, out, err, olderr = StringIO(data), StringIO(), StringIO(), sys.stderr + sys.stderr = err + + try: + server.finish_request((inp,out), ("127.0.0.1",8888)) + finally: + sys.stderr = olderr + + return out.getvalue(), err.getvalue() + + + + + + + + + + + + + + + + + + + + + + + +def compare_generic_iter(make_it,match): + """Utility to compare a generic 2.1/2.2+ iterator with an iterable + + If running under Python 2.2+, this tests the iterator using iter()/next(), + as well as __getitem__. 'make_it' must be a function returning a fresh + iterator to be tested (since this may test the iterator twice).""" + + it = make_it() + n = 0 + for item in match: + if not it[n]==item: raise AssertionError + n+=1 + try: + it[n] + except IndexError: + pass + else: + raise AssertionError("Too many items from __getitem__",it) + + try: + iter, StopIteration + except NameError: + pass + else: + # Only test iter mode under 2.2+ + it = make_it() + if not iter(it) is it: raise AssertionError + for item in match: + if not it.next()==item: raise AssertionError + try: + it.next() + except StopIteration: + pass + else: + raise AssertionError("Too many items from .next()",it) + + + + + + +class IntegrationTests(TestCase): + + def check_hello(self, out, has_length=True): + self.assertEqual(out, + "HTTP/1.0 200 OK\r\n" + "Server: WSGIServer/0.1 Python/"+sys.version.split()[0]+"\r\n" + "Content-Type: text/plain\r\n" + "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + + (has_length and "Content-Length: 13\r\n" or "") + + "\r\n" + "Hello, world!" + ) + + def test_plain_hello(self): + out, err = run_amock() + self.check_hello(out) + + def test_validated_hello(self): + out, err = run_amock(validator(hello_app)) + # the middleware doesn't support len(), so content-length isn't there + self.check_hello(out, has_length=False) + + def test_simple_validation_error(self): + def bad_app(environ,start_response): + start_response("200 OK", ('Content-Type','text/plain')) + return ["Hello, world!"] + out, err = run_amock(validator(bad_app)) + self.failUnless(out.endswith( + "A server error occurred. Please contact the administrator." + )) + self.assertEqual( + err.splitlines()[-2], + "AssertionError: Headers (('Content-Type', 'text/plain')) must" + " be of type list: " + ) + + + + + + +class UtilityTests(TestCase): + + def checkShift(self,sn_in,pi_in,part,sn_out,pi_out): + env = {'SCRIPT_NAME':sn_in,'PATH_INFO':pi_in} + util.setup_testing_defaults(env) + self.assertEqual(util.shift_path_info(env),part) + self.assertEqual(env['PATH_INFO'],pi_out) + self.assertEqual(env['SCRIPT_NAME'],sn_out) + return env + + def checkDefault(self, key, value, alt=None): + # Check defaulting when empty + env = {} + util.setup_testing_defaults(env) + if isinstance(value,StringIO): + self.failUnless(isinstance(env[key],StringIO)) + else: + self.assertEqual(env[key],value) + + # Check existing value + env = {key:alt} + util.setup_testing_defaults(env) + self.failUnless(env[key] is alt) + + def checkCrossDefault(self,key,value,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(kw[key],value) + + def checkAppURI(self,uri,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.application_uri(kw),uri) + + def checkReqURI(self,uri,query=1,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.request_uri(kw,query),uri) + + + + + + + def checkFW(self,text,size,match): + + def make_it(text=text,size=size): + return util.FileWrapper(StringIO(text),size) + + compare_generic_iter(make_it,match) + + it = make_it() + self.failIf(it.filelike.closed) + + for item in it: + pass + + self.failIf(it.filelike.closed) + + it.close() + self.failUnless(it.filelike.closed) + + + def testSimpleShifts(self): + self.checkShift('','/', '', '/', '') + self.checkShift('','/x', 'x', '/x', '') + self.checkShift('/','', None, '/', '') + self.checkShift('/a','/x/y', 'x', '/a/x', '/y') + self.checkShift('/a','/x/', 'x', '/a/x', '/') + + + def testNormalizedShifts(self): + self.checkShift('/a/b', '/../y', '..', '/a', '/y') + self.checkShift('', '/../y', '..', '', '/y') + self.checkShift('/a/b', '//y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '//y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '/./y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '/./y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '///./..//y/.//', '..', '/a', '/y/') + self.checkShift('/a/b', '///', '', '/a/b/', '') + self.checkShift('/a/b', '/.//', '', '/a/b/', '') + self.checkShift('/a/b', '/x//', 'x', '/a/b/x', '/') + self.checkShift('/a/b', '/.', None, '/a/b', '') + + + def testDefaults(self): + for key, value in [ + ('SERVER_NAME','127.0.0.1'), + ('SERVER_PORT', '80'), + ('SERVER_PROTOCOL','HTTP/1.0'), + ('HTTP_HOST','127.0.0.1'), + ('REQUEST_METHOD','GET'), + ('SCRIPT_NAME',''), + ('PATH_INFO','/'), + ('wsgi.version', (1,0)), + ('wsgi.run_once', 0), + ('wsgi.multithread', 0), + ('wsgi.multiprocess', 0), + ('wsgi.input', StringIO("")), + ('wsgi.errors', StringIO()), + ('wsgi.url_scheme','http'), + ]: + self.checkDefault(key,value) + + + def testCrossDefaults(self): + self.checkCrossDefault('HTTP_HOST',"foo.bar",SERVER_NAME="foo.bar") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="on") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="1") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="yes") + self.checkCrossDefault('wsgi.url_scheme',"http",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"80",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"443",HTTPS="on") + + + def testGuessScheme(self): + self.assertEqual(util.guess_scheme({}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https") + + + + + + def testAppURIs(self): + self.checkAppURI("http://127.0.0.1/") + self.checkAppURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkAppURI("http://spam.example.com:2071/", + HTTP_HOST="spam.example.com:2071", SERVER_PORT="2071") + self.checkAppURI("http://spam.example.com/", + SERVER_NAME="spam.example.com") + self.checkAppURI("http://127.0.0.1/", + HTTP_HOST="127.0.0.1", SERVER_NAME="spam.example.com") + self.checkAppURI("https://127.0.0.1/", HTTPS="on") + self.checkAppURI("http://127.0.0.1:8000/", SERVER_PORT="8000", + HTTP_HOST=None) + + def testReqURIs(self): + self.checkReqURI("http://127.0.0.1/") + self.checkReqURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam", + SCRIPT_NAME="/spammity", PATH_INFO="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni", + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + self.checkReqURI("http://127.0.0.1/spammity/spam", 0, + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + + def testFileWrapper(self): + self.checkFW("xyz"*50, 120, ["xyz"*40,"xyz"*10]) + + def testHopByHop(self): + for hop in ( + "Connection Keep-Alive Proxy-Authenticate Proxy-Authorization " + "TE Trailers Transfer-Encoding Upgrade" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.failUnless(util.is_hop_by_hop(alt)) + + # Not comprehensive, just a few random header names + for hop in ( + "Accept Cache-Control Date Pragma Trailer Via Warning" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.failIf(util.is_hop_by_hop(alt)) + +class HeaderTests(TestCase): + + def testMappingInterface(self): + test = [('x','y')] + self.assertEqual(len(Headers([])),0) + self.assertEqual(len(Headers(test[:])),1) + self.assertEqual(Headers(test[:]).keys(), ['x']) + self.assertEqual(Headers(test[:]).values(), ['y']) + self.assertEqual(Headers(test[:]).items(), test) + self.failIf(Headers(test).items() is test) # must be copy! + + h=Headers([]) + del h['foo'] # should not raise an error + + h['Foo'] = 'bar' + for m in h.has_key, h.__contains__, h.get, h.get_all, h.__getitem__: + self.failUnless(m('foo')) + self.failUnless(m('Foo')) + self.failUnless(m('FOO')) + self.failIf(m('bar')) + + self.assertEqual(h['foo'],'bar') + h['foo'] = 'baz' + self.assertEqual(h['FOO'],'baz') + self.assertEqual(h.get_all('foo'),['baz']) + + self.assertEqual(h.get("foo","whee"), "baz") + self.assertEqual(h.get("zoo","whee"), "whee") + self.assertEqual(h.setdefault("foo","whee"), "baz") + self.assertEqual(h.setdefault("zoo","whee"), "whee") + self.assertEqual(h["foo"],"baz") + self.assertEqual(h["zoo"],"whee") + + def testRequireList(self): + self.assertRaises(TypeError, Headers, "foo") + + + def testExtras(self): + h = Headers([]) + self.assertEqual(str(h),'\r\n') + + h.add_header('foo','bar',baz="spam") + self.assertEqual(h['foo'], 'bar; baz="spam"') + self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n') + + h.add_header('Foo','bar',cheese=None) + self.assertEqual(h.get_all('foo'), + ['bar; baz="spam"', 'bar; cheese']) + + self.assertEqual(str(h), + 'foo: bar; baz="spam"\r\n' + 'Foo: bar; cheese\r\n' + '\r\n' + ) + + +class ErrorHandler(BaseCGIHandler): + """Simple handler subclass for testing BaseHandler""" + + # BaseHandler records the OS environment at import time, but envvars + # might have been changed later by other tests, which trips up + # HandlerTests.testEnviron(). + os_environ = dict(os.environ.items()) + + def __init__(self,**kw): + setup_testing_defaults(kw) + BaseCGIHandler.__init__( + self, StringIO(''), StringIO(), StringIO(), kw, + multithread=True, multiprocess=True + ) + +class TestHandler(ErrorHandler): + """Simple handler subclass for testing BaseHandler, w/error passthru""" + + def handle_error(self): + raise # for testing, we want to see what's happening + + + + + + + + + + + +class HandlerTests(TestCase): + + def checkEnvironAttrs(self, handler): + env = handler.environ + for attr in [ + 'version','multithread','multiprocess','run_once','file_wrapper' + ]: + if attr=='file_wrapper' and handler.wsgi_file_wrapper is None: + continue + self.assertEqual(getattr(handler,'wsgi_'+attr),env['wsgi.'+attr]) + + def checkOSEnviron(self,handler): + empty = {}; setup_testing_defaults(empty) + env = handler.environ + from os import environ + for k,v in environ.items(): + if k not in empty: + self.assertEqual(env[k],v) + for k,v in empty.items(): + self.assertTrue(k in env) + + def testEnviron(self): + h = TestHandler(X="Y") + h.setup_environ() + self.checkEnvironAttrs(h) + self.checkOSEnviron(h) + self.assertEqual(h.environ["X"],"Y") + + def testCGIEnviron(self): + h = BaseCGIHandler(None,None,None,{}) + h.setup_environ() + for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors': + self.assertTrue(key in h.environ) + + def testScheme(self): + h=TestHandler(HTTPS="on"); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'https') + h=TestHandler(); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'http') + + + def testAbstractMethods(self): + h = BaseHandler() + for name in [ + '_flush','get_stdin','get_stderr','add_cgi_vars' + ]: + self.assertRaises(NotImplementedError, getattr(h,name)) + self.assertRaises(NotImplementedError, h._write, "test") + + + def testContentLength(self): + # Demo one reason iteration is better than write()... ;) + + def trivial_app1(e,s): + s('200 OK',[]) + return [e['wsgi.url_scheme']] + + def trivial_app2(e,s): + s('200 OK',[])(e['wsgi.url_scheme']) + return [] + + h = TestHandler() + h.run(trivial_app1) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 4\r\n" + "\r\n" + "http") + + h = TestHandler() + h.run(trivial_app2) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n" + "http") + + + + + + + + def testBasicErrorOutput(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + def error_app(e,s): + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(non_error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 0\r\n" + "\r\n") + self.assertEqual(h.stderr.getvalue(),"") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: %s\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: %d\r\n" + "\r\n%s" % (h.error_status,len(h.error_body),h.error_body)) + + self.assertTrue("AssertionError" in h.stderr.getvalue(), + "AssertionError not in stderr") + + def testErrorAfterOutput(self): + MSG = "Some output has been sent" + def error_app(e,s): + s("200 OK",[])(MSG) + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n"+MSG) + self.assertTrue("AssertionError" in h.stderr.getvalue(), + "AssertionError not in stderr") + + + def testHeaderFormats(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + stdpat = ( + r"HTTP/%s 200 OK\r\n" + r"Date: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n" + r"%s" r"Content-Length: 0\r\n" r"\r\n" + ) + shortpat = ( + "Status: 200 OK\r\n" "Content-Length: 0\r\n" "\r\n" + ) + + for ssw in "FooBar/1.0", None: + sw = ssw and "Server: %s\r\n" % ssw or "" + + for version in "1.0", "1.1": + for proto in "HTTP/0.9", "HTTP/1.0", "HTTP/1.1": + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = False + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + self.assertEqual(shortpat,h.stdout.getvalue()) + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = True + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + if proto=="HTTP/0.9": + self.assertEqual(h.stdout.getvalue(),"") + else: + self.failUnless( + re.match(stdpat%(version,sw), h.stdout.getvalue()), + (stdpat%(version,sw), h.stdout.getvalue()) + ) + +# This epilogue is needed for compatibility with the Python 2.5 regrtest module + +def test_main(): + test_support.run_unittest(__name__) + +if __name__ == "__main__": + test_main() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# the above lines intentionally left blank diff -Nru python-gevent-0.13.7/greentest/2.6/version python-gevent-1.0/greentest/2.6/version --- python-gevent-0.13.7/greentest/2.6/version 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/version 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1 @@ +2.6.8 diff -Nru python-gevent-0.13.7/greentest/2.6/wrongcert.pem python-gevent-1.0/greentest/2.6/wrongcert.pem --- python-gevent-0.13.7/greentest/2.6/wrongcert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.6/wrongcert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnH +FlbsVUg2Xtk6+bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6T +f9lnNTwpSoeK24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQAB +AoGAQFko4uyCgzfxr4Ezb4Mp5pN3Npqny5+Jey3r8EjSAX9Ogn+CNYgoBcdtFgbq +1yif/0sK7ohGBJU9FUCAwrqNBI9ZHB6rcy7dx+gULOmRBGckln1o5S1+smVdmOsW +7zUVLBVByKuNWqTYFlzfVd6s4iiXtAE2iHn3GCyYdlICwrECQQDhMQVxHd3EFbzg +SFmJBTARlZ2GKA3c1g/h9/XbkEPQ9/RwI3vnjJ2RaSnjlfoLl8TOcf0uOGbOEyFe +19RvCLXjAkEA1s+UE5ziF+YVkW3WolDCQ2kQ5WG9+ccfNebfh6b67B7Ln5iG0Sbg +ky9cjsO3jbMJQtlzAQnH1850oRD5Gi51dQJAIbHCDLDZU9Ok1TI+I2BhVuA6F666 +lEZ7TeZaJSYq34OaUYUdrwG9OdqwZ9sy9LUav4ESzu2lhEQchCJrKMn23QJAReqs +ZLHUeTjfXkVk7dHhWPWSlUZ6AhmIlA/AQ7Payg2/8wM/JkZEJEPvGVykms9iPUrv +frADRr+hAGe43IewnQJBAJWKZllPgKuEBPwoEldHNS8nRu61D7HzxEzQ2xnfj+Nk +2fgf1MAzzTRsikfGENhVsVWeqOcijWb6g5gsyCmlRpc= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICsDCCAhmgAwIBAgIJAOqYOYFJfEEoMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwHhcNMDgwNjI2MTgxNTUyWhcNMDkwNjI2MTgxNTUyWjBF +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnHFlbsVUg2Xtk6 ++bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6Tf9lnNTwpSoeK +24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQABo4GnMIGkMB0G +A1UdDgQWBBTctMtI3EO9OjLI0x9Zo2ifkwIiNjB1BgNVHSMEbjBsgBTctMtI3EO9 +OjLI0x9Zo2ifkwIiNqFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt +U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAOqYOYFJ +fEEoMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAQwa7jya/DfhaDn7E +usPkpgIX8WCL2B1SqnRTXEZfBPPVq/cUmFGyEVRVATySRuMwi8PXbVcOhXXuocA+ +43W+iIsD9pXapCZhhOerCq18TC1dWK98vLUsoK8PMjB6e5H/O8bqojv0EeC+fyCw +eSHj5jpC8iZKjCHBn+mAi4cQ514= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/badcert.pem python-gevent-1.0/greentest/2.7/badcert.pem --- python-gevent-0.13.7/greentest/2.7/badcert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/badcert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,36 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +Just bad cert data +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +Just bad cert data +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/badkey.pem python-gevent-1.0/greentest/2.7/badkey.pem --- python-gevent-0.13.7/greentest/2.7/badkey.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/badkey.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,40 @@ +-----BEGIN RSA PRIVATE KEY----- +Bad Key, though the cert should be OK +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +Bad Key, though the cert should be OK +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/https_svn_python_org_root.pem python-gevent-1.0/greentest/2.7/https_svn_python_org_root.pem --- python-gevent-0.13.7/greentest/2.7/https_svn_python_org_root.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/https_svn_python_org_root.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,41 @@ +-----BEGIN CERTIFICATE----- +MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290 +IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB +IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA +Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO +BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi +MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ +ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ +8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6 +zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y +fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7 +w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc +G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k +epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q +laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ +QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU +fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826 +YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w +ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY +gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe +MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0 +IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy +dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw +czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0 +dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl +aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC +AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg +b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB +ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc +nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg +18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c +gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl +Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY +sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T +SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF +CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum +GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk +zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW +omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/keycert.pem python-gevent-1.0/greentest/2.7/keycert.pem --- python-gevent-0.13.7/greentest/2.7/keycert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/keycert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L +opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH +fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB +AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU +D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA +IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM +oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0 +ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/ +loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j +oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA +z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq +ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV +q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD +VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x +IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT +U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1 +NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl +bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m +dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj +aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh +m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8 +M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn +fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC +AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb +08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx +CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/ +iHkC6gGdBJhogs4= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/lock_tests.py python-gevent-1.0/greentest/2.7/lock_tests.py --- python-gevent-0.13.7/greentest/2.7/lock_tests.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/lock_tests.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,546 @@ +""" +Various tests for synchronization primitives. +""" + +import sys +import time +from thread import start_new_thread, get_ident +import threading +import unittest + +from test import test_support as support + + +def _wait(): + # A crude wait/yield function not relying on synchronization primitives. + time.sleep(0.01) + +class Bunch(object): + """ + A bunch of threads. + """ + def __init__(self, f, n, wait_before_exit=False): + """ + Construct a bunch of `n` threads running the same function `f`. + If `wait_before_exit` is True, the threads won't terminate until + do_finish() is called. + """ + self.f = f + self.n = n + self.started = [] + self.finished = [] + self._can_exit = not wait_before_exit + def task(): + tid = get_ident() + self.started.append(tid) + try: + f() + finally: + self.finished.append(tid) + while not self._can_exit: + _wait() + for i in range(n): + start_new_thread(task, ()) + + def wait_for_started(self): + while len(self.started) < self.n: + _wait() + + def wait_for_finished(self): + while len(self.finished) < self.n: + _wait() + + def do_finish(self): + self._can_exit = True + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = support.threading_setup() + + def tearDown(self): + support.threading_cleanup(*self._threads) + support.reap_children() + + +class BaseLockTests(BaseTestCase): + """ + Tests for both recursive and non-recursive locks. + """ + + def test_constructor(self): + lock = self.locktype() + del lock + + def test_acquire_destroy(self): + lock = self.locktype() + lock.acquire() + del lock + + def test_acquire_release(self): + lock = self.locktype() + lock.acquire() + lock.release() + del lock + + def test_try_acquire(self): + lock = self.locktype() + self.assertTrue(lock.acquire(False)) + lock.release() + + def test_try_acquire_contended(self): + lock = self.locktype() + lock.acquire() + result = [] + def f(): + result.append(lock.acquire(False)) + Bunch(f, 1).wait_for_finished() + self.assertFalse(result[0]) + lock.release() + + def test_acquire_contended(self): + lock = self.locktype() + lock.acquire() + N = 5 + def f(): + lock.acquire() + lock.release() + + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(len(b.finished), 0) + lock.release() + b.wait_for_finished() + self.assertEqual(len(b.finished), N) + + def test_with(self): + lock = self.locktype() + def f(): + lock.acquire() + lock.release() + def _with(err=None): + with lock: + if err is not None: + raise err + _with() + # Check the lock is unacquired + Bunch(f, 1).wait_for_finished() + self.assertRaises(TypeError, _with, TypeError) + # Check the lock is unacquired + Bunch(f, 1).wait_for_finished() + + def test_thread_leak(self): + # The lock shouldn't leak a Thread instance when used from a foreign + # (non-threading) thread. + lock = self.locktype() + def f(): + lock.acquire() + lock.release() + n = len(threading.enumerate()) + # We run many threads in the hope that existing threads ids won't + # be recycled. + Bunch(f, 15).wait_for_finished() + self.assertEqual(n, len(threading.enumerate())) + + +class LockTests(BaseLockTests): + """ + Tests for non-recursive, weak locks + (which can be acquired and released from different threads). + """ + def test_reacquire(self): + # Lock needs to be released before re-acquiring. + lock = self.locktype() + phase = [] + def f(): + lock.acquire() + phase.append(None) + lock.acquire() + phase.append(None) + start_new_thread(f, ()) + while len(phase) == 0: + _wait() + _wait() + self.assertEqual(len(phase), 1) + lock.release() + while len(phase) == 1: + _wait() + self.assertEqual(len(phase), 2) + + def test_different_thread(self): + # Lock can be released from a different thread. + lock = self.locktype() + lock.acquire() + def f(): + lock.release() + b = Bunch(f, 1) + b.wait_for_finished() + lock.acquire() + lock.release() + + +class RLockTests(BaseLockTests): + """ + Tests for recursive locks. + """ + def test_reacquire(self): + lock = self.locktype() + lock.acquire() + lock.acquire() + lock.release() + lock.acquire() + lock.release() + lock.release() + + def test_release_unacquired(self): + # Cannot release an unacquired lock + lock = self.locktype() + self.assertRaises(RuntimeError, lock.release) + lock.acquire() + lock.acquire() + lock.release() + lock.acquire() + lock.release() + lock.release() + self.assertRaises(RuntimeError, lock.release) + + def test_different_thread(self): + # Cannot release from a different thread + lock = self.locktype() + def f(): + lock.acquire() + b = Bunch(f, 1, True) + try: + self.assertRaises(RuntimeError, lock.release) + finally: + b.do_finish() + + def test__is_owned(self): + lock = self.locktype() + self.assertFalse(lock._is_owned()) + lock.acquire() + self.assertTrue(lock._is_owned()) + lock.acquire() + self.assertTrue(lock._is_owned()) + result = [] + def f(): + result.append(lock._is_owned()) + Bunch(f, 1).wait_for_finished() + self.assertFalse(result[0]) + lock.release() + self.assertTrue(lock._is_owned()) + lock.release() + self.assertFalse(lock._is_owned()) + + +class EventTests(BaseTestCase): + """ + Tests for Event objects. + """ + + def test_is_set(self): + evt = self.eventtype() + self.assertFalse(evt.is_set()) + evt.set() + self.assertTrue(evt.is_set()) + evt.set() + self.assertTrue(evt.is_set()) + evt.clear() + self.assertFalse(evt.is_set()) + evt.clear() + self.assertFalse(evt.is_set()) + + def _check_notify(self, evt): + # All threads get notified + N = 5 + results1 = [] + results2 = [] + def f(): + results1.append(evt.wait()) + results2.append(evt.wait()) + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(len(results1), 0) + evt.set() + b.wait_for_finished() + self.assertEqual(results1, [True] * N) + self.assertEqual(results2, [True] * N) + + def test_notify(self): + evt = self.eventtype() + self._check_notify(evt) + # Another time, after an explicit clear() + evt.set() + evt.clear() + self._check_notify(evt) + + def test_timeout(self): + evt = self.eventtype() + results1 = [] + results2 = [] + N = 5 + def f(): + results1.append(evt.wait(0.0)) + t1 = time.time() + r = evt.wait(0.2) + t2 = time.time() + results2.append((r, t2 - t1)) + Bunch(f, N).wait_for_finished() + self.assertEqual(results1, [False] * N) + for r, dt in results2: + self.assertFalse(r) + self.assertTrue(dt >= 0.2, dt) + # The event is set + results1 = [] + results2 = [] + evt.set() + Bunch(f, N).wait_for_finished() + self.assertEqual(results1, [True] * N) + for r, dt in results2: + self.assertTrue(r) + + +class ConditionTests(BaseTestCase): + """ + Tests for condition variables. + """ + + def test_acquire(self): + cond = self.condtype() + # Be default we have an RLock: the condition can be acquired multiple + # times. + cond.acquire() + cond.acquire() + cond.release() + cond.release() + lock = threading.Lock() + cond = self.condtype(lock) + cond.acquire() + self.assertFalse(lock.acquire(False)) + cond.release() + self.assertTrue(lock.acquire(False)) + self.assertFalse(cond.acquire(False)) + lock.release() + with cond: + self.assertFalse(lock.acquire(False)) + + def test_unacquired_wait(self): + cond = self.condtype() + self.assertRaises(RuntimeError, cond.wait) + + def test_unacquired_notify(self): + cond = self.condtype() + self.assertRaises(RuntimeError, cond.notify) + + def _check_notify(self, cond): + N = 5 + results1 = [] + results2 = [] + phase_num = 0 + def f(): + cond.acquire() + cond.wait() + cond.release() + results1.append(phase_num) + cond.acquire() + cond.wait() + cond.release() + results2.append(phase_num) + b = Bunch(f, N) + b.wait_for_started() + _wait() + self.assertEqual(results1, []) + # Notify 3 threads at first + cond.acquire() + cond.notify(3) + _wait() + phase_num = 1 + cond.release() + while len(results1) < 3: + _wait() + self.assertEqual(results1, [1] * 3) + self.assertEqual(results2, []) + # Notify 5 threads: they might be in their first or second wait + cond.acquire() + cond.notify(5) + _wait() + phase_num = 2 + cond.release() + while len(results1) + len(results2) < 8: + _wait() + self.assertEqual(results1, [1] * 3 + [2] * 2) + self.assertEqual(results2, [2] * 3) + # Notify all threads: they are all in their second wait + cond.acquire() + cond.notify_all() + _wait() + phase_num = 3 + cond.release() + while len(results2) < 5: + _wait() + self.assertEqual(results1, [1] * 3 + [2] * 2) + self.assertEqual(results2, [2] * 3 + [3] * 2) + b.wait_for_finished() + + def test_notify(self): + cond = self.condtype() + self._check_notify(cond) + # A second time, to check internal state is still ok. + self._check_notify(cond) + + def test_timeout(self): + cond = self.condtype() + results = [] + N = 5 + def f(): + cond.acquire() + t1 = time.time() + cond.wait(0.2) + t2 = time.time() + cond.release() + results.append(t2 - t1) + Bunch(f, N).wait_for_finished() + self.assertEqual(len(results), 5) + for dt in results: + self.assertTrue(dt >= 0.2, dt) + + +class BaseSemaphoreTests(BaseTestCase): + """ + Common tests for {bounded, unbounded} semaphore objects. + """ + + def test_constructor(self): + self.assertRaises(ValueError, self.semtype, value = -1) + self.assertRaises(ValueError, self.semtype, value = -sys.maxint) + + def test_acquire(self): + sem = self.semtype(1) + sem.acquire() + sem.release() + sem = self.semtype(2) + sem.acquire() + sem.acquire() + sem.release() + sem.release() + + def test_acquire_destroy(self): + sem = self.semtype() + sem.acquire() + del sem + + def test_acquire_contended(self): + sem = self.semtype(7) + sem.acquire() + N = 10 + results1 = [] + results2 = [] + phase_num = 0 + def f(): + sem.acquire() + results1.append(phase_num) + sem.acquire() + results2.append(phase_num) + b = Bunch(f, 10) + b.wait_for_started() + while len(results1) + len(results2) < 6: + _wait() + self.assertEqual(results1 + results2, [0] * 6) + phase_num = 1 + for i in range(7): + sem.release() + while len(results1) + len(results2) < 13: + _wait() + self.assertEqual(sorted(results1 + results2), [0] * 6 + [1] * 7) + phase_num = 2 + for i in range(6): + sem.release() + while len(results1) + len(results2) < 19: + _wait() + self.assertEqual(sorted(results1 + results2), [0] * 6 + [1] * 7 + [2] * 6) + # The semaphore is still locked + self.assertFalse(sem.acquire(False)) + # Final release, to let the last thread finish + sem.release() + b.wait_for_finished() + + def test_try_acquire(self): + sem = self.semtype(2) + self.assertTrue(sem.acquire(False)) + self.assertTrue(sem.acquire(False)) + self.assertFalse(sem.acquire(False)) + sem.release() + self.assertTrue(sem.acquire(False)) + + def test_try_acquire_contended(self): + sem = self.semtype(4) + sem.acquire() + results = [] + def f(): + results.append(sem.acquire(False)) + results.append(sem.acquire(False)) + Bunch(f, 5).wait_for_finished() + # There can be a thread switch between acquiring the semaphore and + # appending the result, therefore results will not necessarily be + # ordered. + self.assertEqual(sorted(results), [False] * 7 + [True] * 3 ) + + def test_default_value(self): + # The default initial value is 1. + sem = self.semtype() + sem.acquire() + def f(): + sem.acquire() + sem.release() + b = Bunch(f, 1) + b.wait_for_started() + _wait() + self.assertFalse(b.finished) + sem.release() + b.wait_for_finished() + + def test_with(self): + sem = self.semtype(2) + def _with(err=None): + with sem: + self.assertTrue(sem.acquire(False)) + sem.release() + with sem: + self.assertFalse(sem.acquire(False)) + if err: + raise err + _with() + self.assertTrue(sem.acquire(False)) + sem.release() + self.assertRaises(TypeError, _with, TypeError) + self.assertTrue(sem.acquire(False)) + sem.release() + +class SemaphoreTests(BaseSemaphoreTests): + """ + Tests for unbounded semaphores. + """ + + def test_release_unacquired(self): + # Unbounded releases are allowed and increment the semaphore's value + sem = self.semtype(1) + sem.release() + sem.acquire() + sem.acquire() + sem.release() + + +class BoundedSemaphoreTests(BaseSemaphoreTests): + """ + Tests for bounded semaphores. + """ + + def test_release_unacquired(self): + # Cannot go past the initial value + sem = self.semtype() + self.assertRaises(ValueError, sem.release) + sem.acquire() + sem.release() + self.assertRaises(ValueError, sem.release) diff -Nru python-gevent-0.13.7/greentest/2.7/nokia.pem python-gevent-1.0/greentest/2.7/nokia.pem --- python-gevent-0.13.7/greentest/2.7/nokia.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/nokia.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,31 @@ +# Certificate for projects.developer.nokia.com:443 (see issue 13034) +-----BEGIN CERTIFICATE----- +MIIFLDCCBBSgAwIBAgIQLubqdkCgdc7lAF9NfHlUmjANBgkqhkiG9w0BAQUFADCB +vDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL +ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2Ug +YXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykxMDE2MDQGA1UEAxMt +VmVyaVNpZ24gQ2xhc3MgMyBJbnRlcm5hdGlvbmFsIFNlcnZlciBDQSAtIEczMB4X +DTExMDkyMTAwMDAwMFoXDTEyMDkyMDIzNTk1OVowcTELMAkGA1UEBhMCRkkxDjAM +BgNVBAgTBUVzcG9vMQ4wDAYDVQQHFAVFc3BvbzEOMAwGA1UEChQFTm9raWExCzAJ +BgNVBAsUAkJJMSUwIwYDVQQDFBxwcm9qZWN0cy5kZXZlbG9wZXIubm9raWEuY29t +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCr92w1bpHYSYxUEx8N/8Iddda2 +lYi+aXNtQfV/l2Fw9Ykv3Ipw4nLeGTj18FFlAZgMdPRlgrzF/NNXGw/9l3/qKdow +CypkQf8lLaxb9Ze1E/KKmkRJa48QTOqvo6GqKuTI6HCeGlG1RxDb8YSKcQWLiytn +yj3Wp4MgRQO266xmMQIDAQABo4IB9jCCAfIwQQYDVR0RBDowOIIccHJvamVjdHMu +ZGV2ZWxvcGVyLm5va2lhLmNvbYIYcHJvamVjdHMuZm9ydW0ubm9raWEuY29tMAkG +A1UdEwQCMAAwCwYDVR0PBAQDAgWgMEEGA1UdHwQ6MDgwNqA0oDKGMGh0dHA6Ly9T +VlJJbnRsLUczLWNybC52ZXJpc2lnbi5jb20vU1ZSSW50bEczLmNybDBEBgNVHSAE +PTA7MDkGC2CGSAGG+EUBBxcDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZl +cmlzaWduLmNvbS9ycGEwKAYDVR0lBCEwHwYJYIZIAYb4QgQBBggrBgEFBQcDAQYI +KwYBBQUHAwIwcgYIKwYBBQUHAQEEZjBkMCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz +cC52ZXJpc2lnbi5jb20wPAYIKwYBBQUHMAKGMGh0dHA6Ly9TVlJJbnRsLUczLWFp +YS52ZXJpc2lnbi5jb20vU1ZSSW50bEczLmNlcjBuBggrBgEFBQcBDARiMGChXqBc +MFowWDBWFglpbWFnZS9naWYwITAfMAcGBSsOAwIaBBRLa7kolgYMu9BSOJsprEsH +iyEFGDAmFiRodHRwOi8vbG9nby52ZXJpc2lnbi5jb20vdnNsb2dvMS5naWYwDQYJ +KoZIhvcNAQEFBQADggEBACQuPyIJqXwUyFRWw9x5yDXgMW4zYFopQYOw/ItRY522 +O5BsySTh56BWS6mQB07XVfxmYUGAvRQDA5QHpmY8jIlNwSmN3s8RKo+fAtiNRlcL +x/mWSfuMs3D/S6ev3D6+dpEMZtjrhOdctsarMKp8n/hPbwhAbg5hVjpkW5n8vz2y +0KxvvkA1AxpLwpVv7OlK17ttzIHw8bp9HTlHBU5s8bKz4a565V/a5HI0CSEv/+0y +ko4/ghTnZc1CkmUngKKeFMSah/mT/xAh8XnE2l1AazFa8UKuYki1e+ArHaGZc4ix +UYOtiRphwfuYQhRZ7qX9q2MMkCMI65XNK/SaFrAbbG0= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/sha256.pem python-gevent-1.0/greentest/2.7/sha256.pem --- python-gevent-0.13.7/greentest/2.7/sha256.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/sha256.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,129 @@ +# Certificate chain for https://sha256.tbs-internet.com + 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com + i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC +-----BEGIN CERTIFICATE----- +MIIGXTCCBUWgAwIBAgIRAMmag+ygSAdxZsbyzYjhuW0wDQYJKoZIhvcNAQELBQAw +gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl +bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u +ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv +cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg +Q0EgU0dDMB4XDTEwMDIxODAwMDAwMFoXDTEyMDIxOTIzNTk1OVowgcsxCzAJBgNV +BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV +BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM +VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS +c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0 +LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbuM8VT7f0nntwu +N3F7v9KIBlhKNAxqCrziOXU5iqUt8HrQB3DtHbdmII+CpVUlwlmepsx6G+srEZ9a +MIGAy0nxi5aLb7watkyIdPjJTMvTUBQ/+RPWzt5JtYbbY9BlJ+yci0dctP74f4NU +ISLtlrEjUbf2gTohLrcE01TfmOF6PDEbB5PKDi38cB3NzKfizWfrOaJW6Q1C1qOJ +y4/4jkUREX1UFUIxzx7v62VfjXSGlcjGpBX1fvtABQOSLeE0a6gciDZs1REqroFf +5eXtqYphpTa14Z83ITXMfgg5Nze1VtMnzI9Qx4blYBw4dgQVEuIsYr7FDBOITDzc +VEVXZx0CAwEAAaOCAj8wggI7MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf +2YIfMB0GA1UdDgQWBBSJKI/AYVI9RQNY0QPIqc8ej2QivTAOBgNVHQ8BAf8EBAMC +BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG +CisGAQQBgjcKAwMGCWCGSAGG+EIEATBMBgNVHSAERTBDMEEGCysGAQQBgOU3AgQB +MDIwMAYIKwYBBQUHAgEWJGh0dHBzOi8vd3d3LnRicy1pbnRlcm5ldC5jb20vQ0Ev +Q1BTNDBtBgNVHR8EZjBkMDKgMKAuhixodHRwOi8vY3JsLnRicy1pbnRlcm5ldC5j +b20vVEJTWDUwOUNBU0dDLmNybDAuoCygKoYoaHR0cDovL2NybC50YnMteDUwOS5j +b20vVEJTWDUwOUNBU0dDLmNybDCBpgYIKwYBBQUHAQEEgZkwgZYwOAYIKwYBBQUH +MAKGLGh0dHA6Ly9jcnQudGJzLWludGVybmV0LmNvbS9UQlNYNTA5Q0FTR0MuY3J0 +MDQGCCsGAQUFBzAChihodHRwOi8vY3J0LnRicy14NTA5LmNvbS9UQlNYNTA5Q0FT +R0MuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC50YnMteDUwOS5jb20wPwYD +VR0RBDgwNoIXc2hhMjU2LnRicy1pbnRlcm5ldC5jb22CG3d3dy5zaGEyNTYudGJz +LWludGVybmV0LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAA5NL0D4QSqhErhlkdPmz +XtiMvdGL+ZehM4coTRIpasM/Agt36Rc0NzCvnQwKE+wkngg1Gy2qe7Q0E/ziqBtB +fZYzdVgu1zdiL4kTaf+wFKYAFGsFbyeEmXysy+CMwaNoF2vpSjCU1UD56bEnTX/W +fxVZYxtBQUpnu2wOsm8cDZuZRv9XrYgAhGj9Tt6F0aVHSDGn59uwShG1+BVF/uju +SCyPTTjL1oc7YElJUzR/x4mQJYvtQI8gDIDAGEOs7v3R/gKa5EMfbUQUI4C84UbI +Yz09Jdnws/MkC/Hm1BZEqk89u7Hvfv+oHqEb0XaUo0TDfsxE0M1sMdnLb91QNQBm +UQ== +-----END CERTIFICATE----- + 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC + i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root +-----BEGIN CERTIFICATE----- +MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv +MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk +ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF +eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow +gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl +bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u +ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv +cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg +Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6 +rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0 +9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ +ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk +owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G +Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk +9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf +2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ +MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3 +AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk +ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k +by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw +cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV +VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B +ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN +AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232 +euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY +1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98 +RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz +8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV +v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E= +-----END CERTIFICATE----- + 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root + i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC +-----BEGIN CERTIFICATE----- +MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB +kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw +IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT +AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0 +ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB +IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05 +4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6 +2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh +alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv +u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW +xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p +XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd +tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX +BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov +L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN +AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO +rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd +FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM ++bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI +3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb ++M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g= +-----END CERTIFICATE----- + 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC + i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC +-----BEGIN CERTIFICATE----- +MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB +kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw +IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG +EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD +VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu +dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 +E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ +D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK +4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq +lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW +bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB +o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT +MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js +LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr +BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB +AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft +Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj +j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH +KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv +2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 +mfnGV/TJVTl4uix5yaaIK/QI +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/2.7/subprocessdata/sigchild_ignore.py python-gevent-1.0/greentest/2.7/subprocessdata/sigchild_ignore.py --- python-gevent-0.13.7/greentest/2.7/subprocessdata/sigchild_ignore.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/subprocessdata/sigchild_ignore.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,6 @@ +import signal, subprocess, sys +# On Linux this causes os.waitpid to fail with OSError as the OS has already +# reaped our child process. The wait() passing the OSError on to the caller +# and causing us to exit with an error is what we are testing against. +signal.signal(signal.SIGCHLD, signal.SIG_IGN) +subprocess.Popen([sys.executable, '-c', 'print("albatross")']).wait() diff -Nru python-gevent-0.13.7/greentest/2.7/test_asyncore.py python-gevent-1.0/greentest/2.7/test_asyncore.py --- python-gevent-0.13.7/greentest/2.7/test_asyncore.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_asyncore.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,722 @@ +import asyncore +import unittest +import select +import os +import socket +import sys +import time +import warnings +import errno + +from test import test_support +from test.test_support import TESTFN, run_unittest, unlink +from StringIO import StringIO + +try: + import threading +except ImportError: + threading = None + +HOST = test_support.HOST + +class dummysocket: + def __init__(self): + self.closed = False + + def close(self): + self.closed = True + + def fileno(self): + return 42 + +class dummychannel: + def __init__(self): + self.socket = dummysocket() + + def close(self): + self.socket.close() + +class exitingdummy: + def __init__(self): + pass + + def handle_read_event(self): + raise asyncore.ExitNow() + + handle_write_event = handle_read_event + handle_close = handle_read_event + handle_expt_event = handle_read_event + +class crashingdummy: + def __init__(self): + self.error_handled = False + + def handle_read_event(self): + raise Exception() + + handle_write_event = handle_read_event + handle_close = handle_read_event + handle_expt_event = handle_read_event + + def handle_error(self): + self.error_handled = True + +# used when testing senders; just collects what it gets until newline is sent +def capture_server(evt, buf, serv): + try: + serv.listen(5) + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 200 + while n > 0: + r, w, e = select.select([conn], [], []) + if r: + data = conn.recv(10) + # keep everything except for the newline terminator + buf.write(data.replace('\n', '')) + if '\n' in data: + break + n -= 1 + time.sleep(0.01) + + conn.close() + finally: + serv.close() + evt.set() + + +class HelperFunctionTests(unittest.TestCase): + def test_readwriteexc(self): + # Check exception handling behavior of read, write and _exception + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore read/write/_exception calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) + self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) + self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.read(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore.write(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore._exception(tr2) + self.assertEqual(tr2.error_handled, True) + + # asyncore.readwrite uses constants in the select module that + # are not present in Windows systems (see this thread: + # http://mail.python.org/pipermail/python-list/2001-October/109973.html) + # These constants should be present as long as poll is available + + @unittest.skipUnless(hasattr(select, 'poll'), 'select.poll required') + def test_readwrite(self): + # Check that correct methods are called by readwrite() + + attributes = ('read', 'expt', 'write', 'closed', 'error_handled') + + expected = ( + (select.POLLIN, 'read'), + (select.POLLPRI, 'expt'), + (select.POLLOUT, 'write'), + (select.POLLERR, 'closed'), + (select.POLLHUP, 'closed'), + (select.POLLNVAL, 'closed'), + ) + + class testobj: + def __init__(self): + self.read = False + self.write = False + self.closed = False + self.expt = False + self.error_handled = False + + def handle_read_event(self): + self.read = True + + def handle_write_event(self): + self.write = True + + def handle_close(self): + self.closed = True + + def handle_expt_event(self): + self.expt = True + + def handle_error(self): + self.error_handled = True + + for flag, expectedattr in expected: + tobj = testobj() + self.assertEqual(getattr(tobj, expectedattr), False) + asyncore.readwrite(tobj, flag) + + # Only the attribute modified by the routine we expect to be + # called should be True. + for attr in attributes: + self.assertEqual(getattr(tobj, attr), attr==expectedattr) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + self.assertEqual(tr2.error_handled, False) + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + def test_closeall(self): + self.closeall_check(False) + + def test_closeall_default(self): + self.closeall_check(True) + + def closeall_check(self, usedefault): + # Check that close_all() closes everything in a given map + + l = [] + testmap = {} + for i in range(10): + c = dummychannel() + l.append(c) + self.assertEqual(c.socket.closed, False) + testmap[i] = c + + if usedefault: + socketmap = asyncore.socket_map + try: + asyncore.socket_map = testmap + asyncore.close_all() + finally: + testmap, asyncore.socket_map = asyncore.socket_map, socketmap + else: + asyncore.close_all(testmap) + + self.assertEqual(len(testmap), 0) + + for c in l: + self.assertEqual(c.socket.closed, True) + + def test_compact_traceback(self): + try: + raise Exception("I don't like spam!") + except: + real_t, real_v, real_tb = sys.exc_info() + r = asyncore.compact_traceback() + else: + self.fail("Expected exception") + + (f, function, line), t, v, info = r + self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') + self.assertEqual(function, 'test_compact_traceback') + self.assertEqual(t, real_t) + self.assertEqual(v, real_v) + self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) + + +class DispatcherTests(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_basic(self): + d = asyncore.dispatcher() + self.assertEqual(d.readable(), True) + self.assertEqual(d.writable(), True) + + def test_repr(self): + d = asyncore.dispatcher() + self.assertEqual(repr(d), '' % id(d)) + + def test_log(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log() (to stderr) + fp = StringIO() + stderr = sys.stderr + l1 = "Lovely spam! Wonderful spam!" + l2 = "I don't like spam!" + try: + sys.stderr = fp + d.log(l1) + d.log(l2) + finally: + sys.stderr = stderr + + lines = fp.getvalue().splitlines() + self.assertEqual(lines, ['log: %s' % l1, 'log: %s' % l2]) + + def test_log_info(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + l1 = "Have you got anything without spam?" + l2 = "Why can't she have egg bacon spam and sausage?" + l3 = "THAT'S got spam in it!" + try: + sys.stdout = fp + d.log_info(l1, 'EGGS') + d.log_info(l2) + d.log_info(l3, 'SPAM') + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] + + self.assertEqual(lines, expected) + + def test_unhandled(self): + d = asyncore.dispatcher() + d.ignore_log_types = () + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + try: + sys.stdout = fp + d.handle_expt() + d.handle_read() + d.handle_write() + d.handle_connect() + d.handle_accept() + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['warning: unhandled incoming priority event', + 'warning: unhandled read event', + 'warning: unhandled write event', + 'warning: unhandled connect event', + 'warning: unhandled accept event'] + self.assertEqual(lines, expected) + + def test_issue_8594(self): + # XXX - this test is supposed to be removed in next major Python + # version + d = asyncore.dispatcher(socket.socket()) + # make sure the error message no longer refers to the socket + # object but the dispatcher instance instead + self.assertRaisesRegexp(AttributeError, 'dispatcher instance', + getattr, d, 'foo') + # cheap inheritance with the underlying socket is supposed + # to still work but a DeprecationWarning is expected + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + family = d.family + self.assertEqual(family, socket.AF_INET) + self.assertEqual(len(w), 1) + self.assertTrue(issubclass(w[0].category, DeprecationWarning)) + + def test_strerror(self): + # refers to bug #8573 + err = asyncore._strerror(errno.EPERM) + if hasattr(os, 'strerror'): + self.assertEqual(err, os.strerror(errno.EPERM)) + err = asyncore._strerror(-1) + self.assertTrue(err != "") + + +class dispatcherwithsend_noread(asyncore.dispatcher_with_send): + def readable(self): + return False + + def handle_connect(self): + pass + +class DispatcherWithSendTests(unittest.TestCase): + usepoll = False + + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + @unittest.skipUnless(threading, 'Threading required for this test.') + @test_support.reap_threads + def test_send(self): + evt = threading.Event() + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.settimeout(3) + port = test_support.bind_port(sock) + + cap = StringIO() + args = (evt, cap, sock) + t = threading.Thread(target=capture_server, args=args) + t.start() + try: + # wait a little longer for the server to initialize (it sometimes + # refuses connections on slow machines without this wait) + time.sleep(0.2) + + data = "Suppose there isn't a 16-ton weight?" + d = dispatcherwithsend_noread() + d.create_socket(socket.AF_INET, socket.SOCK_STREAM) + d.connect((HOST, port)) + + # give time for socket to connect + time.sleep(0.1) + + d.send(data) + d.send(data) + d.send('\n') + + n = 1000 + while d.out_buffer and n > 0: + asyncore.poll() + n -= 1 + + evt.wait() + + self.assertEqual(cap.getvalue(), data*2) + finally: + t.join() + + +class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): + usepoll = True + +@unittest.skipUnless(hasattr(asyncore, 'file_wrapper'), + 'asyncore.file_wrapper required') +class FileWrapperTest(unittest.TestCase): + def setUp(self): + self.d = "It's not dead, it's sleeping!" + with file(TESTFN, 'w') as h: + h.write(self.d) + + def tearDown(self): + unlink(TESTFN) + + def test_recv(self): + fd = os.open(TESTFN, os.O_RDONLY) + w = asyncore.file_wrapper(fd) + os.close(fd) + + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) + self.assertEqual(w.recv(13), "It's not dead") + self.assertEqual(w.read(6), ", it's") + w.close() + self.assertRaises(OSError, w.read, 1) + + + def test_send(self): + d1 = "Come again?" + d2 = "I want to buy some cheese." + fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) + w = asyncore.file_wrapper(fd) + os.close(fd) + + w.write(d1) + w.send(d2) + w.close() + self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) + + @unittest.skipUnless(hasattr(asyncore, 'file_dispatcher'), + 'asyncore.file_dispatcher required') + def test_dispatcher(self): + fd = os.open(TESTFN, os.O_RDONLY) + data = [] + class FileDispatcher(asyncore.file_dispatcher): + def handle_read(self): + data.append(self.recv(29)) + s = FileDispatcher(fd) + os.close(fd) + asyncore.loop(timeout=0.01, use_poll=True, count=2) + self.assertEqual(b"".join(data), self.d) + + +class BaseTestHandler(asyncore.dispatcher): + + def __init__(self, sock=None): + asyncore.dispatcher.__init__(self, sock) + self.flag = False + + def handle_accept(self): + raise Exception("handle_accept not supposed to be called") + + def handle_connect(self): + raise Exception("handle_connect not supposed to be called") + + def handle_expt(self): + raise Exception("handle_expt not supposed to be called") + + def handle_close(self): + raise Exception("handle_close not supposed to be called") + + def handle_error(self): + raise + + +class TCPServer(asyncore.dispatcher): + """A server which listens on an address and dispatches the + connection to a handler. + """ + + def __init__(self, handler=BaseTestHandler, host=HOST, port=0): + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.set_reuse_addr() + self.bind((host, port)) + self.listen(5) + self.handler = handler + + @property + def address(self): + return self.socket.getsockname()[:2] + + def handle_accept(self): + sock, addr = self.accept() + self.handler(sock) + + def handle_error(self): + raise + + +class BaseClient(BaseTestHandler): + + def __init__(self, address): + BaseTestHandler.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.connect(address) + + def handle_connect(self): + pass + + +class BaseTestAPI(unittest.TestCase): + + def tearDown(self): + asyncore.close_all() + + def loop_waiting_for_flag(self, instance, timeout=5): + timeout = float(timeout) / 100 + count = 100 + while asyncore.socket_map and count > 0: + asyncore.loop(timeout=0.01, count=1, use_poll=self.use_poll) + if instance.flag: + return + count -= 1 + time.sleep(timeout) + self.fail("flag not set") + + def test_handle_connect(self): + # make sure handle_connect is called on connect() + + class TestClient(BaseClient): + def handle_connect(self): + self.flag = True + + server = TCPServer() + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + def test_handle_accept(self): + # make sure handle_accept() is called when a client connects + + class TestListener(BaseTestHandler): + + def __init__(self): + BaseTestHandler.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.bind((HOST, 0)) + self.listen(5) + self.address = self.socket.getsockname()[:2] + + def handle_accept(self): + self.flag = True + + server = TestListener() + client = BaseClient(server.address) + self.loop_waiting_for_flag(server) + + def test_handle_read(self): + # make sure handle_read is called on data received + + class TestClient(BaseClient): + def handle_read(self): + self.flag = True + + class TestHandler(BaseTestHandler): + def __init__(self, conn): + BaseTestHandler.__init__(self, conn) + self.send('x' * 1024) + + server = TCPServer(TestHandler) + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + def test_handle_write(self): + # make sure handle_write is called + + class TestClient(BaseClient): + def handle_write(self): + self.flag = True + + server = TCPServer() + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + def test_handle_close(self): + # make sure handle_close is called when the other end closes + # the connection + + class TestClient(BaseClient): + + def handle_read(self): + # in order to make handle_close be called we are supposed + # to make at least one recv() call + self.recv(1024) + + def handle_close(self): + self.flag = True + self.close() + + class TestHandler(BaseTestHandler): + def __init__(self, conn): + BaseTestHandler.__init__(self, conn) + self.close() + + server = TCPServer(TestHandler) + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + @unittest.skipIf(sys.platform.startswith("sunos"), + "OOB support is broken on Solaris") + def test_handle_expt(self): + # Make sure handle_expt is called on OOB data received. + # Note: this might fail on some platforms as OOB data is + # tenuously supported and rarely used. + + class TestClient(BaseClient): + def handle_expt(self): + self.flag = True + + class TestHandler(BaseTestHandler): + def __init__(self, conn): + BaseTestHandler.__init__(self, conn) + self.socket.send(chr(244), socket.MSG_OOB) + + server = TCPServer(TestHandler) + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + def test_handle_error(self): + + class TestClient(BaseClient): + def handle_write(self): + 1.0 / 0 + def handle_error(self): + self.flag = True + try: + raise + except ZeroDivisionError: + pass + else: + raise Exception("exception not raised") + + server = TCPServer() + client = TestClient(server.address) + self.loop_waiting_for_flag(client) + + def test_connection_attributes(self): + server = TCPServer() + client = BaseClient(server.address) + + # we start disconnected + self.assertFalse(server.connected) + self.assertTrue(server.accepting) + # this can't be taken for granted across all platforms + #self.assertFalse(client.connected) + self.assertFalse(client.accepting) + + # execute some loops so that client connects to server + asyncore.loop(timeout=0.01, use_poll=self.use_poll, count=100) + self.assertFalse(server.connected) + self.assertTrue(server.accepting) + self.assertTrue(client.connected) + self.assertFalse(client.accepting) + + # disconnect the client + client.close() + self.assertFalse(server.connected) + self.assertTrue(server.accepting) + self.assertFalse(client.connected) + self.assertFalse(client.accepting) + + # stop serving + server.close() + self.assertFalse(server.connected) + self.assertFalse(server.accepting) + + def test_create_socket(self): + s = asyncore.dispatcher() + s.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.assertEqual(s.socket.family, socket.AF_INET) + self.assertEqual(s.socket.type, socket.SOCK_STREAM) + + def test_bind(self): + s1 = asyncore.dispatcher() + s1.create_socket(socket.AF_INET, socket.SOCK_STREAM) + s1.bind((HOST, 0)) + s1.listen(5) + port = s1.socket.getsockname()[1] + + s2 = asyncore.dispatcher() + s2.create_socket(socket.AF_INET, socket.SOCK_STREAM) + # EADDRINUSE indicates the socket was correctly bound + self.assertRaises(socket.error, s2.bind, (HOST, port)) + + def test_set_reuse_addr(self): + sock = socket.socket() + try: + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + except socket.error: + unittest.skip("SO_REUSEADDR not supported on this platform") + else: + # if SO_REUSEADDR succeeded for sock we expect asyncore + # to do the same + s = asyncore.dispatcher(socket.socket()) + self.assertFalse(s.socket.getsockopt(socket.SOL_SOCKET, + socket.SO_REUSEADDR)) + s.create_socket(socket.AF_INET, socket.SOCK_STREAM) + s.set_reuse_addr() + self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET, + socket.SO_REUSEADDR)) + finally: + sock.close() + + +class TestAPI_UseSelect(BaseTestAPI): + use_poll = False + +@unittest.skipUnless(hasattr(select, 'poll'), 'select.poll required') +class TestAPI_UsePoll(BaseTestAPI): + use_poll = True + + +def test_main(): + tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, + DispatcherWithSendTests_UsePoll, TestAPI_UseSelect, + TestAPI_UsePoll, FileWrapperTest] + run_unittest(*tests) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_ftplib.py python-gevent-1.0/greentest/2.7/test_ftplib.py --- python-gevent-0.13.7/greentest/2.7/test_ftplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_ftplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,778 @@ +"""Test script for ftplib module.""" + +# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS +# environment + +import ftplib +import asyncore +import asynchat +import socket +import StringIO +import errno +import os +try: + import ssl +except ImportError: + ssl = None + +from unittest import TestCase +from test import test_support +from test.test_support import HOST +threading = test_support.import_module('threading') + + +# the dummy data returned by server over the data channel when +# RETR, LIST and NLST commands are issued +RETR_DATA = 'abcde12345\r\n' * 1000 +LIST_DATA = 'foo\r\nbar\r\n' +NLST_DATA = 'foo\r\nbar\r\n' + + +class DummyDTPHandler(asynchat.async_chat): + dtp_conn_closed = False + + def __init__(self, conn, baseclass): + asynchat.async_chat.__init__(self, conn) + self.baseclass = baseclass + self.baseclass.last_received_data = '' + + def handle_read(self): + self.baseclass.last_received_data += self.recv(1024) + + def handle_close(self): + # XXX: this method can be called many times in a row for a single + # connection, including in clear-text (non-TLS) mode. + # (behaviour witnessed with test_data_connection) + if not self.dtp_conn_closed: + self.baseclass.push('226 transfer complete') + self.close() + self.dtp_conn_closed = True + + def handle_error(self): + raise + + +class DummyFTPHandler(asynchat.async_chat): + + dtp_handler = DummyDTPHandler + + def __init__(self, conn): + asynchat.async_chat.__init__(self, conn) + self.set_terminator("\r\n") + self.in_buffer = [] + self.dtp = None + self.last_received_cmd = None + self.last_received_data = '' + self.next_response = '' + self.rest = None + self.push('220 welcome') + + def collect_incoming_data(self, data): + self.in_buffer.append(data) + + def found_terminator(self): + line = ''.join(self.in_buffer) + self.in_buffer = [] + if self.next_response: + self.push(self.next_response) + self.next_response = '' + cmd = line.split(' ')[0].lower() + self.last_received_cmd = cmd + space = line.find(' ') + if space != -1: + arg = line[space + 1:] + else: + arg = "" + if hasattr(self, 'cmd_' + cmd): + method = getattr(self, 'cmd_' + cmd) + method(arg) + else: + self.push('550 command "%s" not understood.' %cmd) + + def handle_error(self): + raise + + def push(self, data): + asynchat.async_chat.push(self, data + '\r\n') + + def cmd_port(self, arg): + addr = map(int, arg.split(',')) + ip = '%d.%d.%d.%d' %tuple(addr[:4]) + port = (addr[4] * 256) + addr[5] + s = socket.create_connection((ip, port), timeout=10) + self.dtp = self.dtp_handler(s, baseclass=self) + self.push('200 active data connection established') + + def cmd_pasv(self, arg): + sock = socket.socket() + sock.bind((self.socket.getsockname()[0], 0)) + sock.listen(5) + sock.settimeout(10) + ip, port = sock.getsockname()[:2] + ip = ip.replace('.', ',') + p1, p2 = divmod(port, 256) + self.push('227 entering passive mode (%s,%d,%d)' %(ip, p1, p2)) + conn, addr = sock.accept() + self.dtp = self.dtp_handler(conn, baseclass=self) + + def cmd_eprt(self, arg): + af, ip, port = arg.split(arg[0])[1:-1] + port = int(port) + s = socket.create_connection((ip, port), timeout=10) + self.dtp = self.dtp_handler(s, baseclass=self) + self.push('200 active data connection established') + + def cmd_epsv(self, arg): + sock = socket.socket(socket.AF_INET6) + sock.bind((self.socket.getsockname()[0], 0)) + sock.listen(5) + sock.settimeout(10) + port = sock.getsockname()[1] + self.push('229 entering extended passive mode (|||%d|)' %port) + conn, addr = sock.accept() + self.dtp = self.dtp_handler(conn, baseclass=self) + + def cmd_echo(self, arg): + # sends back the received string (used by the test suite) + self.push(arg) + + def cmd_user(self, arg): + self.push('331 username ok') + + def cmd_pass(self, arg): + self.push('230 password ok') + + def cmd_acct(self, arg): + self.push('230 acct ok') + + def cmd_rnfr(self, arg): + self.push('350 rnfr ok') + + def cmd_rnto(self, arg): + self.push('250 rnto ok') + + def cmd_dele(self, arg): + self.push('250 dele ok') + + def cmd_cwd(self, arg): + self.push('250 cwd ok') + + def cmd_size(self, arg): + self.push('250 1000') + + def cmd_mkd(self, arg): + self.push('257 "%s"' %arg) + + def cmd_rmd(self, arg): + self.push('250 rmd ok') + + def cmd_pwd(self, arg): + self.push('257 "pwd ok"') + + def cmd_type(self, arg): + self.push('200 type ok') + + def cmd_quit(self, arg): + self.push('221 quit ok') + self.close() + + def cmd_stor(self, arg): + self.push('125 stor ok') + + def cmd_rest(self, arg): + self.rest = arg + self.push('350 rest ok') + + def cmd_retr(self, arg): + self.push('125 retr ok') + if self.rest is not None: + offset = int(self.rest) + else: + offset = 0 + self.dtp.push(RETR_DATA[offset:]) + self.dtp.close_when_done() + self.rest = None + + def cmd_list(self, arg): + self.push('125 list ok') + self.dtp.push(LIST_DATA) + self.dtp.close_when_done() + + def cmd_nlst(self, arg): + self.push('125 nlst ok') + self.dtp.push(NLST_DATA) + self.dtp.close_when_done() + + +class DummyFTPServer(asyncore.dispatcher, threading.Thread): + + handler = DummyFTPHandler + + def __init__(self, address, af=socket.AF_INET): + threading.Thread.__init__(self) + asyncore.dispatcher.__init__(self) + self.create_socket(af, socket.SOCK_STREAM) + self.bind(address) + self.listen(5) + self.active = False + self.active_lock = threading.Lock() + self.host, self.port = self.socket.getsockname()[:2] + + def start(self): + assert not self.active + self.__flag = threading.Event() + threading.Thread.start(self) + self.__flag.wait() + + def run(self): + self.active = True + self.__flag.set() + while self.active and asyncore.socket_map: + self.active_lock.acquire() + asyncore.loop(timeout=0.1, count=1) + self.active_lock.release() + asyncore.close_all(ignore_all=True) + + def stop(self): + assert self.active + self.active = False + self.join() + + def handle_accept(self): + conn, addr = self.accept() + self.handler = self.handler(conn) + self.close() + + def handle_connect(self): + self.close() + handle_read = handle_connect + + def writable(self): + return 0 + + def handle_error(self): + raise + + +if ssl is not None: + + CERTFILE = os.path.join(os.path.dirname(__file__), "keycert.pem") + + class SSLConnection(object, asyncore.dispatcher): + """An asyncore.dispatcher subclass supporting TLS/SSL.""" + + _ssl_accepting = False + _ssl_closing = False + + def secure_connection(self): + self.socket = ssl.wrap_socket(self.socket, suppress_ragged_eofs=False, + certfile=CERTFILE, server_side=True, + do_handshake_on_connect=False, + ssl_version=ssl.PROTOCOL_SSLv23) + self._ssl_accepting = True + + def _do_ssl_handshake(self): + try: + self.socket.do_handshake() + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return + elif err.args[0] == ssl.SSL_ERROR_EOF: + return self.handle_close() + raise + except socket.error, err: + if err.args[0] == errno.ECONNABORTED: + return self.handle_close() + else: + self._ssl_accepting = False + + def _do_ssl_shutdown(self): + self._ssl_closing = True + try: + self.socket = self.socket.unwrap() + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return + except socket.error, err: + # Any "socket error" corresponds to a SSL_ERROR_SYSCALL return + # from OpenSSL's SSL_shutdown(), corresponding to a + # closed socket condition. See also: + # http://www.mail-archive.com/openssl-users@openssl.org/msg60710.html + pass + self._ssl_closing = False + super(SSLConnection, self).close() + + def handle_read_event(self): + if self._ssl_accepting: + self._do_ssl_handshake() + elif self._ssl_closing: + self._do_ssl_shutdown() + else: + super(SSLConnection, self).handle_read_event() + + def handle_write_event(self): + if self._ssl_accepting: + self._do_ssl_handshake() + elif self._ssl_closing: + self._do_ssl_shutdown() + else: + super(SSLConnection, self).handle_write_event() + + def send(self, data): + try: + return super(SSLConnection, self).send(data) + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN, + ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return 0 + raise + + def recv(self, buffer_size): + try: + return super(SSLConnection, self).recv(buffer_size) + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return '' + if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN): + self.handle_close() + return '' + raise + + def handle_error(self): + raise + + def close(self): + if (isinstance(self.socket, ssl.SSLSocket) and + self.socket._sslobj is not None): + self._do_ssl_shutdown() + + + class DummyTLS_DTPHandler(SSLConnection, DummyDTPHandler): + """A DummyDTPHandler subclass supporting TLS/SSL.""" + + def __init__(self, conn, baseclass): + DummyDTPHandler.__init__(self, conn, baseclass) + if self.baseclass.secure_data_channel: + self.secure_connection() + + + class DummyTLS_FTPHandler(SSLConnection, DummyFTPHandler): + """A DummyFTPHandler subclass supporting TLS/SSL.""" + + dtp_handler = DummyTLS_DTPHandler + + def __init__(self, conn): + DummyFTPHandler.__init__(self, conn) + self.secure_data_channel = False + + def cmd_auth(self, line): + """Set up secure control channel.""" + self.push('234 AUTH TLS successful') + self.secure_connection() + + def cmd_pbsz(self, line): + """Negotiate size of buffer for secure data transfer. + For TLS/SSL the only valid value for the parameter is '0'. + Any other value is accepted but ignored. + """ + self.push('200 PBSZ=0 successful.') + + def cmd_prot(self, line): + """Setup un/secure data channel.""" + arg = line.upper() + if arg == 'C': + self.push('200 Protection set to Clear') + self.secure_data_channel = False + elif arg == 'P': + self.push('200 Protection set to Private') + self.secure_data_channel = True + else: + self.push("502 Unrecognized PROT type (use C or P).") + + + class DummyTLS_FTPServer(DummyFTPServer): + handler = DummyTLS_FTPHandler + + +class TestFTPClass(TestCase): + + def setUp(self): + self.server = DummyFTPServer((HOST, 0)) + self.server.start() + self.client = ftplib.FTP(timeout=10) + self.client.connect(self.server.host, self.server.port) + + def tearDown(self): + self.client.close() + self.server.stop() + + def test_getwelcome(self): + self.assertEqual(self.client.getwelcome(), '220 welcome') + + def test_sanitize(self): + self.assertEqual(self.client.sanitize('foo'), repr('foo')) + self.assertEqual(self.client.sanitize('pass 12345'), repr('pass *****')) + self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****')) + + def test_exceptions(self): + self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400') + self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499') + self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500') + self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 599') + self.assertRaises(ftplib.error_proto, self.client.sendcmd, 'echo 999') + + def test_all_errors(self): + exceptions = (ftplib.error_reply, ftplib.error_temp, ftplib.error_perm, + ftplib.error_proto, ftplib.Error, IOError, EOFError) + for x in exceptions: + try: + raise x('exception not included in all_errors set') + except ftplib.all_errors: + pass + + def test_set_pasv(self): + # passive mode is supposed to be enabled by default + self.assertTrue(self.client.passiveserver) + self.client.set_pasv(True) + self.assertTrue(self.client.passiveserver) + self.client.set_pasv(False) + self.assertFalse(self.client.passiveserver) + + def test_voidcmd(self): + self.client.voidcmd('echo 200') + self.client.voidcmd('echo 299') + self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 199') + self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300') + + def test_login(self): + self.client.login() + + def test_acct(self): + self.client.acct('passwd') + + def test_rename(self): + self.client.rename('a', 'b') + self.server.handler.next_response = '200' + self.assertRaises(ftplib.error_reply, self.client.rename, 'a', 'b') + + def test_delete(self): + self.client.delete('foo') + self.server.handler.next_response = '199' + self.assertRaises(ftplib.error_reply, self.client.delete, 'foo') + + def test_size(self): + self.client.size('foo') + + def test_mkd(self): + dir = self.client.mkd('/foo') + self.assertEqual(dir, '/foo') + + def test_rmd(self): + self.client.rmd('foo') + + def test_pwd(self): + dir = self.client.pwd() + self.assertEqual(dir, 'pwd ok') + + def test_quit(self): + self.assertEqual(self.client.quit(), '221 quit ok') + # Ensure the connection gets closed; sock attribute should be None + self.assertEqual(self.client.sock, None) + + def test_retrbinary(self): + received = [] + self.client.retrbinary('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA) + + def test_retrbinary_rest(self): + for rest in (0, 10, 20): + received = [] + self.client.retrbinary('retr', received.append, rest=rest) + self.assertEqual(''.join(received), RETR_DATA[rest:], + msg='rest test case %d %d %d' % (rest, + len(''.join(received)), + len(RETR_DATA[rest:]))) + + def test_retrlines(self): + received = [] + self.client.retrlines('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA.replace('\r\n', '')) + + def test_storbinary(self): + f = StringIO.StringIO(RETR_DATA) + self.client.storbinary('stor', f) + self.assertEqual(self.server.handler.last_received_data, RETR_DATA) + # test new callback arg + flag = [] + f.seek(0) + self.client.storbinary('stor', f, callback=lambda x: flag.append(None)) + self.assertTrue(flag) + + def test_storbinary_rest(self): + f = StringIO.StringIO(RETR_DATA) + for r in (30, '30'): + f.seek(0) + self.client.storbinary('stor', f, rest=r) + self.assertEqual(self.server.handler.rest, str(r)) + + def test_storlines(self): + f = StringIO.StringIO(RETR_DATA.replace('\r\n', '\n')) + self.client.storlines('stor', f) + self.assertEqual(self.server.handler.last_received_data, RETR_DATA) + # test new callback arg + flag = [] + f.seek(0) + self.client.storlines('stor foo', f, callback=lambda x: flag.append(None)) + self.assertTrue(flag) + + def test_nlst(self): + self.client.nlst() + self.assertEqual(self.client.nlst(), NLST_DATA.split('\r\n')[:-1]) + + def test_dir(self): + l = [] + self.client.dir(lambda x: l.append(x)) + self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', '')) + + def test_makeport(self): + self.client.makeport() + # IPv4 is in use, just make sure send_eprt has not been used + self.assertEqual(self.server.handler.last_received_cmd, 'port') + + def test_makepasv(self): + host, port = self.client.makepasv() + conn = socket.create_connection((host, port), 10) + conn.close() + # IPv4 is in use, just make sure send_epsv has not been used + self.assertEqual(self.server.handler.last_received_cmd, 'pasv') + + +class TestIPv6Environment(TestCase): + + def setUp(self): + self.server = DummyFTPServer((HOST, 0), af=socket.AF_INET6) + self.server.start() + self.client = ftplib.FTP() + self.client.connect(self.server.host, self.server.port) + + def tearDown(self): + self.client.close() + self.server.stop() + + def test_af(self): + self.assertEqual(self.client.af, socket.AF_INET6) + + def test_makeport(self): + self.client.makeport() + self.assertEqual(self.server.handler.last_received_cmd, 'eprt') + + def test_makepasv(self): + host, port = self.client.makepasv() + conn = socket.create_connection((host, port), 10) + conn.close() + self.assertEqual(self.server.handler.last_received_cmd, 'epsv') + + def test_transfer(self): + def retr(): + received = [] + self.client.retrbinary('retr', received.append) + self.assertEqual(''.join(received), RETR_DATA) + self.client.set_pasv(True) + retr() + self.client.set_pasv(False) + retr() + + +class TestTLS_FTPClassMixin(TestFTPClass): + """Repeat TestFTPClass tests starting the TLS layer for both control + and data connections first. + """ + + def setUp(self): + self.server = DummyTLS_FTPServer((HOST, 0)) + self.server.start() + self.client = ftplib.FTP_TLS(timeout=10) + self.client.connect(self.server.host, self.server.port) + # enable TLS + self.client.auth() + self.client.prot_p() + + +class TestTLS_FTPClass(TestCase): + """Specific TLS_FTP class tests.""" + + def setUp(self): + self.server = DummyTLS_FTPServer((HOST, 0)) + self.server.start() + self.client = ftplib.FTP_TLS(timeout=10) + self.client.connect(self.server.host, self.server.port) + + def tearDown(self): + self.client.close() + self.server.stop() + + def test_control_connection(self): + self.assertNotIsInstance(self.client.sock, ssl.SSLSocket) + self.client.auth() + self.assertIsInstance(self.client.sock, ssl.SSLSocket) + + def test_data_connection(self): + # clear text + sock = self.client.transfercmd('list') + self.assertNotIsInstance(sock, ssl.SSLSocket) + sock.close() + self.assertEqual(self.client.voidresp(), "226 transfer complete") + + # secured, after PROT P + self.client.prot_p() + sock = self.client.transfercmd('list') + self.assertIsInstance(sock, ssl.SSLSocket) + sock.close() + self.assertEqual(self.client.voidresp(), "226 transfer complete") + + # PROT C is issued, the connection must be in cleartext again + self.client.prot_c() + sock = self.client.transfercmd('list') + self.assertNotIsInstance(sock, ssl.SSLSocket) + sock.close() + self.assertEqual(self.client.voidresp(), "226 transfer complete") + + def test_login(self): + # login() is supposed to implicitly secure the control connection + self.assertNotIsInstance(self.client.sock, ssl.SSLSocket) + self.client.login() + self.assertIsInstance(self.client.sock, ssl.SSLSocket) + # make sure that AUTH TLS doesn't get issued again + self.client.login() + + def test_auth_issued_twice(self): + self.client.auth() + self.assertRaises(ValueError, self.client.auth) + + def test_auth_ssl(self): + try: + self.client.ssl_version = ssl.PROTOCOL_SSLv3 + self.client.auth() + self.assertRaises(ValueError, self.client.auth) + finally: + self.client.ssl_version = ssl.PROTOCOL_TLSv1 + + +class TestTimeouts(TestCase): + + def setUp(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(10) + self.port = test_support.bind_port(self.sock) + threading.Thread(target=self.server, args=(self.evt,self.sock)).start() + # Wait for the server to be ready. + self.evt.wait() + self.evt.clear() + ftplib.FTP.port = self.port + + def tearDown(self): + self.evt.wait() + + def server(self, evt, serv): + # This method sets the evt 3 times: + # 1) when the connection is ready to be accepted. + # 2) when it is safe for the caller to close the connection + # 3) when we have closed the socket + serv.listen(5) + # (1) Signal the caller that we are ready to accept the connection. + evt.set() + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + conn.send("1 Hola mundo\n") + # (2) Signal the caller that it is safe to close the socket. + evt.set() + conn.close() + finally: + serv.close() + # (3) Signal the caller that we are done. + evt.set() + + def testTimeoutDefault(self): + # default -- use global socket timeout + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutNone(self): + # no timeout -- do not use global socket timeout + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost", timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(ftp.sock.gettimeout() is None) + self.evt.wait() + ftp.close() + + def testTimeoutValue(self): + # a value + ftp = ftplib.FTP(HOST, timeout=30) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutConnect(self): + ftp = ftplib.FTP() + ftp.connect(HOST, timeout=30) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutDifferentOrder(self): + ftp = ftplib.FTP(timeout=30) + ftp.connect(HOST) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutDirectAccess(self): + ftp = ftplib.FTP() + ftp.timeout = 30 + ftp.connect(HOST) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + +def test_main(): + tests = [TestFTPClass, TestTimeouts] + if socket.has_ipv6: + try: + DummyFTPServer((HOST, 0), af=socket.AF_INET6) + except socket.error: + pass + else: + tests.append(TestIPv6Environment) + + if ssl is not None: + tests.extend([TestTLS_FTPClassMixin, TestTLS_FTPClass]) + + thread_info = test_support.threading_setup() + try: + test_support.run_unittest(*tests) + finally: + test_support.threading_cleanup(*thread_info) + + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_httplib.py python-gevent-1.0/greentest/2.7/test_httplib.py --- python-gevent-0.13.7/greentest/2.7/test_httplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_httplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,471 @@ +import httplib +import array +import httplib +import StringIO +import socket +import errno + +import unittest +TestCase = unittest.TestCase + +from test import test_support + +HOST = test_support.HOST + +class FakeSocket: + def __init__(self, text, fileclass=StringIO.StringIO): + self.text = text + self.fileclass = fileclass + self.data = '' + + def sendall(self, data): + self.data += ''.join(data) + + def makefile(self, mode, bufsize=None): + if mode != 'r' and mode != 'rb': + raise httplib.UnimplementedFileMode() + return self.fileclass(self.text) + +class EPipeSocket(FakeSocket): + + def __init__(self, text, pipe_trigger): + # When sendall() is called with pipe_trigger, raise EPIPE. + FakeSocket.__init__(self, text) + self.pipe_trigger = pipe_trigger + + def sendall(self, data): + if self.pipe_trigger in data: + raise socket.error(errno.EPIPE, "gotcha") + self.data += data + + def close(self): + pass + +class NoEOFStringIO(StringIO.StringIO): + """Like StringIO, but raises AssertionError on EOF. + + This is used below to test that httplib doesn't try to read + more from the underlying file than it should. + """ + def read(self, n=-1): + data = StringIO.StringIO.read(self, n) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + def readline(self, length=None): + data = StringIO.StringIO.readline(self, length) + if data == '': + raise AssertionError('caller tried to read past EOF') + return data + + +class HeaderTests(TestCase): + def test_auto_headers(self): + # Some headers are added automatically, but should not be added by + # .request() if they are explicitly set. + + class HeaderCountingBuffer(list): + def __init__(self): + self.count = {} + def append(self, item): + kv = item.split(':') + if len(kv) > 1: + # item is a 'Key: Value' header string + lcKey = kv[0].lower() + self.count.setdefault(lcKey, 0) + self.count[lcKey] += 1 + list.append(self, item) + + for explicit_header in True, False: + for header in 'Content-length', 'Host', 'Accept-encoding': + conn = httplib.HTTPConnection('example.com') + conn.sock = FakeSocket('blahblahblah') + conn._buffer = HeaderCountingBuffer() + + body = 'spamspamspam' + headers = {} + if explicit_header: + headers[header] = str(len(body)) + conn.request('POST', '/', body, headers) + self.assertEqual(conn._buffer.count[header.lower()], 1) + + def test_putheader(self): + conn = httplib.HTTPConnection('example.com') + conn.sock = FakeSocket(None) + conn.putrequest('GET','/') + conn.putheader('Content-length',42) + self.assertTrue('Content-length: 42' in conn._buffer) + + def test_ipv6host_header(self): + # Default host header on IPv6 transaction should wrapped by [] if + # its actual IPv6 address + expected = 'GET /foo HTTP/1.1\r\nHost: [2001::]:81\r\n' \ + 'Accept-Encoding: identity\r\n\r\n' + conn = httplib.HTTPConnection('[2001::]:81') + sock = FakeSocket('') + conn.sock = sock + conn.request('GET', '/foo') + self.assertTrue(sock.data.startswith(expected)) + + expected = 'GET /foo HTTP/1.1\r\nHost: [2001:102A::]\r\n' \ + 'Accept-Encoding: identity\r\n\r\n' + conn = httplib.HTTPConnection('[2001:102A::]') + sock = FakeSocket('') + conn.sock = sock + conn.request('GET', '/foo') + self.assertTrue(sock.data.startswith(expected)) + + +class BasicTest(TestCase): + def test_status_lines(self): + # Test HTTP status lines + + body = "HTTP/1.1 200 Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + resp.begin() + self.assertEqual(resp.read(), 'Text') + self.assertTrue(resp.isclosed()) + + body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + self.assertRaises(httplib.BadStatusLine, resp.begin) + + def test_bad_status_repr(self): + exc = httplib.BadStatusLine('') + self.assertEqual(repr(exc), '''BadStatusLine("\'\'",)''') + + def test_partial_reads(self): + # if we have a lenght, the system knows when to close itself + # same behaviour than when we read the whole thing with read() + body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + resp.begin() + self.assertEqual(resp.read(2), 'Te') + self.assertFalse(resp.isclosed()) + self.assertEqual(resp.read(2), 'xt') + self.assertTrue(resp.isclosed()) + + def test_host_port(self): + # Check invalid host_port + + # Note that httplib does not accept user:password@ in the host-port. + for hp in ("www.python.org:abc", "user:password@www.python.org"): + self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) + + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), + ("www.python.org:80", "www.python.org", 80), + ("www.python.org", "www.python.org", 80), + ("www.python.org:", "www.python.org", 80), + ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): + http = httplib.HTTP(hp) + c = http._conn + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + + def test_response_headers(self): + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE";' + ' Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + self.fail("multiple headers not combined properly") + + def test_read_head(self): + # Test that the library doesn't attempt to read any data + # from a HEAD request. (Tickles SF bug #622042.) + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 14432\r\n' + '\r\n', + NoEOFStringIO) + resp = httplib.HTTPResponse(sock, method="HEAD") + resp.begin() + if resp.read() != "": + self.fail("Did not expect response from HEAD request") + + def test_send_file(self): + expected = 'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \ + 'Accept-Encoding: identity\r\nContent-Length:' + + body = open(__file__, 'rb') + conn = httplib.HTTPConnection('example.com') + sock = FakeSocket(body) + conn.sock = sock + conn.request('GET', '/foo', body) + self.assertTrue(sock.data.startswith(expected)) + + def test_send(self): + expected = 'this is a test this is only a test' + conn = httplib.HTTPConnection('example.com') + sock = FakeSocket(None) + conn.sock = sock + conn.send(expected) + self.assertEqual(expected, sock.data) + sock.data = '' + conn.send(array.array('c', expected)) + self.assertEqual(expected, sock.data) + sock.data = '' + conn.send(StringIO.StringIO(expected)) + self.assertEqual(expected, sock.data) + + def test_chunked(self): + chunked_start = ( + 'HTTP/1.1 200 OK\r\n' + 'Transfer-Encoding: chunked\r\n\r\n' + 'a\r\n' + 'hello worl\r\n' + '1\r\n' + 'd\r\n' + ) + sock = FakeSocket(chunked_start + '0\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEqual(resp.read(), 'hello world') + resp.close() + + for x in ('', 'foo\r\n'): + sock = FakeSocket(chunked_start + x) + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + try: + resp.read() + except httplib.IncompleteRead, i: + self.assertEqual(i.partial, 'hello world') + self.assertEqual(repr(i),'IncompleteRead(11 bytes read)') + self.assertEqual(str(i),'IncompleteRead(11 bytes read)') + else: + self.fail('IncompleteRead expected') + finally: + resp.close() + + def test_chunked_head(self): + chunked_start = ( + 'HTTP/1.1 200 OK\r\n' + 'Transfer-Encoding: chunked\r\n\r\n' + 'a\r\n' + 'hello world\r\n' + '1\r\n' + 'd\r\n' + ) + sock = FakeSocket(chunked_start + '0\r\n') + resp = httplib.HTTPResponse(sock, method="HEAD") + resp.begin() + self.assertEqual(resp.read(), '') + self.assertEqual(resp.status, 200) + self.assertEqual(resp.reason, 'OK') + self.assertTrue(resp.isclosed()) + + def test_negative_content_length(self): + sock = FakeSocket('HTTP/1.1 200 OK\r\n' + 'Content-Length: -1\r\n\r\nHello\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEqual(resp.read(), 'Hello\r\n') + resp.close() + + def test_incomplete_read(self): + sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n') + resp = httplib.HTTPResponse(sock, method="GET") + resp.begin() + try: + resp.read() + except httplib.IncompleteRead as i: + self.assertEqual(i.partial, 'Hello\r\n') + self.assertEqual(repr(i), + "IncompleteRead(7 bytes read, 3 more expected)") + self.assertEqual(str(i), + "IncompleteRead(7 bytes read, 3 more expected)") + else: + self.fail('IncompleteRead expected') + finally: + resp.close() + + def test_epipe(self): + sock = EPipeSocket( + "HTTP/1.0 401 Authorization Required\r\n" + "Content-type: text/html\r\n" + "WWW-Authenticate: Basic realm=\"example\"\r\n", + b"Content-Length") + conn = httplib.HTTPConnection("example.com") + conn.sock = sock + self.assertRaises(socket.error, + lambda: conn.request("PUT", "/url", "body")) + resp = conn.getresponse() + self.assertEqual(401, resp.status) + self.assertEqual("Basic realm=\"example\"", + resp.getheader("www-authenticate")) + + def test_filenoattr(self): + # Just test the fileno attribute in the HTTPResponse Object. + body = "HTTP/1.1 200 Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + self.assertTrue(hasattr(resp,'fileno'), + 'HTTPResponse should expose a fileno attribute') + + # Test lines overflowing the max line size (_MAXLINE in http.client) + + def test_overflowing_status_line(self): + self.skipTest("disabled for HTTP 0.9 support") + body = "HTTP/1.1 200 Ok" + "k" * 65536 + "\r\n" + resp = httplib.HTTPResponse(FakeSocket(body)) + self.assertRaises((httplib.LineTooLong, httplib.BadStatusLine), resp.begin) + + def test_overflowing_header_line(self): + body = ( + 'HTTP/1.1 200 OK\r\n' + 'X-Foo: bar' + 'r' * 65536 + '\r\n\r\n' + ) + resp = httplib.HTTPResponse(FakeSocket(body)) + self.assertRaises(httplib.LineTooLong, resp.begin) + + def test_overflowing_chunked_line(self): + body = ( + 'HTTP/1.1 200 OK\r\n' + 'Transfer-Encoding: chunked\r\n\r\n' + + '0' * 65536 + 'a\r\n' + 'hello world\r\n' + '0\r\n' + ) + resp = httplib.HTTPResponse(FakeSocket(body)) + resp.begin() + self.assertRaises(httplib.LineTooLong, resp.read) + + +class OfflineTest(TestCase): + def test_responses(self): + self.assertEqual(httplib.responses[httplib.NOT_FOUND], "Not Found") + + +class SourceAddressTest(TestCase): + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.serv) + self.source_port = test_support.find_unused_port() + self.serv.listen(5) + self.conn = None + + def tearDown(self): + if self.conn: + self.conn.close() + self.conn = None + self.serv.close() + self.serv = None + + def testHTTPConnectionSourceAddress(self): + self.conn = httplib.HTTPConnection(HOST, self.port, + source_address=('', self.source_port)) + self.conn.connect() + self.assertEqual(self.conn.sock.getsockname()[1], self.source_port) + + @unittest.skipIf(not hasattr(httplib, 'HTTPSConnection'), + 'httplib.HTTPSConnection not defined') + def testHTTPSConnectionSourceAddress(self): + self.conn = httplib.HTTPSConnection(HOST, self.port, + source_address=('', self.source_port)) + # We don't test anything here other the constructor not barfing as + # this code doesn't deal with setting up an active running SSL server + # for an ssl_wrapped connect() to actually return from. + + +class TimeoutTest(TestCase): + PORT = None + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + TimeoutTest.PORT = test_support.bind_port(self.serv) + self.serv.listen(5) + + def tearDown(self): + self.serv.close() + self.serv = None + + def testTimeoutAttribute(self): + '''This will prove that the timeout gets through + HTTPConnection and into the socket. + ''' + # default -- use global socket timeout + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT) + httpConn.connect() + finally: + socket.setdefaulttimeout(None) + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + # no timeout -- do not use global socket default + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, + timeout=None) + httpConn.connect() + finally: + socket.setdefaulttimeout(None) + self.assertEqual(httpConn.sock.gettimeout(), None) + httpConn.close() + + # a value + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) + httpConn.connect() + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + +class HTTPSTimeoutTest(TestCase): +# XXX Here should be tests for HTTPS, there isn't any right now! + + def test_attributes(self): + # simple test to check it's storing it + if hasattr(httplib, 'HTTPSConnection'): + h = httplib.HTTPSConnection(HOST, TimeoutTest.PORT, timeout=30) + self.assertEqual(h.timeout, 30) + + @unittest.skipIf(not hasattr(httplib, 'HTTPS'), 'httplib.HTTPS not available') + def test_host_port(self): + # Check invalid host_port + + # Note that httplib does not accept user:password@ in the host-port. + for hp in ("www.python.org:abc", "user:password@www.python.org"): + self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) + + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), + ("pypi.python.org:443", "pypi.python.org", 443), + ("pypi.python.org", "pypi.python.org", 443), + ("pypi.python.org:", "pypi.python.org", 443), + ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 443)): + http = httplib.HTTPS(hp) + c = http._conn + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + + +def test_main(verbose=None): + test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, + HTTPSTimeoutTest, SourceAddressTest) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_httpservers.py python-gevent-1.0/greentest/2.7/test_httpservers.py --- python-gevent-0.13.7/greentest/2.7/test_httpservers.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_httpservers.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,534 @@ +"""Unittests for the various HTTPServer modules. + +Written by Cody A.W. Somerville , +Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest. +""" + +from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +from SimpleHTTPServer import SimpleHTTPRequestHandler +from CGIHTTPServer import CGIHTTPRequestHandler +import CGIHTTPServer + +import os +import sys +import re +import base64 +import shutil +import urllib +import httplib +import tempfile + +import unittest + +from StringIO import StringIO + +from test import test_support +threading = test_support.import_module('threading') + + +class NoLogRequestHandler: + def log_message(self, *args): + # don't write log messages to stderr + pass + +class SocketlessRequestHandler(SimpleHTTPRequestHandler): + def __init__(self): + self.get_called = False + self.protocol_version = "HTTP/1.1" + + def do_GET(self): + self.get_called = True + self.send_response(200) + self.send_header('Content-Type', 'text/html') + self.end_headers() + self.wfile.write(b'Data\r\n') + + def log_message(self, format, *args): + pass + + +class TestServerThread(threading.Thread): + def __init__(self, test_object, request_handler): + threading.Thread.__init__(self) + self.request_handler = request_handler + self.test_object = test_object + + def run(self): + self.server = HTTPServer(('', 0), self.request_handler) + self.test_object.PORT = self.server.socket.getsockname()[1] + self.test_object.server_started.set() + self.test_object = None + try: + self.server.serve_forever(0.05) + finally: + self.server.server_close() + + def stop(self): + self.server.shutdown() + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = test_support.threading_setup() + os.environ = test_support.EnvironmentVarGuard() + self.server_started = threading.Event() + self.thread = TestServerThread(self, self.request_handler) + self.thread.start() + self.server_started.wait() + + def tearDown(self): + self.thread.stop() + os.environ.__exit__() + test_support.threading_cleanup(*self._threads) + + def request(self, uri, method='GET', body=None, headers={}): + self.connection = httplib.HTTPConnection('localhost', self.PORT) + self.connection.request(method, uri, body, headers) + return self.connection.getresponse() + +class BaseHTTPRequestHandlerTestCase(unittest.TestCase): + """Test the functionality of the BaseHTTPServer focussing on + BaseHTTPRequestHandler. + """ + + HTTPResponseMatch = re.compile('HTTP/1.[0-9]+ 200 OK') + + def setUp (self): + self.handler = SocketlessRequestHandler() + + def send_typical_request(self, message): + input = StringIO(message) + output = StringIO() + self.handler.rfile = input + self.handler.wfile = output + self.handler.handle_one_request() + output.seek(0) + return output.readlines() + + def verify_get_called(self): + self.assertTrue(self.handler.get_called) + + def verify_expected_headers(self, headers): + for fieldName in 'Server: ', 'Date: ', 'Content-Type: ': + self.assertEqual(sum(h.startswith(fieldName) for h in headers), 1) + + def verify_http_server_response(self, response): + match = self.HTTPResponseMatch.search(response) + self.assertTrue(match is not None) + + def test_http_1_1(self): + result = self.send_typical_request('GET / HTTP/1.1\r\n\r\n') + self.verify_http_server_response(result[0]) + self.verify_expected_headers(result[1:-1]) + self.verify_get_called() + self.assertEqual(result[-1], 'Data\r\n') + + def test_http_1_0(self): + result = self.send_typical_request('GET / HTTP/1.0\r\n\r\n') + self.verify_http_server_response(result[0]) + self.verify_expected_headers(result[1:-1]) + self.verify_get_called() + self.assertEqual(result[-1], 'Data\r\n') + + def test_http_0_9(self): + result = self.send_typical_request('GET / HTTP/0.9\r\n\r\n') + self.assertEqual(len(result), 1) + self.assertEqual(result[0], 'Data\r\n') + self.verify_get_called() + + def test_with_continue_1_0(self): + result = self.send_typical_request('GET / HTTP/1.0\r\nExpect: 100-continue\r\n\r\n') + self.verify_http_server_response(result[0]) + self.verify_expected_headers(result[1:-1]) + self.verify_get_called() + self.assertEqual(result[-1], 'Data\r\n') + + def test_request_length(self): + # Issue #10714: huge request lines are discarded, to avoid Denial + # of Service attacks. + result = self.send_typical_request(b'GET ' + b'x' * 65537) + self.assertEqual(result[0], b'HTTP/1.1 414 Request-URI Too Long\r\n') + self.assertFalse(self.handler.get_called) + + +class BaseHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, BaseHTTPRequestHandler): + protocol_version = 'HTTP/1.1' + default_request_version = 'HTTP/1.1' + + def do_TEST(self): + self.send_response(204) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'close') + self.end_headers() + + def do_KEEP(self): + self.send_response(204) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'keep-alive') + self.end_headers() + + def do_KEYERROR(self): + self.send_error(999) + + def do_CUSTOM(self): + self.send_response(999) + self.send_header('Content-Type', 'text/html') + self.send_header('Connection', 'close') + self.end_headers() + + def setUp(self): + BaseTestCase.setUp(self) + self.con = httplib.HTTPConnection('localhost', self.PORT) + self.con.connect() + + def test_command(self): + self.con.request('GET', '/') + res = self.con.getresponse() + self.assertEqual(res.status, 501) + + def test_request_line_trimming(self): + self.con._http_vsn_str = 'HTTP/1.1\n' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 501) + + def test_version_bogus(self): + self.con._http_vsn_str = 'FUBAR' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 400) + + def test_version_digits(self): + self.con._http_vsn_str = 'HTTP/9.9.9' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 400) + + def test_version_none_get(self): + self.con._http_vsn_str = '' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 501) + + def test_version_none(self): + self.con._http_vsn_str = '' + self.con.putrequest('PUT', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 400) + + def test_version_invalid(self): + self.con._http_vsn = 99 + self.con._http_vsn_str = 'HTTP/9.9' + self.con.putrequest('GET', '/') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 505) + + def test_send_blank(self): + self.con._http_vsn_str = '' + self.con.putrequest('', '') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 400) + + def test_header_close(self): + self.con.putrequest('GET', '/') + self.con.putheader('Connection', 'close') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 501) + + def test_head_keep_alive(self): + self.con._http_vsn_str = 'HTTP/1.1' + self.con.putrequest('GET', '/') + self.con.putheader('Connection', 'keep-alive') + self.con.endheaders() + res = self.con.getresponse() + self.assertEqual(res.status, 501) + + def test_handler(self): + self.con.request('TEST', '/') + res = self.con.getresponse() + self.assertEqual(res.status, 204) + + def test_return_header_keep_alive(self): + self.con.request('KEEP', '/') + res = self.con.getresponse() + self.assertEqual(res.getheader('Connection'), 'keep-alive') + self.con.request('TEST', '/') + self.addCleanup(self.con.close) + + def test_internal_key_error(self): + self.con.request('KEYERROR', '/') + res = self.con.getresponse() + self.assertEqual(res.status, 999) + + def test_return_custom_status(self): + self.con.request('CUSTOM', '/') + res = self.con.getresponse() + self.assertEqual(res.status, 999) + + +class SimpleHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler): + pass + + def setUp(self): + BaseTestCase.setUp(self) + self.cwd = os.getcwd() + basetempdir = tempfile.gettempdir() + os.chdir(basetempdir) + self.data = 'We are the knights who say Ni!' + self.tempdir = tempfile.mkdtemp(dir=basetempdir) + self.tempdir_name = os.path.basename(self.tempdir) + temp = open(os.path.join(self.tempdir, 'test'), 'wb') + temp.write(self.data) + temp.close() + + def tearDown(self): + try: + os.chdir(self.cwd) + try: + shutil.rmtree(self.tempdir) + except: + pass + finally: + BaseTestCase.tearDown(self) + + def check_status_and_reason(self, response, status, data=None): + body = response.read() + self.assertTrue(response) + self.assertEqual(response.status, status) + self.assertIsNotNone(response.reason) + if data: + self.assertEqual(data, body) + + def test_get(self): + #constructs the path relative to the root directory of the HTTPServer + response = self.request(self.tempdir_name + '/test') + self.check_status_and_reason(response, 200, data=self.data) + response = self.request(self.tempdir_name + '/') + self.check_status_and_reason(response, 200) + response = self.request(self.tempdir_name) + self.check_status_and_reason(response, 301) + response = self.request('/ThisDoesNotExist') + self.check_status_and_reason(response, 404) + response = self.request('/' + 'ThisDoesNotExist' + '/') + self.check_status_and_reason(response, 404) + f = open(os.path.join(self.tempdir_name, 'index.html'), 'w') + response = self.request('/' + self.tempdir_name + '/') + self.check_status_and_reason(response, 200) + + # chmod() doesn't work as expected on Windows, and filesystem + # permissions are ignored by root on Unix. + if os.name == 'posix' and os.geteuid() != 0: + os.chmod(self.tempdir, 0) + response = self.request(self.tempdir_name + '/') + self.check_status_and_reason(response, 404) + os.chmod(self.tempdir, 0755) + + def test_head(self): + response = self.request( + self.tempdir_name + '/test', method='HEAD') + self.check_status_and_reason(response, 200) + self.assertEqual(response.getheader('content-length'), + str(len(self.data))) + self.assertEqual(response.getheader('content-type'), + 'application/octet-stream') + + def test_invalid_requests(self): + response = self.request('/', method='FOO') + self.check_status_and_reason(response, 501) + # requests must be case sensitive,so this should fail too + response = self.request('/', method='get') + self.check_status_and_reason(response, 501) + response = self.request('/', method='GETs') + self.check_status_and_reason(response, 501) + + +cgi_file1 = """\ +#!%s + +print "Content-type: text/html" +print +print "Hello World" +""" + +cgi_file2 = """\ +#!%s +import cgi + +print "Content-type: text/html" +print + +form = cgi.FieldStorage() +print "%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"), + form.getfirst("bacon")) +""" + + +@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, + "This test can't be run reliably as root (issue #13308).") +class CGIHTTPServerTestCase(BaseTestCase): + class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler): + pass + + def setUp(self): + BaseTestCase.setUp(self) + self.parent_dir = tempfile.mkdtemp() + self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') + os.mkdir(self.cgi_dir) + + # The shebang line should be pure ASCII: use symlink if possible. + # See issue #7668. + if hasattr(os, 'symlink'): + self.pythonexe = os.path.join(self.parent_dir, 'python') + os.symlink(sys.executable, self.pythonexe) + else: + self.pythonexe = sys.executable + + self.file1_path = os.path.join(self.cgi_dir, 'file1.py') + with open(self.file1_path, 'w') as file1: + file1.write(cgi_file1 % self.pythonexe) + os.chmod(self.file1_path, 0777) + + self.file2_path = os.path.join(self.cgi_dir, 'file2.py') + with open(self.file2_path, 'w') as file2: + file2.write(cgi_file2 % self.pythonexe) + os.chmod(self.file2_path, 0777) + + self.cwd = os.getcwd() + os.chdir(self.parent_dir) + + def tearDown(self): + try: + os.chdir(self.cwd) + if self.pythonexe != sys.executable: + os.remove(self.pythonexe) + os.remove(self.file1_path) + os.remove(self.file2_path) + os.rmdir(self.cgi_dir) + os.rmdir(self.parent_dir) + finally: + BaseTestCase.tearDown(self) + + def test_url_collapse_path_split(self): + test_vectors = { + '': ('/', ''), + '..': IndexError, + '/.//..': IndexError, + '/': ('/', ''), + '//': ('/', ''), + '/\\': ('/', '\\'), + '/.//': ('/', ''), + 'cgi-bin/file1.py': ('/cgi-bin', 'file1.py'), + '/cgi-bin/file1.py': ('/cgi-bin', 'file1.py'), + 'a': ('/', 'a'), + '/a': ('/', 'a'), + '//a': ('/', 'a'), + './a': ('/', 'a'), + './C:/': ('/C:', ''), + '/a/b': ('/a', 'b'), + '/a/b/': ('/a/b', ''), + '/a/b/c/..': ('/a/b', ''), + '/a/b/c/../d': ('/a/b', 'd'), + '/a/b/c/../d/e/../f': ('/a/b/d', 'f'), + '/a/b/c/../d/e/../../f': ('/a/b', 'f'), + '/a/b/c/../d/e/.././././..//f': ('/a/b', 'f'), + '../a/b/c/../d/e/.././././..//f': IndexError, + '/a/b/c/../d/e/../../../f': ('/a', 'f'), + '/a/b/c/../d/e/../../../../f': ('/', 'f'), + '/a/b/c/../d/e/../../../../../f': IndexError, + '/a/b/c/../d/e/../../../../f/..': ('/', ''), + } + for path, expected in test_vectors.iteritems(): + if isinstance(expected, type) and issubclass(expected, Exception): + self.assertRaises(expected, + CGIHTTPServer._url_collapse_path_split, path) + else: + actual = CGIHTTPServer._url_collapse_path_split(path) + self.assertEqual(expected, actual, + msg='path = %r\nGot: %r\nWanted: %r' % + (path, actual, expected)) + + def test_headers_and_content(self): + res = self.request('/cgi-bin/file1.py') + self.assertEqual(('Hello World\n', 'text/html', 200), + (res.read(), res.getheader('Content-type'), res.status)) + + def test_post(self): + params = urllib.urlencode({'spam' : 1, 'eggs' : 'python', 'bacon' : 123456}) + headers = {'Content-type' : 'application/x-www-form-urlencoded'} + res = self.request('/cgi-bin/file2.py', 'POST', params, headers) + + self.assertEqual(res.read(), '1, python, 123456\n') + + def test_invaliduri(self): + res = self.request('/cgi-bin/invalid') + res.read() + self.assertEqual(res.status, 404) + + def test_authorization(self): + headers = {'Authorization' : 'Basic %s' % + base64.b64encode('username:pass')} + res = self.request('/cgi-bin/file1.py', 'GET', headers=headers) + self.assertEqual(('Hello World\n', 'text/html', 200), + (res.read(), res.getheader('Content-type'), res.status)) + + def test_no_leading_slash(self): + # http://bugs.python.org/issue2254 + res = self.request('cgi-bin/file1.py') + self.assertEqual(('Hello World\n', 'text/html', 200), + (res.read(), res.getheader('Content-type'), res.status)) + + def test_os_environ_is_not_altered(self): + signature = "Test CGI Server" + os.environ['SERVER_SOFTWARE'] = signature + res = self.request('/cgi-bin/file1.py') + self.assertEqual((b'Hello World\n', 'text/html', 200), + (res.read(), res.getheader('Content-type'), res.status)) + self.assertEqual(os.environ['SERVER_SOFTWARE'], signature) + + +class SimpleHTTPRequestHandlerTestCase(unittest.TestCase): + """ Test url parsing """ + def setUp(self): + self.translated = os.getcwd() + self.translated = os.path.join(self.translated, 'filename') + self.handler = SocketlessRequestHandler() + + def test_query_arguments(self): + path = self.handler.translate_path('/filename') + self.assertEqual(path, self.translated) + path = self.handler.translate_path('/filename?foo=bar') + self.assertEqual(path, self.translated) + path = self.handler.translate_path('/filename?a=b&spam=eggs#zot') + self.assertEqual(path, self.translated) + + def test_start_with_double_slash(self): + path = self.handler.translate_path('//filename') + self.assertEqual(path, self.translated) + path = self.handler.translate_path('//filename?foo=bar') + self.assertEqual(path, self.translated) + + +def test_main(verbose=None): + try: + cwd = os.getcwd() + test_support.run_unittest(BaseHTTPRequestHandlerTestCase, + SimpleHTTPRequestHandlerTestCase, + BaseHTTPServerTestCase, + SimpleHTTPServerTestCase, + CGIHTTPServerTestCase + ) + finally: + os.chdir(cwd) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_queue.py python-gevent-1.0/greentest/2.7/test_queue.py --- python-gevent-0.13.7/greentest/2.7/test_queue.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,322 @@ +# Some simple queue module tests, plus some failure conditions +# to ensure the Queue locks remain stable. +import Queue +import time +import unittest +from test import test_support +threading = test_support.import_module('threading') + +QUEUE_SIZE = 5 + +# A thread to run a function that unclogs a blocked Queue. +class _TriggerThread(threading.Thread): + def __init__(self, fn, args): + self.fn = fn + self.args = args + self.startedEvent = threading.Event() + threading.Thread.__init__(self) + + def run(self): + # The sleep isn't necessary, but is intended to give the blocking + # function in the main thread a chance at actually blocking before + # we unclog it. But if the sleep is longer than the timeout-based + # tests wait in their blocking functions, those tests will fail. + # So we give them much longer timeout values compared to the + # sleep here (I aimed at 10 seconds for blocking functions -- + # they should never actually wait that long - they should make + # progress as soon as we call self.fn()). + time.sleep(0.1) + self.startedEvent.set() + self.fn(*self.args) + + +# Execute a function that blocks, and in a separate thread, a function that +# triggers the release. Returns the result of the blocking function. Caution: +# block_func must guarantee to block until trigger_func is called, and +# trigger_func must guarantee to change queue state so that block_func can make +# enough progress to return. In particular, a block_func that just raises an +# exception regardless of whether trigger_func is called will lead to +# timing-dependent sporadic failures, and one of those went rarely seen but +# undiagnosed for years. Now block_func must be unexceptional. If block_func +# is supposed to raise an exception, call do_exceptional_blocking_test() +# instead. + +class BlockingTestMixin: + + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): + self.t = _TriggerThread(trigger_func, trigger_args) + self.t.start() + self.result = block_func(*block_args) + # If block_func returned before our thread made the call, we failed! + if not self.t.startedEvent.is_set(): + self.fail("blocking function '%r' appeared not to block" % + block_func) + self.t.join(10) # make sure the thread terminates + if self.t.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) + return self.result + + # Call this instead if block_func is supposed to raise an exception. + def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, + trigger_args, expected_exception_class): + self.t = _TriggerThread(trigger_func, trigger_args) + self.t.start() + try: + try: + block_func(*block_args) + except expected_exception_class: + raise + else: + self.fail("expected exception of kind %r" % + expected_exception_class) + finally: + self.t.join(10) # make sure the thread terminates + if self.t.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) + if not self.t.startedEvent.is_set(): + self.fail("trigger thread ended but event never set") + + +class BaseQueueTest(unittest.TestCase, BlockingTestMixin): + def setUp(self): + self.cum = 0 + self.cumlock = threading.Lock() + + def simple_queue_test(self, q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + # I guess we better check things actually queue correctly a little :) + q.put(111) + q.put(333) + q.put(222) + target_order = dict(Queue = [111, 333, 222], + LifoQueue = [222, 333, 111], + PriorityQueue = [111, 222, 333]) + actual_order = [q.get(), q.get(), q.get()] + self.assertEqual(actual_order, target_order[q.__class__.__name__], + "Didn't seem to queue the correct data!") + for i in range(QUEUE_SIZE-1): + q.put(i) + self.assertTrue(not q.empty(), "Queue should not be empty") + self.assertTrue(not q.full(), "Queue should not be full") + last = 2 * QUEUE_SIZE + full = 3 * 2 * QUEUE_SIZE + q.put(last) + self.assertTrue(q.full(), "Queue should be full") + try: + q.put(full, block=0) + self.fail("Didn't appear to block with a full queue") + except Queue.Full: + pass + try: + q.put(full, timeout=0.01) + self.fail("Didn't appear to time-out with a full queue") + except Queue.Full: + pass + # Test a blocking put + self.do_blocking_test(q.put, (full,), q.get, ()) + self.do_blocking_test(q.put, (full, True, 10), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + self.assertTrue(q.empty(), "Queue should be empty") + try: + q.get(block=0) + self.fail("Didn't appear to block with an empty queue") + except Queue.Empty: + pass + try: + q.get(timeout=0.01) + self.fail("Didn't appear to time-out with an empty queue") + except Queue.Empty: + pass + # Test a blocking get + self.do_blocking_test(q.get, (), q.put, ('empty',)) + self.do_blocking_test(q.get, (True, 10), q.put, ('empty',)) + + + def worker(self, q): + while True: + x = q.get() + if x is None: + q.task_done() + return + with self.cumlock: + self.cum += x + q.task_done() + + def queue_join_test(self, q): + self.cum = 0 + for i in (0,1): + threading.Thread(target=self.worker, args=(q,)).start() + for i in xrange(100): + q.put(i) + q.join() + self.assertEqual(self.cum, sum(range(100)), + "q.join() did not block until all tasks were done") + for i in (0,1): + q.put(None) # instruct the threads to close + q.join() # verify that you can join twice + + def test_queue_task_done(self): + # Test to make sure a queue task completed successfully. + q = self.type2test() + try: + q.task_done() + except ValueError: + pass + else: + self.fail("Did not detect task count going negative") + + def test_queue_join(self): + # Test that a queue join()s successfully, and before anything else + # (done twice for insurance). + q = self.type2test() + self.queue_join_test(q) + self.queue_join_test(q) + try: + q.task_done() + except ValueError: + pass + else: + self.fail("Did not detect task count going negative") + + def test_simple_queue(self): + # Do it a couple of times on the same queue. + # Done twice to make sure works with same instance reused. + q = self.type2test(QUEUE_SIZE) + self.simple_queue_test(q) + self.simple_queue_test(q) + + +class QueueTest(BaseQueueTest): + type2test = Queue.Queue + +class LifoQueueTest(BaseQueueTest): + type2test = Queue.LifoQueue + +class PriorityQueueTest(BaseQueueTest): + type2test = Queue.PriorityQueue + + + +# A Queue subclass that can provoke failure at a moment's notice :) +class FailingQueueException(Exception): + pass + +class FailingQueue(Queue.Queue): + def __init__(self, *args): + self.fail_next_put = False + self.fail_next_get = False + Queue.Queue.__init__(self, *args) + def _put(self, item): + if self.fail_next_put: + self.fail_next_put = False + raise FailingQueueException, "You Lose" + return Queue.Queue._put(self, item) + def _get(self): + if self.fail_next_get: + self.fail_next_get = False + raise FailingQueueException, "You Lose" + return Queue.Queue._get(self) + +class FailingQueueTest(unittest.TestCase, BlockingTestMixin): + + def failing_queue_test(self, q): + if not q.empty(): + raise RuntimeError, "Call this function with an empty queue" + for i in range(QUEUE_SIZE-1): + q.put(i) + # Test a failing non-blocking put. + q.fail_next_put = True + try: + q.put("oops", block=0) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.fail_next_put = True + try: + q.put("oops", timeout=0.1) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + q.put("last") + self.assertTrue(q.full(), "Queue should be full") + # Test a failing blocking put + q.fail_next_put = True + try: + self.do_blocking_test(q.put, ("full",), q.get, ()) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + # Test a failing timeout put + q.fail_next_put = True + try: + self.do_exceptional_blocking_test(q.put, ("full", True, 10), q.get, (), + FailingQueueException) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # Check the Queue isn't damaged. + # put failed, but get succeeded - re-add + q.put("last") + self.assertTrue(q.full(), "Queue should be full") + q.get() + self.assertTrue(not q.full(), "Queue should not be full") + q.put("last") + self.assertTrue(q.full(), "Queue should be full") + # Test a blocking put + self.do_blocking_test(q.put, ("full",), q.get, ()) + # Empty it + for i in range(QUEUE_SIZE): + q.get() + self.assertTrue(q.empty(), "Queue should be empty") + q.put("first") + q.fail_next_get = True + try: + q.get() + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + self.assertTrue(not q.empty(), "Queue should not be empty") + q.fail_next_get = True + try: + q.get(timeout=0.1) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + self.assertTrue(not q.empty(), "Queue should not be empty") + q.get() + self.assertTrue(q.empty(), "Queue should be empty") + q.fail_next_get = True + try: + self.do_exceptional_blocking_test(q.get, (), q.put, ('empty',), + FailingQueueException) + self.fail("The queue didn't fail when it should have") + except FailingQueueException: + pass + # put succeeded, but get failed. + self.assertTrue(not q.empty(), "Queue should not be empty") + q.get() + self.assertTrue(q.empty(), "Queue should be empty") + + def test_failing_queue(self): + # Test to make sure a queue is functioning correctly. + # Done twice to the same instance. + q = FailingQueue(QUEUE_SIZE) + self.failing_queue_test(q) + self.failing_queue_test(q) + + +def test_main(): + test_support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, + FailingQueueTest) + + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_select.py python-gevent-1.0/greentest/2.7/test_select.py --- python-gevent-0.13.7/greentest/2.7/test_select.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_select.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,58 @@ +from test import test_support +import unittest +import select +import os +import sys + +@unittest.skipIf(sys.platform[:3] in ('win', 'os2', 'riscos'), + "can't easily test on this system") +class SelectTestCase(unittest.TestCase): + + class Nope: + pass + + class Almost: + def fileno(self): + return 'fileno' + + def test_error_conditions(self): + self.assertRaises(TypeError, select.select, 1, 2, 3) + self.assertRaises(TypeError, select.select, [self.Nope()], [], []) + self.assertRaises(TypeError, select.select, [self.Almost()], [], []) + self.assertRaises(TypeError, select.select, [], [], [], "not a number") + + def test_returned_list_identity(self): + # See issue #8329 + r, w, x = select.select([], [], [], 1) + self.assertIsNot(r, w) + self.assertIsNot(r, x) + self.assertIsNot(w, x) + + def test_select(self): + cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done' + p = os.popen(cmd, 'r') + for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10: + if test_support.verbose: + print 'timeout =', tout + rfd, wfd, xfd = select.select([p], [], [], tout) + if (rfd, wfd, xfd) == ([], [], []): + continue + if (rfd, wfd, xfd) == ([p], [], []): + line = p.readline() + if test_support.verbose: + print repr(line) + if not line: + if test_support.verbose: + print 'EOF' + break + continue + self.fail('Unexpected return values from select():', rfd, wfd, xfd) + p.close() + + +def test_main(): + test_support.run_unittest(SelectTestCase) + test_support.reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_signal.py python-gevent-1.0/greentest/2.7/test_signal.py --- python-gevent-0.13.7/greentest/2.7/test_signal.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_signal.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,493 @@ +import unittest +from test import test_support +from contextlib import closing +import gc +import pickle +import select +import signal +import subprocess +import traceback +import sys, os, time, errno + +if sys.platform in ('os2', 'riscos'): + raise unittest.SkipTest("Can't test signal on %s" % sys.platform) + + +class HandlerBCalled(Exception): + pass + + +def exit_subprocess(): + """Use os._exit(0) to exit the current subprocess. + + Otherwise, the test catches the SystemExit and continues executing + in parallel with the original test, so you wind up with an + exponential number of tests running concurrently. + """ + os._exit(0) + + +def ignoring_eintr(__func, *args, **kwargs): + try: + return __func(*args, **kwargs) + except EnvironmentError as e: + if e.errno != errno.EINTR: + raise + return None + + +@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +class InterProcessSignalTests(unittest.TestCase): + MAX_DURATION = 20 # Entire test should last at most 20 sec. + + def setUp(self): + self.using_gc = gc.isenabled() + gc.disable() + + def tearDown(self): + if self.using_gc: + gc.enable() + + def format_frame(self, frame, limit=None): + return ''.join(traceback.format_stack(frame, limit=limit)) + + def handlerA(self, signum, frame): + self.a_called = True + if test_support.verbose: + print "handlerA invoked from signal %s at:\n%s" % ( + signum, self.format_frame(frame, limit=1)) + + def handlerB(self, signum, frame): + self.b_called = True + if test_support.verbose: + print "handlerB invoked from signal %s at:\n%s" % ( + signum, self.format_frame(frame, limit=1)) + raise HandlerBCalled(signum, self.format_frame(frame)) + + def wait(self, child): + """Wait for child to finish, ignoring EINTR.""" + while True: + try: + child.wait() + return + except OSError as e: + if e.errno != errno.EINTR: + raise + + def run_test(self): + # Install handlers. This function runs in a sub-process, so we + # don't worry about re-setting the default handlers. + signal.signal(signal.SIGHUP, self.handlerA) + signal.signal(signal.SIGUSR1, self.handlerB) + signal.signal(signal.SIGUSR2, signal.SIG_IGN) + signal.signal(signal.SIGALRM, signal.default_int_handler) + + # Variables the signals will modify: + self.a_called = False + self.b_called = False + + # Let the sub-processes know who to send signals to. + pid = os.getpid() + if test_support.verbose: + print "test runner's pid is", pid + + child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)]) + if child: + self.wait(child) + if not self.a_called: + time.sleep(1) # Give the signal time to be delivered. + self.assertTrue(self.a_called) + self.assertFalse(self.b_called) + self.a_called = False + + # Make sure the signal isn't delivered while the previous + # Popen object is being destroyed, because __del__ swallows + # exceptions. + del child + try: + child = subprocess.Popen(['kill', '-USR1', str(pid)]) + # This wait should be interrupted by the signal's exception. + self.wait(child) + time.sleep(1) # Give the signal time to be delivered. + self.fail('HandlerBCalled exception not thrown') + except HandlerBCalled: + self.assertTrue(self.b_called) + self.assertFalse(self.a_called) + if test_support.verbose: + print "HandlerBCalled exception caught" + + child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)]) + if child: + self.wait(child) # Nothing should happen. + + try: + signal.alarm(1) + # The race condition in pause doesn't matter in this case, + # since alarm is going to raise a KeyboardException, which + # will skip the call. + signal.pause() + # But if another signal arrives before the alarm, pause + # may return early. + time.sleep(1) + except KeyboardInterrupt: + if test_support.verbose: + print "KeyboardInterrupt (the alarm() went off)" + except: + self.fail("Some other exception woke us from pause: %s" % + traceback.format_exc()) + else: + self.fail("pause returned of its own accord, and the signal" + " didn't arrive after another second.") + + # Issue 3864. Unknown if this affects earlier versions of freebsd also. + @unittest.skipIf(sys.platform=='freebsd6', + 'inter process signals not reliable (do not mix well with threading) ' + 'on freebsd6') + def test_main(self): + # This function spawns a child process to insulate the main + # test-running process from all the signals. It then + # communicates with that child process over a pipe and + # re-raises information about any exceptions the child + # throws. The real work happens in self.run_test(). + os_done_r, os_done_w = os.pipe() + with closing(os.fdopen(os_done_r)) as done_r, \ + closing(os.fdopen(os_done_w, 'w')) as done_w: + child = os.fork() + if child == 0: + # In the child process; run the test and report results + # through the pipe. + try: + done_r.close() + # Have to close done_w again here because + # exit_subprocess() will skip the enclosing with block. + with closing(done_w): + try: + self.run_test() + except: + pickle.dump(traceback.format_exc(), done_w) + else: + pickle.dump(None, done_w) + except: + print 'Uh oh, raised from pickle.' + traceback.print_exc() + finally: + exit_subprocess() + + done_w.close() + # Block for up to MAX_DURATION seconds for the test to finish. + r, w, x = select.select([done_r], [], [], self.MAX_DURATION) + if done_r in r: + tb = pickle.load(done_r) + if tb: + self.fail(tb) + else: + os.kill(child, signal.SIGKILL) + self.fail('Test deadlocked after %d seconds.' % + self.MAX_DURATION) + + +@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +class BasicSignalTests(unittest.TestCase): + def trivial_signal_handler(self, *args): + pass + + def test_out_of_range_signal_number_raises_error(self): + self.assertRaises(ValueError, signal.getsignal, 4242) + + self.assertRaises(ValueError, signal.signal, 4242, + self.trivial_signal_handler) + + def test_setting_signal_handler_to_none_raises_error(self): + self.assertRaises(TypeError, signal.signal, + signal.SIGUSR1, None) + + def test_getsignal(self): + hup = signal.signal(signal.SIGHUP, self.trivial_signal_handler) + self.assertEqual(signal.getsignal(signal.SIGHUP), + self.trivial_signal_handler) + signal.signal(signal.SIGHUP, hup) + self.assertEqual(signal.getsignal(signal.SIGHUP), hup) + + +@unittest.skipUnless(sys.platform == "win32", "Windows specific") +class WindowsSignalTests(unittest.TestCase): + def test_issue9324(self): + # Updated for issue #10003, adding SIGBREAK + handler = lambda x, y: None + for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, + signal.SIGILL, signal.SIGINT, signal.SIGSEGV, + signal.SIGTERM): + # Set and then reset a handler for signals that work on windows + signal.signal(sig, signal.signal(sig, handler)) + + with self.assertRaises(ValueError): + signal.signal(-1, handler) + + with self.assertRaises(ValueError): + signal.signal(7, handler) + + +@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +class WakeupSignalTests(unittest.TestCase): + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 + + def test_wakeup_fd_early(self): + import select + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the sleep, + # before select is called + time.sleep(self.TIMEOUT_FULL) + mid_time = time.time() + self.assertTrue(mid_time - before_time < self.TIMEOUT_HALF) + select.select([self.read], [], [], self.TIMEOUT_FULL) + after_time = time.time() + self.assertTrue(after_time - mid_time < self.TIMEOUT_HALF) + + def test_wakeup_fd_during(self): + import select + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the select call + self.assertRaises(select.error, select.select, + [self.read], [], [], self.TIMEOUT_FULL) + after_time = time.time() + self.assertTrue(after_time - before_time < self.TIMEOUT_HALF) + + def setUp(self): + import fcntl + + self.alrm = signal.signal(signal.SIGALRM, lambda x,y:None) + self.read, self.write = os.pipe() + flags = fcntl.fcntl(self.write, fcntl.F_GETFL, 0) + flags = flags | os.O_NONBLOCK + fcntl.fcntl(self.write, fcntl.F_SETFL, flags) + self.old_wakeup = signal.set_wakeup_fd(self.write) + + def tearDown(self): + signal.set_wakeup_fd(self.old_wakeup) + os.close(self.read) + os.close(self.write) + signal.signal(signal.SIGALRM, self.alrm) + +@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +class SiginterruptTest(unittest.TestCase): + + def setUp(self): + """Install a no-op signal handler that can be set to allow + interrupts or not, and arrange for the original signal handler to be + re-installed when the test is finished. + """ + self.signum = signal.SIGUSR1 + oldhandler = signal.signal(self.signum, lambda x,y: None) + self.addCleanup(signal.signal, self.signum, oldhandler) + + def readpipe_interrupted(self): + """Perform a read during which a signal will arrive. Return True if the + read is interrupted by the signal and raises an exception. Return False + if it returns normally. + """ + # Create a pipe that can be used for the read. Also clean it up + # when the test is over, since nothing else will (but see below for + # the write end). + r, w = os.pipe() + self.addCleanup(os.close, r) + + # Create another process which can send a signal to this one to try + # to interrupt the read. + ppid = os.getpid() + pid = os.fork() + + if pid == 0: + # Child code: sleep to give the parent enough time to enter the + # read() call (there's a race here, but it's really tricky to + # eliminate it); then signal the parent process. Also, sleep + # again to make it likely that the signal is delivered to the + # parent process before the child exits. If the child exits + # first, the write end of the pipe will be closed and the test + # is invalid. + try: + time.sleep(0.2) + os.kill(ppid, self.signum) + time.sleep(0.2) + finally: + # No matter what, just exit as fast as possible now. + exit_subprocess() + else: + # Parent code. + # Make sure the child is eventually reaped, else it'll be a + # zombie for the rest of the test suite run. + self.addCleanup(os.waitpid, pid, 0) + + # Close the write end of the pipe. The child has a copy, so + # it's not really closed until the child exits. We need it to + # close when the child exits so that in the non-interrupt case + # the read eventually completes, otherwise we could just close + # it *after* the test. + os.close(w) + + # Try the read and report whether it is interrupted or not to + # the caller. + try: + d = os.read(r, 1) + return False + except OSError, err: + if err.errno != errno.EINTR: + raise + return True + + def test_without_siginterrupt(self): + """If a signal handler is installed and siginterrupt is not called + at all, when that signal arrives, it interrupts a syscall that's in + progress. + """ + i = self.readpipe_interrupted() + self.assertTrue(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertTrue(i) + + def test_siginterrupt_on(self): + """If a signal handler is installed and siginterrupt is called with + a true value for the second argument, when that signal arrives, it + interrupts a syscall that's in progress. + """ + signal.siginterrupt(self.signum, 1) + i = self.readpipe_interrupted() + self.assertTrue(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertTrue(i) + + def test_siginterrupt_off(self): + """If a signal handler is installed and siginterrupt is called with + a false value for the second argument, when that signal arrives, it + does not interrupt a syscall that's in progress. + """ + signal.siginterrupt(self.signum, 0) + i = self.readpipe_interrupted() + self.assertFalse(i) + # Arrival of the signal shouldn't have changed anything. + i = self.readpipe_interrupted() + self.assertFalse(i) + + +@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +class ItimerTest(unittest.TestCase): + def setUp(self): + self.hndl_called = False + self.hndl_count = 0 + self.itimer = None + self.old_alarm = signal.signal(signal.SIGALRM, self.sig_alrm) + + def tearDown(self): + signal.signal(signal.SIGALRM, self.old_alarm) + if self.itimer is not None: # test_itimer_exc doesn't change this attr + # just ensure that itimer is stopped + signal.setitimer(self.itimer, 0) + + def sig_alrm(self, *args): + self.hndl_called = True + if test_support.verbose: + print("SIGALRM handler invoked", args) + + def sig_vtalrm(self, *args): + self.hndl_called = True + + if self.hndl_count > 3: + # it shouldn't be here, because it should have been disabled. + raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL " + "timer.") + elif self.hndl_count == 3: + # disable ITIMER_VIRTUAL, this function shouldn't be called anymore + signal.setitimer(signal.ITIMER_VIRTUAL, 0) + if test_support.verbose: + print("last SIGVTALRM handler call") + + self.hndl_count += 1 + + if test_support.verbose: + print("SIGVTALRM handler invoked", args) + + def sig_prof(self, *args): + self.hndl_called = True + signal.setitimer(signal.ITIMER_PROF, 0) + + if test_support.verbose: + print("SIGPROF handler invoked", args) + + def test_itimer_exc(self): + # XXX I'm assuming -1 is an invalid itimer, but maybe some platform + # defines it ? + self.assertRaises(signal.ItimerError, signal.setitimer, -1, 0) + # Negative times are treated as zero on some platforms. + if 0: + self.assertRaises(signal.ItimerError, + signal.setitimer, signal.ITIMER_REAL, -1) + + def test_itimer_real(self): + self.itimer = signal.ITIMER_REAL + signal.setitimer(self.itimer, 1.0) + if test_support.verbose: + print("\ncall pause()...") + signal.pause() + + self.assertEqual(self.hndl_called, True) + + # Issue 3864. Unknown if this affects earlier versions of freebsd also. + @unittest.skipIf(sys.platform in ('freebsd6', 'netbsd5'), + 'itimer not reliable (does not mix well with threading) on some BSDs.') + def test_itimer_virtual(self): + self.itimer = signal.ITIMER_VIRTUAL + signal.signal(signal.SIGVTALRM, self.sig_vtalrm) + signal.setitimer(self.itimer, 0.3, 0.2) + + start_time = time.time() + while time.time() - start_time < 60.0: + # use up some virtual time by doing real work + _ = pow(12345, 67890, 10000019) + if signal.getitimer(self.itimer) == (0.0, 0.0): + break # sig_vtalrm handler stopped this itimer + else: # Issue 8424 + self.skipTest("timeout: likely cause: machine too slow or load too " + "high") + + # virtual itimer should be (0.0, 0.0) now + self.assertEqual(signal.getitimer(self.itimer), (0.0, 0.0)) + # and the handler should have been called + self.assertEqual(self.hndl_called, True) + + # Issue 3864. Unknown if this affects earlier versions of freebsd also. + @unittest.skipIf(sys.platform=='freebsd6', + 'itimer not reliable (does not mix well with threading) on freebsd6') + def test_itimer_prof(self): + self.itimer = signal.ITIMER_PROF + signal.signal(signal.SIGPROF, self.sig_prof) + signal.setitimer(self.itimer, 0.2, 0.2) + + start_time = time.time() + while time.time() - start_time < 60.0: + # do some work + _ = pow(12345, 67890, 10000019) + if signal.getitimer(self.itimer) == (0.0, 0.0): + break # sig_prof handler stopped this itimer + else: # Issue 8424 + self.skipTest("timeout: likely cause: machine too slow or load too " + "high") + + # profiling itimer should be (0.0, 0.0) now + self.assertEqual(signal.getitimer(self.itimer), (0.0, 0.0)) + # and the handler should have been called + self.assertEqual(self.hndl_called, True) + +def test_main(): + test_support.run_unittest(BasicSignalTests, InterProcessSignalTests, + WakeupSignalTests, SiginterruptTest, + ItimerTest, WindowsSignalTests) + + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_smtplib.py python-gevent-1.0/greentest/2.7/test_smtplib.py --- python-gevent-0.13.7/greentest/2.7/test_smtplib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_smtplib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,517 @@ +import asyncore +import email.utils +import socket +import smtpd +import smtplib +import StringIO +import sys +import time +import select + +import unittest +from test import test_support + +try: + import threading +except ImportError: + threading = None + +HOST = test_support.HOST + +def server(evt, buf, serv): + serv.listen(5) + evt.set() + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 500 + while buf and n > 0: + r, w, e = select.select([], [conn], []) + if w: + sent = conn.send(buf) + buf = buf[sent:] + + n -= 1 + + conn.close() + finally: + serv.close() + evt.set() + +@unittest.skipUnless(threading, 'Threading required for this test.') +class GeneralTests(unittest.TestCase): + + def setUp(self): + self._threads = test_support.threading_setup() + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(15) + self.port = test_support.bind_port(self.sock) + servargs = (self.evt, "220 Hola mundo\n", self.sock) + self.thread = threading.Thread(target=server, args=servargs) + self.thread.start() + self.evt.wait() + self.evt.clear() + + def tearDown(self): + self.evt.wait() + self.thread.join() + test_support.threading_cleanup(*self._threads) + + def testBasic1(self): + # connects + smtp = smtplib.SMTP(HOST, self.port) + smtp.close() + + def testBasic2(self): + # connects, include port in host name + smtp = smtplib.SMTP("%s:%s" % (HOST, self.port)) + smtp.close() + + def testLocalHostName(self): + # check that supplied local_hostname is used + smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost") + self.assertEqual(smtp.local_hostname, "testhost") + smtp.close() + + def testTimeoutDefault(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + smtp = smtplib.SMTP(HOST, self.port) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(smtp.sock.gettimeout(), 30) + smtp.close() + + def testTimeoutNone(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + smtp = smtplib.SMTP(HOST, self.port, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(smtp.sock.gettimeout() is None) + smtp.close() + + def testTimeoutValue(self): + smtp = smtplib.SMTP(HOST, self.port, timeout=30) + self.assertEqual(smtp.sock.gettimeout(), 30) + smtp.close() + + +# Test server thread using the specified SMTP server class +def debugging_server(serv, serv_evt, client_evt): + serv_evt.set() + + try: + if hasattr(select, 'poll'): + poll_fun = asyncore.poll2 + else: + poll_fun = asyncore.poll + + n = 1000 + while asyncore.socket_map and n > 0: + poll_fun(0.01, asyncore.socket_map) + + # when the client conversation is finished, it will + # set client_evt, and it's then ok to kill the server + if client_evt.is_set(): + serv.close() + break + + n -= 1 + + except socket.timeout: + pass + finally: + if not client_evt.is_set(): + # allow some time for the client to read the result + time.sleep(0.5) + serv.close() + asyncore.close_all() + serv_evt.set() + +MSG_BEGIN = '---------- MESSAGE FOLLOWS ----------\n' +MSG_END = '------------ END MESSAGE ------------\n' + +# NOTE: Some SMTP objects in the tests below are created with a non-default +# local_hostname argument to the constructor, since (on some systems) the FQDN +# lookup caused by the default local_hostname sometimes takes so long that the +# test server times out, causing the test to fail. + +# Test behavior of smtpd.DebuggingServer +@unittest.skipUnless(threading, 'Threading required for this test.') +class DebuggingServerTests(unittest.TestCase): + + def setUp(self): + # temporarily replace sys.stdout to capture DebuggingServer output + self.old_stdout = sys.stdout + self.output = StringIO.StringIO() + sys.stdout = self.output + + self._threads = test_support.threading_setup() + self.serv_evt = threading.Event() + self.client_evt = threading.Event() + # Pick a random unused port by passing 0 for the port number + self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1)) + # Keep a note of what port was assigned + self.port = self.serv.socket.getsockname()[1] + serv_args = (self.serv, self.serv_evt, self.client_evt) + self.thread = threading.Thread(target=debugging_server, args=serv_args) + self.thread.start() + + # wait until server thread has assigned a port number + self.serv_evt.wait() + self.serv_evt.clear() + + def tearDown(self): + # indicate that the client is finished + self.client_evt.set() + # wait for the server thread to terminate + self.serv_evt.wait() + self.thread.join() + test_support.threading_cleanup(*self._threads) + # restore sys.stdout + sys.stdout = self.old_stdout + + def testBasic(self): + # connect + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.quit() + + def testNOOP(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (250, 'Ok') + self.assertEqual(smtp.noop(), expected) + smtp.quit() + + def testRSET(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (250, 'Ok') + self.assertEqual(smtp.rset(), expected) + smtp.quit() + + def testNotImplemented(self): + # EHLO isn't implemented in DebuggingServer + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (502, 'Error: command "EHLO" not implemented') + self.assertEqual(smtp.ehlo(), expected) + smtp.quit() + + def testVRFY(self): + # VRFY isn't implemented in DebuggingServer + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + expected = (502, 'Error: command "VRFY" not implemented') + self.assertEqual(smtp.vrfy('nobody@nowhere.com'), expected) + self.assertEqual(smtp.verify('nobody@nowhere.com'), expected) + smtp.quit() + + def testSecondHELO(self): + # check that a second HELO returns a message that it's a duplicate + # (this behavior is specific to smtpd.SMTPChannel) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.helo() + expected = (503, 'Duplicate HELO/EHLO') + self.assertEqual(smtp.helo(), expected) + smtp.quit() + + def testHELP(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + self.assertEqual(smtp.help(), 'Error: command "HELP" not implemented') + smtp.quit() + + def testSend(self): + # connect and send mail + m = 'A test message' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.sendmail('John', 'Sally', m) + # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor + # in asyncore. This sleep might help, but should really be fixed + # properly by using an Event variable. + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + + +class NonConnectingTests(unittest.TestCase): + + def testNotConnected(self): + # Test various operations on an unconnected SMTP object that + # should raise exceptions (at present the attempt in SMTP.send + # to reference the nonexistent 'sock' attribute of the SMTP object + # causes an AttributeError) + smtp = smtplib.SMTP() + self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo) + self.assertRaises(smtplib.SMTPServerDisconnected, + smtp.send, 'test msg') + + def testNonnumericPort(self): + # check that non-numeric port raises socket.error + self.assertRaises(socket.error, smtplib.SMTP, + "localhost", "bogus") + self.assertRaises(socket.error, smtplib.SMTP, + "localhost:bogus") + + +# test response of client to a non-successful HELO message +@unittest.skipUnless(threading, 'Threading required for this test.') +class BadHELOServerTests(unittest.TestCase): + + def setUp(self): + self.old_stdout = sys.stdout + self.output = StringIO.StringIO() + sys.stdout = self.output + + self._threads = test_support.threading_setup() + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(15) + self.port = test_support.bind_port(self.sock) + servargs = (self.evt, "199 no hello for you!\n", self.sock) + self.thread = threading.Thread(target=server, args=servargs) + self.thread.start() + self.evt.wait() + self.evt.clear() + + def tearDown(self): + self.evt.wait() + self.thread.join() + test_support.threading_cleanup(*self._threads) + sys.stdout = self.old_stdout + + def testFailingHELO(self): + self.assertRaises(smtplib.SMTPConnectError, smtplib.SMTP, + HOST, self.port, 'localhost', 3) + + +sim_users = {'Mr.A@somewhere.com':'John A', + 'Ms.B@somewhere.com':'Sally B', + 'Mrs.C@somewhereesle.com':'Ruth C', + } + +sim_auth = ('Mr.A@somewhere.com', 'somepassword') +sim_cram_md5_challenge = ('PENCeUxFREJoU0NnbmhNWitOMjNGNn' + 'dAZWx3b29kLmlubm9zb2Z0LmNvbT4=') +sim_auth_credentials = { + 'login': 'TXIuQUBzb21ld2hlcmUuY29t', + 'plain': 'AE1yLkFAc29tZXdoZXJlLmNvbQBzb21lcGFzc3dvcmQ=', + 'cram-md5': ('TXIUQUBZB21LD2HLCMUUY29TIDG4OWQ0MJ' + 'KWZGQ4ODNMNDA4NTGXMDRLZWMYZJDMODG1'), + } +sim_auth_login_password = 'C29TZXBHC3N3B3JK' + +sim_lists = {'list-1':['Mr.A@somewhere.com','Mrs.C@somewhereesle.com'], + 'list-2':['Ms.B@somewhere.com',], + } + +# Simulated SMTP channel & server +class SimSMTPChannel(smtpd.SMTPChannel): + + def __init__(self, extra_features, *args, **kw): + self._extrafeatures = ''.join( + [ "250-{0}\r\n".format(x) for x in extra_features ]) + smtpd.SMTPChannel.__init__(self, *args, **kw) + + def smtp_EHLO(self, arg): + resp = ('250-testhost\r\n' + '250-EXPN\r\n' + '250-SIZE 20000000\r\n' + '250-STARTTLS\r\n' + '250-DELIVERBY\r\n') + resp = resp + self._extrafeatures + '250 HELP' + self.push(resp) + + def smtp_VRFY(self, arg): + # For max compatibility smtplib should be sending the raw address. + if arg in sim_users: + self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg))) + else: + self.push('550 No such user: %s' % arg) + + def smtp_EXPN(self, arg): + list_name = arg.lower() + if list_name in sim_lists: + user_list = sim_lists[list_name] + for n, user_email in enumerate(user_list): + quoted_addr = smtplib.quoteaddr(user_email) + if n < len(user_list) - 1: + self.push('250-%s %s' % (sim_users[user_email], quoted_addr)) + else: + self.push('250 %s %s' % (sim_users[user_email], quoted_addr)) + else: + self.push('550 No access for you!') + + def smtp_AUTH(self, arg): + if arg.strip().lower()=='cram-md5': + self.push('334 {0}'.format(sim_cram_md5_challenge)) + return + mech, auth = arg.split() + mech = mech.lower() + if mech not in sim_auth_credentials: + self.push('504 auth type unimplemented') + return + if mech == 'plain' and auth==sim_auth_credentials['plain']: + self.push('235 plain auth ok') + elif mech=='login' and auth==sim_auth_credentials['login']: + self.push('334 Password:') + else: + self.push('550 No access for you!') + + def handle_error(self): + raise + + +class SimSMTPServer(smtpd.SMTPServer): + + def __init__(self, *args, **kw): + self._extra_features = [] + smtpd.SMTPServer.__init__(self, *args, **kw) + + def handle_accept(self): + conn, addr = self.accept() + self._SMTPchannel = SimSMTPChannel(self._extra_features, + self, conn, addr) + + def process_message(self, peer, mailfrom, rcpttos, data): + pass + + def add_feature(self, feature): + self._extra_features.append(feature) + + def handle_error(self): + raise + + +# Test various SMTP & ESMTP commands/behaviors that require a simulated server +# (i.e., something with more features than DebuggingServer) +@unittest.skipUnless(threading, 'Threading required for this test.') +class SMTPSimTests(unittest.TestCase): + + def setUp(self): + self._threads = test_support.threading_setup() + self.serv_evt = threading.Event() + self.client_evt = threading.Event() + # Pick a random unused port by passing 0 for the port number + self.serv = SimSMTPServer((HOST, 0), ('nowhere', -1)) + # Keep a note of what port was assigned + self.port = self.serv.socket.getsockname()[1] + serv_args = (self.serv, self.serv_evt, self.client_evt) + self.thread = threading.Thread(target=debugging_server, args=serv_args) + self.thread.start() + + # wait until server thread has assigned a port number + self.serv_evt.wait() + self.serv_evt.clear() + + def tearDown(self): + # indicate that the client is finished + self.client_evt.set() + # wait for the server thread to terminate + self.serv_evt.wait() + self.thread.join() + test_support.threading_cleanup(*self._threads) + + def testBasic(self): + # smoke test + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.quit() + + def testEHLO(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + # no features should be present before the EHLO + self.assertEqual(smtp.esmtp_features, {}) + + # features expected from the test server + expected_features = {'expn':'', + 'size': '20000000', + 'starttls': '', + 'deliverby': '', + 'help': '', + } + + smtp.ehlo() + self.assertEqual(smtp.esmtp_features, expected_features) + for k in expected_features: + self.assertTrue(smtp.has_extn(k)) + self.assertFalse(smtp.has_extn('unsupported-feature')) + smtp.quit() + + def testVRFY(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + for email, name in sim_users.items(): + expected_known = (250, '%s %s' % (name, smtplib.quoteaddr(email))) + self.assertEqual(smtp.vrfy(email), expected_known) + + u = 'nobody@nowhere.com' + expected_unknown = (550, 'No such user: %s' % u) + self.assertEqual(smtp.vrfy(u), expected_unknown) + smtp.quit() + + def testEXPN(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + for listname, members in sim_lists.items(): + users = [] + for m in members: + users.append('%s %s' % (sim_users[m], smtplib.quoteaddr(m))) + expected_known = (250, '\n'.join(users)) + self.assertEqual(smtp.expn(listname), expected_known) + + u = 'PSU-Members-List' + expected_unknown = (550, 'No access for you!') + self.assertEqual(smtp.expn(u), expected_unknown) + smtp.quit() + + def testAUTH_PLAIN(self): + self.serv.add_feature("AUTH PLAIN") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + expected_auth_ok = (235, b'plain auth ok') + self.assertEqual(smtp.login(sim_auth[0], sim_auth[1]), expected_auth_ok) + + # SimSMTPChannel doesn't fully support LOGIN or CRAM-MD5 auth because they + # require a synchronous read to obtain the credentials...so instead smtpd + # sees the credential sent by smtplib's login method as an unknown command, + # which results in smtplib raising an auth error. Fortunately the error + # message contains the encoded credential, so we can partially check that it + # was generated correctly (partially, because the 'word' is uppercased in + # the error message). + + def testAUTH_LOGIN(self): + self.serv.add_feature("AUTH LOGIN") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + try: smtp.login(sim_auth[0], sim_auth[1]) + except smtplib.SMTPAuthenticationError as err: + if sim_auth_login_password not in str(err): + raise "expected encoded password not found in error message" + + def testAUTH_CRAM_MD5(self): + self.serv.add_feature("AUTH CRAM-MD5") + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + + try: smtp.login(sim_auth[0], sim_auth[1]) + except smtplib.SMTPAuthenticationError as err: + if sim_auth_credentials['cram-md5'] not in str(err): + raise "expected encoded credentials not found in error message" + + #TODO: add tests for correct AUTH method fallback now that the + #test infrastructure can support it. + + +def test_main(verbose=None): + test_support.run_unittest(GeneralTests, DebuggingServerTests, + NonConnectingTests, + BadHELOServerTests, SMTPSimTests) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_socket.py python-gevent-1.0/greentest/2.7/test_socket.py --- python-gevent-0.13.7/greentest/2.7/test_socket.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_socket.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1627 @@ +#!/usr/bin/env python + +import unittest +from test import test_support + +import errno +import socket +import select +import time +import traceback +import Queue +import sys +import os +import array +import contextlib +from weakref import proxy +import signal +import math + +def try_address(host, port=0, family=socket.AF_INET): + """Try to bind a socket on the given host:port and return True + if that has been possible.""" + try: + sock = socket.socket(family, socket.SOCK_STREAM) + sock.bind((host, port)) + except (socket.error, socket.gaierror): + return False + else: + sock.close() + return True + +HOST = test_support.HOST +MSG = b'Michael Gilfix was here\n' +SUPPORTS_IPV6 = socket.has_ipv6 and try_address('::1', family=socket.AF_INET6) + +try: + import thread + import threading +except ImportError: + thread = None + threading = None + +HOST = test_support.HOST +MSG = 'Michael Gilfix was here\n' + +class SocketTCPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.serv) + self.serv.listen(1) + + def tearDown(self): + self.serv.close() + self.serv = None + +class SocketUDPTest(unittest.TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.port = test_support.bind_port(self.serv) + + def tearDown(self): + self.serv.close() + self.serv = None + +class ThreadableTest: + """Threadable Test class + + The ThreadableTest class makes it easy to create a threaded + client/server pair from an existing unit test. To create a + new threaded class from an existing unit test, use multiple + inheritance: + + class NewClass (OldClass, ThreadableTest): + pass + + This class defines two new fixture functions with obvious + purposes for overriding: + + clientSetUp () + clientTearDown () + + Any new test functions within the class must then define + tests in pairs, where the test name is preceeded with a + '_' to indicate the client portion of the test. Ex: + + def testFoo(self): + # Server portion + + def _testFoo(self): + # Client portion + + Any exceptions raised by the clients during their tests + are caught and transferred to the main thread to alert + the testing framework. + + Note, the server setup function cannot call any blocking + functions that rely on the client thread during setup, + unless serverExplicitReady() is called just before + the blocking call (such as in setting up a client/server + connection and performing the accept() in setUp(). + """ + + def __init__(self): + # Swap the true setup function + self.__setUp = self.setUp + self.__tearDown = self.tearDown + self.setUp = self._setUp + self.tearDown = self._tearDown + + def serverExplicitReady(self): + """This method allows the server to explicitly indicate that + it wants the client thread to proceed. This is useful if the + server is about to execute a blocking routine that is + dependent upon the client thread during its setup routine.""" + self.server_ready.set() + + def _setUp(self): + self.server_ready = threading.Event() + self.client_ready = threading.Event() + self.done = threading.Event() + self.queue = Queue.Queue(1) + + # Do some munging to start the client test. + methodname = self.id() + i = methodname.rfind('.') + methodname = methodname[i+1:] + test_method = getattr(self, '_' + methodname) + self.client_thread = thread.start_new_thread( + self.clientRun, (test_method,)) + + self.__setUp() + if not self.server_ready.is_set(): + self.server_ready.set() + self.client_ready.wait() + + def _tearDown(self): + self.__tearDown() + self.done.wait() + + if not self.queue.empty(): + msg = self.queue.get() + self.fail(msg) + + def clientRun(self, test_func): + self.server_ready.wait() + self.clientSetUp() + self.client_ready.set() + if not callable(test_func): + raise TypeError("test_func must be a callable function.") + try: + test_func() + except Exception, strerror: + self.queue.put(strerror) + self.clientTearDown() + + def clientSetUp(self): + raise NotImplementedError("clientSetUp must be implemented.") + + def clientTearDown(self): + self.done.set() + thread.exit() + +class ThreadedTCPSocketTest(SocketTCPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketTCPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + +class ThreadedUDPSocketTest(SocketUDPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketUDPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + +class SocketConnectedTest(ThreadedTCPSocketTest): + + def __init__(self, methodName='runTest'): + ThreadedTCPSocketTest.__init__(self, methodName=methodName) + + def setUp(self): + ThreadedTCPSocketTest.setUp(self) + # Indicate explicitly we're ready for the client thread to + # proceed and then perform the blocking call to accept + self.serverExplicitReady() + conn, addr = self.serv.accept() + self.cli_conn = conn + + def tearDown(self): + self.cli_conn.close() + self.cli_conn = None + ThreadedTCPSocketTest.tearDown(self) + + def clientSetUp(self): + ThreadedTCPSocketTest.clientSetUp(self) + self.cli.connect((HOST, self.port)) + self.serv_conn = self.cli + + def clientTearDown(self): + self.serv_conn.close() + self.serv_conn = None + ThreadedTCPSocketTest.clientTearDown(self) + +class SocketPairTest(unittest.TestCase, ThreadableTest): + + def __init__(self, methodName='runTest'): + unittest.TestCase.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def setUp(self): + self.serv, self.cli = socket.socketpair() + + def tearDown(self): + self.serv.close() + self.serv = None + + def clientSetUp(self): + pass + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + + +####################################################################### +## Begin Tests + +class GeneralModuleTests(unittest.TestCase): + + def test_weakref(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + p = proxy(s) + self.assertEqual(p.fileno(), s.fileno()) + s.close() + s = None + try: + p.fileno() + except ReferenceError: + pass + else: + self.fail('Socket proxy still exists') + + def testSocketError(self): + # Testing socket module exceptions + def raise_error(*args, **kwargs): + raise socket.error + def raise_herror(*args, **kwargs): + raise socket.herror + def raise_gaierror(*args, **kwargs): + raise socket.gaierror + self.assertRaises(socket.error, raise_error, + "Error raising socket exception.") + self.assertRaises(socket.error, raise_herror, + "Error raising socket exception.") + self.assertRaises(socket.error, raise_gaierror, + "Error raising socket exception.") + + def testSendtoErrors(self): + # Testing that sendto doens't masks failures. See #10169. + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.addCleanup(s.close) + s.bind(('', 0)) + sockname = s.getsockname() + # 2 args + with self.assertRaises(UnicodeEncodeError): + s.sendto(u'\u2620', sockname) + with self.assertRaises(TypeError) as cm: + s.sendto(5j, sockname) + self.assertIn('not complex', str(cm.exception)) + with self.assertRaises(TypeError) as cm: + s.sendto('foo', None) + self.assertIn('not NoneType', str(cm.exception)) + # 3 args + with self.assertRaises(UnicodeEncodeError): + s.sendto(u'\u2620', 0, sockname) + with self.assertRaises(TypeError) as cm: + s.sendto(5j, 0, sockname) + self.assertIn('not complex', str(cm.exception)) + with self.assertRaises(TypeError) as cm: + s.sendto('foo', 0, None) + self.assertIn('not NoneType', str(cm.exception)) + with self.assertRaises(TypeError) as cm: + s.sendto('foo', 'bar', sockname) + self.assertIn('an integer is required', str(cm.exception)) + with self.assertRaises(TypeError) as cm: + s.sendto('foo', None, None) + self.assertIn('an integer is required', str(cm.exception)) + # wrong number of args + with self.assertRaises(TypeError) as cm: + s.sendto('foo') + self.assertIn('(1 given)', str(cm.exception)) + with self.assertRaises(TypeError) as cm: + s.sendto('foo', 0, sockname, 4) + self.assertIn('(4 given)', str(cm.exception)) + + + def testCrucialConstants(self): + # Testing for mission critical constants + socket.AF_INET + socket.SOCK_STREAM + socket.SOCK_DGRAM + socket.SOCK_RAW + socket.SOCK_RDM + socket.SOCK_SEQPACKET + socket.SOL_SOCKET + socket.SO_REUSEADDR + + def testHostnameRes(self): + # Testing hostname resolution mechanisms + hostname = socket.gethostname() + try: + ip = socket.gethostbyname(hostname) + except socket.error: + # Probably name lookup wasn't set up right; skip this test + return + self.assertTrue(ip.find('.') >= 0, "Error resolving host to ip.") + try: + hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + except socket.error: + # Probably a similar problem as above; skip this test + return + all_host_names = [hostname, hname] + aliases + fqhn = socket.getfqdn(ip) + if not fqhn in all_host_names: + self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) + + def testRefCountGetNameInfo(self): + # Testing reference count for getnameinfo + if hasattr(sys, "getrefcount"): + try: + # On some versions, this loses a reference + orig = sys.getrefcount(__name__) + socket.getnameinfo(__name__,0) + except TypeError: + self.assertEqual(sys.getrefcount(__name__), orig, + "socket.getnameinfo loses a reference") + + def testInterpreterCrash(self): + # Making sure getnameinfo doesn't crash the interpreter + try: + # On some versions, this crashes the interpreter. + socket.getnameinfo(('x', 0, 0, 0), 0) + except socket.error: + pass + + def testNtoH(self): + # This just checks that htons etc. are their own inverse, + # when looking at the lower 16 or 32 bits. + sizes = {socket.htonl: 32, socket.ntohl: 32, + socket.htons: 16, socket.ntohs: 16} + for func, size in sizes.items(): + mask = (1L<= 0.9 + self.assertGreaterEqual(n, 0x900000) + # < 2.0 + self.assertLess(n, 0x20000000) + major, minor, fix, patch, status = t + self.assertGreaterEqual(major, 0) + self.assertLess(major, 2) + self.assertGreaterEqual(minor, 0) + self.assertLess(minor, 256) + self.assertGreaterEqual(fix, 0) + self.assertLess(fix, 256) + self.assertGreaterEqual(patch, 0) + self.assertLessEqual(patch, 26) + self.assertGreaterEqual(status, 0) + self.assertLessEqual(status, 15) + # Version string as returned by OpenSSL, the format might change + self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)), + (s, t)) + + def test_ciphers(self): + if not test_support.is_resource_enabled('network'): + return + remote = ("svn.python.org", 443) + with test_support.transient_internet(remote[0]): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="ALL") + s.connect(remote) + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT") + s.connect(remote) + # Error checking occurs when connecting, because the SSL context + # isn't created before. + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") + with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"): + s.connect(remote) + + @test_support.cpython_only + def test_refcycle(self): + # Issue #7943: an SSL object doesn't create reference cycles with + # itself. + s = socket.socket(socket.AF_INET) + ss = ssl.wrap_socket(s) + wr = weakref.ref(ss) + del ss + self.assertEqual(wr(), None) + + def test_wrapped_unconnected(self): + # The _delegate_methods in socket.py are correctly delegated to by an + # unconnected SSLSocket, so they will raise a socket.error rather than + # something unexpected like TypeError. + s = socket.socket(socket.AF_INET) + ss = ssl.wrap_socket(s) + self.assertRaises(socket.error, ss.recv, 1) + self.assertRaises(socket.error, ss.recv_into, bytearray(b'x')) + self.assertRaises(socket.error, ss.recvfrom, 1) + self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), 1) + self.assertRaises(socket.error, ss.send, b'x') + self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0)) + + +class NetworkedTests(unittest.TestCase): + + def test_connect(self): + with test_support.transient_internet("svn.python.org"): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE) + s.connect(("svn.python.org", 443)) + c = s.getpeercert() + if c: + self.fail("Peer cert %s shouldn't be here!") + s.close() + + # this should fail because we have no verification certs + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED) + try: + s.connect(("svn.python.org", 443)) + except ssl.SSLError: + pass + finally: + s.close() + + # this should succeed because we specify the root cert + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED, + ca_certs=SVN_PYTHON_ORG_ROOT_CERT) + try: + s.connect(("svn.python.org", 443)) + finally: + s.close() + + def test_connect_ex(self): + # Issue #11326: check connect_ex() implementation + with test_support.transient_internet("svn.python.org"): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED, + ca_certs=SVN_PYTHON_ORG_ROOT_CERT) + try: + self.assertEqual(0, s.connect_ex(("svn.python.org", 443))) + self.assertTrue(s.getpeercert()) + finally: + s.close() + + def test_non_blocking_connect_ex(self): + # Issue #11326: non-blocking connect_ex() should allow handshake + # to proceed after the socket gets ready. + with test_support.transient_internet("svn.python.org"): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED, + ca_certs=SVN_PYTHON_ORG_ROOT_CERT, + do_handshake_on_connect=False) + try: + s.setblocking(False) + rc = s.connect_ex(('svn.python.org', 443)) + # EWOULDBLOCK under Windows, EINPROGRESS elsewhere + self.assertIn(rc, (0, errno.EINPROGRESS, errno.EWOULDBLOCK)) + # Wait for connect to finish + select.select([], [s], [], 5.0) + # Non-blocking handshake + while True: + try: + s.do_handshake() + break + except ssl.SSLError as err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], [], 5.0) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], [], 5.0) + else: + raise + # SSL established + self.assertTrue(s.getpeercert()) + finally: + s.close() + + @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows") + def test_makefile_close(self): + # Issue #5238: creating a file-like object with makefile() shouldn't + # delay closing the underlying "real socket" (here tested with its + # file descriptor, hence skipping the test under Windows). + with test_support.transient_internet("svn.python.org"): + ss = ssl.wrap_socket(socket.socket(socket.AF_INET)) + ss.connect(("svn.python.org", 443)) + fd = ss.fileno() + f = ss.makefile() + f.close() + # The fd is still open + os.read(fd, 0) + # Closing the SSL socket should close the fd too + ss.close() + gc.collect() + with self.assertRaises(OSError) as e: + os.read(fd, 0) + self.assertEqual(e.exception.errno, errno.EBADF) + + def test_non_blocking_handshake(self): + with test_support.transient_internet("svn.python.org"): + s = socket.socket(socket.AF_INET) + s.connect(("svn.python.org", 443)) + s.setblocking(False) + s = ssl.wrap_socket(s, + cert_reqs=ssl.CERT_NONE, + do_handshake_on_connect=False) + count = 0 + while True: + try: + count += 1 + s.do_handshake() + break + except ssl.SSLError, err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], []) + else: + raise + s.close() + if test_support.verbose: + sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) + + def test_get_server_certificate(self): + with test_support.transient_internet("svn.python.org"): + pem = ssl.get_server_certificate(("svn.python.org", 443)) + if not pem: + self.fail("No server certificate on svn.python.org:443!") + + try: + pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=CERTFILE) + except ssl.SSLError: + #should fail + pass + else: + self.fail("Got server certificate %s for svn.python.org!" % pem) + + pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=SVN_PYTHON_ORG_ROOT_CERT) + if not pem: + self.fail("No server certificate on svn.python.org:443!") + if test_support.verbose: + sys.stdout.write("\nVerified certificate for svn.python.org:443 is\n%s\n" % pem) + + def test_algorithms(self): + # Issue #8484: all algorithms should be available when verifying a + # certificate. + # SHA256 was added in OpenSSL 0.9.8 + if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15): + self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION) + # NOTE: https://sha256.tbs-internet.com is another possible test host + remote = ("sha256.tbs-internet.com", 443) + sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem") + with test_support.transient_internet("sha256.tbs-internet.com"): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED, + ca_certs=sha256_cert,) + try: + s.connect(remote) + if test_support.verbose: + sys.stdout.write("\nCipher with %r is %r\n" % + (remote, s.cipher())) + sys.stdout.write("Certificate is:\n%s\n" % + pprint.pformat(s.getpeercert())) + finally: + s.close() + + +try: + import threading +except ImportError: + _have_threads = False +else: + _have_threads = True + + class ThreadedEchoServer(threading.Thread): + + class ConnectionHandler(threading.Thread): + + """A mildly complicated class, because we want it to work both + with and without the SSL wrapper around the socket connection, so + that we can test the STARTTLS functionality.""" + + def __init__(self, server, connsock): + self.server = server + self.running = False + self.sock = connsock + self.sock.setblocking(1) + self.sslconn = None + threading.Thread.__init__(self) + self.daemon = True + + def show_conn_details(self): + if self.server.certreqs == ssl.CERT_REQUIRED: + cert = self.sslconn.getpeercert() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") + cert_binary = self.sslconn.getpeercert(True) + if test_support.verbose and self.server.chatty: + sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") + cipher = self.sslconn.cipher() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") + + def wrap_conn(self): + try: + self.sslconn = ssl.wrap_socket(self.sock, server_side=True, + certfile=self.server.certificate, + ssl_version=self.server.protocol, + ca_certs=self.server.cacerts, + cert_reqs=self.server.certreqs, + ciphers=self.server.ciphers) + except ssl.SSLError as e: + # XXX Various errors can have happened here, for example + # a mismatching protocol version, an invalid certificate, + # or a low-level bug. This should be made more discriminating. + self.server.conn_errors.append(e) + if self.server.chatty: + handle_error("\n server: bad connection attempt from " + + str(self.sock.getpeername()) + ":\n") + self.close() + self.running = False + self.server.stop() + return False + else: + return True + + def read(self): + if self.sslconn: + return self.sslconn.read() + else: + return self.sock.recv(1024) + + def write(self, bytes): + if self.sslconn: + return self.sslconn.write(bytes) + else: + return self.sock.send(bytes) + + def close(self): + if self.sslconn: + self.sslconn.close() + else: + self.sock._sock.close() + + def run(self): + self.running = True + if not self.server.starttls_server: + if isinstance(self.sock, ssl.SSLSocket): + self.sslconn = self.sock + elif not self.wrap_conn(): + return + self.show_conn_details() + while self.running: + try: + msg = self.read() + if not msg: + # eof, so quit this handler + self.running = False + self.close() + elif msg.strip() == 'over': + if test_support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: client closed connection\n") + self.close() + return + elif self.server.starttls_server and msg.strip() == 'STARTTLS': + if test_support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read STARTTLS from client, sending OK...\n") + self.write("OK\n") + if not self.wrap_conn(): + return + elif self.server.starttls_server and self.sslconn and msg.strip() == 'ENDTLS': + if test_support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read ENDTLS from client, sending OK...\n") + self.write("OK\n") + self.sslconn.unwrap() + self.sslconn = None + if test_support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: connection is now unencrypted...\n") + else: + if (test_support.verbose and + self.server.connectionchatty): + ctype = (self.sslconn and "encrypted") or "unencrypted" + sys.stdout.write(" server: read %s (%s), sending back %s (%s)...\n" + % (repr(msg), ctype, repr(msg.lower()), ctype)) + self.write(msg.lower()) + except ssl.SSLError: + if self.server.chatty: + handle_error("Test server failure:\n") + self.close() + self.running = False + # normally, we'd just stop here, but for the test + # harness, we want to stop the server + self.server.stop() + + def __init__(self, certificate, ssl_version=None, + certreqs=None, cacerts=None, + chatty=True, connectionchatty=False, starttls_server=False, + wrap_accepting_socket=False, ciphers=None): + + if ssl_version is None: + ssl_version = ssl.PROTOCOL_TLSv1 + if certreqs is None: + certreqs = ssl.CERT_NONE + self.certificate = certificate + self.protocol = ssl_version + self.certreqs = certreqs + self.cacerts = cacerts + self.ciphers = ciphers + self.chatty = chatty + self.connectionchatty = connectionchatty + self.starttls_server = starttls_server + self.sock = socket.socket() + self.flag = None + if wrap_accepting_socket: + self.sock = ssl.wrap_socket(self.sock, server_side=True, + certfile=self.certificate, + cert_reqs = self.certreqs, + ca_certs = self.cacerts, + ssl_version = self.protocol, + ciphers = self.ciphers) + if test_support.verbose and self.chatty: + sys.stdout.write(' server: wrapped server socket as %s\n' % str(self.sock)) + self.port = test_support.bind_port(self.sock) + self.active = False + self.conn_errors = [] + threading.Thread.__init__(self) + self.daemon = True + + def __enter__(self): + self.start(threading.Event()) + self.flag.wait() + return self + + def __exit__(self, *args): + self.stop() + self.join() + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + self.sock.settimeout(0.05) + self.sock.listen(5) + self.active = True + if self.flag: + # signal an event + self.flag.set() + while self.active: + try: + newconn, connaddr = self.sock.accept() + if test_support.verbose and self.chatty: + sys.stdout.write(' server: new connection from ' + + str(connaddr) + '\n') + handler = self.ConnectionHandler(self, newconn) + handler.start() + handler.join() + except socket.timeout: + pass + except KeyboardInterrupt: + self.stop() + self.sock.close() + + def stop(self): + self.active = False + + class AsyncoreEchoServer(threading.Thread): + + class EchoServer(asyncore.dispatcher): + + class ConnectionHandler(asyncore.dispatcher_with_send): + + def __init__(self, conn, certfile): + asyncore.dispatcher_with_send.__init__(self, conn) + self.socket = ssl.wrap_socket(conn, server_side=True, + certfile=certfile, + do_handshake_on_connect=False) + self._ssl_accepting = True + + def readable(self): + if isinstance(self.socket, ssl.SSLSocket): + while self.socket.pending() > 0: + self.handle_read_event() + return True + + def _do_ssl_handshake(self): + try: + self.socket.do_handshake() + except ssl.SSLError, err: + if err.args[0] in (ssl.SSL_ERROR_WANT_READ, + ssl.SSL_ERROR_WANT_WRITE): + return + elif err.args[0] == ssl.SSL_ERROR_EOF: + return self.handle_close() + raise + except socket.error, err: + if err.args[0] == errno.ECONNABORTED: + return self.handle_close() + else: + self._ssl_accepting = False + + def handle_read(self): + if self._ssl_accepting: + self._do_ssl_handshake() + else: + data = self.recv(1024) + if data and data.strip() != 'over': + self.send(data.lower()) + + def handle_close(self): + self.close() + if test_support.verbose: + sys.stdout.write(" server: closed connection %s\n" % self.socket) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.certfile = certfile + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.socket) + self.listen(5) + + def handle_accept(self): + sock_obj, addr = self.accept() + if test_support.verbose: + sys.stdout.write(" server: new connection from %s:%s\n" %addr) + self.ConnectionHandler(sock_obj, self.certfile) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.flag = None + self.active = False + self.server = self.EchoServer(certfile) + self.port = self.server.port + threading.Thread.__init__(self) + self.daemon = True + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def __enter__(self): + self.start(threading.Event()) + self.flag.wait() + return self + + def __exit__(self, *args): + if test_support.verbose: + sys.stdout.write(" cleanup: stopping server.\n") + self.stop() + if test_support.verbose: + sys.stdout.write(" cleanup: joining server thread.\n") + self.join() + if test_support.verbose: + sys.stdout.write(" cleanup: successfully joined.\n") + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + self.active = True + if self.flag: + self.flag.set() + while self.active: + asyncore.loop(0.05) + + def stop(self): + self.active = False + self.server.close() + + class SocketServerHTTPSServer(threading.Thread): + + class HTTPSServer(HTTPServer): + + def __init__(self, server_address, RequestHandlerClass, certfile): + HTTPServer.__init__(self, server_address, RequestHandlerClass) + # we assume the certfile contains both private key and certificate + self.certfile = certfile + self.allow_reuse_address = True + + def __str__(self): + return ('<%s %s:%s>' % + (self.__class__.__name__, + self.server_name, + self.server_port)) + + def get_request(self): + # override this to wrap socket with SSL + sock, addr = self.socket.accept() + sslconn = ssl.wrap_socket(sock, server_side=True, + certfile=self.certfile) + return sslconn, addr + + class RootedHTTPRequestHandler(SimpleHTTPRequestHandler): + # need to override translate_path to get a known root, + # instead of using os.curdir, since the test could be + # run from anywhere + + server_version = "TestHTTPS/1.0" + + root = None + + def translate_path(self, path): + """Translate a /-separated PATH to the local filename syntax. + + Components that mean special things to the local file system + (e.g. drive or directory names) are ignored. (XXX They should + probably be diagnosed.) + + """ + # abandon query parameters + path = urlparse.urlparse(path)[2] + path = os.path.normpath(urllib.unquote(path)) + words = path.split('/') + words = filter(None, words) + path = self.root + for word in words: + drive, word = os.path.splitdrive(word) + head, word = os.path.split(word) + if word in self.root: continue + path = os.path.join(path, word) + return path + + def log_message(self, format, *args): + + # we override this to suppress logging unless "verbose" + + if test_support.verbose: + sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" % + (self.server.server_address, + self.server.server_port, + self.request.cipher(), + self.log_date_time_string(), + format%args)) + + + def __init__(self, certfile): + self.flag = None + self.RootedHTTPRequestHandler.root = os.path.split(CERTFILE)[0] + self.server = self.HTTPSServer( + (HOST, 0), self.RootedHTTPRequestHandler, certfile) + self.port = self.server.server_port + threading.Thread.__init__(self) + self.daemon = True + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + if self.flag: + self.flag.set() + self.server.serve_forever(0.05) + + def stop(self): + self.server.shutdown() + + + def bad_cert_test(certfile): + """ + Launch a server with CERT_REQUIRED, and check that trying to + connect to it with the given client certificate fails. + """ + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_REQUIRED, + cacerts=CERTFILE, chatty=False) + with server: + try: + s = ssl.wrap_socket(socket.socket(), + certfile=certfile, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + except ssl.SSLError, x: + if test_support.verbose: + sys.stdout.write("\nSSLError is %s\n" % x[1]) + except socket.error, x: + if test_support.verbose: + sys.stdout.write("\nsocket.error is %s\n" % x[1]) + else: + raise AssertionError("Use of invalid cert should have failed!") + + def server_params_test(certfile, protocol, certreqs, cacertsfile, + client_certfile, client_protocol=None, indata="FOO\n", + ciphers=None, chatty=True, connectionchatty=False, + wrap_accepting_socket=False): + """ + Launch a server, connect a client to it and try various reads + and writes. + """ + server = ThreadedEchoServer(certfile, + certreqs=certreqs, + ssl_version=protocol, + cacerts=cacertsfile, + ciphers=ciphers, + chatty=chatty, + connectionchatty=connectionchatty, + wrap_accepting_socket=wrap_accepting_socket) + with server: + # try to connect + if client_protocol is None: + client_protocol = protocol + s = ssl.wrap_socket(socket.socket(), + certfile=client_certfile, + ca_certs=cacertsfile, + ciphers=ciphers, + cert_reqs=certreqs, + ssl_version=client_protocol) + s.connect((HOST, server.port)) + for arg in [indata, bytearray(indata), memoryview(indata)]: + if connectionchatty: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(arg))) + s.write(arg) + outdata = s.read() + if connectionchatty: + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + raise AssertionError( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if connectionchatty: + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + + def try_protocol_combo(server_protocol, + client_protocol, + expect_success, + certsreqs=None): + if certsreqs is None: + certsreqs = ssl.CERT_NONE + certtype = { + ssl.CERT_NONE: "CERT_NONE", + ssl.CERT_OPTIONAL: "CERT_OPTIONAL", + ssl.CERT_REQUIRED: "CERT_REQUIRED", + }[certsreqs] + if test_support.verbose: + formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n" + sys.stdout.write(formatstr % + (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol), + certtype)) + try: + # NOTE: we must enable "ALL" ciphers, otherwise an SSLv23 client + # will send an SSLv3 hello (rather than SSLv2) starting from + # OpenSSL 1.0.0 (see issue #8322). + server_params_test(CERTFILE, server_protocol, certsreqs, + CERTFILE, CERTFILE, client_protocol, + ciphers="ALL", chatty=False) + # Protocol mismatch can result in either an SSLError, or a + # "Connection reset by peer" error. + except ssl.SSLError: + if expect_success: + raise + except socket.error as e: + if expect_success or e.errno != errno.ECONNRESET: + raise + else: + if not expect_success: + raise AssertionError( + "Client protocol %s succeeded with server protocol %s!" + % (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol))) + + + class ThreadedTests(unittest.TestCase): + + def test_rude_shutdown(self): + """A brutal shutdown of an SSL server should raise an IOError + in the client when attempting handshake. + """ + listener_ready = threading.Event() + listener_gone = threading.Event() + + s = socket.socket() + port = test_support.bind_port(s, HOST) + + # `listener` runs in a thread. It sits in an accept() until + # the main thread connects. Then it rudely closes the socket, + # and sets Event `listener_gone` to let the main thread know + # the socket is gone. + def listener(): + s.listen(5) + listener_ready.set() + s.accept() + s.close() + listener_gone.set() + + def connector(): + listener_ready.wait() + c = socket.socket() + c.connect((HOST, port)) + listener_gone.wait() + try: + ssl_sock = ssl.wrap_socket(c) + except IOError: + pass + else: + self.fail('connecting to closed SSL socket should have failed') + + t = threading.Thread(target=listener) + t.start() + try: + connector() + finally: + t.join() + + @skip_if_broken_ubuntu_ssl + def test_echo(self): + """Basic test of an SSL client connecting to a server""" + if test_support.verbose: + sys.stdout.write("\n") + server_params_test(CERTFILE, ssl.PROTOCOL_TLSv1, ssl.CERT_NONE, + CERTFILE, CERTFILE, ssl.PROTOCOL_TLSv1, + chatty=True, connectionchatty=True) + + def test_getpeercert(self): + if test_support.verbose: + sys.stdout.write("\n") + s2 = socket.socket() + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_SSLv23, + cacerts=CERTFILE, + chatty=False) + with server: + s = ssl.wrap_socket(socket.socket(), + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_REQUIRED, + ssl_version=ssl.PROTOCOL_SSLv23) + s.connect((HOST, server.port)) + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") + cipher = s.cipher() + if test_support.verbose: + sys.stdout.write(pprint.pformat(cert) + '\n') + sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') + if 'subject' not in cert: + self.fail("No subject field in certificate: %s." % + pprint.pformat(cert)) + if ((('organizationName', 'Python Software Foundation'),) + not in cert['subject']): + self.fail( + "Missing or invalid 'organizationName' field in certificate subject; " + "should be 'Python Software Foundation'.") + s.close() + + def test_empty_cert(self): + """Connecting with an empty cert file""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "nullcert.pem")) + def test_malformed_cert(self): + """Connecting with a badly formatted certificate (syntax error)""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "badcert.pem")) + def test_nonexisting_cert(self): + """Connecting with a non-existing cert file""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "wrongcert.pem")) + def test_malformed_key(self): + """Connecting with a badly formatted key (syntax error)""" + bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, + "badkey.pem")) + + @skip_if_broken_ubuntu_ssl + def test_protocol_sslv2(self): + """Connecting to an SSLv2 server with various client options""" + if test_support.verbose: + sys.stdout.write("\n") + if not hasattr(ssl, 'PROTOCOL_SSLv2'): + self.skipTest("PROTOCOL_SSLv2 needed") + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, True) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) + + @skip_if_broken_ubuntu_ssl + def test_protocol_sslv23(self): + """Connecting to an SSLv23 server with various client options""" + if test_support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) + + @skip_if_broken_ubuntu_ssl + def test_protocol_sslv3(self): + """Connecting to an SSLv3 server with various client options""" + if test_support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) + + @skip_if_broken_ubuntu_ssl + def test_protocol_tlsv1(self): + """Connecting to a TLSv1 server with various client options""" + if test_support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) + + def test_starttls(self): + """Switching from clear text to encrypted and back again.""" + msgs = ("msg 1", "MSG 2", "STARTTLS", "MSG 3", "msg 4", "ENDTLS", "msg 5", "msg 6") + + server = ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_TLSv1, + starttls_server=True, + chatty=True, + connectionchatty=True) + wrapped = False + with server: + s = socket.socket() + s.setblocking(1) + s.connect((HOST, server.port)) + if test_support.verbose: + sys.stdout.write("\n") + for indata in msgs: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % repr(indata)) + if wrapped: + conn.write(indata) + outdata = conn.read() + else: + s.send(indata) + outdata = s.recv(1024) + if (indata == "STARTTLS" and + outdata.strip().lower().startswith("ok")): + # STARTTLS ok, switch to secure mode + if test_support.verbose: + sys.stdout.write( + " client: read %s from server, starting TLS...\n" + % repr(outdata)) + conn = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) + wrapped = True + elif (indata == "ENDTLS" and + outdata.strip().lower().startswith("ok")): + # ENDTLS ok, switch back to clear text + if test_support.verbose: + sys.stdout.write( + " client: read %s from server, ending TLS...\n" + % repr(outdata)) + s = conn.unwrap() + wrapped = False + else: + if test_support.verbose: + sys.stdout.write( + " client: read %s from server\n" % repr(outdata)) + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + if wrapped: + conn.write("over\n") + else: + s.send("over\n") + s.close() + + def test_socketserver(self): + """Using a SocketServer to create and manage SSL connections.""" + server = SocketServerHTTPSServer(CERTFILE) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + if test_support.verbose: + sys.stdout.write('\n') + with open(CERTFILE, 'rb') as f: + d1 = f.read() + d2 = '' + # now fetch the same data from the HTTPS server + url = 'https://127.0.0.1:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) + with test_support.check_py3k_warnings(): + f = urllib.urlopen(url) + dlen = f.info().getheader("content-length") + if dlen and (int(dlen) > 0): + d2 = f.read(int(dlen)) + if test_support.verbose: + sys.stdout.write( + " client: read %d bytes from remote server '%s'\n" + % (len(d2), server)) + f.close() + self.assertEqual(d1, d2) + finally: + server.stop() + server.join() + + def test_wrapped_accept(self): + """Check the accept() method on SSL sockets.""" + if test_support.verbose: + sys.stdout.write("\n") + server_params_test(CERTFILE, ssl.PROTOCOL_SSLv23, ssl.CERT_REQUIRED, + CERTFILE, CERTFILE, ssl.PROTOCOL_SSLv23, + chatty=True, connectionchatty=True, + wrap_accepting_socket=True) + + def test_asyncore_server(self): + """Check the example asyncore integration.""" + indata = "TEST MESSAGE of mixed case\n" + + if test_support.verbose: + sys.stdout.write("\n") + server = AsyncoreEchoServer(CERTFILE) + with server: + s = ssl.wrap_socket(socket.socket()) + s.connect(('127.0.0.1', server.port)) + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(indata))) + s.write(indata) + outdata = s.read() + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + self.fail( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + + def test_recv_send(self): + """Test recv(), send() and friends.""" + if test_support.verbose: + sys.stdout.write("\n") + + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + with server: + s = ssl.wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + # helper methods for standardising recv* method signatures + def _recv_into(): + b = bytearray("\0"*100) + count = s.recv_into(b) + return b[:count] + + def _recvfrom_into(): + b = bytearray("\0"*100) + count, addr = s.recvfrom_into(b) + return b[:count] + + # (name, method, whether to expect success, *args) + send_methods = [ + ('send', s.send, True, []), + ('sendto', s.sendto, False, ["some.address"]), + ('sendall', s.sendall, True, []), + ] + recv_methods = [ + ('recv', s.recv, True, []), + ('recvfrom', s.recvfrom, False, ["some.address"]), + ('recv_into', _recv_into, True, []), + ('recvfrom_into', _recvfrom_into, False, []), + ] + data_prefix = u"PREFIX_" + + for meth_name, send_meth, expect_success, args in send_methods: + indata = data_prefix + meth_name + try: + send_meth(indata.encode('ASCII', 'strict'), *args) + outdata = s.read() + outdata = outdata.decode('ASCII', 'strict') + if outdata != indata.lower(): + self.fail( + "While sending with <<%s>> bad data " + "<<%r>> (%d) received; " + "expected <<%r>> (%d)\n" % ( + meth_name, outdata[:20], len(outdata), + indata[:20], len(indata) + ) + ) + except ValueError as e: + if expect_success: + self.fail( + "Failed to send with method <<%s>>; " + "expected to succeed.\n" % (meth_name,) + ) + if not str(e).startswith(meth_name): + self.fail( + "Method <<%s>> failed with unexpected " + "exception message: %s\n" % ( + meth_name, e + ) + ) + + for meth_name, recv_meth, expect_success, args in recv_methods: + indata = data_prefix + meth_name + try: + s.send(indata.encode('ASCII', 'strict')) + outdata = recv_meth(*args) + outdata = outdata.decode('ASCII', 'strict') + if outdata != indata.lower(): + self.fail( + "While receiving with <<%s>> bad data " + "<<%r>> (%d) received; " + "expected <<%r>> (%d)\n" % ( + meth_name, outdata[:20], len(outdata), + indata[:20], len(indata) + ) + ) + except ValueError as e: + if expect_success: + self.fail( + "Failed to receive with method <<%s>>; " + "expected to succeed.\n" % (meth_name,) + ) + if not str(e).startswith(meth_name): + self.fail( + "Method <<%s>> failed with unexpected " + "exception message: %s\n" % ( + meth_name, e + ) + ) + # consume data + s.read() + + s.write("over\n".encode("ASCII", "strict")) + s.close() + + def test_handshake_timeout(self): + # Issue #5103: SSL handshake must respect the socket timeout + server = socket.socket(socket.AF_INET) + host = "127.0.0.1" + port = test_support.bind_port(server) + started = threading.Event() + finish = False + + def serve(): + server.listen(5) + started.set() + conns = [] + while not finish: + r, w, e = select.select([server], [], [], 0.1) + if server in r: + # Let the socket hang around rather than having + # it closed by garbage collection. + conns.append(server.accept()[0]) + + t = threading.Thread(target=serve) + t.start() + started.wait() + + try: + try: + c = socket.socket(socket.AF_INET) + c.settimeout(0.2) + c.connect((host, port)) + # Will attempt handshake and time out + self.assertRaisesRegexp(ssl.SSLError, "timed out", + ssl.wrap_socket, c) + finally: + c.close() + try: + c = socket.socket(socket.AF_INET) + c.settimeout(0.2) + c = ssl.wrap_socket(c) + # Will attempt handshake and time out + self.assertRaisesRegexp(ssl.SSLError, "timed out", + c.connect, (host, port)) + finally: + c.close() + finally: + finish = True + t.join() + server.close() + + def test_default_ciphers(self): + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_SSLv23, + chatty=False) as server: + sock = socket.socket() + try: + # Force a set of weak ciphers on our client socket + try: + s = ssl.wrap_socket(sock, + ssl_version=ssl.PROTOCOL_SSLv23, + ciphers="DES") + except ssl.SSLError: + self.skipTest("no DES cipher available") + with self.assertRaises((OSError, ssl.SSLError)): + s.connect((HOST, server.port)) + finally: + sock.close() + self.assertIn("no shared cipher", str(server.conn_errors[0])) + + +def test_main(verbose=False): + global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT + CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, + "keycert.pem") + SVN_PYTHON_ORG_ROOT_CERT = os.path.join( + os.path.dirname(__file__) or os.curdir, + "https_svn_python_org_root.pem") + NOKIACERT = os.path.join(os.path.dirname(__file__) or os.curdir, + "nokia.pem") + + if (not os.path.exists(CERTFILE) or + not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT) or + not os.path.exists(NOKIACERT)): + raise test_support.TestFailed("Can't read certificate files!") + + tests = [BasicTests, BasicSocketTests] + + if test_support.is_resource_enabled('network'): + tests.append(NetworkedTests) + + if _have_threads: + thread_info = test_support.threading_setup() + if thread_info and test_support.is_resource_enabled('network'): + tests.append(ThreadedTests) + + try: + test_support.run_unittest(*tests) + finally: + if _have_threads: + test_support.threading_cleanup(*thread_info) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_subprocess.py python-gevent-1.0/greentest/2.7/test_subprocess.py --- python-gevent-0.13.7/greentest/2.7/test_subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_subprocess.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1224 @@ +import unittest +from test import test_support +import subprocess +import sys +import signal +import os +import errno +import tempfile +import time +import re +import sysconfig + +try: + import resource +except ImportError: + resource = None + +mswindows = (sys.platform == "win32") + +# +# Depends on the following external programs: Python +# + +if mswindows: + SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), ' + 'os.O_BINARY);') +else: + SETBINARY = '' + + +try: + mkstemp = tempfile.mkstemp +except AttributeError: + # tempfile.mkstemp is not available + def mkstemp(): + """Replacement for mkstemp, calling mktemp.""" + fname = tempfile.mktemp() + return os.open(fname, os.O_RDWR|os.O_CREAT), fname + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + # Try to minimize the number of children we have so this test + # doesn't crash on some buildbots (Alphas in particular). + test_support.reap_children() + + def tearDown(self): + for inst in subprocess._active: + inst.wait() + subprocess._cleanup() + self.assertFalse(subprocess._active, "subprocess._active not empty") + + def assertStderrEqual(self, stderr, expected, msg=None): + # In a debug build, stuff like "[6580 refs]" is printed to stderr at + # shutdown time. That frustrates tests trying to check stderr produced + # from a spawned Python process. + actual = re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) + self.assertEqual(actual, expected, msg) + + +class ProcessTestCase(BaseTestCase): + + def test_call_seq(self): + # call() function with sequence argument + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + self.assertEqual(rc, 47) + + def test_check_call_zero(self): + # check_call() function with zero return code + rc = subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(0)"]) + self.assertEqual(rc, 0) + + def test_check_call_nonzero(self): + # check_call() function with non-zero return code + with self.assertRaises(subprocess.CalledProcessError) as c: + subprocess.check_call([sys.executable, "-c", + "import sys; sys.exit(47)"]) + self.assertEqual(c.exception.returncode, 47) + + def test_check_output(self): + # check_output() function with zero return code + output = subprocess.check_output( + [sys.executable, "-c", "print 'BDFL'"]) + self.assertIn('BDFL', output) + + def test_check_output_nonzero(self): + # check_call() function with non-zero return code + with self.assertRaises(subprocess.CalledProcessError) as c: + subprocess.check_output( + [sys.executable, "-c", "import sys; sys.exit(5)"]) + self.assertEqual(c.exception.returncode, 5) + + def test_check_output_stderr(self): + # check_output() function stderr redirected to stdout + output = subprocess.check_output( + [sys.executable, "-c", "import sys; sys.stderr.write('BDFL')"], + stderr=subprocess.STDOUT) + self.assertIn('BDFL', output) + + def test_check_output_stdout_arg(self): + # check_output() function stderr redirected to stdout + with self.assertRaises(ValueError) as c: + output = subprocess.check_output( + [sys.executable, "-c", "print 'will not be run'"], + stdout=sys.stdout) + self.fail("Expected ValueError when stdout arg supplied.") + self.assertIn('stdout', c.exception.args[0]) + + def test_call_kwargs(self): + # call() function with keyword args + newenv = os.environ.copy() + newenv["FRUIT"] = "banana" + rc = subprocess.call([sys.executable, "-c", + 'import sys, os;' + 'sys.exit(os.getenv("FRUIT")=="banana")'], + env=newenv) + self.assertEqual(rc, 1) + + def test_invalid_args(self): + # Popen() called with invalid arguments should raise TypeError + # but Popen.__del__ should not complain (issue #12085) + with test_support.captured_stderr() as s: + self.assertRaises(TypeError, subprocess.Popen, invalid_arg_name=1) + argcount = subprocess.Popen.__init__.__code__.co_argcount + too_many_args = [0] * (argcount + 1) + self.assertRaises(TypeError, subprocess.Popen, *too_many_args) + self.assertEqual(s.getvalue(), '') + + def test_stdin_none(self): + # .stdin is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + p.wait() + self.assertEqual(p.stdin, None) + + def test_stdout_none(self): + # .stdout is None when not redirected + p = subprocess.Popen([sys.executable, "-c", + 'print " this bit of output is from a ' + 'test of stdout in a different ' + 'process ..."'], + stdin=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdin.close) + self.addCleanup(p.stderr.close) + p.wait() + self.assertEqual(p.stdout, None) + + def test_stderr_none(self): + # .stderr is None when not redirected + p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stdin.close) + p.wait() + self.assertEqual(p.stderr, None) + + def test_executable_with_cwd(self): + python_dir = os.path.dirname(os.path.realpath(sys.executable)) + p = subprocess.Popen(["somethingyoudonthave", "-c", + "import sys; sys.exit(47)"], + executable=sys.executable, cwd=python_dir) + p.wait() + self.assertEqual(p.returncode, 47) + + @unittest.skipIf(sysconfig.is_python_build(), + "need an installed Python. See #7774") + def test_executable_without_cwd(self): + # For a normal installation, it should work without 'cwd' + # argument. For test runs in the build directory, see #7774. + p = subprocess.Popen(["somethingyoudonthave", "-c", + "import sys; sys.exit(47)"], + executable=sys.executable) + p.wait() + self.assertEqual(p.returncode, 47) + + def test_stdin_pipe(self): + # stdin redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.stdin.write("pear") + p.stdin.close() + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_filedes(self): + # stdin is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + os.write(d, "pear") + os.lseek(d, 0, 0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=d) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdin_fileobj(self): + # stdin is set to open file object + tf = tempfile.TemporaryFile() + tf.write("pear") + tf.seek(0) + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read() == "pear")'], + stdin=tf) + p.wait() + self.assertEqual(p.returncode, 1) + + def test_stdout_pipe(self): + # stdout redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read(), "orange") + + def test_stdout_filedes(self): + # stdout is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=d) + p.wait() + os.lseek(d, 0, 0) + self.assertEqual(os.read(d, 1024), "orange") + + def test_stdout_fileobj(self): + # stdout is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("orange")'], + stdout=tf) + p.wait() + tf.seek(0) + self.assertEqual(tf.read(), "orange") + + def test_stderr_pipe(self): + # stderr redirection + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=subprocess.PIPE) + self.addCleanup(p.stderr.close) + self.assertStderrEqual(p.stderr.read(), "strawberry") + + def test_stderr_filedes(self): + # stderr is set to open file descriptor + tf = tempfile.TemporaryFile() + d = tf.fileno() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=d) + p.wait() + os.lseek(d, 0, 0) + self.assertStderrEqual(os.read(d, 1024), "strawberry") + + def test_stderr_fileobj(self): + # stderr is set to open file object + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("strawberry")'], + stderr=tf) + p.wait() + tf.seek(0) + self.assertStderrEqual(tf.read(), "strawberry") + + def test_stdout_stderr_pipe(self): + # capture stdout and stderr to the same pipe + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' + 'sys.stdout.write("apple");' + 'sys.stdout.flush();' + 'sys.stderr.write("orange")'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + self.addCleanup(p.stdout.close) + self.assertStderrEqual(p.stdout.read(), "appleorange") + + def test_stdout_stderr_file(self): + # capture stdout and stderr to the same open file + tf = tempfile.TemporaryFile() + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' + 'sys.stdout.write("apple");' + 'sys.stdout.flush();' + 'sys.stderr.write("orange")'], + stdout=tf, + stderr=tf) + p.wait() + tf.seek(0) + self.assertStderrEqual(tf.read(), "appleorange") + + def test_stdout_filedes_of_stdout(self): + # stdout is set to 1 (#1531862). + cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), '.\n'))" + rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) + self.assertEqual(rc, 2) + + def test_cwd(self): + tmpdir = tempfile.gettempdir() + # We cannot use os.path.realpath to canonicalize the path, + # since it doesn't expand Tru64 {memb} strings. See bug 1063571. + cwd = os.getcwd() + os.chdir(tmpdir) + tmpdir = os.getcwd() + os.chdir(cwd) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(os.getcwd())'], + stdout=subprocess.PIPE, + cwd=tmpdir) + self.addCleanup(p.stdout.close) + normcase = os.path.normcase + self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir)) + + def test_env(self): + newenv = os.environ.copy() + newenv["FRUIT"] = "orange" + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + env=newenv) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read(), "orange") + + def test_communicate_stdin(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' + 'sys.exit(sys.stdin.read() == "pear")'], + stdin=subprocess.PIPE) + p.communicate("pear") + self.assertEqual(p.returncode, 1) + + def test_communicate_stdout(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stdout.write("pineapple")'], + stdout=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, "pineapple") + self.assertEqual(stderr, None) + + def test_communicate_stderr(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.stderr.write("pineapple")'], + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + self.assertStderrEqual(stderr, "pineapple") + + def test_communicate(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stderr.write("pineapple");' + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + self.addCleanup(p.stdin.close) + (stdout, stderr) = p.communicate("banana") + self.assertEqual(stdout, "banana") + self.assertStderrEqual(stderr, "pineapple") + + # This test is Linux specific for simplicity to at least have + # some coverage. It is not a platform specific bug. + @unittest.skipUnless(os.path.isdir('/proc/%d/fd' % os.getpid()), + "Linux specific") + # Test for the fd leak reported in http://bugs.python.org/issue2791. + def test_communicate_pipe_fd_leak(self): + fd_directory = '/proc/%d/fd' % os.getpid() + num_fds_before_popen = len(os.listdir(fd_directory)) + p = subprocess.Popen([sys.executable, "-c", "print()"], + stdout=subprocess.PIPE) + p.communicate() + num_fds_after_communicate = len(os.listdir(fd_directory)) + del p + num_fds_after_destruction = len(os.listdir(fd_directory)) + self.assertEqual(num_fds_before_popen, num_fds_after_destruction) + self.assertEqual(num_fds_before_popen, num_fds_after_communicate) + + def test_communicate_returns(self): + # communicate() should return None if no redirection is active + p = subprocess.Popen([sys.executable, "-c", + "import sys; sys.exit(47)"]) + (stdout, stderr) = p.communicate() + self.assertEqual(stdout, None) + self.assertEqual(stderr, None) + + def test_communicate_pipe_buf(self): + # communicate() with writes larger than pipe_buf + # This test will probably deadlock rather than fail, if + # communicate() does not work properly. + x, y = os.pipe() + if mswindows: + pipe_buf = 512 + else: + pipe_buf = os.fpathconf(x, "PC_PIPE_BUF") + os.close(x) + os.close(y) + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(sys.stdin.read(47));' + 'sys.stderr.write("xyz"*%d);' + 'sys.stdout.write(sys.stdin.read())' % pipe_buf], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + self.addCleanup(p.stdin.close) + string_to_write = "abc"*pipe_buf + (stdout, stderr) = p.communicate(string_to_write) + self.assertEqual(stdout, string_to_write) + + def test_writes_before_communicate(self): + # stdin.write before communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + self.addCleanup(p.stdin.close) + p.stdin.write("banana") + (stdout, stderr) = p.communicate("split") + self.assertEqual(stdout, "bananasplit") + self.assertStderrEqual(stderr, "") + + def test_universal_newlines(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, + universal_newlines=1) + self.addCleanup(p.stdout.close) + stdout = p.stdout.read() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_universal_newlines_communicate(self): + # universal newlines through communicate() + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=1) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + (stdout, stderr) = p.communicate() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + + def test_no_leaking(self): + # Make sure we leak no resources + if not mswindows: + max_handles = 1026 # too much for most UNIX systems + else: + max_handles = 2050 # too much for (at least some) Windows setups + handles = [] + try: + for i in range(max_handles): + try: + handles.append(os.open(test_support.TESTFN, + os.O_WRONLY | os.O_CREAT)) + except OSError as e: + if e.errno != errno.EMFILE: + raise + break + else: + self.skipTest("failed to reach the file descriptor limit " + "(tried %d)" % max_handles) + # Close a couple of them (should be enough for a subprocess) + for i in range(10): + os.close(handles.pop()) + # Loop creating some subprocesses. If one of them leaks some fds, + # the next loop iteration will fail by reaching the max fd limit. + for i in range(15): + p = subprocess.Popen([sys.executable, "-c", + "import sys;" + "sys.stdout.write(sys.stdin.read())"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + data = p.communicate(b"lime")[0] + self.assertEqual(data, b"lime") + finally: + for h in handles: + os.close(h) + + def test_list2cmdline(self): + self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']), + '"a b c" d e') + self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']), + 'ab\\"c \\ d') + self.assertEqual(subprocess.list2cmdline(['ab"c', ' \\', 'd']), + 'ab\\"c " \\\\" d') + self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']), + 'a\\\\\\b "de fg" h') + self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']), + 'a\\\\\\"b c d') + self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']), + '"a\\\\b c" d e') + self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']), + '"a\\\\b\\ c" d e') + self.assertEqual(subprocess.list2cmdline(['ab', '']), + 'ab ""') + + + def test_poll(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(1)"]) + count = 0 + while p.poll() is None: + time.sleep(0.1) + count += 1 + # We expect that the poll loop probably went around about 10 times, + # but, based on system scheduling we can't control, it's possible + # poll() never returned None. It "should be" very rare that it + # didn't go around at least twice. + self.assertGreaterEqual(count, 2) + # Subsequent invocations should just return the returncode + self.assertEqual(p.poll(), 0) + + + def test_wait(self): + p = subprocess.Popen([sys.executable, + "-c", "import time; time.sleep(2)"]) + self.assertEqual(p.wait(), 0) + # Subsequent invocations should just return the returncode + self.assertEqual(p.wait(), 0) + + + def test_invalid_bufsize(self): + # an invalid type of the bufsize argument should raise + # TypeError. + with self.assertRaises(TypeError): + subprocess.Popen([sys.executable, "-c", "pass"], "orange") + + def test_leaking_fds_on_error(self): + # see bug #5179: Popen leaks file descriptors to PIPEs if + # the child fails to execute; this will eventually exhaust + # the maximum number of open fds. 1024 seems a very common + # value for that limit, but Windows has 2048, so we loop + # 1024 times (each call leaked two fds). + for i in range(1024): + # Windows raises IOError. Others raise OSError. + with self.assertRaises(EnvironmentError) as c: + subprocess.Popen(['nonexisting_i_hope'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + # ignore errors that indicate the command was not found + if c.exception.errno not in (errno.ENOENT, errno.EACCES): + raise c.exception + + def test_handles_closed_on_exception(self): + # If CreateProcess exits with an error, ensure the + # duplicate output handles are released + ifhandle, ifname = mkstemp() + ofhandle, ofname = mkstemp() + efhandle, efname = mkstemp() + try: + subprocess.Popen (["*"], stdin=ifhandle, stdout=ofhandle, + stderr=efhandle) + except OSError: + os.close(ifhandle) + os.remove(ifname) + os.close(ofhandle) + os.remove(ofname) + os.close(efhandle) + os.remove(efname) + self.assertFalse(os.path.exists(ifname)) + self.assertFalse(os.path.exists(ofname)) + self.assertFalse(os.path.exists(efname)) + + def test_communicate_epipe(self): + # Issue 10963: communicate() should hide EPIPE + p = subprocess.Popen([sys.executable, "-c", 'pass'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + self.addCleanup(p.stdin.close) + p.communicate("x" * 2**20) + + def test_communicate_epipe_only_stdin(self): + # Issue 10963: communicate() should hide EPIPE + p = subprocess.Popen([sys.executable, "-c", 'pass'], + stdin=subprocess.PIPE) + self.addCleanup(p.stdin.close) + time.sleep(2) + p.communicate("x" * 2**20) + +# context manager +class _SuppressCoreFiles(object): + """Try to prevent core files from being created.""" + old_limit = None + + def __enter__(self): + """Try to save previous ulimit, then set it to (0, 0).""" + if resource is not None: + try: + self.old_limit = resource.getrlimit(resource.RLIMIT_CORE) + resource.setrlimit(resource.RLIMIT_CORE, (0, 0)) + except (ValueError, resource.error): + pass + + if sys.platform == 'darwin': + # Check if the 'Crash Reporter' on OSX was configured + # in 'Developer' mode and warn that it will get triggered + # when it is. + # + # This assumes that this context manager is used in tests + # that might trigger the next manager. + value = subprocess.Popen(['/usr/bin/defaults', 'read', + 'com.apple.CrashReporter', 'DialogType'], + stdout=subprocess.PIPE).communicate()[0] + if value.strip() == b'developer': + print "this tests triggers the Crash Reporter, that is intentional" + sys.stdout.flush() + + def __exit__(self, *args): + """Return core file behavior to default.""" + if self.old_limit is None: + return + if resource is not None: + try: + resource.setrlimit(resource.RLIMIT_CORE, self.old_limit) + except (ValueError, resource.error): + pass + + @unittest.skipUnless(hasattr(signal, 'SIGALRM'), + "Requires signal.SIGALRM") + def test_communicate_eintr(self): + # Issue #12493: communicate() should handle EINTR + def handler(signum, frame): + pass + old_handler = signal.signal(signal.SIGALRM, handler) + self.addCleanup(signal.signal, signal.SIGALRM, old_handler) + + # the process is running for 2 seconds + args = [sys.executable, "-c", 'import time; time.sleep(2)'] + for stream in ('stdout', 'stderr'): + kw = {stream: subprocess.PIPE} + with subprocess.Popen(args, **kw) as process: + signal.alarm(1) + # communicate() will be interrupted by SIGALRM + process.communicate() + + +@unittest.skipIf(mswindows, "POSIX specific tests") +class POSIXProcessTestCase(BaseTestCase): + + def test_exceptions(self): + # caught & re-raised exceptions + with self.assertRaises(OSError) as c: + p = subprocess.Popen([sys.executable, "-c", ""], + cwd="/this/path/does/not/exist") + # The attribute child_traceback should contain "os.chdir" somewhere. + self.assertIn("os.chdir", c.exception.child_traceback) + + def test_run_abort(self): + # returncode handles signal termination + with _SuppressCoreFiles(): + p = subprocess.Popen([sys.executable, "-c", + "import os; os.abort()"]) + p.wait() + self.assertEqual(-p.returncode, signal.SIGABRT) + + def test_preexec(self): + # preexec function + p = subprocess.Popen([sys.executable, "-c", + "import sys, os;" + "sys.stdout.write(os.getenv('FRUIT'))"], + stdout=subprocess.PIPE, + preexec_fn=lambda: os.putenv("FRUIT", "apple")) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read(), "apple") + + def test_args_string(self): + # args is a string + f, fname = mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec '%s' -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0o700) + p = subprocess.Popen(fname) + p.wait() + os.remove(fname) + self.assertEqual(p.returncode, 47) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, "-c", + "import sys; sys.exit(47)"], + startupinfo=47) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, "-c", + "import sys; sys.exit(47)"], + creationflags=47) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen(["echo $FRUIT"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen("echo $FRUIT", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read().strip(), "apple") + + def test_call_string(self): + # call() function with string argument on UNIX + f, fname = mkstemp() + os.write(f, "#!/bin/sh\n") + os.write(f, "exec '%s' -c 'import sys; sys.exit(47)'\n" % + sys.executable) + os.close(f) + os.chmod(fname, 0700) + rc = subprocess.call(fname) + os.remove(fname) + self.assertEqual(rc, 47) + + def test_specific_shell(self): + # Issue #9265: Incorrect name passed as arg[0]. + shells = [] + for prefix in ['/bin', '/usr/bin/', '/usr/local/bin']: + for name in ['bash', 'ksh']: + sh = os.path.join(prefix, name) + if os.path.isfile(sh): + shells.append(sh) + if not shells: # Will probably work for any shell but csh. + self.skipTest("bash or ksh required for this test") + sh = '/bin/sh' + if os.path.isfile(sh) and not os.path.islink(sh): + # Test will fail if /bin/sh is a symlink to csh. + shells.append(sh) + for sh in shells: + p = subprocess.Popen("echo $0", executable=sh, shell=True, + stdout=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.assertEqual(p.stdout.read().strip(), sh) + + def _kill_process(self, method, *args): + # Do not inherit file handles from the parent. + # It should fix failures on some platforms. + p = subprocess.Popen([sys.executable, "-c", """if 1: + import sys, time + sys.stdout.write('x\\n') + sys.stdout.flush() + time.sleep(30) + """], + close_fds=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + # Wait for the interpreter to be completely initialized before + # sending any signal. + p.stdout.read(1) + getattr(p, method)(*args) + return p + + def test_send_signal(self): + p = self._kill_process('send_signal', signal.SIGINT) + _, stderr = p.communicate() + self.assertIn('KeyboardInterrupt', stderr) + self.assertNotEqual(p.wait(), 0) + + def test_kill(self): + p = self._kill_process('kill') + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') + self.assertEqual(p.wait(), -signal.SIGKILL) + + def test_terminate(self): + p = self._kill_process('terminate') + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') + self.assertEqual(p.wait(), -signal.SIGTERM) + + def check_close_std_fds(self, fds): + # Issue #9905: test that subprocess pipes still work properly with + # some standard fds closed + stdin = 0 + newfds = [] + for a in fds: + b = os.dup(a) + newfds.append(b) + if a == 0: + stdin = b + try: + for fd in fds: + os.close(fd) + out, err = subprocess.Popen([sys.executable, "-c", + 'import sys;' + 'sys.stdout.write("apple");' + 'sys.stdout.flush();' + 'sys.stderr.write("orange")'], + stdin=stdin, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate() + err = test_support.strip_python_stderr(err) + self.assertEqual((out, err), (b'apple', b'orange')) + finally: + for b, a in zip(newfds, fds): + os.dup2(b, a) + for b in newfds: + os.close(b) + + def test_close_fd_0(self): + self.check_close_std_fds([0]) + + def test_close_fd_1(self): + self.check_close_std_fds([1]) + + def test_close_fd_2(self): + self.check_close_std_fds([2]) + + def test_close_fds_0_1(self): + self.check_close_std_fds([0, 1]) + + def test_close_fds_0_2(self): + self.check_close_std_fds([0, 2]) + + def test_close_fds_1_2(self): + self.check_close_std_fds([1, 2]) + + def test_close_fds_0_1_2(self): + # Issue #10806: test that subprocess pipes still work properly with + # all standard fds closed. + self.check_close_std_fds([0, 1, 2]) + + def check_swap_fds(self, stdin_no, stdout_no, stderr_no): + # open up some temporary files + temps = [mkstemp() for i in range(3)] + temp_fds = [fd for fd, fname in temps] + try: + # unlink the files -- we won't need to reopen them + for fd, fname in temps: + os.unlink(fname) + + # save a copy of the standard file descriptors + saved_fds = [os.dup(fd) for fd in range(3)] + try: + # duplicate the temp files over the standard fd's 0, 1, 2 + for fd, temp_fd in enumerate(temp_fds): + os.dup2(temp_fd, fd) + + # write some data to what will become stdin, and rewind + os.write(stdin_no, b"STDIN") + os.lseek(stdin_no, 0, 0) + + # now use those files in the given order, so that subprocess + # has to rearrange them in the child + p = subprocess.Popen([sys.executable, "-c", + 'import sys; got = sys.stdin.read();' + 'sys.stdout.write("got %s"%got); sys.stderr.write("err")'], + stdin=stdin_no, + stdout=stdout_no, + stderr=stderr_no) + p.wait() + + for fd in temp_fds: + os.lseek(fd, 0, 0) + + out = os.read(stdout_no, 1024) + err = test_support.strip_python_stderr(os.read(stderr_no, 1024)) + finally: + for std, saved in enumerate(saved_fds): + os.dup2(saved, std) + os.close(saved) + + self.assertEqual(out, b"got STDIN") + self.assertEqual(err, b"err") + + finally: + for fd in temp_fds: + os.close(fd) + + # When duping fds, if there arises a situation where one of the fds is + # either 0, 1 or 2, it is possible that it is overwritten (#12607). + # This tests all combinations of this. + def test_swap_fds(self): + self.check_swap_fds(0, 1, 2) + self.check_swap_fds(0, 2, 1) + self.check_swap_fds(1, 0, 2) + self.check_swap_fds(1, 2, 0) + self.check_swap_fds(2, 0, 1) + self.check_swap_fds(2, 1, 0) + + def test_wait_when_sigchild_ignored(self): + # NOTE: sigchild_ignore.py may not be an effective test on all OSes. + sigchild_ignore = test_support.findfile("sigchild_ignore.py", + subdir="subprocessdata") + p = subprocess.Popen([sys.executable, sigchild_ignore], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = p.communicate() + self.assertEqual(0, p.returncode, "sigchild_ignore.py exited" + " non-zero with this error:\n%s" % stderr) + + def test_zombie_fast_process_del(self): + # Issue #12650: on Unix, if Popen.__del__() was called before the + # process exited, it wouldn't be added to subprocess._active, and would + # remain a zombie. + # spawn a Popen, and delete its reference before it exits + p = subprocess.Popen([sys.executable, "-c", + 'import sys, time;' + 'time.sleep(0.2)'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + ident = id(p) + pid = p.pid + del p + # check that p is in the active processes list + self.assertIn(ident, [id(o) for o in subprocess._active]) + + def test_leak_fast_process_del_killed(self): + # Issue #12650: on Unix, if Popen.__del__() was called before the + # process exited, and the process got killed by a signal, it would never + # be removed from subprocess._active, which triggered a FD and memory + # leak. + # spawn a Popen, delete its reference and kill it + p = subprocess.Popen([sys.executable, "-c", + 'import time;' + 'time.sleep(3)'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + ident = id(p) + pid = p.pid + del p + os.kill(pid, signal.SIGKILL) + # check that p is in the active processes list + self.assertIn(ident, [id(o) for o in subprocess._active]) + + # let some time for the process to exit, and create a new Popen: this + # should trigger the wait() of p + time.sleep(0.2) + with self.assertRaises(EnvironmentError) as c: + with subprocess.Popen(['nonexisting_i_hope'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as proc: + pass + # p should have been wait()ed on, and removed from the _active list + self.assertRaises(OSError, os.waitpid, pid, 0) + self.assertNotIn(ident, [id(o) for o in subprocess._active]) + + def test_pipe_cloexec(self): + # Issue 12786: check that the communication pipes' FDs are set CLOEXEC, + # and are not inherited by another child process. + p1 = subprocess.Popen([sys.executable, "-c", + 'import os;' + 'os.read(0, 1)' + ], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + p2 = subprocess.Popen([sys.executable, "-c", """if True: + import os, errno, sys + for fd in %r: + try: + os.close(fd) + except OSError as e: + if e.errno != errno.EBADF: + raise + else: + sys.exit(1) + sys.exit(0) + """ % [f.fileno() for f in (p1.stdin, p1.stdout, + p1.stderr)] + ], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, close_fds=False) + p1.communicate('foo') + _, stderr = p2.communicate() + + self.assertEqual(p2.returncode, 0, "Unexpected error: " + repr(stderr)) + + +@unittest.skipUnless(mswindows, "Windows specific tests") +class Win32ProcessTestCase(BaseTestCase): + + def test_startupinfo(self): + # startupinfo argument + # We uses hardcoded constants, because we do not want to + # depend on win32all. + STARTF_USESHOWWINDOW = 1 + SW_MAXIMIZE = 3 + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags = STARTF_USESHOWWINDOW + startupinfo.wShowWindow = SW_MAXIMIZE + # Since Python is a console process, it won't be affected + # by wShowWindow, but the argument should be silently + # ignored + subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"], + startupinfo=startupinfo) + + def test_creationflags(self): + # creationflags argument + CREATE_NEW_CONSOLE = 16 + sys.stderr.write(" a DOS box should flash briefly ...\n") + subprocess.call(sys.executable + + ' -c "import time; time.sleep(0.25)"', + creationflags=CREATE_NEW_CONSOLE) + + def test_invalid_args(self): + # invalid arguments should raise ValueError + self.assertRaises(ValueError, subprocess.call, + [sys.executable, "-c", + "import sys; sys.exit(47)"], + preexec_fn=lambda: 1) + self.assertRaises(ValueError, subprocess.call, + [sys.executable, "-c", + "import sys; sys.exit(47)"], + stdout=subprocess.PIPE, + close_fds=True) + + def test_close_fds(self): + # close file descriptors + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"], + close_fds=True) + self.assertEqual(rc, 47) + + def test_shell_sequence(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen(["set"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.addCleanup(p.stdout.close) + self.assertIn("physalis", p.stdout.read()) + + def test_shell_string(self): + # Run command through the shell (string) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + p = subprocess.Popen("set", shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.addCleanup(p.stdout.close) + self.assertIn("physalis", p.stdout.read()) + + def test_call_string(self): + # call() function with string argument on Windows + rc = subprocess.call(sys.executable + + ' -c "import sys; sys.exit(47)"') + self.assertEqual(rc, 47) + + def _kill_process(self, method, *args): + # Some win32 buildbot raises EOFError if stdin is inherited + p = subprocess.Popen([sys.executable, "-c", """if 1: + import sys, time + sys.stdout.write('x\\n') + sys.stdout.flush() + time.sleep(30) + """], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + self.addCleanup(p.stdin.close) + # Wait for the interpreter to be completely initialized before + # sending any signal. + p.stdout.read(1) + getattr(p, method)(*args) + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') + returncode = p.wait() + self.assertNotEqual(returncode, 0) + + def test_send_signal(self): + self._kill_process('send_signal', signal.SIGTERM) + + def test_kill(self): + self._kill_process('kill') + + def test_terminate(self): + self._kill_process('terminate') + + +@unittest.skipUnless(getattr(subprocess, '_has_poll', False), + "poll system call not supported") +class ProcessTestCaseNoPoll(ProcessTestCase): + def setUp(self): + subprocess._has_poll = False + ProcessTestCase.setUp(self) + + def tearDown(self): + subprocess._has_poll = True + ProcessTestCase.tearDown(self) + + +class HelperFunctionTests(unittest.TestCase): + @unittest.skipIf(mswindows, "errno and EINTR make no sense on windows") + def test_eintr_retry_call(self): + record_calls = [] + def fake_os_func(*args): + record_calls.append(args) + if len(record_calls) == 2: + raise OSError(errno.EINTR, "fake interrupted system call") + return tuple(reversed(args)) + + self.assertEqual((999, 256), + subprocess._eintr_retry_call(fake_os_func, 256, 999)) + self.assertEqual([(256, 999)], record_calls) + # This time there will be an EINTR so it will loop once. + self.assertEqual((666,), + subprocess._eintr_retry_call(fake_os_func, 666)) + self.assertEqual([(256, 999), (666,), (666,)], record_calls) + +@unittest.skipUnless(mswindows, "mswindows only") +class CommandsWithSpaces (BaseTestCase): + + def setUp(self): + super(CommandsWithSpaces, self).setUp() + f, fname = mkstemp(".py", "te st") + self.fname = fname.lower () + os.write(f, b"import sys;" + b"sys.stdout.write('%d %s' % (len(sys.argv), [a.lower () for a in sys.argv]))" + ) + os.close(f) + + def tearDown(self): + os.remove(self.fname) + super(CommandsWithSpaces, self).tearDown() + + def with_spaces(self, *args, **kwargs): + kwargs['stdout'] = subprocess.PIPE + p = subprocess.Popen(*args, **kwargs) + self.addCleanup(p.stdout.close) + self.assertEqual( + p.stdout.read ().decode("mbcs"), + "2 [%r, 'ab cd']" % self.fname + ) + + def test_shell_string_with_spaces(self): + # call() function with string argument with spaces on Windows + self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname, + "ab cd"), shell=1) + + def test_shell_sequence_with_spaces(self): + # call() function with sequence argument with spaces on Windows + self.with_spaces([sys.executable, self.fname, "ab cd"], shell=1) + + def test_noshell_string_with_spaces(self): + # call() function with string argument with spaces on Windows + self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname, + "ab cd")) + + def test_noshell_sequence_with_spaces(self): + # call() function with sequence argument with spaces on Windows + self.with_spaces([sys.executable, self.fname, "ab cd"]) + +def test_main(): + unit_tests = (ProcessTestCase, + POSIXProcessTestCase, + Win32ProcessTestCase, + ProcessTestCaseNoPoll, + HelperFunctionTests, + CommandsWithSpaces) + + test_support.run_unittest(*unit_tests) + test_support.reap_children() + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_telnetlib.py python-gevent-1.0/greentest/2.7/test_telnetlib.py --- python-gevent-0.13.7/greentest/2.7/test_telnetlib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_telnetlib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,364 @@ +import socket +import telnetlib +import time +import Queue + +from unittest import TestCase +from test import test_support +threading = test_support.import_module('threading') + +HOST = test_support.HOST +EOF_sigil = object() + +def server(evt, serv, dataq=None): + """ Open a tcp server in three steps + 1) set evt to true to let the parent know we are ready + 2) [optional] if is not False, write the list of data from dataq.get() + to the socket. + """ + serv.listen(5) + evt.set() + try: + conn, addr = serv.accept() + if dataq: + data = '' + new_data = dataq.get(True, 0.5) + dataq.task_done() + for item in new_data: + if item == EOF_sigil: + break + if type(item) in [int, float]: + time.sleep(item) + else: + data += item + written = conn.send(data) + data = data[written:] + conn.close() + except socket.timeout: + pass + finally: + serv.close() + +class GeneralTests(TestCase): + + def setUp(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(60) # Safety net. Look issue 11812 + self.port = test_support.bind_port(self.sock) + self.thread = threading.Thread(target=server, args=(self.evt,self.sock)) + self.thread.setDaemon(True) + self.thread.start() + self.evt.wait() + + def tearDown(self): + self.thread.join() + + def testBasic(self): + # connects + telnet = telnetlib.Telnet(HOST, self.port) + telnet.sock.close() + + def testTimeoutDefault(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet(HOST, self.port) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + + def testTimeoutNone(self): + # None, having other default + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet(HOST, self.port, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(telnet.sock.gettimeout() is None) + telnet.sock.close() + + def testTimeoutValue(self): + telnet = telnetlib.Telnet(HOST, self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + + def testTimeoutOpen(self): + telnet = telnetlib.Telnet() + telnet.open(HOST, self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() + +def _read_setUp(self): + self.evt = threading.Event() + self.dataq = Queue.Queue() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(10) + self.port = test_support.bind_port(self.sock) + self.thread = threading.Thread(target=server, args=(self.evt,self.sock, self.dataq)) + self.thread.start() + self.evt.wait() + +def _read_tearDown(self): + self.thread.join() + +class ReadTests(TestCase): + setUp = _read_setUp + tearDown = _read_tearDown + + # use a similar approach to testing timeouts as test_timeout.py + # these will never pass 100% but make the fuzz big enough that it is rare + block_long = 0.6 + block_short = 0.3 + def test_read_until_A(self): + """ + read_until(expected, [timeout]) + Read until the expected string has been seen, or a timeout is + hit (default is no timeout); may block. + """ + want = ['x' * 10, 'match', 'y' * 10, EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + data = telnet.read_until('match') + self.assertEqual(data, ''.join(want[:-2])) + + def test_read_until_B(self): + # test the timeout - it does NOT raise socket.timeout + want = ['hello', self.block_long, 'not seen', EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + data = telnet.read_until('not seen', self.block_short) + self.assertEqual(data, want[0]) + self.assertEqual(telnet.read_all(), 'not seen') + + def test_read_all_A(self): + """ + read_all() + Read all data until EOF; may block. + """ + want = ['x' * 500, 'y' * 500, 'z' * 500, EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + data = telnet.read_all() + self.assertEqual(data, ''.join(want[:-1])) + return + + def _test_blocking(self, func): + self.dataq.put([self.block_long, EOF_sigil]) + self.dataq.join() + start = time.time() + data = func() + self.assertTrue(self.block_short <= time.time() - start) + + def test_read_all_B(self): + self._test_blocking(telnetlib.Telnet(HOST, self.port).read_all) + + def test_read_all_C(self): + self.dataq.put([EOF_sigil]) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + telnet.read_all() + telnet.read_all() # shouldn't raise + + def test_read_some_A(self): + """ + read_some() + Read at least one byte or EOF; may block. + """ + # test 'at least one byte' + want = ['x' * 500, EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + data = telnet.read_all() + self.assertTrue(len(data) >= 1) + + def test_read_some_B(self): + # test EOF + self.dataq.put([EOF_sigil]) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + self.assertEqual('', telnet.read_some()) + + def test_read_some_C(self): + self._test_blocking(telnetlib.Telnet(HOST, self.port).read_some) + + def _test_read_any_eager_A(self, func_name): + """ + read_very_eager() + Read all data available already queued or on the socket, + without blocking. + """ + want = [self.block_long, 'x' * 100, 'y' * 100, EOF_sigil] + expects = want[1] + want[2] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + func = getattr(telnet, func_name) + data = '' + while True: + try: + data += func() + self.assertTrue(expects.startswith(data)) + except EOFError: + break + self.assertEqual(expects, data) + + def _test_read_any_eager_B(self, func_name): + # test EOF + self.dataq.put([EOF_sigil]) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + time.sleep(self.block_short) + func = getattr(telnet, func_name) + self.assertRaises(EOFError, func) + + # read_eager and read_very_eager make the same gaurantees + # (they behave differently but we only test the gaurantees) + def test_read_very_eager_A(self): + self._test_read_any_eager_A('read_very_eager') + def test_read_very_eager_B(self): + self._test_read_any_eager_B('read_very_eager') + def test_read_eager_A(self): + self._test_read_any_eager_A('read_eager') + def test_read_eager_B(self): + self._test_read_any_eager_B('read_eager') + # NB -- we need to test the IAC block which is mentioned in the docstring + # but not in the module docs + + def _test_read_any_lazy_B(self, func_name): + self.dataq.put([EOF_sigil]) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + func = getattr(telnet, func_name) + telnet.fill_rawq() + self.assertRaises(EOFError, func) + + def test_read_lazy_A(self): + want = ['x' * 100, EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + time.sleep(self.block_short) + self.assertEqual('', telnet.read_lazy()) + data = '' + while True: + try: + read_data = telnet.read_lazy() + data += read_data + if not read_data: + telnet.fill_rawq() + except EOFError: + break + self.assertTrue(want[0].startswith(data)) + self.assertEqual(data, want[0]) + + def test_read_lazy_B(self): + self._test_read_any_lazy_B('read_lazy') + + def test_read_very_lazy_A(self): + want = ['x' * 100, EOF_sigil] + self.dataq.put(want) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + time.sleep(self.block_short) + self.assertEqual('', telnet.read_very_lazy()) + data = '' + while True: + try: + read_data = telnet.read_very_lazy() + except EOFError: + break + data += read_data + if not read_data: + telnet.fill_rawq() + self.assertEqual('', telnet.cookedq) + telnet.process_rawq() + self.assertTrue(want[0].startswith(data)) + self.assertEqual(data, want[0]) + + def test_read_very_lazy_B(self): + self._test_read_any_lazy_B('read_very_lazy') + +class nego_collector(object): + def __init__(self, sb_getter=None): + self.seen = '' + self.sb_getter = sb_getter + self.sb_seen = '' + + def do_nego(self, sock, cmd, opt): + self.seen += cmd + opt + if cmd == tl.SE and self.sb_getter: + sb_data = self.sb_getter() + self.sb_seen += sb_data + +tl = telnetlib +class OptionTests(TestCase): + setUp = _read_setUp + tearDown = _read_tearDown + # RFC 854 commands + cmds = [tl.AO, tl.AYT, tl.BRK, tl.EC, tl.EL, tl.GA, tl.IP, tl.NOP] + + def _test_command(self, data): + """ helper for testing IAC + cmd """ + self.setUp() + self.dataq.put(data) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + nego = nego_collector() + telnet.set_option_negotiation_callback(nego.do_nego) + txt = telnet.read_all() + cmd = nego.seen + self.assertTrue(len(cmd) > 0) # we expect at least one command + self.assertIn(cmd[0], self.cmds) + self.assertEqual(cmd[1], tl.NOOPT) + self.assertEqual(len(''.join(data[:-1])), len(txt + cmd)) + nego.sb_getter = None # break the nego => telnet cycle + self.tearDown() + + def test_IAC_commands(self): + # reset our setup + self.dataq.put([EOF_sigil]) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + self.tearDown() + + for cmd in self.cmds: + self._test_command(['x' * 100, tl.IAC + cmd, 'y'*100, EOF_sigil]) + self._test_command(['x' * 10, tl.IAC + cmd, 'y'*10, EOF_sigil]) + self._test_command([tl.IAC + cmd, EOF_sigil]) + # all at once + self._test_command([tl.IAC + cmd for (cmd) in self.cmds] + [EOF_sigil]) + self.assertEqual('', telnet.read_sb_data()) + + def test_SB_commands(self): + # RFC 855, subnegotiations portion + send = [tl.IAC + tl.SB + tl.IAC + tl.SE, + tl.IAC + tl.SB + tl.IAC + tl.IAC + tl.IAC + tl.SE, + tl.IAC + tl.SB + tl.IAC + tl.IAC + 'aa' + tl.IAC + tl.SE, + tl.IAC + tl.SB + 'bb' + tl.IAC + tl.IAC + tl.IAC + tl.SE, + tl.IAC + tl.SB + 'cc' + tl.IAC + tl.IAC + 'dd' + tl.IAC + tl.SE, + EOF_sigil, + ] + self.dataq.put(send) + telnet = telnetlib.Telnet(HOST, self.port) + self.dataq.join() + nego = nego_collector(telnet.read_sb_data) + telnet.set_option_negotiation_callback(nego.do_nego) + txt = telnet.read_all() + self.assertEqual(txt, '') + want_sb_data = tl.IAC + tl.IAC + 'aabb' + tl.IAC + 'cc' + tl.IAC + 'dd' + self.assertEqual(nego.sb_seen, want_sb_data) + self.assertEqual('', telnet.read_sb_data()) + nego.sb_getter = None # break the nego => telnet cycle + +def test_main(verbose=None): + test_support.run_unittest(GeneralTests, ReadTests, OptionTests) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_threading_local.py python-gevent-1.0/greentest/2.7/test_threading_local.py --- python-gevent-0.13.7/greentest/2.7/test_threading_local.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_threading_local.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,234 @@ +import unittest +from doctest import DocTestSuite +from test import test_support +import weakref +import gc + +# Modules under test +_thread = test_support.import_module('thread') +threading = test_support.import_module('threading') +import _threading_local + + +class Weak(object): + pass + +def target(local, weaklist): + weak = Weak() + local.weak = weak + weaklist.append(weakref.ref(weak)) + +class BaseLocalTest: + + def test_local_refs(self): + self._local_refs(20) + self._local_refs(50) + self._local_refs(100) + + def _local_refs(self, n): + local = self._local() + weaklist = [] + for i in range(n): + t = threading.Thread(target=target, args=(local, weaklist)) + t.start() + t.join() + del t + + gc.collect() + self.assertEqual(len(weaklist), n) + + # XXX _threading_local keeps the local of the last stopped thread alive. + deadlist = [weak for weak in weaklist if weak() is None] + self.assertIn(len(deadlist), (n-1, n)) + + # Assignment to the same thread local frees it sometimes (!) + local.someothervar = None + gc.collect() + deadlist = [weak for weak in weaklist if weak() is None] + self.assertIn(len(deadlist), (n-1, n), (n, len(deadlist))) + + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import time + class Local(self._local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_derived_cycle_dealloc(self): + # http://bugs.python.org/issue6990 + class Local(self._local): + pass + locals = None + passed = [False] + e1 = threading.Event() + e2 = threading.Event() + + def f(): + # 1) Involve Local in a cycle + cycle = [Local()] + cycle.append(cycle) + cycle[0].foo = 'bar' + + # 2) GC the cycle (triggers threadmodule.c::local_clear + # before local_dealloc) + del cycle + gc.collect() + e1.set() + e2.wait() + + # 4) New Locals should be empty + passed[0] = all(not hasattr(local, 'foo') for local in locals) + + t = threading.Thread(target=f) + t.start() + e1.wait() + + # 3) New Locals should recycle the original's address. Creating + # them in the thread overwrites the thread state and avoids the + # bug + locals = [Local() for i in range(10)] + e2.set() + t.join() + + self.assertTrue(passed[0]) + + def test_arguments(self): + # Issue 1522237 + from thread import _local as local + from _threading_local import local as py_local + + for cls in (local, py_local): + class MyLocal(cls): + def __init__(self, *args, **kwargs): + pass + + MyLocal(a=1) + MyLocal(1) + self.assertRaises(TypeError, cls, a=1) + self.assertRaises(TypeError, cls, 1) + + def _test_one_class(self, c): + self._failed = "No error message set or cleared." + obj = c() + e1 = threading.Event() + e2 = threading.Event() + + def f1(): + obj.x = 'foo' + obj.y = 'bar' + del obj.y + e1.set() + e2.wait() + + def f2(): + try: + foo = obj.x + except AttributeError: + # This is expected -- we haven't set obj.x in this thread yet! + self._failed = "" # passed + else: + self._failed = ('Incorrectly got value %r from class %r\n' % + (foo, c)) + sys.stderr.write(self._failed) + + t1 = threading.Thread(target=f1) + t1.start() + e1.wait() + t2 = threading.Thread(target=f2) + t2.start() + t2.join() + # The test is done; just let t1 know it can exit, and wait for it. + e2.set() + t1.join() + + self.assertFalse(self._failed, self._failed) + + def test_threading_local(self): + self._test_one_class(self._local) + + def test_threading_local_subclass(self): + class LocalSubclass(self._local): + """To test that subclasses behave properly.""" + self._test_one_class(LocalSubclass) + + def _test_dict_attribute(self, cls): + obj = cls() + obj.x = 5 + self.assertEqual(obj.__dict__, {'x': 5}) + with self.assertRaises(AttributeError): + obj.__dict__ = {} + with self.assertRaises(AttributeError): + del obj.__dict__ + + def test_dict_attribute(self): + self._test_dict_attribute(self._local) + + def test_dict_attribute_subclass(self): + class LocalSubclass(self._local): + """To test that subclasses behave properly.""" + self._test_dict_attribute(LocalSubclass) + + +class ThreadLocalTest(unittest.TestCase, BaseLocalTest): + _local = _thread._local + + # Fails for the pure Python implementation + def test_cycle_collection(self): + class X: + pass + + x = X() + x.local = self._local() + x.local.x = x + wr = weakref.ref(x) + del x + gc.collect() + self.assertIs(wr(), None) + +class PyThreadingLocalTest(unittest.TestCase, BaseLocalTest): + _local = _threading_local.local + + +def test_main(): + suite = unittest.TestSuite() + suite.addTest(DocTestSuite('_threading_local')) + suite.addTest(unittest.makeSuite(ThreadLocalTest)) + suite.addTest(unittest.makeSuite(PyThreadingLocalTest)) + + try: + from thread import _local + except ImportError: + pass + else: + import _threading_local + local_orig = _threading_local.local + def setUp(test): + _threading_local.local = _local + def tearDown(test): + _threading_local.local = local_orig + suite.addTest(DocTestSuite('_threading_local', + setUp=setUp, tearDown=tearDown) + ) + + test_support.run_unittest(suite) + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_threading.py python-gevent-1.0/greentest/2.7/test_threading.py --- python-gevent-0.13.7/greentest/2.7/test_threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,749 @@ +# Very rudimentary test of threading module + +import test.test_support +from test.test_support import verbose +import random +import re +import sys +thread = test.test_support.import_module('thread') +threading = test.test_support.import_module('threading') +import time +import unittest +import weakref +import os +import subprocess + +import lock_tests + +# A trivial mutable counter. +class Counter(object): + def __init__(self): + self.value = 0 + def inc(self): + self.value += 1 + def dec(self): + self.value -= 1 + def get(self): + return self.value + +class TestThread(threading.Thread): + def __init__(self, name, testcase, sema, mutex, nrunning): + threading.Thread.__init__(self, name=name) + self.testcase = testcase + self.sema = sema + self.mutex = mutex + self.nrunning = nrunning + + def run(self): + delay = random.random() / 10000.0 + if verbose: + print 'task %s will run for %.1f usec' % ( + self.name, delay * 1e6) + + with self.sema: + with self.mutex: + self.nrunning.inc() + if verbose: + print self.nrunning.get(), 'tasks are running' + self.testcase.assertTrue(self.nrunning.get() <= 3) + + time.sleep(delay) + if verbose: + print 'task', self.name, 'done' + + with self.mutex: + self.nrunning.dec() + self.testcase.assertTrue(self.nrunning.get() >= 0) + if verbose: + print '%s is finished. %d tasks are running' % ( + self.name, self.nrunning.get()) + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = test.test_support.threading_setup() + + def tearDown(self): + test.test_support.threading_cleanup(*self._threads) + test.test_support.reap_children() + + +class ThreadTests(BaseTestCase): + + # Create a bunch of threads, let each do some work, wait until all are + # done. + def test_various_ops(self): + # This takes about n/3 seconds to run (about n/3 clumps of tasks, + # times about 1 second per clump). + NUMTASKS = 10 + + # no more than 3 of the 10 can run at once + sema = threading.BoundedSemaphore(value=3) + mutex = threading.RLock() + numrunning = Counter() + + threads = [] + + for i in range(NUMTASKS): + t = TestThread(""%i, self, sema, mutex, numrunning) + threads.append(t) + self.assertEqual(t.ident, None) + self.assertTrue(re.match('', repr(t))) + t.start() + + if verbose: + print 'waiting for all tasks to complete' + for t in threads: + t.join(NUMTASKS) + self.assertTrue(not t.is_alive()) + self.assertNotEqual(t.ident, 0) + self.assertFalse(t.ident is None) + self.assertTrue(re.match('', repr(t))) + if verbose: + print 'all tasks done' + self.assertEqual(numrunning.get(), 0) + + def test_ident_of_no_threading_threads(self): + # The ident still must work for the main thread and dummy threads. + self.assertFalse(threading.currentThread().ident is None) + def f(): + ident.append(threading.currentThread().ident) + done.set() + done = threading.Event() + ident = [] + thread.start_new_thread(f, ()) + done.wait() + self.assertFalse(ident[0] is None) + # Kill the "immortal" _DummyThread + del threading._active[ident[0]] + + # run with a small(ish) thread stack size (256kB) + def test_various_ops_small_stack(self): + if verbose: + print 'with 256kB thread stack size...' + try: + threading.stack_size(262144) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + # run with a large thread stack size (1MB) + def test_various_ops_large_stack(self): + if verbose: + print 'with 1MB thread stack size...' + try: + threading.stack_size(0x100000) + except thread.error: + if verbose: + print 'platform does not support changing thread stack size' + return + self.test_various_ops() + threading.stack_size(0) + + def test_foreign_thread(self): + # Check that a "foreign" thread can use the threading module. + def f(mutex): + # Calling current_thread() forces an entry for the foreign + # thread to get made in the threading._active map. + threading.current_thread() + mutex.release() + + mutex = threading.Lock() + mutex.acquire() + tid = thread.start_new_thread(f, (mutex,)) + # Wait for the thread to finish. + mutex.acquire() + self.assertIn(tid, threading._active) + self.assertIsInstance(threading._active[tid], threading._DummyThread) + del threading._active[tid] + + # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) + # exposed at the Python level. This test relies on ctypes to get at it. + def test_PyThreadState_SetAsyncExc(self): + try: + import ctypes + except ImportError: + if verbose: + print "test_PyThreadState_SetAsyncExc can't import ctypes" + return # can't do anything + + set_async_exc = ctypes.pythonapi.PyThreadState_SetAsyncExc + + class AsyncExc(Exception): + pass + + exception = ctypes.py_object(AsyncExc) + + # First check it works when setting the exception from the same thread. + tid = thread.get_ident() + + try: + result = set_async_exc(ctypes.c_long(tid), exception) + # The exception is async, so we might have to keep the VM busy until + # it notices. + while True: + pass + except AsyncExc: + pass + else: + # This code is unreachable but it reflects the intent. If we wanted + # to be smarter the above loop wouldn't be infinite. + self.fail("AsyncExc not raised") + try: + self.assertEqual(result, 1) # one thread state modified + except UnboundLocalError: + # The exception was raised too quickly for us to get the result. + pass + + # `worker_started` is set by the thread when it's inside a try/except + # block waiting to catch the asynchronously set AsyncExc exception. + # `worker_saw_exception` is set by the thread upon catching that + # exception. + worker_started = threading.Event() + worker_saw_exception = threading.Event() + + class Worker(threading.Thread): + def run(self): + self.id = thread.get_ident() + self.finished = False + + try: + while True: + worker_started.set() + time.sleep(0.1) + except AsyncExc: + self.finished = True + worker_saw_exception.set() + + t = Worker() + t.daemon = True # so if this fails, we don't hang Python at shutdown + t.start() + if verbose: + print " started worker thread" + + # Try a thread id that doesn't make sense. + if verbose: + print " trying nonsensical thread id" + result = set_async_exc(ctypes.c_long(-1), exception) + self.assertEqual(result, 0) # no thread states modified + + # Now raise an exception in the worker thread. + if verbose: + print " waiting for worker thread to get started" + ret = worker_started.wait() + self.assertTrue(ret) + if verbose: + print " verifying worker hasn't exited" + self.assertTrue(not t.finished) + if verbose: + print " attempting to raise asynch exception in worker" + result = set_async_exc(ctypes.c_long(t.id), exception) + self.assertEqual(result, 1) # one thread state modified + if verbose: + print " waiting for worker to say it caught the exception" + worker_saw_exception.wait(timeout=10) + self.assertTrue(t.finished) + if verbose: + print " all OK -- joining worker" + if t.finished: + t.join() + # else the thread is still running, and we have no way to kill it + + def test_limbo_cleanup(self): + # Issue 7481: Failure to start thread should cleanup the limbo map. + def fail_new_thread(*args): + raise thread.error() + _start_new_thread = threading._start_new_thread + threading._start_new_thread = fail_new_thread + try: + t = threading.Thread(target=lambda: None) + self.assertRaises(thread.error, t.start) + self.assertFalse( + t in threading._limbo, + "Failed to cleanup _limbo map on failure of Thread.start().") + finally: + threading._start_new_thread = _start_new_thread + + def test_finalize_runnning_thread(self): + # Issue 1402: the PyGILState_Ensure / _Release functions may be called + # very late on python exit: on deallocation of a running thread for + # example. + try: + import ctypes + except ImportError: + if verbose: + print("test_finalize_with_runnning_thread can't import ctypes") + return # can't do anything + + rc = subprocess.call([sys.executable, "-c", """if 1: + import ctypes, sys, time, thread + + # This lock is used as a simple event variable. + ready = thread.allocate_lock() + ready.acquire() + + # Module globals are cleared before __del__ is run + # So we save the functions in class dict + class C: + ensure = ctypes.pythonapi.PyGILState_Ensure + release = ctypes.pythonapi.PyGILState_Release + def __del__(self): + state = self.ensure() + self.release(state) + + def waitingThread(): + x = C() + ready.release() + time.sleep(100) + + thread.start_new_thread(waitingThread, ()) + ready.acquire() # Be sure the other thread is waiting. + sys.exit(42) + """]) + self.assertEqual(rc, 42) + + def test_finalize_with_trace(self): + # Issue1733757 + # Avoid a deadlock when sys.settrace steps into threading._shutdown + p = subprocess.Popen([sys.executable, "-c", """if 1: + import sys, threading + + # A deadlock-killer, to prevent the + # testsuite to hang forever + def killer(): + import os, time + time.sleep(2) + print 'program blocked; aborting' + os._exit(2) + t = threading.Thread(target=killer) + t.daemon = True + t.start() + + # This is the trace function + def func(frame, event, arg): + threading.current_thread() + return func + + sys.settrace(func) + """], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + stdout, stderr = p.communicate() + rc = p.returncode + self.assertFalse(rc == 2, "interpreted was blocked") + self.assertTrue(rc == 0, + "Unexpected error: " + repr(stderr)) + + def test_join_nondaemon_on_shutdown(self): + # Issue 1722344 + # Raising SystemExit skipped threading._shutdown + p = subprocess.Popen([sys.executable, "-c", """if 1: + import threading + from time import sleep + + def child(): + sleep(1) + # As a non-daemon thread we SHOULD wake up and nothing + # should be torn down yet + print "Woke up, sleep function is:", sleep + + threading.Thread(target=child).start() + raise SystemExit + """], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + stdout, stderr = p.communicate() + self.assertEqual(stdout.strip(), + "Woke up, sleep function is: ") + stderr = re.sub(r"^\[\d+ refs\]", "", stderr, re.MULTILINE).strip() + self.assertEqual(stderr, "") + + def test_enumerate_after_join(self): + # Try hard to trigger #1703448: a thread is still returned in + # threading.enumerate() after it has been join()ed. + enum = threading.enumerate + old_interval = sys.getcheckinterval() + try: + for i in xrange(1, 100): + # Try a couple times at each thread-switching interval + # to get more interleavings. + sys.setcheckinterval(i // 5) + t = threading.Thread(target=lambda: None) + t.start() + t.join() + l = enum() + self.assertNotIn(t, l, + "#1703448 triggered after %d trials: %s" % (i, l)) + finally: + sys.setcheckinterval(old_interval) + + def test_no_refcycle_through_target(self): + class RunSelfFunction(object): + def __init__(self, should_raise): + # The links in this refcycle from Thread back to self + # should be cleaned up when the thread completes. + self.should_raise = should_raise + self.thread = threading.Thread(target=self._run, + args=(self,), + kwargs={'yet_another':self}) + self.thread.start() + + def _run(self, other_ref, yet_another): + if self.should_raise: + raise SystemExit + + cyclic_object = RunSelfFunction(should_raise=False) + weak_cyclic_object = weakref.ref(cyclic_object) + cyclic_object.thread.join() + del cyclic_object + self.assertEqual(None, weak_cyclic_object(), + msg=('%d references still around' % + sys.getrefcount(weak_cyclic_object()))) + + raising_cyclic_object = RunSelfFunction(should_raise=True) + weak_raising_cyclic_object = weakref.ref(raising_cyclic_object) + raising_cyclic_object.thread.join() + del raising_cyclic_object + self.assertEqual(None, weak_raising_cyclic_object(), + msg=('%d references still around' % + sys.getrefcount(weak_raising_cyclic_object()))) + + +class ThreadJoinOnShutdown(BaseTestCase): + + # Between fork() and exec(), only async-safe functions are allowed (issues + # #12316 and #11870), and fork() from a worker thread is known to trigger + # problems with some operating systems (issue #3863): skip problematic tests + # on platforms known to behave badly. + platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', + 'os2emx') + + def _run_and_join(self, script): + script = """if 1: + import sys, os, time, threading + + # a thread, which waits for the main program to terminate + def joiningfunc(mainthread): + mainthread.join() + print 'end of thread' + \n""" + script + + p = subprocess.Popen([sys.executable, "-c", script], stdout=subprocess.PIPE) + rc = p.wait() + data = p.stdout.read().replace('\r', '') + p.stdout.close() + self.assertEqual(data, "end of main\nend of thread\n") + self.assertFalse(rc == 2, "interpreter was blocked") + self.assertTrue(rc == 0, "Unexpected error") + + def test_1_join_on_shutdown(self): + # The usual case: on exit, wait for a non-daemon thread + script = """if 1: + import os + t = threading.Thread(target=joiningfunc, + args=(threading.current_thread(),)) + t.start() + time.sleep(0.1) + print 'end of main' + """ + self._run_and_join(script) + + + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") + def test_2_join_in_forked_process(self): + # Like the test above, but from a forked interpreter + script = """if 1: + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(threading.current_thread(),)) + t.start() + print 'end of main' + """ + self._run_and_join(script) + + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") + def test_3_join_in_forked_from_thread(self): + # Like the test above, but fork() was called from a worker thread + # In the forked process, the main Thread object must be marked as stopped. + script = """if 1: + main_thread = threading.current_thread() + def worker(): + childpid = os.fork() + if childpid != 0: + os.waitpid(childpid, 0) + sys.exit(0) + + t = threading.Thread(target=joiningfunc, + args=(main_thread,)) + print 'end of main' + t.start() + t.join() # Should not block: main_thread is already stopped + + w = threading.Thread(target=worker) + w.start() + """ + self._run_and_join(script) + + def assertScriptHasOutput(self, script, expected_output): + p = subprocess.Popen([sys.executable, "-c", script], + stdout=subprocess.PIPE) + rc = p.wait() + data = p.stdout.read().decode().replace('\r', '') + self.assertEqual(rc, 0, "Unexpected error") + self.assertEqual(data, expected_output) + + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") + def test_4_joining_across_fork_in_worker_thread(self): + # There used to be a possible deadlock when forking from a child + # thread. See http://bugs.python.org/issue6643. + + # The script takes the following steps: + # - The main thread in the parent process starts a new thread and then + # tries to join it. + # - The join operation acquires the Lock inside the thread's _block + # Condition. (See threading.py:Thread.join().) + # - We stub out the acquire method on the condition to force it to wait + # until the child thread forks. (See LOCK ACQUIRED HERE) + # - The child thread forks. (See LOCK HELD and WORKER THREAD FORKS + # HERE) + # - The main thread of the parent process enters Condition.wait(), + # which releases the lock on the child thread. + # - The child process returns. Without the necessary fix, when the + # main thread of the child process (which used to be the child thread + # in the parent process) attempts to exit, it will try to acquire the + # lock in the Thread._block Condition object and hang, because the + # lock was held across the fork. + + script = """if 1: + import os, time, threading + + finish_join = False + start_fork = False + + def worker(): + # Wait until this thread's lock is acquired before forking to + # create the deadlock. + global finish_join + while not start_fork: + time.sleep(0.01) + # LOCK HELD: Main thread holds lock across this call. + childpid = os.fork() + finish_join = True + if childpid != 0: + # Parent process just waits for child. + os.waitpid(childpid, 0) + # Child process should just return. + + w = threading.Thread(target=worker) + + # Stub out the private condition variable's lock acquire method. + # This acquires the lock and then waits until the child has forked + # before returning, which will release the lock soon after. If + # someone else tries to fix this test case by acquiring this lock + # before forking instead of resetting it, the test case will + # deadlock when it shouldn't. + condition = w._block + orig_acquire = condition.acquire + call_count_lock = threading.Lock() + call_count = 0 + def my_acquire(): + global call_count + global start_fork + orig_acquire() # LOCK ACQUIRED HERE + start_fork = True + if call_count == 0: + while not finish_join: + time.sleep(0.01) # WORKER THREAD FORKS HERE + with call_count_lock: + call_count += 1 + condition.acquire = my_acquire + + w.start() + w.join() + print('end of main') + """ + self.assertScriptHasOutput(script, "end of main\n") + + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") + def test_5_clear_waiter_locks_to_avoid_crash(self): + # Check that a spawned thread that forks doesn't segfault on certain + # platforms, namely OS X. This used to happen if there was a waiter + # lock in the thread's condition variable's waiters list. Even though + # we know the lock will be held across the fork, it is not safe to + # release locks held across forks on all platforms, so releasing the + # waiter lock caused a segfault on OS X. Furthermore, since locks on + # OS X are (as of this writing) implemented with a mutex + condition + # variable instead of a semaphore, while we know that the Python-level + # lock will be acquired, we can't know if the internal mutex will be + # acquired at the time of the fork. + + script = """if True: + import os, time, threading + + start_fork = False + + def worker(): + # Wait until the main thread has attempted to join this thread + # before continuing. + while not start_fork: + time.sleep(0.01) + childpid = os.fork() + if childpid != 0: + # Parent process just waits for child. + (cpid, rc) = os.waitpid(childpid, 0) + assert cpid == childpid + assert rc == 0 + print('end of worker thread') + else: + # Child process should just return. + pass + + w = threading.Thread(target=worker) + + # Stub out the private condition variable's _release_save method. + # This releases the condition's lock and flips the global that + # causes the worker to fork. At this point, the problematic waiter + # lock has been acquired once by the waiter and has been put onto + # the waiters list. + condition = w._block + orig_release_save = condition._release_save + def my_release_save(): + global start_fork + orig_release_save() + # Waiter lock held here, condition lock released. + start_fork = True + condition._release_save = my_release_save + + w.start() + w.join() + print('end of main thread') + """ + output = "end of worker thread\nend of main thread\n" + self.assertScriptHasOutput(script, output) + + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") + def test_reinit_tls_after_fork(self): + # Issue #13817: fork() would deadlock in a multithreaded program with + # the ad-hoc TLS implementation. + + def do_fork_and_wait(): + # just fork a child process and wait it + pid = os.fork() + if pid > 0: + os.waitpid(pid, 0) + else: + os._exit(0) + + # start a bunch of threads that will fork() child processes + threads = [] + for i in range(16): + t = threading.Thread(target=do_fork_and_wait) + threads.append(t) + t.start() + + for t in threads: + t.join() + + +class ThreadingExceptionTests(BaseTestCase): + # A RuntimeError should be raised if Thread.start() is called + # multiple times. + def test_start_thread_again(self): + thread = threading.Thread() + thread.start() + self.assertRaises(RuntimeError, thread.start) + + def test_joining_current_thread(self): + current_thread = threading.current_thread() + self.assertRaises(RuntimeError, current_thread.join); + + def test_joining_inactive_thread(self): + thread = threading.Thread() + self.assertRaises(RuntimeError, thread.join) + + def test_daemonize_active_thread(self): + thread = threading.Thread() + thread.start() + self.assertRaises(RuntimeError, setattr, thread, "daemon", True) + + +class LockTests(lock_tests.LockTests): + locktype = staticmethod(threading.Lock) + +class RLockTests(lock_tests.RLockTests): + locktype = staticmethod(threading.RLock) + +class EventTests(lock_tests.EventTests): + eventtype = staticmethod(threading.Event) + +class ConditionAsRLockTests(lock_tests.RLockTests): + # An Condition uses an RLock by default and exports its API. + locktype = staticmethod(threading.Condition) + +class ConditionTests(lock_tests.ConditionTests): + condtype = staticmethod(threading.Condition) + +class SemaphoreTests(lock_tests.SemaphoreTests): + semtype = staticmethod(threading.Semaphore) + +class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests): + semtype = staticmethod(threading.BoundedSemaphore) + + @unittest.skipUnless(sys.platform == 'darwin', 'test macosx problem') + def test_recursion_limit(self): + # Issue 9670 + # test that excessive recursion within a non-main thread causes + # an exception rather than crashing the interpreter on platforms + # like Mac OS X or FreeBSD which have small default stack sizes + # for threads + script = """if True: + import threading + + def recurse(): + return recurse() + + def outer(): + try: + recurse() + except RuntimeError: + pass + + w = threading.Thread(target=outer) + w.start() + w.join() + print('end of main thread') + """ + expected_output = "end of main thread\n" + p = subprocess.Popen([sys.executable, "-c", script], + stdout=subprocess.PIPE) + stdout, stderr = p.communicate() + data = stdout.decode().replace('\r', '') + self.assertEqual(p.returncode, 0, "Unexpected error") + self.assertEqual(data, expected_output) + +def test_main(): + test.test_support.run_unittest(LockTests, RLockTests, EventTests, + ConditionAsRLockTests, ConditionTests, + SemaphoreTests, BoundedSemaphoreTests, + ThreadTests, + ThreadJoinOnShutdown, + ThreadingExceptionTests, + ) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_thread.py python-gevent-1.0/greentest/2.7/test_thread.py --- python-gevent-0.13.7/greentest/2.7/test_thread.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_thread.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,242 @@ +import os +import unittest +import random +from test import test_support +thread = test_support.import_module('thread') +import time +import sys +import weakref + +import lock_tests + +NUMTASKS = 10 +NUMTRIPS = 3 + + +_print_mutex = thread.allocate_lock() + +def verbose_print(arg): + """Helper function for printing out debugging output.""" + if test_support.verbose: + with _print_mutex: + print arg + + +class BasicThreadTest(unittest.TestCase): + + def setUp(self): + self.done_mutex = thread.allocate_lock() + self.done_mutex.acquire() + self.running_mutex = thread.allocate_lock() + self.random_mutex = thread.allocate_lock() + self.created = 0 + self.running = 0 + self.next_ident = 0 + + +class ThreadRunningTests(BasicThreadTest): + + def newtask(self): + with self.running_mutex: + self.next_ident += 1 + verbose_print("creating task %s" % self.next_ident) + thread.start_new_thread(self.task, (self.next_ident,)) + self.created += 1 + self.running += 1 + + def task(self, ident): + with self.random_mutex: + delay = random.random() / 10000.0 + verbose_print("task %s will run for %sus" % (ident, round(delay*1e6))) + time.sleep(delay) + verbose_print("task %s done" % ident) + with self.running_mutex: + self.running -= 1 + if self.created == NUMTASKS and self.running == 0: + self.done_mutex.release() + + def test_starting_threads(self): + # Basic test for thread creation. + for i in range(NUMTASKS): + self.newtask() + verbose_print("waiting for tasks to complete...") + self.done_mutex.acquire() + verbose_print("all tasks done") + + def test_stack_size(self): + # Various stack size tests. + self.assertEqual(thread.stack_size(), 0, "initial stack size is not 0") + + thread.stack_size(0) + self.assertEqual(thread.stack_size(), 0, "stack_size not reset to default") + + if os.name not in ("nt", "os2", "posix"): + return + + tss_supported = True + try: + thread.stack_size(4096) + except ValueError: + verbose_print("caught expected ValueError setting " + "stack_size(4096)") + except thread.error: + tss_supported = False + verbose_print("platform does not support changing thread stack " + "size") + + if tss_supported: + fail_msg = "stack_size(%d) failed - should succeed" + for tss in (262144, 0x100000, 0): + thread.stack_size(tss) + self.assertEqual(thread.stack_size(), tss, fail_msg % tss) + verbose_print("successfully set stack_size(%d)" % tss) + + for tss in (262144, 0x100000): + verbose_print("trying stack_size = (%d)" % tss) + self.next_ident = 0 + self.created = 0 + for i in range(NUMTASKS): + self.newtask() + + verbose_print("waiting for all tasks to complete") + self.done_mutex.acquire() + verbose_print("all tasks done") + + thread.stack_size(0) + + def test__count(self): + # Test the _count() function. + orig = thread._count() + mut = thread.allocate_lock() + mut.acquire() + started = [] + def task(): + started.append(None) + mut.acquire() + mut.release() + thread.start_new_thread(task, ()) + while not started: + time.sleep(0.01) + self.assertEqual(thread._count(), orig + 1) + # Allow the task to finish. + mut.release() + # The only reliable way to be sure that the thread ended from the + # interpreter's point of view is to wait for the function object to be + # destroyed. + done = [] + wr = weakref.ref(task, lambda _: done.append(None)) + del task + while not done: + time.sleep(0.01) + self.assertEqual(thread._count(), orig) + + +class Barrier: + def __init__(self, num_threads): + self.num_threads = num_threads + self.waiting = 0 + self.checkin_mutex = thread.allocate_lock() + self.checkout_mutex = thread.allocate_lock() + self.checkout_mutex.acquire() + + def enter(self): + self.checkin_mutex.acquire() + self.waiting = self.waiting + 1 + if self.waiting == self.num_threads: + self.waiting = self.num_threads - 1 + self.checkout_mutex.release() + return + self.checkin_mutex.release() + + self.checkout_mutex.acquire() + self.waiting = self.waiting - 1 + if self.waiting == 0: + self.checkin_mutex.release() + return + self.checkout_mutex.release() + + +class BarrierTest(BasicThreadTest): + + def test_barrier(self): + self.bar = Barrier(NUMTASKS) + self.running = NUMTASKS + for i in range(NUMTASKS): + thread.start_new_thread(self.task2, (i,)) + verbose_print("waiting for tasks to end") + self.done_mutex.acquire() + verbose_print("tasks done") + + def task2(self, ident): + for i in range(NUMTRIPS): + if ident == 0: + # give it a good chance to enter the next + # barrier before the others are all out + # of the current one + delay = 0 + else: + with self.random_mutex: + delay = random.random() / 10000.0 + verbose_print("task %s will run for %sus" % + (ident, round(delay * 1e6))) + time.sleep(delay) + verbose_print("task %s entering %s" % (ident, i)) + self.bar.enter() + verbose_print("task %s leaving barrier" % ident) + with self.running_mutex: + self.running -= 1 + # Must release mutex before releasing done, else the main thread can + # exit and set mutex to None as part of global teardown; then + # mutex.release() raises AttributeError. + finished = self.running == 0 + if finished: + self.done_mutex.release() + + +class LockTests(lock_tests.LockTests): + locktype = thread.allocate_lock + + +class TestForkInThread(unittest.TestCase): + def setUp(self): + self.read_fd, self.write_fd = os.pipe() + + @unittest.skipIf(sys.platform.startswith('win'), + "This test is only appropriate for POSIX-like systems.") + @test_support.reap_threads + def test_forkinthread(self): + def thread1(): + try: + pid = os.fork() # fork in a thread + except RuntimeError: + sys.exit(0) # exit the child + + if pid == 0: # child + os.close(self.read_fd) + os.write(self.write_fd, "OK") + sys.exit(0) + else: # parent + os.close(self.write_fd) + + thread.start_new_thread(thread1, ()) + self.assertEqual(os.read(self.read_fd, 2), "OK", + "Unable to fork() in thread") + + def tearDown(self): + try: + os.close(self.read_fd) + except OSError: + pass + + try: + os.close(self.write_fd) + except OSError: + pass + + +def test_main(): + test_support.run_unittest(ThreadRunningTests, BarrierTest, LockTests, + TestForkInThread) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_timeout.py python-gevent-1.0/greentest/2.7/test_timeout.py --- python-gevent-0.13.7/greentest/2.7/test_timeout.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,202 @@ +"""Unit tests for socket timeout feature.""" + +import unittest +from test import test_support + +# This requires the 'network' resource as given on the regrtest command line. +skip_expected = not test_support.is_resource_enabled('network') + +import time +import socket + + +class CreationTestCase(unittest.TestCase): + """Test case for socket.gettimeout() and socket.settimeout()""" + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + def tearDown(self): + self.sock.close() + + def testObjectCreation(self): + # Test Socket creation + self.assertEqual(self.sock.gettimeout(), None, + "timeout not disabled by default") + + def testFloatReturnValue(self): + # Test return value of gettimeout() + self.sock.settimeout(7.345) + self.assertEqual(self.sock.gettimeout(), 7.345) + + self.sock.settimeout(3) + self.assertEqual(self.sock.gettimeout(), 3) + + self.sock.settimeout(None) + self.assertEqual(self.sock.gettimeout(), None) + + def testReturnType(self): + # Test return type of gettimeout() + self.sock.settimeout(1) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + self.sock.settimeout(3.9) + self.assertEqual(type(self.sock.gettimeout()), type(1.0)) + + def testTypeCheck(self): + # Test type checking by settimeout() + self.sock.settimeout(0) + self.sock.settimeout(0L) + self.sock.settimeout(0.0) + self.sock.settimeout(None) + self.assertRaises(TypeError, self.sock.settimeout, "") + self.assertRaises(TypeError, self.sock.settimeout, u"") + self.assertRaises(TypeError, self.sock.settimeout, ()) + self.assertRaises(TypeError, self.sock.settimeout, []) + self.assertRaises(TypeError, self.sock.settimeout, {}) + self.assertRaises(TypeError, self.sock.settimeout, 0j) + + def testRangeCheck(self): + # Test range checking by settimeout() + self.assertRaises(ValueError, self.sock.settimeout, -1) + self.assertRaises(ValueError, self.sock.settimeout, -1L) + self.assertRaises(ValueError, self.sock.settimeout, -1.0) + + def testTimeoutThenBlocking(self): + # Test settimeout() followed by setblocking() + self.sock.settimeout(10) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + + self.sock.settimeout(10) + self.sock.setblocking(0) + self.assertEqual(self.sock.gettimeout(), 0.0) + self.sock.setblocking(1) + self.assertEqual(self.sock.gettimeout(), None) + + def testBlockingThenTimeout(self): + # Test setblocking() followed by settimeout() + self.sock.setblocking(0) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + self.sock.setblocking(1) + self.sock.settimeout(1) + self.assertEqual(self.sock.gettimeout(), 1) + + +class TimeoutTestCase(unittest.TestCase): + """Test case for socket.socket() timeout functions""" + + # There are a number of tests here trying to make sure that an operation + # doesn't take too much longer than expected. But competing machine + # activity makes it inevitable that such tests will fail at times. + # When fuzz was at 1.0, I (tim) routinely saw bogus failures on Win2K + # and Win98SE. Boosting it to 2.0 helped a lot, but isn't a real + # solution. + fuzz = 2.0 + + def setUp(self): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.addr_remote = ('www.python.org.', 80) + self.localhost = '127.0.0.1' + + def tearDown(self): + self.sock.close() + + def testConnectTimeout(self): + # Choose a private address that is unlikely to exist to prevent + # failures due to the connect succeeding before the timeout. + # Use a dotted IP address to avoid including the DNS lookup time + # with the connect time. This avoids failing the assertion that + # the timeout occurred fast enough. + addr = ('10.0.0.0', 12345) + + # Test connect() timeout + _timeout = 0.001 + self.sock.settimeout(_timeout) + + _t1 = time.time() + self.assertRaises(socket.error, self.sock.connect, addr) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assertTrue(_delta < _timeout + self.fuzz, + "timeout (%g) is more than %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvTimeout(self): + # Test recv() timeout + _timeout = 0.02 + + with test_support.transient_internet(self.addr_remote[0]): + self.sock.connect(self.addr_remote) + self.sock.settimeout(_timeout) + + _t1 = time.time() + self.assertRaises(socket.timeout, self.sock.recv, 1024) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assertTrue(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testAcceptTimeout(self): + # Test accept() timeout + _timeout = 2 + self.sock.settimeout(_timeout) + # Prevent "Address already in use" socket exceptions + test_support.bind_port(self.sock, self.localhost) + self.sock.listen(5) + + _t1 = time.time() + self.assertRaises(socket.error, self.sock.accept) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assertTrue(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testRecvfromTimeout(self): + # Test recvfrom() timeout + _timeout = 2 + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.sock.settimeout(_timeout) + # Prevent "Address already in use" socket exceptions + test_support.bind_port(self.sock, self.localhost) + + _t1 = time.time() + self.assertRaises(socket.error, self.sock.recvfrom, 8192) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assertTrue(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) + + def testSend(self): + # Test send() timeout + # couldn't figure out how to test it + pass + + def testSendto(self): + # Test sendto() timeout + # couldn't figure out how to test it + pass + + def testSendall(self): + # Test sendall() timeout + # couldn't figure out how to test it + pass + + +def test_main(): + test_support.requires('network') + test_support.run_unittest(CreationTestCase, TimeoutTestCase) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_urllib2_localnet.py python-gevent-1.0/greentest/2.7/test_urllib2_localnet.py --- python-gevent-0.13.7/greentest/2.7/test_urllib2_localnet.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_urllib2_localnet.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,539 @@ +#!/usr/bin/env python + +import urlparse +import urllib2 +import BaseHTTPServer +import unittest +import hashlib +from test import test_support +mimetools = test_support.import_module('mimetools', deprecated=True) +threading = test_support.import_module('threading') + +# Loopback http server infrastructure + +class LoopbackHttpServer(BaseHTTPServer.HTTPServer): + """HTTP server w/ a few modifications that make it useful for + loopback testing purposes. + """ + + def __init__(self, server_address, RequestHandlerClass): + BaseHTTPServer.HTTPServer.__init__(self, + server_address, + RequestHandlerClass) + + # Set the timeout of our listening socket really low so + # that we can stop the server easily. + self.socket.settimeout(0.1) + + def get_request(self): + """BaseHTTPServer method, overridden.""" + + request, client_address = self.socket.accept() + + # It's a loopback connection, so setting the timeout + # really low shouldn't affect anything, but should make + # deadlocks less likely to occur. + request.settimeout(1.0) + + return (request, client_address) + +class LoopbackHttpServerThread(threading.Thread): + """Stoppable thread that runs a loopback http server.""" + + def __init__(self, request_handler): + threading.Thread.__init__(self) + self._stop = False + self.ready = threading.Event() + request_handler.protocol_version = "HTTP/1.0" + self.httpd = LoopbackHttpServer(('127.0.0.1', 0), + request_handler) + #print "Serving HTTP on %s port %s" % (self.httpd.server_name, + # self.httpd.server_port) + self.port = self.httpd.server_port + + def stop(self): + """Stops the webserver if it's currently running.""" + + # Set the stop flag. + self._stop = True + + self.join() + + def run(self): + self.ready.set() + while not self._stop: + self.httpd.handle_request() + +# Authentication infrastructure + +class DigestAuthHandler: + """Handler for performing digest authentication.""" + + def __init__(self): + self._request_num = 0 + self._nonces = [] + self._users = {} + self._realm_name = "Test Realm" + self._qop = "auth" + + def set_qop(self, qop): + self._qop = qop + + def set_users(self, users): + assert isinstance(users, dict) + self._users = users + + def set_realm(self, realm): + self._realm_name = realm + + def _generate_nonce(self): + self._request_num += 1 + nonce = hashlib.md5(str(self._request_num)).hexdigest() + self._nonces.append(nonce) + return nonce + + def _create_auth_dict(self, auth_str): + first_space_index = auth_str.find(" ") + auth_str = auth_str[first_space_index+1:] + + parts = auth_str.split(",") + + auth_dict = {} + for part in parts: + name, value = part.split("=") + name = name.strip() + if value[0] == '"' and value[-1] == '"': + value = value[1:-1] + else: + value = value.strip() + auth_dict[name] = value + return auth_dict + + def _validate_auth(self, auth_dict, password, method, uri): + final_dict = {} + final_dict.update(auth_dict) + final_dict["password"] = password + final_dict["method"] = method + final_dict["uri"] = uri + HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict + HA1 = hashlib.md5(HA1_str).hexdigest() + HA2_str = "%(method)s:%(uri)s" % final_dict + HA2 = hashlib.md5(HA2_str).hexdigest() + final_dict["HA1"] = HA1 + final_dict["HA2"] = HA2 + response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ + "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict + response = hashlib.md5(response_str).hexdigest() + + return response == auth_dict["response"] + + def _return_auth_challenge(self, request_handler): + request_handler.send_response(407, "Proxy Authentication Required") + request_handler.send_header("Content-Type", "text/html") + request_handler.send_header( + 'Proxy-Authenticate', 'Digest realm="%s", ' + 'qop="%s",' + 'nonce="%s", ' % \ + (self._realm_name, self._qop, self._generate_nonce())) + # XXX: Not sure if we're supposed to add this next header or + # not. + #request_handler.send_header('Connection', 'close') + request_handler.end_headers() + request_handler.wfile.write("Proxy Authentication Required.") + return False + + def handle_request(self, request_handler): + """Performs digest authentication on the given HTTP request + handler. Returns True if authentication was successful, False + otherwise. + + If no users have been set, then digest auth is effectively + disabled and this method will always return True. + """ + + if len(self._users) == 0: + return True + + if 'Proxy-Authorization' not in request_handler.headers: + return self._return_auth_challenge(request_handler) + else: + auth_dict = self._create_auth_dict( + request_handler.headers['Proxy-Authorization'] + ) + if auth_dict["username"] in self._users: + password = self._users[ auth_dict["username"] ] + else: + return self._return_auth_challenge(request_handler) + if not auth_dict.get("nonce") in self._nonces: + return self._return_auth_challenge(request_handler) + else: + self._nonces.remove(auth_dict["nonce"]) + + auth_validated = False + + # MSIE uses short_path in its validation, but Python's + # urllib2 uses the full path, so we're going to see if + # either of them works here. + + for path in [request_handler.path, request_handler.short_path]: + if self._validate_auth(auth_dict, + password, + request_handler.command, + path): + auth_validated = True + + if not auth_validated: + return self._return_auth_challenge(request_handler) + return True + +# Proxy test infrastructure + +class FakeProxyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + """This is a 'fake proxy' that makes it look like the entire + internet has gone down due to a sudden zombie invasion. It main + utility is in providing us with authentication support for + testing. + """ + + def __init__(self, digest_auth_handler, *args, **kwargs): + # This has to be set before calling our parent's __init__(), which will + # try to call do_GET(). + self.digest_auth_handler = digest_auth_handler + BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs) + + def log_message(self, format, *args): + # Uncomment the next line for debugging. + #sys.stderr.write(format % args) + pass + + def do_GET(self): + (scm, netloc, path, params, query, fragment) = urlparse.urlparse( + self.path, 'http') + self.short_path = path + if self.digest_auth_handler.handle_request(self): + self.send_response(200, "OK") + self.send_header("Content-Type", "text/html") + self.end_headers() + self.wfile.write("You've reached %s!
" % self.path) + self.wfile.write("Our apologies, but our server is down due to " + "a sudden zombie invasion.") + +# Test cases + +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = test_support.threading_setup() + + def tearDown(self): + test_support.threading_cleanup(*self._threads) + + +class ProxyAuthTests(BaseTestCase): + URL = "http://localhost" + + USER = "tester" + PASSWD = "test123" + REALM = "TestRealm" + + def setUp(self): + super(ProxyAuthTests, self).setUp() + self.digest_auth_handler = DigestAuthHandler() + self.digest_auth_handler.set_users({self.USER: self.PASSWD}) + self.digest_auth_handler.set_realm(self.REALM) + def create_fake_proxy_handler(*args, **kwargs): + return FakeProxyHandler(self.digest_auth_handler, *args, **kwargs) + + self.server = LoopbackHttpServerThread(create_fake_proxy_handler) + self.server.start() + self.server.ready.wait() + proxy_url = "http://127.0.0.1:%d" % self.server.port + handler = urllib2.ProxyHandler({"http" : proxy_url}) + self.proxy_digest_handler = urllib2.ProxyDigestAuthHandler() + self.opener = urllib2.build_opener(handler, self.proxy_digest_handler) + + def tearDown(self): + self.server.stop() + super(ProxyAuthTests, self).tearDown() + + def test_proxy_with_bad_password_raises_httperror(self): + self.proxy_digest_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD+"bad") + self.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_with_no_password_raises_httperror(self): + self.digest_auth_handler.set_qop("auth") + self.assertRaises(urllib2.HTTPError, + self.opener.open, + self.URL) + + def test_proxy_qop_auth_works(self): + self.proxy_digest_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + self.digest_auth_handler.set_qop("auth") + result = self.opener.open(self.URL) + while result.read(): + pass + result.close() + + def test_proxy_qop_auth_int_works_or_throws_urlerror(self): + self.proxy_digest_handler.add_password(self.REALM, self.URL, + self.USER, self.PASSWD) + self.digest_auth_handler.set_qop("auth-int") + try: + result = self.opener.open(self.URL) + except urllib2.URLError: + # It's okay if we don't support auth-int, but we certainly + # shouldn't receive any kind of exception here other than + # a URLError. + result = None + if result: + while result.read(): + pass + result.close() + + +def GetRequestHandler(responses): + + class FakeHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): + + server_version = "TestHTTP/" + requests = [] + headers_received = [] + port = 80 + + def do_GET(self): + body = self.send_head() + if body: + self.wfile.write(body) + + def do_POST(self): + content_length = self.headers['Content-Length'] + post_data = self.rfile.read(int(content_length)) + self.do_GET() + self.requests.append(post_data) + + def send_head(self): + FakeHTTPRequestHandler.headers_received = self.headers + self.requests.append(self.path) + response_code, headers, body = responses.pop(0) + + self.send_response(response_code) + + for (header, value) in headers: + self.send_header(header, value % self.port) + if body: + self.send_header('Content-type', 'text/plain') + self.end_headers() + return body + self.end_headers() + + def log_message(self, *args): + pass + + + return FakeHTTPRequestHandler + + +class TestUrlopen(BaseTestCase): + """Tests urllib2.urlopen using the network. + + These tests are not exhaustive. Assuming that testing using files does a + good job overall of some of the basic interface features. There are no + tests exercising the optional 'data' and 'proxies' arguments. No tests + for transparent redirection have been written. + """ + + def start_server(self, responses): + handler = GetRequestHandler(responses) + + self.server = LoopbackHttpServerThread(handler) + self.server.start() + self.server.ready.wait() + port = self.server.port + handler.port = port + return handler + + + def test_redirection(self): + expected_response = 'We got here...' + responses = [ + (302, [('Location', 'http://localhost:%s/somewhere_else')], ''), + (200, [], expected_response) + ] + + handler = self.start_server(responses) + + try: + f = urllib2.urlopen('http://localhost:%s/' % handler.port) + data = f.read() + f.close() + + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ['/', '/somewhere_else']) + finally: + self.server.stop() + + + def test_404(self): + expected_response = 'Bad bad bad...' + handler = self.start_server([(404, [], expected_response)]) + + try: + try: + urllib2.urlopen('http://localhost:%s/weeble' % handler.port) + except urllib2.URLError, f: + pass + else: + self.fail('404 should raise URLError') + + data = f.read() + f.close() + + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ['/weeble']) + finally: + self.server.stop() + + + def test_200(self): + expected_response = 'pycon 2008...' + handler = self.start_server([(200, [], expected_response)]) + + try: + f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port) + data = f.read() + f.close() + + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ['/bizarre']) + finally: + self.server.stop() + + def test_200_with_parameters(self): + expected_response = 'pycon 2008...' + handler = self.start_server([(200, [], expected_response)]) + + try: + f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port, 'get=with_feeling') + data = f.read() + f.close() + + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ['/bizarre', 'get=with_feeling']) + finally: + self.server.stop() + + + def test_sending_headers(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + req = urllib2.Request("http://localhost:%s/" % handler.port, + headers={'Range': 'bytes=20-39'}) + urllib2.urlopen(req) + self.assertEqual(handler.headers_received['Range'], 'bytes=20-39') + finally: + self.server.stop() + + def test_basic(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + for attr in ("read", "close", "info", "geturl"): + self.assertTrue(hasattr(open_url, attr), "object returned from " + "urlopen lacks the %s attribute" % attr) + try: + self.assertTrue(open_url.read(), "calling 'read' failed") + finally: + open_url.close() + finally: + self.server.stop() + + def test_info(self): + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + info_obj = open_url.info() + self.assertIsInstance(info_obj, mimetools.Message, + "object returned by 'info' is not an " + "instance of mimetools.Message") + self.assertEqual(info_obj.getsubtype(), "plain") + finally: + self.server.stop() + + def test_geturl(self): + # Make sure same URL as opened is returned by geturl. + handler = self.start_server([(200, [], "we don't care")]) + + try: + open_url = urllib2.urlopen("http://localhost:%s" % handler.port) + url = open_url.geturl() + self.assertEqual(url, "http://localhost:%s" % handler.port) + finally: + self.server.stop() + + + def test_bad_address(self): + # Make sure proper exception is raised when connecting to a bogus + # address. + self.assertRaises(IOError, + # Given that both VeriSign and various ISPs have in + # the past or are presently hijacking various invalid + # domain name requests in an attempt to boost traffic + # to their own sites, finding a domain name to use + # for this test is difficult. RFC2606 leads one to + # believe that '.invalid' should work, but experience + # seemed to indicate otherwise. Single character + # TLDs are likely to remain invalid, so this seems to + # be the best choice. The trailing '.' prevents a + # related problem: The normal DNS resolver appends + # the domain names from the search path if there is + # no '.' the end and, and if one of those domains + # implements a '*' rule a result is returned. + # However, none of this will prevent the test from + # failing if the ISP hijacks all invalid domain + # requests. The real solution would be to be able to + # parameterize the framework with a mock resolver. + urllib2.urlopen, "http://sadflkjsasf.i.nvali.d./") + + def test_iteration(self): + expected_response = "pycon 2008..." + handler = self.start_server([(200, [], expected_response)]) + try: + data = urllib2.urlopen("http://localhost:%s" % handler.port) + for line in data: + self.assertEqual(line, expected_response) + finally: + self.server.stop() + + def ztest_line_iteration(self): + lines = ["We\n", "got\n", "here\n", "verylong " * 8192 + "\n"] + expected_response = "".join(lines) + handler = self.start_server([(200, [], expected_response)]) + try: + data = urllib2.urlopen("http://localhost:%s" % handler.port) + for index, line in enumerate(data): + self.assertEqual(line, lines[index], + "Fetched line number %s doesn't match expected:\n" + " Expected length was %s, got %s" % + (index, len(lines[index]), len(line))) + finally: + self.server.stop() + self.assertEqual(index + 1, len(lines)) + +def test_main(): + # We will NOT depend on the network resource flag + # (Lib/test/regrtest.py -u network) since all tests here are only + # localhost. However, if this is a bad rationale, then uncomment + # the next line. + #test_support.requires("network") + + test_support.run_unittest(ProxyAuthTests, TestUrlopen) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_urllib2net.py python-gevent-1.0/greentest/2.7/test_urllib2net.py --- python-gevent-0.13.7/greentest/2.7/test_urllib2net.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_urllib2net.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,332 @@ +#!/usr/bin/env python + +import unittest +from test import test_support +from test_urllib2 import sanepathname2url + +import socket +import urllib2 +import os +import sys + +TIMEOUT = 60 # seconds + + +def _retry_thrice(func, exc, *args, **kwargs): + for i in range(3): + try: + return func(*args, **kwargs) + except exc, last_exc: + continue + except: + raise + raise last_exc + +def _wrap_with_retry_thrice(func, exc): + def wrapped(*args, **kwargs): + return _retry_thrice(func, exc, *args, **kwargs) + return wrapped + +# Connecting to remote hosts is flaky. Make it more robust by retrying +# the connection several times. +_urlopen_with_retry = _wrap_with_retry_thrice(urllib2.urlopen, urllib2.URLError) + + +class AuthTests(unittest.TestCase): + """Tests urllib2 authentication features.""" + +## Disabled at the moment since there is no page under python.org which +## could be used to HTTP authentication. +# +# def test_basic_auth(self): +# import httplib +# +# test_url = "http://www.python.org/test/test_urllib2/basic_auth" +# test_hostport = "www.python.org" +# test_realm = 'Test Realm' +# test_user = 'test.test_urllib2net' +# test_password = 'blah' +# +# # failure +# try: +# _urlopen_with_retry(test_url) +# except urllib2.HTTPError, exc: +# self.assertEqual(exc.code, 401) +# else: +# self.fail("urlopen() should have failed with 401") +# +# # success +# auth_handler = urllib2.HTTPBasicAuthHandler() +# auth_handler.add_password(test_realm, test_hostport, +# test_user, test_password) +# opener = urllib2.build_opener(auth_handler) +# f = opener.open('http://localhost/') +# response = _urlopen_with_retry("http://www.python.org/") +# +# # The 'userinfo' URL component is deprecated by RFC 3986 for security +# # reasons, let's not implement it! (it's already implemented for proxy +# # specification strings (that is, URLs or authorities specifying a +# # proxy), so we must keep that) +# self.assertRaises(httplib.InvalidURL, +# urllib2.urlopen, "http://evil:thing@example.com") + + +class CloseSocketTest(unittest.TestCase): + + def test_close(self): + import httplib + + # calling .close() on urllib2's response objects should close the + # underlying socket + + # delve deep into response to fetch socket._socketobject + response = _urlopen_with_retry("http://www.python.org/") + abused_fileobject = response.fp + self.assertTrue(abused_fileobject.__class__ is socket._fileobject) + httpresponse = abused_fileobject._sock + self.assertTrue(httpresponse.__class__ is httplib.HTTPResponse) + fileobject = httpresponse.fp + self.assertTrue(fileobject.__class__ is socket._fileobject) + + self.assertTrue(not fileobject.closed) + response.close() + self.assertTrue(fileobject.closed) + +class OtherNetworkTests(unittest.TestCase): + def setUp(self): + if 0: # for debugging + import logging + logger = logging.getLogger("test_urllib2net") + logger.addHandler(logging.StreamHandler()) + + # XXX The rest of these tests aren't very good -- they don't check much. + # They do sometimes catch some major disasters, though. + + def test_ftp(self): + urls = [ + 'ftp://ftp.kernel.org/pub/linux/kernel/README', + 'ftp://ftp.kernel.org/pub/linux/kernel/non-existent-file', + #'ftp://ftp.kernel.org/pub/leenox/kernel/test', + 'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC' + '/research-reports/00README-Legal-Rules-Regs', + ] + self._test_urls(urls, self._extra_handlers()) + + def test_file(self): + TESTFN = test_support.TESTFN + f = open(TESTFN, 'w') + try: + f.write('hi there\n') + f.close() + urls = [ + 'file:'+sanepathname2url(os.path.abspath(TESTFN)), + ('file:///nonsensename/etc/passwd', None, urllib2.URLError), + ] + self._test_urls(urls, self._extra_handlers(), retry=True) + finally: + os.remove(TESTFN) + + self.assertRaises(ValueError, urllib2.urlopen,'./relative_path/to/file') + + # XXX Following test depends on machine configurations that are internal + # to CNRI. Need to set up a public server with the right authentication + # configuration for test purposes. + +## def test_cnri(self): +## if socket.gethostname() == 'bitdiddle': +## localhost = 'bitdiddle.cnri.reston.va.us' +## elif socket.gethostname() == 'bitdiddle.concentric.net': +## localhost = 'localhost' +## else: +## localhost = None +## if localhost is not None: +## urls = [ +## 'file://%s/etc/passwd' % localhost, +## 'http://%s/simple/' % localhost, +## 'http://%s/digest/' % localhost, +## 'http://%s/not/found.h' % localhost, +## ] + +## bauth = HTTPBasicAuthHandler() +## bauth.add_password('basic_test_realm', localhost, 'jhylton', +## 'password') +## dauth = HTTPDigestAuthHandler() +## dauth.add_password('digest_test_realm', localhost, 'jhylton', +## 'password') + +## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) + + def test_urlwithfrag(self): + urlwith_frag = "http://docs.python.org/glossary.html#glossary" + with test_support.transient_internet(urlwith_frag): + req = urllib2.Request(urlwith_frag) + res = urllib2.urlopen(req) + self.assertEqual(res.geturl(), + "http://docs.python.org/glossary.html#glossary") + + def test_fileno(self): + req = urllib2.Request("http://www.python.org") + opener = urllib2.build_opener() + res = opener.open(req) + try: + res.fileno() + except AttributeError: + self.fail("HTTPResponse object should return a valid fileno") + finally: + res.close() + + def test_custom_headers(self): + url = "http://www.example.com" + with test_support.transient_internet(url): + opener = urllib2.build_opener() + request = urllib2.Request(url) + self.assertFalse(request.header_items()) + opener.open(request) + self.assertTrue(request.header_items()) + self.assertTrue(request.has_header('User-agent')) + request.add_header('User-Agent','Test-Agent') + opener.open(request) + self.assertEqual(request.get_header('User-agent'),'Test-Agent') + + def test_sites_no_connection_close(self): + # Some sites do not send Connection: close header. + # Verify that those work properly. (#issue12576) + + URL = 'http://www.imdb.com' # No Connection:close + with test_support.transient_internet(URL): + req = urllib2.urlopen(URL) + res = req.read() + self.assertTrue(res) + + def _test_urls(self, urls, handlers, retry=True): + import time + import logging + debug = logging.getLogger("test_urllib2").debug + + urlopen = urllib2.build_opener(*handlers).open + if retry: + urlopen = _wrap_with_retry_thrice(urlopen, urllib2.URLError) + + for url in urls: + if isinstance(url, tuple): + url, req, expected_err = url + else: + req = expected_err = None + with test_support.transient_internet(url): + debug(url) + try: + f = urlopen(url, req, TIMEOUT) + except EnvironmentError as err: + debug(err) + if expected_err: + msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" % + (expected_err, url, req, type(err), err)) + self.assertIsInstance(err, expected_err, msg) + except urllib2.URLError as err: + if isinstance(err[0], socket.timeout): + print >>sys.stderr, "" % url + continue + else: + raise + else: + try: + with test_support.transient_internet(url): + buf = f.read() + debug("read %d bytes" % len(buf)) + except socket.timeout: + print >>sys.stderr, "" % url + f.close() + debug("******** next url coming up...") + time.sleep(0.1) + + def _extra_handlers(self): + handlers = [] + + cfh = urllib2.CacheFTPHandler() + self.addCleanup(cfh.clear_cache) + cfh.setTimeout(1) + handlers.append(cfh) + + return handlers + + +class TimeoutTest(unittest.TestCase): + def test_http_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) + url = "http://www.python.org" + with test_support.transient_internet(url, timeout=None): + u = _urlopen_with_retry(url) + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) + + def test_http_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + url = "http://www.python.org" + with test_support.transient_internet(url): + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(url) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) + + def test_http_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + url = "http://www.python.org" + with test_support.transient_internet(url): + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(url, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) + + def test_http_timeout(self): + url = "http://www.python.org" + with test_support.transient_internet(url): + u = _urlopen_with_retry(url, timeout=120) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) + + FTP_HOST = "ftp://ftp.mirror.nl/pub/gnu/" + + def test_ftp_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) + with test_support.transient_internet(self.FTP_HOST, timeout=None): + u = _urlopen_with_retry(self.FTP_HOST) + self.assertTrue(u.fp.fp._sock.gettimeout() is None) + + def test_ftp_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + with test_support.transient_internet(self.FTP_HOST): + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + + def test_ftp_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + with test_support.transient_internet(self.FTP_HOST): + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertTrue(u.fp.fp._sock.gettimeout() is None) + + def test_ftp_timeout(self): + with test_support.transient_internet(self.FTP_HOST): + u = _urlopen_with_retry(self.FTP_HOST, timeout=60) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + + +def test_main(): + test_support.requires("network") + test_support.run_unittest(AuthTests, + OtherNetworkTests, + CloseSocketTest, + TimeoutTest, + ) + +if __name__ == "__main__": + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_urllib2.py python-gevent-1.0/greentest/2.7/test_urllib2.py --- python-gevent-0.13.7/greentest/2.7/test_urllib2.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_urllib2.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1344 @@ +import unittest +from test import test_support + +import os +import socket +import StringIO + +import urllib2 +from urllib2 import Request, OpenerDirector + +# XXX +# Request +# CacheFTPHandler (hard to write) +# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler + +class TrivialTests(unittest.TestCase): + def test_trivial(self): + # A couple trivial tests + + self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') + + # XXX Name hacking to get this to work on Windows. + fname = os.path.abspath(urllib2.__file__).replace('\\', '/') + + # And more hacking to get it to work on MacOS. This assumes + # urllib.pathname2url works, unfortunately... + if os.name == 'riscos': + import string + fname = os.expand(fname) + fname = fname.translate(string.maketrans("/.", "./")) + + if os.name == 'nt': + file_url = "file:///%s" % fname + else: + file_url = "file://%s" % fname + + f = urllib2.urlopen(file_url) + + buf = f.read() + f.close() + + def test_parse_http_list(self): + tests = [('a,b,c', ['a', 'b', 'c']), + ('path"o,l"og"i"cal, example', ['path"o,l"og"i"cal', 'example']), + ('a, b, "c", "d", "e,f", g, h', ['a', 'b', '"c"', '"d"', '"e,f"', 'g', 'h']), + ('a="b\\"c", d="e\\,f", g="h\\\\i"', ['a="b"c"', 'd="e,f"', 'g="h\\i"'])] + for string, list in tests: + self.assertEqual(urllib2.parse_http_list(string), list) + + +def test_request_headers_dict(): + """ + The Request.headers dictionary is not a documented interface. It should + stay that way, because the complete set of headers are only accessible + through the .get_header(), .has_header(), .header_items() interface. + However, .headers pre-dates those methods, and so real code will be using + the dictionary. + + The introduction in 2.4 of those methods was a mistake for the same reason: + code that previously saw all (urllib2 user)-provided headers in .headers + now sees only a subset (and the function interface is ugly and incomplete). + A better change would have been to replace .headers dict with a dict + subclass (or UserDict.DictMixin instance?) that preserved the .headers + interface and also provided access to the "unredirected" headers. It's + probably too late to fix that, though. + + + Check .capitalize() case normalization: + + >>> url = "http://example.com" + >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"] + 'blah' + >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"] + 'blah' + + Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError, + but that could be changed in future. + + """ + +def test_request_headers_methods(): + """ + Note the case normalization of header names here, to .capitalize()-case. + This should be preserved for backwards-compatibility. (In the HTTP case, + normalization to .title()-case is done by urllib2 before sending headers to + httplib). + + >>> url = "http://example.com" + >>> r = Request(url, headers={"Spam-eggs": "blah"}) + >>> r.has_header("Spam-eggs") + True + >>> r.header_items() + [('Spam-eggs', 'blah')] + >>> r.add_header("Foo-Bar", "baz") + >>> items = r.header_items() + >>> items.sort() + >>> items + [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')] + + Note that e.g. r.has_header("spam-EggS") is currently False, and + r.get_header("spam-EggS") returns None, but that could be changed in + future. + + >>> r.has_header("Not-there") + False + >>> print r.get_header("Not-there") + None + >>> r.get_header("Not-there", "default") + 'default' + + """ + + +def test_password_manager(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + >>> add("Some Realm", "http://example.com/", "joe", "password") + >>> add("Some Realm", "http://example.com/ni", "ni", "ni") + >>> add("c", "http://example.com/foo", "foo", "ni") + >>> add("c", "http://example.com/bar", "bar", "nini") + >>> add("b", "http://example.com/", "first", "blah") + >>> add("b", "http://example.com/", "second", "spam") + >>> add("a", "http://example.com", "1", "a") + >>> add("Some Realm", "http://c.example.com:3128", "3", "c") + >>> add("Some Realm", "d.example.com", "4", "d") + >>> add("Some Realm", "e.example.com:3128", "5", "e") + + >>> mgr.find_user_password("Some Realm", "example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam") + ('joe', 'password') + >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam") + ('joe', 'password') + >>> mgr.find_user_password("c", "http://example.com/foo") + ('foo', 'ni') + >>> mgr.find_user_password("c", "http://example.com/bar") + ('bar', 'nini') + + Actually, this is really undefined ATM +## Currently, we use the highest-level path where more than one match: + +## >>> mgr.find_user_password("Some Realm", "http://example.com/ni") +## ('joe', 'password') + + Use latest add_password() in case of conflict: + + >>> mgr.find_user_password("b", "http://example.com/") + ('second', 'spam') + + No special relationship between a.example.com and example.com: + + >>> mgr.find_user_password("a", "http://example.com/") + ('1', 'a') + >>> mgr.find_user_password("a", "http://a.example.com/") + (None, None) + + Ports: + + >>> mgr.find_user_password("Some Realm", "c.example.com") + (None, None) + >>> mgr.find_user_password("Some Realm", "c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128") + ('3', 'c') + >>> mgr.find_user_password("Some Realm", "d.example.com") + ('4', 'd') + >>> mgr.find_user_password("Some Realm", "e.example.com:3128") + ('5', 'e') + + """ + pass + + +def test_password_manager_default_port(self): + """ + >>> mgr = urllib2.HTTPPasswordMgr() + >>> add = mgr.add_password + + The point to note here is that we can't guess the default port if there's + no scheme. This applies to both add_password and find_user_password. + + >>> add("f", "http://g.example.com:80", "10", "j") + >>> add("g", "http://h.example.com", "11", "k") + >>> add("h", "i.example.com:80", "12", "l") + >>> add("i", "j.example.com", "13", "m") + >>> mgr.find_user_password("f", "g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "g.example.com") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:100") + (None, None) + >>> mgr.find_user_password("f", "http://g.example.com:80") + ('10', 'j') + >>> mgr.find_user_password("f", "http://g.example.com") + ('10', 'j') + >>> mgr.find_user_password("g", "h.example.com") + ('11', 'k') + >>> mgr.find_user_password("g", "h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("g", "http://h.example.com:80") + ('11', 'k') + >>> mgr.find_user_password("h", "i.example.com") + (None, None) + >>> mgr.find_user_password("h", "i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("h", "http://i.example.com:80") + ('12', 'l') + >>> mgr.find_user_password("i", "j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "j.example.com:80") + (None, None) + >>> mgr.find_user_password("i", "http://j.example.com") + ('13', 'm') + >>> mgr.find_user_password("i", "http://j.example.com:80") + (None, None) + + """ + +class MockOpener: + addheaders = [] + def open(self, req, data=None,timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.req, self.data, self.timeout = req, data, timeout + def error(self, proto, *args): + self.proto, self.args = proto, args + +class MockFile: + def read(self, count=None): pass + def readline(self, count=None): pass + def close(self): pass + +class MockHeaders(dict): + def getheaders(self, name): + return self.values() + +class MockResponse(StringIO.StringIO): + def __init__(self, code, msg, headers, data, url=None): + StringIO.StringIO.__init__(self, data) + self.code, self.msg, self.headers, self.url = code, msg, headers, url + def info(self): + return self.headers + def geturl(self): + return self.url + +class MockCookieJar: + def add_cookie_header(self, request): + self.ach_req = request + def extract_cookies(self, response, request): + self.ec_req, self.ec_r = request, response + +class FakeMethod: + def __init__(self, meth_name, action, handle): + self.meth_name = meth_name + self.handle = handle + self.action = action + def __call__(self, *args): + return self.handle(self.meth_name, self.action, *args) + +class MockHTTPResponse: + def __init__(self, fp, msg, status, reason): + self.fp = fp + self.msg = msg + self.status = status + self.reason = reason + def read(self): + return '' + +class MockHTTPClass: + def __init__(self): + self.req_headers = [] + self.data = None + self.raise_on_endheaders = False + self._tunnel_headers = {} + + def __call__(self, host, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.host = host + self.timeout = timeout + return self + + def set_debuglevel(self, level): + self.level = level + + def set_tunnel(self, host, port=None, headers=None): + self._tunnel_host = host + self._tunnel_port = port + if headers: + self._tunnel_headers = headers + else: + self._tunnel_headers.clear() + + def request(self, method, url, body=None, headers=None): + self.method = method + self.selector = url + if headers is not None: + self.req_headers += headers.items() + self.req_headers.sort() + if body: + self.data = body + if self.raise_on_endheaders: + import socket + raise socket.error() + + def getresponse(self): + return MockHTTPResponse(MockFile(), {}, 200, "OK") + + def close(self): + pass + +class MockHandler: + # useful for testing handler machinery + # see add_ordered_mock_handlers() docstring + handler_order = 500 + def __init__(self, methods): + self._define_methods(methods) + def _define_methods(self, methods): + for spec in methods: + if len(spec) == 2: name, action = spec + else: name, action = spec, None + meth = FakeMethod(name, action, self.handle) + setattr(self.__class__, name, meth) + def handle(self, fn_name, action, *args, **kwds): + self.parent.calls.append((self, fn_name, args, kwds)) + if action is None: + return None + elif action == "return self": + return self + elif action == "return response": + res = MockResponse(200, "OK", {}, "") + return res + elif action == "return request": + return Request("http://blah/") + elif action.startswith("error"): + code = action[action.rfind(" ")+1:] + try: + code = int(code) + except ValueError: + pass + res = MockResponse(200, "OK", {}, "") + return self.parent.error("http", args[0], res, code, "", {}) + elif action == "raise": + raise urllib2.URLError("blah") + assert False + def close(self): pass + def add_parent(self, parent): + self.parent = parent + self.parent.calls = [] + def __lt__(self, other): + if not hasattr(other, "handler_order"): + # No handler_order, leave in original order. Yuck. + return True + return self.handler_order < other.handler_order + +def add_ordered_mock_handlers(opener, meth_spec): + """Create MockHandlers and add them to an OpenerDirector. + + meth_spec: list of lists of tuples and strings defining methods to define + on handlers. eg: + + [["http_error", "ftp_open"], ["http_open"]] + + defines methods .http_error() and .ftp_open() on one handler, and + .http_open() on another. These methods just record their arguments and + return None. Using a tuple instead of a string causes the method to + perform some action (see MockHandler.handle()), eg: + + [["http_error"], [("http_open", "return request")]] + + defines .http_error() on one handler (which simply returns None), and + .http_open() on another handler, which returns a Request object. + + """ + handlers = [] + count = 0 + for meths in meth_spec: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order += count + h.add_parent(opener) + count = count + 1 + handlers.append(h) + opener.add_handler(h) + return handlers + +def build_test_opener(*handler_instances): + opener = OpenerDirector() + for h in handler_instances: + opener.add_handler(h) + return opener + +class MockHTTPHandler(urllib2.BaseHandler): + # useful for testing redirections and auth + # sends supplied headers and code as first response + # sends 200 OK as second response + def __init__(self, code, headers): + self.code = code + self.headers = headers + self.reset() + def reset(self): + self._count = 0 + self.requests = [] + def http_open(self, req): + import mimetools, httplib, copy + from StringIO import StringIO + self.requests.append(copy.deepcopy(req)) + if self._count == 0: + self._count = self._count + 1 + name = httplib.responses[self.code] + msg = mimetools.Message(StringIO(self.headers)) + return self.parent.error( + "http", req, MockFile(), self.code, name, msg) + else: + self.req = req + msg = mimetools.Message(StringIO("\r\n\r\n")) + return MockResponse(200, "OK", msg, "", req.get_full_url()) + +class MockHTTPSHandler(urllib2.AbstractHTTPHandler): + # Useful for testing the Proxy-Authorization request by verifying the + # properties of httpcon + + def __init__(self): + urllib2.AbstractHTTPHandler.__init__(self) + self.httpconn = MockHTTPClass() + + def https_open(self, req): + return self.do_open(self.httpconn, req) + +class MockPasswordManager: + def add_password(self, realm, uri, user, password): + self.realm = realm + self.url = uri + self.user = user + self.password = password + def find_user_password(self, realm, authuri): + self.target_realm = realm + self.target_url = authuri + return self.user, self.password + + +class OpenerDirectorTests(unittest.TestCase): + + def test_add_non_handler(self): + class NonHandler(object): + pass + self.assertRaises(TypeError, + OpenerDirector().add_handler, NonHandler()) + + def test_badly_named_methods(self): + # test work-around for three methods that accidentally follow the + # naming conventions for handler methods + # (*_open() / *_request() / *_response()) + + # These used to call the accidentally-named methods, causing a + # TypeError in real code; here, returning self from these mock + # methods would either cause no exception, or AttributeError. + + from urllib2 import URLError + + o = OpenerDirector() + meth_spec = [ + [("do_open", "return self"), ("proxy_open", "return self")], + [("redirect_request", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + o.add_handler(urllib2.UnknownHandler()) + for scheme in "do", "proxy", "redirect": + self.assertRaises(URLError, o.open, scheme+"://example.com/") + + def test_handled(self): + # handler returning non-None means no more handlers will be called + o = OpenerDirector() + meth_spec = [ + ["http_open", "ftp_open", "http_error_302"], + ["ftp_open"], + [("http_open", "return self")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # Second .http_open() gets called, third doesn't, since second returned + # non-None. Handlers without .http_open() never get any methods called + # on them. + # In fact, second mock handler defining .http_open() returns self + # (instead of response), which becomes the OpenerDirector's return + # value. + self.assertEqual(r, handlers[2]) + calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] + for expected, got in zip(calls, o.calls): + handler, name, args, kwds = got + self.assertEqual((handler, name), expected) + self.assertEqual(args, (req,)) + + def test_handler_order(self): + o = OpenerDirector() + handlers = [] + for meths, handler_order in [ + ([("http_open", "return self")], 500), + (["http_open"], 0), + ]: + class MockHandlerSubclass(MockHandler): pass + h = MockHandlerSubclass(meths) + h.handler_order = handler_order + handlers.append(h) + o.add_handler(h) + + r = o.open("http://example.com/") + # handlers called in reverse order, thanks to their sort order + self.assertEqual(o.calls[0][0], handlers[1]) + self.assertEqual(o.calls[1][0], handlers[0]) + + def test_raise(self): + # raising URLError stops processing of request + o = OpenerDirector() + meth_spec = [ + [("http_open", "raise")], + [("http_open", "return self")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + self.assertRaises(urllib2.URLError, o.open, req) + self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) + +## def test_error(self): +## # XXX this doesn't actually seem to be used in standard library, +## # but should really be tested anyway... + + def test_http_error(self): + # XXX http_error_default + # http errors are a special case + o = OpenerDirector() + meth_spec = [ + [("http_open", "error 302")], + [("http_error_400", "raise"), "http_open"], + [("http_error_302", "return response"), "http_error_303", + "http_error"], + [("http_error_302")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + class Unknown: + def __eq__(self, other): return True + + req = Request("http://example.com/") + r = o.open(req) + assert len(o.calls) == 2 + calls = [(handlers[0], "http_open", (req,)), + (handlers[2], "http_error_302", + (req, Unknown(), 302, "", {}))] + for expected, got in zip(calls, o.calls): + handler, method_name, args = expected + self.assertEqual((handler, method_name), got[:2]) + self.assertEqual(args, got[2]) + + def test_processors(self): + # *_request / *_response methods get called appropriately + o = OpenerDirector() + meth_spec = [ + [("http_request", "return request"), + ("http_response", "return response")], + [("http_request", "return request"), + ("http_response", "return response")], + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://example.com/") + r = o.open(req) + # processor methods are called on *all* handlers that define them, + # not just the first handler that handles the request + calls = [ + (handlers[0], "http_request"), (handlers[1], "http_request"), + (handlers[0], "http_response"), (handlers[1], "http_response")] + + for i, (handler, name, args, kwds) in enumerate(o.calls): + if i < 2: + # *_request + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 1) + self.assertIsInstance(args[0], Request) + else: + # *_response + self.assertEqual((handler, name), calls[i]) + self.assertEqual(len(args), 2) + self.assertIsInstance(args[0], Request) + # response from opener.open is None, because there's no + # handler that defines http_open to handle it + self.assertTrue(args[1] is None or + isinstance(args[1], MockResponse)) + + +def sanepathname2url(path): + import urllib + urlpath = urllib.pathname2url(path) + if os.name == "nt" and urlpath.startswith("///"): + urlpath = urlpath[2:] + # XXX don't ask me about the mac... + return urlpath + +class HandlerTests(unittest.TestCase): + + def test_ftp(self): + class MockFTPWrapper: + def __init__(self, data): self.data = data + def retrfile(self, filename, filetype): + self.filename, self.filetype = filename, filetype + return StringIO.StringIO(self.data), len(self.data) + def close(self): pass + + class NullFTPHandler(urllib2.FTPHandler): + def __init__(self, data): self.data = data + def connect_ftp(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + self.user, self.passwd = user, passwd + self.host, self.port = host, port + self.dirs = dirs + self.ftpwrapper = MockFTPWrapper(self.data) + return self.ftpwrapper + + import ftplib + data = "rheum rhaponicum" + h = NullFTPHandler(data) + o = h.parent = MockOpener() + + for url, host, port, user, passwd, type_, dirs, filename, mimetype in [ + ("ftp://localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "", "", "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://parrot@localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "parrot", "", "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://%25parrot@localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "%parrot", "", "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://%2542parrot@localhost/foo/bar/baz.html", + "localhost", ftplib.FTP_PORT, "%42parrot", "", "I", + ["foo", "bar"], "baz.html", "text/html"), + ("ftp://localhost:80/foo/bar/", + "localhost", 80, "", "", "D", + ["foo", "bar"], "", None), + ("ftp://localhost/baz.gif;type=a", + "localhost", ftplib.FTP_PORT, "", "", "A", + [], "baz.gif", None), # XXX really this should guess image/gif + ]: + req = Request(url) + req.timeout = None + r = h.ftp_open(req) + # ftp authentication not yet implemented by FTPHandler + self.assertEqual(h.user, user) + self.assertEqual(h.passwd, passwd) + self.assertEqual(h.host, socket.gethostbyname(host)) + self.assertEqual(h.port, port) + self.assertEqual(h.dirs, dirs) + self.assertEqual(h.ftpwrapper.filename, filename) + self.assertEqual(h.ftpwrapper.filetype, type_) + headers = r.info() + self.assertEqual(headers.get("Content-type"), mimetype) + self.assertEqual(int(headers["Content-length"]), len(data)) + + def test_file(self): + import rfc822, socket + h = urllib2.FileHandler() + o = h.parent = MockOpener() + + TESTFN = test_support.TESTFN + urlpath = sanepathname2url(os.path.abspath(TESTFN)) + towrite = "hello, world\n" + urls = [ + "file://localhost%s" % urlpath, + "file://%s" % urlpath, + "file://%s%s" % (socket.gethostbyname('localhost'), urlpath), + ] + try: + localaddr = socket.gethostbyname(socket.gethostname()) + except socket.gaierror: + localaddr = '' + if localaddr: + urls.append("file://%s%s" % (localaddr, urlpath)) + + for url in urls: + f = open(TESTFN, "wb") + try: + try: + f.write(towrite) + finally: + f.close() + + r = h.file_open(Request(url)) + try: + data = r.read() + headers = r.info() + respurl = r.geturl() + finally: + r.close() + stats = os.stat(TESTFN) + modified = rfc822.formatdate(stats.st_mtime) + finally: + os.remove(TESTFN) + self.assertEqual(data, towrite) + self.assertEqual(headers["Content-type"], "text/plain") + self.assertEqual(headers["Content-length"], "13") + self.assertEqual(headers["Last-modified"], modified) + self.assertEqual(respurl, url) + + for url in [ + "file://localhost:80%s" % urlpath, + "file:///file_does_not_exist.txt", + "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), + os.getcwd(), TESTFN), + "file://somerandomhost.ontheinternet.com%s/%s" % + (os.getcwd(), TESTFN), + ]: + try: + f = open(TESTFN, "wb") + try: + f.write(towrite) + finally: + f.close() + + self.assertRaises(urllib2.URLError, + h.file_open, Request(url)) + finally: + os.remove(TESTFN) + + h = urllib2.FileHandler() + o = h.parent = MockOpener() + # XXXX why does // mean ftp (and /// mean not ftp!), and where + # is file: scheme specified? I think this is really a bug, and + # what was intended was to distinguish between URLs like: + # file:/blah.txt (a file) + # file://localhost/blah.txt (a file) + # file:///blah.txt (a file) + # file://ftp.example.com/blah.txt (an ftp URL) + for url, ftp in [ + ("file://ftp.example.com//foo.txt", True), + ("file://ftp.example.com///foo.txt", False), +# XXXX bug: fails with OSError, should be URLError + ("file://ftp.example.com/foo.txt", False), + ("file://somehost//foo/something.txt", True), + ("file://localhost//foo/something.txt", False), + ]: + req = Request(url) + try: + h.file_open(req) + # XXXX remove OSError when bug fixed + except (urllib2.URLError, OSError): + self.assertTrue(not ftp) + else: + self.assertTrue(o.req is req) + self.assertEqual(req.type, "ftp") + self.assertEqual(req.type == "ftp", ftp) + + def test_http(self): + + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + url = "http://example.com/" + for method, data in [("GET", None), ("POST", "blah")]: + req = Request(url, data, {"Foo": "bar"}) + req.timeout = None + req.add_unredirected_header("Spam", "eggs") + http = MockHTTPClass() + r = h.do_open(http, req) + + # result attributes + r.read; r.readline # wrapped MockFile methods + r.info; r.geturl # addinfourl methods + r.code, r.msg == 200, "OK" # added from MockHTTPClass.getreply() + hdrs = r.info() + hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() + self.assertEqual(r.geturl(), url) + + self.assertEqual(http.host, "example.com") + self.assertEqual(http.level, 0) + self.assertEqual(http.method, method) + self.assertEqual(http.selector, "/") + self.assertEqual(http.req_headers, + [("Connection", "close"), + ("Foo", "bar"), ("Spam", "eggs")]) + self.assertEqual(http.data, data) + + # check socket.error converted to URLError + http.raise_on_endheaders = True + self.assertRaises(urllib2.URLError, h.do_open, http, req) + + # check adding of standard headers + o.addheaders = [("Spam", "eggs")] + for data in "", None: # POST, GET + req = Request("http://example.com/", data) + r = MockResponse(200, "OK", {}, "") + newreq = h.do_request_(req) + if data is None: # GET + self.assertNotIn("Content-length", req.unredirected_hdrs) + self.assertNotIn("Content-type", req.unredirected_hdrs) + else: # POST + self.assertEqual(req.unredirected_hdrs["Content-length"], "0") + self.assertEqual(req.unredirected_hdrs["Content-type"], + "application/x-www-form-urlencoded") + # XXX the details of Host could be better tested + self.assertEqual(req.unredirected_hdrs["Host"], "example.com") + self.assertEqual(req.unredirected_hdrs["Spam"], "eggs") + + # don't clobber existing headers + req.add_unredirected_header("Content-length", "foo") + req.add_unredirected_header("Content-type", "bar") + req.add_unredirected_header("Host", "baz") + req.add_unredirected_header("Spam", "foo") + newreq = h.do_request_(req) + self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") + self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") + self.assertEqual(req.unredirected_hdrs["Host"], "baz") + self.assertEqual(req.unredirected_hdrs["Spam"], "foo") + + def test_http_doubleslash(self): + # Checks that the presence of an unnecessary double slash in a url doesn't break anything + # Previously, a double slash directly after the host could cause incorrect parsing of the url + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + data = "" + ds_urls = [ + "http://example.com/foo/bar/baz.html", + "http://example.com//foo/bar/baz.html", + "http://example.com/foo//bar/baz.html", + "http://example.com/foo/bar//baz.html", + ] + + for ds_url in ds_urls: + ds_req = Request(ds_url, data) + + # Check whether host is determined correctly if there is no proxy + np_ds_req = h.do_request_(ds_req) + self.assertEqual(np_ds_req.unredirected_hdrs["Host"],"example.com") + + # Check whether host is determined correctly if there is a proxy + ds_req.set_proxy("someproxy:3128",None) + p_ds_req = h.do_request_(ds_req) + self.assertEqual(p_ds_req.unredirected_hdrs["Host"],"example.com") + + def test_fixpath_in_weirdurls(self): + # Issue4493: urllib2 to supply '/' when to urls where path does not + # start with'/' + + h = urllib2.AbstractHTTPHandler() + o = h.parent = MockOpener() + + weird_url = 'http://www.python.org?getspam' + req = Request(weird_url) + newreq = h.do_request_(req) + self.assertEqual(newreq.get_host(),'www.python.org') + self.assertEqual(newreq.get_selector(),'/?getspam') + + url_without_path = 'http://www.python.org' + req = Request(url_without_path) + newreq = h.do_request_(req) + self.assertEqual(newreq.get_host(),'www.python.org') + self.assertEqual(newreq.get_selector(),'') + + def test_errors(self): + h = urllib2.HTTPErrorProcessor() + o = h.parent = MockOpener() + + url = "http://example.com/" + req = Request(url) + # all 2xx are passed through + r = MockResponse(200, "OK", {}, "", url) + newr = h.http_response(req, r) + self.assertTrue(r is newr) + self.assertTrue(not hasattr(o, "proto")) # o.error not called + r = MockResponse(202, "Accepted", {}, "", url) + newr = h.http_response(req, r) + self.assertTrue(r is newr) + self.assertTrue(not hasattr(o, "proto")) # o.error not called + r = MockResponse(206, "Partial content", {}, "", url) + newr = h.http_response(req, r) + self.assertTrue(r is newr) + self.assertTrue(not hasattr(o, "proto")) # o.error not called + # anything else calls o.error (and MockOpener returns None, here) + r = MockResponse(502, "Bad gateway", {}, "", url) + self.assertTrue(h.http_response(req, r) is None) + self.assertEqual(o.proto, "http") # o.error called + self.assertEqual(o.args, (req, r, 502, "Bad gateway", {})) + + def test_cookies(self): + cj = MockCookieJar() + h = urllib2.HTTPCookieProcessor(cj) + o = h.parent = MockOpener() + + req = Request("http://example.com/") + r = MockResponse(200, "OK", {}, "") + newreq = h.http_request(req) + self.assertTrue(cj.ach_req is req is newreq) + self.assertEqual(req.get_origin_req_host(), "example.com") + self.assertTrue(not req.is_unverifiable()) + newr = h.http_response(req, r) + self.assertTrue(cj.ec_req is req) + self.assertTrue(cj.ec_r is r is newr) + + def test_redirect(self): + from_url = "http://example.com/a.html" + to_url = "http://example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + + # ordinary redirect behaviour + for code in 301, 302, 303, 307: + for data in None, "blah\nblah\n": + method = getattr(h, "http_error_%s" % code) + req = Request(from_url, data) + req.add_header("Nonsense", "viking=withhold") + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + if data is not None: + req.add_header("Content-Length", str(len(data))) + req.add_unredirected_header("Spam", "spam") + try: + method(req, MockFile(), code, "Blah", + MockHeaders({"location": to_url})) + except urllib2.HTTPError: + # 307 in response to POST requires user OK + self.assertTrue(code == 307 and data is not None) + self.assertEqual(o.req.get_full_url(), to_url) + try: + self.assertEqual(o.req.get_method(), "GET") + except AttributeError: + self.assertTrue(not o.req.has_data()) + + # now it's a GET, there should not be headers regarding content + # (possibly dragged from before being a POST) + headers = [x.lower() for x in o.req.headers] + self.assertNotIn("content-length", headers) + self.assertNotIn("content-type", headers) + + self.assertEqual(o.req.headers["Nonsense"], + "viking=withhold") + self.assertNotIn("Spam", o.req.headers) + self.assertNotIn("Spam", o.req.unredirected_hdrs) + + # loop detection + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + def redirect(h, req, url=to_url): + h.http_error_302(req, MockFile(), 302, "Blah", + MockHeaders({"location": url})) + # Note that the *original* request shares the same record of + # redirections with the sub-requests caused by the redirections. + + # detect infinite loop redirect of a URL to itself + req = Request(from_url, origin_req_host="example.com") + count = 0 + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + try: + while 1: + redirect(h, req, "http://example.com/") + count = count + 1 + except urllib2.HTTPError: + # don't stop until max_repeats, because cookies may introduce state + self.assertEqual(count, urllib2.HTTPRedirectHandler.max_repeats) + + # detect endless non-repeating chain of redirects + req = Request(from_url, origin_req_host="example.com") + count = 0 + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + try: + while 1: + redirect(h, req, "http://example.com/%d" % count) + count = count + 1 + except urllib2.HTTPError: + self.assertEqual(count, + urllib2.HTTPRedirectHandler.max_redirections) + + def test_invalid_redirect(self): + from_url = "http://example.com/a.html" + valid_schemes = ['http', 'https', 'ftp'] + invalid_schemes = ['file', 'imap', 'ldap'] + schemeless_url = "example.com/b.html" + h = urllib2.HTTPRedirectHandler() + o = h.parent = MockOpener() + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + + for scheme in invalid_schemes: + invalid_url = scheme + '://' + schemeless_url + self.assertRaises(urllib2.HTTPError, h.http_error_302, + req, MockFile(), 302, "Security Loophole", + MockHeaders({"location": invalid_url})) + + for scheme in valid_schemes: + valid_url = scheme + '://' + schemeless_url + h.http_error_302(req, MockFile(), 302, "That's fine", + MockHeaders({"location": valid_url})) + self.assertEqual(o.req.get_full_url(), valid_url) + + def test_cookie_redirect(self): + # cookies shouldn't leak into redirected requests + from cookielib import CookieJar + + from test_cookielib import interact_netscape + + cj = CookieJar() + interact_netscape(cj, "http://www.example.com/", "spam=eggs") + hh = MockHTTPHandler(302, "Location: http://www.cracker.com/\r\n\r\n") + hdeh = urllib2.HTTPDefaultErrorHandler() + hrh = urllib2.HTTPRedirectHandler() + cp = urllib2.HTTPCookieProcessor(cj) + o = build_test_opener(hh, hdeh, hrh, cp) + o.open("http://www.example.com/") + self.assertTrue(not hh.req.has_header("Cookie")) + + def test_redirect_fragment(self): + redirected_url = 'http://www.example.com/index.html#OK\r\n\r\n' + hh = MockHTTPHandler(302, 'Location: ' + redirected_url) + hdeh = urllib2.HTTPDefaultErrorHandler() + hrh = urllib2.HTTPRedirectHandler() + o = build_test_opener(hh, hdeh, hrh) + fp = o.open('http://www.example.com') + self.assertEqual(fp.geturl(), redirected_url.strip()) + + def test_proxy(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + o.add_handler(ph) + meth_spec = [ + [("http_open", "return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("http://acme.example.com/") + self.assertEqual(req.get_host(), "acme.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + + self.assertEqual([(handlers[0], "http_open")], + [tup[0:2] for tup in o.calls]) + + def test_proxy_no_proxy(self): + os.environ['no_proxy'] = 'python.org' + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com")) + o.add_handler(ph) + req = Request("http://www.perl.org/") + self.assertEqual(req.get_host(), "www.perl.org") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com") + req = Request("http://www.python.org") + self.assertEqual(req.get_host(), "www.python.org") + r = o.open(req) + self.assertEqual(req.get_host(), "www.python.org") + del os.environ['no_proxy'] + + + def test_proxy_https(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(https='proxy.example.com:3128')) + o.add_handler(ph) + meth_spec = [ + [("https_open","return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + req = Request("https://www.example.com/") + self.assertEqual(req.get_host(), "www.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + self.assertEqual([(handlers[0], "https_open")], + [tup[0:2] for tup in o.calls]) + + def test_proxy_https_proxy_authorization(self): + o = OpenerDirector() + ph = urllib2.ProxyHandler(dict(https='proxy.example.com:3128')) + o.add_handler(ph) + https_handler = MockHTTPSHandler() + o.add_handler(https_handler) + req = Request("https://www.example.com/") + req.add_header("Proxy-Authorization","FooBar") + req.add_header("User-Agent","Grail") + self.assertEqual(req.get_host(), "www.example.com") + self.assertIsNone(req._tunnel_host) + r = o.open(req) + # Verify Proxy-Authorization gets tunneled to request. + # httpsconn req_headers do not have the Proxy-Authorization header but + # the req will have. + self.assertNotIn(("Proxy-Authorization","FooBar"), + https_handler.httpconn.req_headers) + self.assertIn(("User-Agent","Grail"), + https_handler.httpconn.req_headers) + self.assertIsNotNone(req._tunnel_host) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + self.assertEqual(req.get_header("Proxy-authorization"),"FooBar") + + def test_basic_auth(self, quote_char='"'): + opener = OpenerDirector() + password_manager = MockPasswordManager() + auth_handler = urllib2.HTTPBasicAuthHandler(password_manager) + realm = "ACME Widget Store" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm=%s%s%s\r\n\r\n' % + (quote_char, realm, quote_char) ) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + + def test_basic_auth_with_single_quoted_realm(self): + self.test_basic_auth(quote_char="'") + + def test_proxy_basic_auth(self): + opener = OpenerDirector() + ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) + opener.add_handler(ph) + password_manager = MockPasswordManager() + auth_handler = urllib2.ProxyBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(auth_handler) + opener.add_handler(http_handler) + self._test_basic_auth(opener, auth_handler, "Proxy-authorization", + realm, http_handler, password_manager, + "http://acme.example.com:3128/protected", + "proxy.example.com:3128", + ) + + def test_basic_and_digest_auth_handlers(self): + # HTTPDigestAuthHandler threw an exception if it couldn't handle a 40* + # response (http://python.org/sf/1479302), where it should instead + # return None to allow another handler (especially + # HTTPBasicAuthHandler) to handle the response. + + # Also (http://python.org/sf/14797027, RFC 2617 section 1.2), we must + # try digest first (since it's the strongest auth scheme), so we record + # order of calls here to check digest comes first: + class RecordingOpenerDirector(OpenerDirector): + def __init__(self): + OpenerDirector.__init__(self) + self.recorded = [] + def record(self, info): + self.recorded.append(info) + class TestDigestAuthHandler(urllib2.HTTPDigestAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("digest") + urllib2.HTTPDigestAuthHandler.http_error_401(self, + *args, **kwds) + class TestBasicAuthHandler(urllib2.HTTPBasicAuthHandler): + def http_error_401(self, *args, **kwds): + self.parent.record("basic") + urllib2.HTTPBasicAuthHandler.http_error_401(self, + *args, **kwds) + + opener = RecordingOpenerDirector() + password_manager = MockPasswordManager() + digest_handler = TestDigestAuthHandler(password_manager) + basic_handler = TestBasicAuthHandler(password_manager) + realm = "ACME Networks" + http_handler = MockHTTPHandler( + 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) + opener.add_handler(basic_handler) + opener.add_handler(digest_handler) + opener.add_handler(http_handler) + + # check basic auth isn't blocked by digest handler failing + self._test_basic_auth(opener, basic_handler, "Authorization", + realm, http_handler, password_manager, + "http://acme.example.com/protected", + "http://acme.example.com/protected", + ) + # check digest was tried before basic (twice, because + # _test_basic_auth called .open() twice) + self.assertEqual(opener.recorded, ["digest", "basic"]*2) + + def _test_basic_auth(self, opener, auth_handler, auth_header, + realm, http_handler, password_manager, + request_url, protected_url): + import base64 + user, password = "wile", "coyote" + + # .add_password() fed through to password manager + auth_handler.add_password(realm, request_url, user, password) + self.assertEqual(realm, password_manager.realm) + self.assertEqual(request_url, password_manager.url) + self.assertEqual(user, password_manager.user) + self.assertEqual(password, password_manager.password) + + r = opener.open(request_url) + + # should have asked the password manager for the username/password + self.assertEqual(password_manager.target_realm, realm) + self.assertEqual(password_manager.target_url, protected_url) + + # expect one request without authorization, then one with + self.assertEqual(len(http_handler.requests), 2) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + userpass = '%s:%s' % (user, password) + auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip() + self.assertEqual(http_handler.requests[1].get_header(auth_header), + auth_hdr_value) + self.assertEqual(http_handler.requests[1].unredirected_hdrs[auth_header], + auth_hdr_value) + # if the password manager can't find a password, the handler won't + # handle the HTTP auth error + password_manager.user = password_manager.password = None + http_handler.reset() + r = opener.open(request_url) + self.assertEqual(len(http_handler.requests), 1) + self.assertFalse(http_handler.requests[0].has_header(auth_header)) + +class MiscTests(unittest.TestCase): + + def test_build_opener(self): + class MyHTTPHandler(urllib2.HTTPHandler): pass + class FooHandler(urllib2.BaseHandler): + def foo_open(self): pass + class BarHandler(urllib2.BaseHandler): + def bar_open(self): pass + + build_opener = urllib2.build_opener + + o = build_opener(FooHandler, BarHandler) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # can take a mix of classes and instances + o = build_opener(FooHandler, BarHandler()) + self.opener_has_handler(o, FooHandler) + self.opener_has_handler(o, BarHandler) + + # subclasses of default handlers override default handlers + o = build_opener(MyHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + + # a particular case of overriding: default handlers can be passed + # in explicitly + o = build_opener() + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler) + self.opener_has_handler(o, urllib2.HTTPHandler) + o = build_opener(urllib2.HTTPHandler()) + self.opener_has_handler(o, urllib2.HTTPHandler) + + # Issue2670: multiple handlers sharing the same base class + class MyOtherHTTPHandler(urllib2.HTTPHandler): pass + o = build_opener(MyHTTPHandler, MyOtherHTTPHandler) + self.opener_has_handler(o, MyHTTPHandler) + self.opener_has_handler(o, MyOtherHTTPHandler) + + def opener_has_handler(self, opener, handler_class): + for h in opener.handlers: + if h.__class__ == handler_class: + break + else: + self.assertTrue(False) + +class RequestTests(unittest.TestCase): + + def setUp(self): + self.get = urllib2.Request("http://www.python.org/~jeremy/") + self.post = urllib2.Request("http://www.python.org/~jeremy/", + "data", + headers={"X-Test": "test"}) + + def test_method(self): + self.assertEqual("POST", self.post.get_method()) + self.assertEqual("GET", self.get.get_method()) + + def test_add_data(self): + self.assertTrue(not self.get.has_data()) + self.assertEqual("GET", self.get.get_method()) + self.get.add_data("spam") + self.assertTrue(self.get.has_data()) + self.assertEqual("POST", self.get.get_method()) + + def test_get_full_url(self): + self.assertEqual("http://www.python.org/~jeremy/", + self.get.get_full_url()) + + def test_selector(self): + self.assertEqual("/~jeremy/", self.get.get_selector()) + req = urllib2.Request("http://www.python.org/") + self.assertEqual("/", req.get_selector()) + + def test_get_type(self): + self.assertEqual("http", self.get.get_type()) + + def test_get_host(self): + self.assertEqual("www.python.org", self.get.get_host()) + + def test_get_host_unquote(self): + req = urllib2.Request("http://www.%70ython.org/") + self.assertEqual("www.python.org", req.get_host()) + + def test_proxy(self): + self.assertTrue(not self.get.has_proxy()) + self.get.set_proxy("www.perl.org", "http") + self.assertTrue(self.get.has_proxy()) + self.assertEqual("www.python.org", self.get.get_origin_req_host()) + self.assertEqual("www.perl.org", self.get.get_host()) + + def test_wrapped_url(self): + req = Request("") + self.assertEqual("www.python.org", req.get_host()) + + def test_url_fragment(self): + req = Request("http://www.python.org/?qs=query#fragment=true") + self.assertEqual("/?qs=query", req.get_selector()) + req = Request("http://www.python.org/#fun=true") + self.assertEqual("/", req.get_selector()) + + # Issue 11703: geturl() omits fragment in the original URL. + url = 'http://docs.python.org/library/urllib2.html#OK' + req = Request(url) + self.assertEqual(req.get_full_url(), url) + +def test_HTTPError_interface(): + """ + Issue 13211 reveals that HTTPError didn't implement the URLError + interface even though HTTPError is a subclass of URLError. + + >>> err = urllib2.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None) + >>> assert hasattr(err, 'reason') + >>> err.reason + 'something bad happened' + """ + +def test_main(verbose=None): + import test_urllib2 + test_support.run_doctest(test_urllib2, verbose) + test_support.run_doctest(urllib2, verbose) + tests = (TrivialTests, + OpenerDirectorTests, + HandlerTests, + MiscTests, + RequestTests) + test_support.run_unittest(*tests) + +if __name__ == "__main__": + test_main(verbose=True) diff -Nru python-gevent-0.13.7/greentest/2.7/test_urllib.py python-gevent-1.0/greentest/2.7/test_urllib.py --- python-gevent-0.13.7/greentest/2.7/test_urllib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_urllib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,892 @@ +"""Regresssion tests for urllib""" + +import urllib +import httplib +import unittest +import os +import sys +import mimetools +import tempfile +import StringIO + +from test import test_support +from base64 import b64encode + + +def hexescape(char): + """Escape char as RFC 2396 specifies""" + hex_repr = hex(ord(char))[2:].upper() + if len(hex_repr) == 1: + hex_repr = "0%s" % hex_repr + return "%" + hex_repr + + +class FakeHTTPMixin(object): + def fakehttp(self, fakedata): + class FakeSocket(StringIO.StringIO): + + def sendall(self, data): + FakeHTTPConnection.buf = data + + def makefile(self, *args, **kwds): + return self + + def read(self, amt=None): + if self.closed: + return "" + return StringIO.StringIO.read(self, amt) + + def readline(self, length=None): + if self.closed: + return "" + return StringIO.StringIO.readline(self, length) + + class FakeHTTPConnection(httplib.HTTPConnection): + + # buffer to store data for verification in urlopen tests. + buf = "" + + def connect(self): + self.sock = FakeSocket(fakedata) + + assert httplib.HTTP._connection_class == httplib.HTTPConnection + + httplib.HTTP._connection_class = FakeHTTPConnection + + def unfakehttp(self): + httplib.HTTP._connection_class = httplib.HTTPConnection + + +class urlopen_FileTests(unittest.TestCase): + """Test urlopen() opening a temporary file. + + Try to test as much functionality as possible so as to cut down on reliance + on connecting to the Net for testing. + + """ + + def setUp(self): + """Setup of a temp file to use for testing""" + self.text = "test_urllib: %s\n" % self.__class__.__name__ + FILE = file(test_support.TESTFN, 'wb') + try: + FILE.write(self.text) + finally: + FILE.close() + self.pathname = test_support.TESTFN + self.returned_obj = urllib.urlopen("file:%s" % self.pathname) + + def tearDown(self): + """Shut down the open object""" + self.returned_obj.close() + os.remove(test_support.TESTFN) + + def test_interface(self): + # Make sure object returned by urlopen() has the specified methods + for attr in ("read", "readline", "readlines", "fileno", + "close", "info", "geturl", "getcode", "__iter__"): + self.assertTrue(hasattr(self.returned_obj, attr), + "object returned by urlopen() lacks %s attribute" % + attr) + + def test_read(self): + self.assertEqual(self.text, self.returned_obj.read()) + + def test_readline(self): + self.assertEqual(self.text, self.returned_obj.readline()) + self.assertEqual('', self.returned_obj.readline(), + "calling readline() after exhausting the file did not" + " return an empty string") + + def test_readlines(self): + lines_list = self.returned_obj.readlines() + self.assertEqual(len(lines_list), 1, + "readlines() returned the wrong number of lines") + self.assertEqual(lines_list[0], self.text, + "readlines() returned improper text") + + def test_fileno(self): + file_num = self.returned_obj.fileno() + self.assertIsInstance(file_num, int, "fileno() did not return an int") + self.assertEqual(os.read(file_num, len(self.text)), self.text, + "Reading on the file descriptor returned by fileno() " + "did not return the expected text") + + def test_close(self): + # Test close() by calling it hear and then having it be called again + # by the tearDown() method for the test + self.returned_obj.close() + + def test_info(self): + self.assertIsInstance(self.returned_obj.info(), mimetools.Message) + + def test_geturl(self): + self.assertEqual(self.returned_obj.geturl(), self.pathname) + + def test_getcode(self): + self.assertEqual(self.returned_obj.getcode(), None) + + def test_iter(self): + # Test iterator + # Don't need to count number of iterations since test would fail the + # instant it returned anything beyond the first line from the + # comparison + for line in self.returned_obj.__iter__(): + self.assertEqual(line, self.text) + + def test_relativelocalfile(self): + self.assertRaises(ValueError,urllib.urlopen,'./' + self.pathname) + +class ProxyTests(unittest.TestCase): + + def setUp(self): + # Records changes to env vars + self.env = test_support.EnvironmentVarGuard() + # Delete all proxy related env vars + for k in os.environ.keys(): + if 'proxy' in k.lower(): + self.env.unset(k) + + def tearDown(self): + # Restore all proxy related env vars + self.env.__exit__() + del self.env + + def test_getproxies_environment_keep_no_proxies(self): + self.env.set('NO_PROXY', 'localhost') + proxies = urllib.getproxies_environment() + # getproxies_environment use lowered case truncated (no '_proxy') keys + self.assertEqual('localhost', proxies['no']) + # List of no_proxies with space. + self.env.set('NO_PROXY', 'localhost, anotherdomain.com, newdomain.com') + self.assertTrue(urllib.proxy_bypass_environment('anotherdomain.com')) + + +class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin): + """Test urlopen() opening a fake http connection.""" + + def test_read(self): + self.fakehttp('Hello!') + try: + fp = urllib.urlopen("http://python.org/") + self.assertEqual(fp.readline(), 'Hello!') + self.assertEqual(fp.readline(), '') + self.assertEqual(fp.geturl(), 'http://python.org/') + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + def test_url_fragment(self): + # Issue #11703: geturl() omits fragments in the original URL. + url = 'http://docs.python.org/library/urllib.html#OK' + self.fakehttp('Hello!') + try: + fp = urllib.urlopen(url) + self.assertEqual(fp.geturl(), url) + finally: + self.unfakehttp() + + def test_read_bogus(self): + # urlopen() should raise IOError for many error codes. + self.fakehttp('''HTTP/1.1 401 Authentication Required +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Connection: close +Content-Type: text/html; charset=iso-8859-1 +''') + try: + self.assertRaises(IOError, urllib.urlopen, "http://python.org/") + finally: + self.unfakehttp() + + def test_invalid_redirect(self): + # urlopen() should raise IOError for many error codes. + self.fakehttp("""HTTP/1.1 302 Found +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Location: file:README +Connection: close +Content-Type: text/html; charset=iso-8859-1 +""") + try: + self.assertRaises(IOError, urllib.urlopen, "http://python.org/") + finally: + self.unfakehttp() + + def test_empty_socket(self): + # urlopen() raises IOError if the underlying socket does not send any + # data. (#1680230) + self.fakehttp('') + try: + self.assertRaises(IOError, urllib.urlopen, 'http://something') + finally: + self.unfakehttp() + + def test_userpass_inurl(self): + self.fakehttp('Hello!') + try: + fakehttp_wrapper = httplib.HTTP._connection_class + fp = urllib.urlopen("http://user:pass@python.org/") + authorization = ("Authorization: Basic %s\r\n" % + b64encode('user:pass')) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf) + self.assertEqual(fp.readline(), "Hello!") + self.assertEqual(fp.readline(), "") + self.assertEqual(fp.geturl(), 'http://user:pass@python.org/') + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + def test_userpass_with_spaces_inurl(self): + self.fakehttp('Hello!') + try: + url = "http://a b:c d@python.org/" + fakehttp_wrapper = httplib.HTTP._connection_class + authorization = ("Authorization: Basic %s\r\n" % + b64encode('a b:c d')) + fp = urllib.urlopen(url) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf) + self.assertEqual(fp.readline(), "Hello!") + self.assertEqual(fp.readline(), "") + # the spaces are quoted in URL so no match + self.assertNotEqual(fp.geturl(), url) + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + +class urlretrieve_FileTests(unittest.TestCase): + """Test urllib.urlretrieve() on local files""" + + def setUp(self): + # Create a list of temporary files. Each item in the list is a file + # name (absolute path or relative to the current working directory). + # All files in this list will be deleted in the tearDown method. Note, + # this only helps to makes sure temporary files get deleted, but it + # does nothing about trying to close files that may still be open. It + # is the responsibility of the developer to properly close files even + # when exceptional conditions occur. + self.tempFiles = [] + + # Create a temporary file. + self.registerFileForCleanUp(test_support.TESTFN) + self.text = 'testing urllib.urlretrieve' + try: + FILE = file(test_support.TESTFN, 'wb') + FILE.write(self.text) + FILE.close() + finally: + try: FILE.close() + except: pass + + def tearDown(self): + # Delete the temporary files. + for each in self.tempFiles: + try: os.remove(each) + except: pass + + def constructLocalFileUrl(self, filePath): + return "file://%s" % urllib.pathname2url(os.path.abspath(filePath)) + + def createNewTempFile(self, data=""): + """Creates a new temporary file containing the specified data, + registers the file for deletion during the test fixture tear down, and + returns the absolute path of the file.""" + + newFd, newFilePath = tempfile.mkstemp() + try: + self.registerFileForCleanUp(newFilePath) + newFile = os.fdopen(newFd, "wb") + newFile.write(data) + newFile.close() + finally: + try: newFile.close() + except: pass + return newFilePath + + def registerFileForCleanUp(self, fileName): + self.tempFiles.append(fileName) + + def test_basic(self): + # Make sure that a local file just gets its own location returned and + # a headers value is returned. + result = urllib.urlretrieve("file:%s" % test_support.TESTFN) + self.assertEqual(result[0], test_support.TESTFN) + self.assertIsInstance(result[1], mimetools.Message, + "did not get a mimetools.Message instance as " + "second returned value") + + def test_copy(self): + # Test that setting the filename argument works. + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + result = urllib.urlretrieve(self.constructLocalFileUrl( + test_support.TESTFN), second_temp) + self.assertEqual(second_temp, result[0]) + self.assertTrue(os.path.exists(second_temp), "copy of the file was not " + "made") + FILE = file(second_temp, 'rb') + try: + text = FILE.read() + FILE.close() + finally: + try: FILE.close() + except: pass + self.assertEqual(self.text, text) + + def test_reporthook(self): + # Make sure that the reporthook works. + def hooktester(count, block_size, total_size, count_holder=[0]): + self.assertIsInstance(count, int) + self.assertIsInstance(block_size, int) + self.assertIsInstance(total_size, int) + self.assertEqual(count, count_holder[0]) + count_holder[0] = count_holder[0] + 1 + second_temp = "%s.2" % test_support.TESTFN + self.registerFileForCleanUp(second_temp) + urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), + second_temp, hooktester) + + def test_reporthook_0_bytes(self): + # Test on zero length file. Should call reporthook only 1 time. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile() + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 1) + self.assertEqual(report[0][2], 0) + + def test_reporthook_5_bytes(self): + # Test on 5 byte file. Should call reporthook only 2 times (once when + # the "network connection" is established and once when the block is + # read). Since the block size is 8192 bytes, only one block read is + # required to read the entire file. + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 5) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 2) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 5) + + def test_reporthook_8193_bytes(self): + # Test on 8193 byte file. Should call reporthook only 3 times (once + # when the "network connection" is established, once for the next 8192 + # bytes, and once for the last byte). + report = [] + def hooktester(count, block_size, total_size, _report=report): + _report.append((count, block_size, total_size)) + srcFileName = self.createNewTempFile("x" * 8193) + urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), + test_support.TESTFN, hooktester) + self.assertEqual(len(report), 3) + self.assertEqual(report[0][1], 8192) + self.assertEqual(report[0][2], 8193) + + +class urlretrieve_HttpTests(unittest.TestCase, FakeHTTPMixin): + """Test urllib.urlretrieve() using fake http connections""" + + def test_short_content_raises_ContentTooShortError(self): + self.fakehttp('''HTTP/1.1 200 OK +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Connection: close +Content-Length: 100 +Content-Type: text/html; charset=iso-8859-1 + +FF +''') + + def _reporthook(par1, par2, par3): + pass + + try: + self.assertRaises(urllib.ContentTooShortError, urllib.urlretrieve, + 'http://example.com', reporthook=_reporthook) + finally: + self.unfakehttp() + + def test_short_content_raises_ContentTooShortError_without_reporthook(self): + self.fakehttp('''HTTP/1.1 200 OK +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Connection: close +Content-Length: 100 +Content-Type: text/html; charset=iso-8859-1 + +FF +''') + try: + self.assertRaises(urllib.ContentTooShortError, urllib.urlretrieve, 'http://example.com/') + finally: + self.unfakehttp() + +class QuotingTests(unittest.TestCase): + """Tests for urllib.quote() and urllib.quote_plus() + + According to RFC 2396 ("Uniform Resource Identifiers), to escape a + character you write it as '%' + <2 character US-ASCII hex value>. The Python + code of ``'%' + hex(ord())[2:]`` escapes a character properly. + Case does not matter on the hex letters. + + The various character sets specified are: + + Reserved characters : ";/?:@&=+$," + Have special meaning in URIs and must be escaped if not being used for + their special meaning + Data characters : letters, digits, and "-_.!~*'()" + Unreserved and do not need to be escaped; can be, though, if desired + Control characters : 0x00 - 0x1F, 0x7F + Have no use in URIs so must be escaped + space : 0x20 + Must be escaped + Delimiters : '<>#%"' + Must be escaped + Unwise : "{}|\^[]`" + Must be escaped + + """ + + def test_never_quote(self): + # Make sure quote() does not quote letters, digits, and "_,.-" + do_not_quote = '' .join(["ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "abcdefghijklmnopqrstuvwxyz", + "0123456789", + "_.-"]) + result = urllib.quote(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote(): %s != %s" % (do_not_quote, result)) + result = urllib.quote_plus(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote_plus(): %s != %s" % (do_not_quote, result)) + + def test_default_safe(self): + # Test '/' is default value for 'safe' parameter + self.assertEqual(urllib.quote.func_defaults[0], '/') + + def test_safe(self): + # Test setting 'safe' parameter does what it should do + quote_by_default = "<>" + result = urllib.quote(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote(): %s != %s" % (quote_by_default, result)) + result = urllib.quote_plus(quote_by_default, safe=quote_by_default) + self.assertEqual(quote_by_default, result, + "using quote_plus(): %s != %s" % + (quote_by_default, result)) + + def test_default_quoting(self): + # Make sure all characters that should be quoted are by default sans + # space (separate test for that). + should_quote = [chr(num) for num in range(32)] # For 0x00 - 0x1F + should_quote.append('<>#%"{}|\^[]`') + should_quote.append(chr(127)) # For 0x7F + should_quote = ''.join(should_quote) + for char in should_quote: + result = urllib.quote(char) + self.assertEqual(hexescape(char), result, + "using quote(): %s should be escaped to %s, not %s" % + (char, hexescape(char), result)) + result = urllib.quote_plus(char) + self.assertEqual(hexescape(char), result, + "using quote_plus(): " + "%s should be escapes to %s, not %s" % + (char, hexescape(char), result)) + del should_quote + partial_quote = "ab[]cd" + expected = "ab%5B%5Dcd" + result = urllib.quote(partial_quote) + self.assertEqual(expected, result, + "using quote(): %s != %s" % (expected, result)) + result = urllib.quote_plus(partial_quote) + self.assertEqual(expected, result, + "using quote_plus(): %s != %s" % (expected, result)) + self.assertRaises(TypeError, urllib.quote, None) + + def test_quoting_space(self): + # Make sure quote() and quote_plus() handle spaces as specified in + # their unique way + result = urllib.quote(' ') + self.assertEqual(result, hexescape(' '), + "using quote(): %s != %s" % (result, hexescape(' '))) + result = urllib.quote_plus(' ') + self.assertEqual(result, '+', + "using quote_plus(): %s != +" % result) + given = "a b cd e f" + expect = given.replace(' ', hexescape(' ')) + result = urllib.quote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + expect = given.replace(' ', '+') + result = urllib.quote_plus(given) + self.assertEqual(expect, result, + "using quote_plus(): %s != %s" % (expect, result)) + + def test_quoting_plus(self): + self.assertEqual(urllib.quote_plus('alpha+beta gamma'), + 'alpha%2Bbeta+gamma') + self.assertEqual(urllib.quote_plus('alpha+beta gamma', '+'), + 'alpha+beta+gamma') + +class UnquotingTests(unittest.TestCase): + """Tests for unquote() and unquote_plus() + + See the doc string for quoting_Tests for details on quoting and such. + + """ + + def test_unquoting(self): + # Make sure unquoting of all ASCII values works + escape_list = [] + for num in range(128): + given = hexescape(chr(num)) + expect = chr(num) + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % + (expect, result)) + escape_list.append(given) + escape_string = ''.join(escape_list) + del escape_list + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using quote(): not all characters escaped; %s" % + result) + result = urllib.unquote(escape_string) + self.assertEqual(result.count('%'), 1, + "using unquote(): not all characters escaped: " + "%s" % result) + + def test_unquoting_badpercent(self): + # Test unquoting on bad percent-escapes + given = '%xab' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + given = '%x' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + given = '%' + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + + def test_unquoting_mixed_case(self): + # Test unquoting on mixed-case hex digits in the percent-escapes + given = '%Ab%eA' + expect = '\xab\xea' + result = urllib.unquote(given) + self.assertEqual(expect, result, "using unquote(): %r != %r" + % (expect, result)) + + def test_unquoting_parts(self): + # Make sure unquoting works when have non-quoted characters + # interspersed + given = 'ab%sd' % hexescape('c') + expect = "abcd" + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using quote(): %s != %s" % (expect, result)) + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquoting_plus(self): + # Test difference between unquote() and unquote_plus() + given = "are+there+spaces..." + expect = given + result = urllib.unquote(given) + self.assertEqual(expect, result, + "using unquote(): %s != %s" % (expect, result)) + expect = given.replace('+', ' ') + result = urllib.unquote_plus(given) + self.assertEqual(expect, result, + "using unquote_plus(): %s != %s" % (expect, result)) + + def test_unquote_with_unicode(self): + r = urllib.unquote(u'br%C3%BCckner_sapporo_20050930.doc') + self.assertEqual(r, u'br\xc3\xbcckner_sapporo_20050930.doc') + +class urlencode_Tests(unittest.TestCase): + """Tests for urlencode()""" + + def help_inputtype(self, given, test_type): + """Helper method for testing different input types. + + 'given' must lead to only the pairs: + * 1st, 1 + * 2nd, 2 + * 3rd, 3 + + Test cannot assume anything about order. Docs make no guarantee and + have possible dictionary input. + + """ + expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] + result = urllib.urlencode(given) + for expected in expect_somewhere: + self.assertIn(expected, result, + "testing %s: %s not found in %s" % + (test_type, expected, result)) + self.assertEqual(result.count('&'), 2, + "testing %s: expected 2 '&'s; got %s" % + (test_type, result.count('&'))) + amp_location = result.index('&') + on_amp_left = result[amp_location - 1] + on_amp_right = result[amp_location + 1] + self.assertTrue(on_amp_left.isdigit() and on_amp_right.isdigit(), + "testing %s: '&' not located in proper place in %s" % + (test_type, result)) + self.assertEqual(len(result), (5 * 3) + 2, #5 chars per thing and amps + "testing %s: " + "unexpected number of characters: %s != %s" % + (test_type, len(result), (5 * 3) + 2)) + + def test_using_mapping(self): + # Test passing in a mapping object as an argument. + self.help_inputtype({"1st":'1', "2nd":'2', "3rd":'3'}, + "using dict as input type") + + def test_using_sequence(self): + # Test passing in a sequence of two-item sequences as an argument. + self.help_inputtype([('1st', '1'), ('2nd', '2'), ('3rd', '3')], + "using sequence of two-item tuples as input") + + def test_quoting(self): + # Make sure keys and values are quoted using quote_plus() + given = {"&":"="} + expect = "%s=%s" % (hexescape('&'), hexescape('=')) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + given = {"key name":"A bunch of pluses"} + expect = "key+name=A+bunch+of+pluses" + result = urllib.urlencode(given) + self.assertEqual(expect, result) + + def test_doseq(self): + # Test that passing True for 'doseq' parameter works correctly + given = {'sequence':['1', '2', '3']} + expect = "sequence=%s" % urllib.quote_plus(str(['1', '2', '3'])) + result = urllib.urlencode(given) + self.assertEqual(expect, result) + result = urllib.urlencode(given, True) + for value in given["sequence"]: + expect = "sequence=%s" % value + self.assertIn(expect, result) + self.assertEqual(result.count('&'), 2, + "Expected 2 '&'s, got %s" % result.count('&')) + +class Pathname_Tests(unittest.TestCase): + """Test pathname2url() and url2pathname()""" + + def test_basic(self): + # Make sure simple tests pass + expected_path = os.path.join("parts", "of", "a", "path") + expected_url = "parts/of/a/path" + result = urllib.pathname2url(expected_path) + self.assertEqual(expected_url, result, + "pathname2url() failed; %s != %s" % + (result, expected_url)) + result = urllib.url2pathname(expected_url) + self.assertEqual(expected_path, result, + "url2pathame() failed; %s != %s" % + (result, expected_path)) + + def test_quoting(self): + # Test automatic quoting and unquoting works for pathnam2url() and + # url2pathname() respectively + given = os.path.join("needs", "quot=ing", "here") + expect = "needs/%s/here" % urllib.quote("quot=ing") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + expect = given + result = urllib.url2pathname(result) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + given = os.path.join("make sure", "using_quote") + expect = "%s/using_quote" % urllib.quote("make sure") + result = urllib.pathname2url(given) + self.assertEqual(expect, result, + "pathname2url() failed; %s != %s" % + (expect, result)) + given = "make+sure/using_unquote" + expect = os.path.join("make+sure", "using_unquote") + result = urllib.url2pathname(given) + self.assertEqual(expect, result, + "url2pathname() failed; %s != %s" % + (expect, result)) + + @unittest.skipUnless(sys.platform == 'win32', + 'test specific to the nturl2path library') + def test_ntpath(self): + given = ('/C:/', '///C:/', '/C|//') + expect = 'C:\\' + for url in given: + result = urllib.url2pathname(url) + self.assertEqual(expect, result, + 'nturl2path.url2pathname() failed; %s != %s' % + (expect, result)) + given = '///C|/path' + expect = 'C:\\path' + result = urllib.url2pathname(given) + self.assertEqual(expect, result, + 'nturl2path.url2pathname() failed; %s != %s' % + (expect, result)) + +class Utility_Tests(unittest.TestCase): + """Testcase to test the various utility functions in the urllib.""" + + def test_splitpasswd(self): + """Some of the password examples are not sensible, but it is added to + confirming to RFC2617 and addressing issue4675. + """ + self.assertEqual(('user', 'ab'),urllib.splitpasswd('user:ab')) + self.assertEqual(('user', 'a\nb'),urllib.splitpasswd('user:a\nb')) + self.assertEqual(('user', 'a\tb'),urllib.splitpasswd('user:a\tb')) + self.assertEqual(('user', 'a\rb'),urllib.splitpasswd('user:a\rb')) + self.assertEqual(('user', 'a\fb'),urllib.splitpasswd('user:a\fb')) + self.assertEqual(('user', 'a\vb'),urllib.splitpasswd('user:a\vb')) + self.assertEqual(('user', 'a:b'),urllib.splitpasswd('user:a:b')) + self.assertEqual(('user', 'a b'),urllib.splitpasswd('user:a b')) + self.assertEqual(('user 2', 'ab'),urllib.splitpasswd('user 2:ab')) + self.assertEqual(('user+1', 'a+b'),urllib.splitpasswd('user+1:a+b')) + + +class URLopener_Tests(unittest.TestCase): + """Testcase to test the open method of URLopener class.""" + + def test_quoted_open(self): + class DummyURLopener(urllib.URLopener): + def open_spam(self, url): + return url + + self.assertEqual(DummyURLopener().open( + 'spam://example/ /'),'//example/%20/') + + # test the safe characters are not quoted by urlopen + self.assertEqual(DummyURLopener().open( + "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"), + "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/") + + +# Just commented them out. +# Can't really tell why keep failing in windows and sparc. +# Everywhere else they work ok, but on those machines, sometimes +# fail in one of the tests, sometimes in other. I have a linux, and +# the tests go ok. +# If anybody has one of the problematic enviroments, please help! +# . Facundo +# +# def server(evt): +# import socket, time +# serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +# serv.settimeout(3) +# serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +# serv.bind(("", 9093)) +# serv.listen(5) +# try: +# conn, addr = serv.accept() +# conn.send("1 Hola mundo\n") +# cantdata = 0 +# while cantdata < 13: +# data = conn.recv(13-cantdata) +# cantdata += len(data) +# time.sleep(.3) +# conn.send("2 No more lines\n") +# conn.close() +# except socket.timeout: +# pass +# finally: +# serv.close() +# evt.set() +# +# class FTPWrapperTests(unittest.TestCase): +# +# def setUp(self): +# import ftplib, time, threading +# ftplib.FTP.port = 9093 +# self.evt = threading.Event() +# threading.Thread(target=server, args=(self.evt,)).start() +# time.sleep(.1) +# +# def tearDown(self): +# self.evt.wait() +# +# def testBasic(self): +# # connects +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# ftp.close() +# +# def testTimeoutNone(self): +# # global default timeout is ignored +# import socket +# self.assertTrue(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() +# +# def testTimeoutDefault(self): +# # global default timeout is used +# import socket +# self.assertTrue(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() +# +# def testTimeoutValue(self): +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], +# timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() + + + +def test_main(): + import warnings + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', ".*urllib\.urlopen.*Python 3.0", + DeprecationWarning) + test_support.run_unittest( + urlopen_FileTests, + urlopen_HttpTests, + urlretrieve_FileTests, + urlretrieve_HttpTests, + ProxyTests, + QuotingTests, + UnquotingTests, + urlencode_Tests, + Pathname_Tests, + Utility_Tests, + URLopener_Tests, + #FTPWrapperTests, + ) + + + +if __name__ == '__main__': + test_main() diff -Nru python-gevent-0.13.7/greentest/2.7/test_wsgiref.py python-gevent-1.0/greentest/2.7/test_wsgiref.py --- python-gevent-0.13.7/greentest/2.7/test_wsgiref.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/test_wsgiref.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,630 @@ +from __future__ import nested_scopes # Backward compat for 2.1 +from unittest import TestCase +from wsgiref.util import setup_testing_defaults +from wsgiref.headers import Headers +from wsgiref.handlers import BaseHandler, BaseCGIHandler +from wsgiref import util +from wsgiref.validate import validator +from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app +from wsgiref.simple_server import make_server +from StringIO import StringIO +from SocketServer import BaseServer +import os +import re +import sys + +from test import test_support + +class MockServer(WSGIServer): + """Non-socket HTTP server""" + + def __init__(self, server_address, RequestHandlerClass): + BaseServer.__init__(self, server_address, RequestHandlerClass) + self.server_bind() + + def server_bind(self): + host, port = self.server_address + self.server_name = host + self.server_port = port + self.setup_environ() + + +class MockHandler(WSGIRequestHandler): + """Non-socket HTTP handler""" + def setup(self): + self.connection = self.request + self.rfile, self.wfile = self.connection + + def finish(self): + pass + + + + + +def hello_app(environ,start_response): + start_response("200 OK", [ + ('Content-Type','text/plain'), + ('Date','Mon, 05 Jun 2006 18:49:54 GMT') + ]) + return ["Hello, world!"] + +def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"): + server = make_server("", 80, app, MockServer, MockHandler) + inp, out, err, olderr = StringIO(data), StringIO(), StringIO(), sys.stderr + sys.stderr = err + + try: + server.finish_request((inp,out), ("127.0.0.1",8888)) + finally: + sys.stderr = olderr + + return out.getvalue(), err.getvalue() + + + + + + + + + + + + + + + + + + + + + + + +def compare_generic_iter(make_it,match): + """Utility to compare a generic 2.1/2.2+ iterator with an iterable + + If running under Python 2.2+, this tests the iterator using iter()/next(), + as well as __getitem__. 'make_it' must be a function returning a fresh + iterator to be tested (since this may test the iterator twice).""" + + it = make_it() + n = 0 + for item in match: + if not it[n]==item: raise AssertionError + n+=1 + try: + it[n] + except IndexError: + pass + else: + raise AssertionError("Too many items from __getitem__",it) + + try: + iter, StopIteration + except NameError: + pass + else: + # Only test iter mode under 2.2+ + it = make_it() + if not iter(it) is it: raise AssertionError + for item in match: + if not it.next()==item: raise AssertionError + try: + it.next() + except StopIteration: + pass + else: + raise AssertionError("Too many items from .next()",it) + + + + + + +class IntegrationTests(TestCase): + + def check_hello(self, out, has_length=True): + self.assertEqual(out, + "HTTP/1.0 200 OK\r\n" + "Server: WSGIServer/0.1 Python/"+sys.version.split()[0]+"\r\n" + "Content-Type: text/plain\r\n" + "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + + (has_length and "Content-Length: 13\r\n" or "") + + "\r\n" + "Hello, world!" + ) + + def test_plain_hello(self): + out, err = run_amock() + self.check_hello(out) + + def test_validated_hello(self): + out, err = run_amock(validator(hello_app)) + # the middleware doesn't support len(), so content-length isn't there + self.check_hello(out, has_length=False) + + def test_simple_validation_error(self): + def bad_app(environ,start_response): + start_response("200 OK", ('Content-Type','text/plain')) + return ["Hello, world!"] + out, err = run_amock(validator(bad_app)) + self.assertTrue(out.endswith( + "A server error occurred. Please contact the administrator." + )) + self.assertEqual( + err.splitlines()[-2], + "AssertionError: Headers (('Content-Type', 'text/plain')) must" + " be of type list: " + ) + + + + + + +class UtilityTests(TestCase): + + def checkShift(self,sn_in,pi_in,part,sn_out,pi_out): + env = {'SCRIPT_NAME':sn_in,'PATH_INFO':pi_in} + util.setup_testing_defaults(env) + self.assertEqual(util.shift_path_info(env),part) + self.assertEqual(env['PATH_INFO'],pi_out) + self.assertEqual(env['SCRIPT_NAME'],sn_out) + return env + + def checkDefault(self, key, value, alt=None): + # Check defaulting when empty + env = {} + util.setup_testing_defaults(env) + if isinstance(value, StringIO): + self.assertIsInstance(env[key], StringIO) + else: + self.assertEqual(env[key], value) + + # Check existing value + env = {key:alt} + util.setup_testing_defaults(env) + self.assertTrue(env[key] is alt) + + def checkCrossDefault(self,key,value,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(kw[key],value) + + def checkAppURI(self,uri,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.application_uri(kw),uri) + + def checkReqURI(self,uri,query=1,**kw): + util.setup_testing_defaults(kw) + self.assertEqual(util.request_uri(kw,query),uri) + + + + + + + def checkFW(self,text,size,match): + + def make_it(text=text,size=size): + return util.FileWrapper(StringIO(text),size) + + compare_generic_iter(make_it,match) + + it = make_it() + self.assertFalse(it.filelike.closed) + + for item in it: + pass + + self.assertFalse(it.filelike.closed) + + it.close() + self.assertTrue(it.filelike.closed) + + + def testSimpleShifts(self): + self.checkShift('','/', '', '/', '') + self.checkShift('','/x', 'x', '/x', '') + self.checkShift('/','', None, '/', '') + self.checkShift('/a','/x/y', 'x', '/a/x', '/y') + self.checkShift('/a','/x/', 'x', '/a/x', '/') + + + def testNormalizedShifts(self): + self.checkShift('/a/b', '/../y', '..', '/a', '/y') + self.checkShift('', '/../y', '..', '', '/y') + self.checkShift('/a/b', '//y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '//y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '/./y', 'y', '/a/b/y', '') + self.checkShift('/a/b', '/./y/', 'y', '/a/b/y', '/') + self.checkShift('/a/b', '///./..//y/.//', '..', '/a', '/y/') + self.checkShift('/a/b', '///', '', '/a/b/', '') + self.checkShift('/a/b', '/.//', '', '/a/b/', '') + self.checkShift('/a/b', '/x//', 'x', '/a/b/x', '/') + self.checkShift('/a/b', '/.', None, '/a/b', '') + + + def testDefaults(self): + for key, value in [ + ('SERVER_NAME','127.0.0.1'), + ('SERVER_PORT', '80'), + ('SERVER_PROTOCOL','HTTP/1.0'), + ('HTTP_HOST','127.0.0.1'), + ('REQUEST_METHOD','GET'), + ('SCRIPT_NAME',''), + ('PATH_INFO','/'), + ('wsgi.version', (1,0)), + ('wsgi.run_once', 0), + ('wsgi.multithread', 0), + ('wsgi.multiprocess', 0), + ('wsgi.input', StringIO("")), + ('wsgi.errors', StringIO()), + ('wsgi.url_scheme','http'), + ]: + self.checkDefault(key,value) + + + def testCrossDefaults(self): + self.checkCrossDefault('HTTP_HOST',"foo.bar",SERVER_NAME="foo.bar") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="on") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="1") + self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="yes") + self.checkCrossDefault('wsgi.url_scheme',"http",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"80",HTTPS="foo") + self.checkCrossDefault('SERVER_PORT',"443",HTTPS="on") + + + def testGuessScheme(self): + self.assertEqual(util.guess_scheme({}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http") + self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https") + self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https") + + + + + + def testAppURIs(self): + self.checkAppURI("http://127.0.0.1/") + self.checkAppURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkAppURI("http://spam.example.com:2071/", + HTTP_HOST="spam.example.com:2071", SERVER_PORT="2071") + self.checkAppURI("http://spam.example.com/", + SERVER_NAME="spam.example.com") + self.checkAppURI("http://127.0.0.1/", + HTTP_HOST="127.0.0.1", SERVER_NAME="spam.example.com") + self.checkAppURI("https://127.0.0.1/", HTTPS="on") + self.checkAppURI("http://127.0.0.1:8000/", SERVER_PORT="8000", + HTTP_HOST=None) + + def testReqURIs(self): + self.checkReqURI("http://127.0.0.1/") + self.checkReqURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam", + SCRIPT_NAME="/spammity", PATH_INFO="/spam") + self.checkReqURI("http://127.0.0.1/spammity/spam;ham", + SCRIPT_NAME="/spammity", PATH_INFO="/spam;ham") + self.checkReqURI("http://127.0.0.1/spammity/spam;cookie=1234,5678", + SCRIPT_NAME="/spammity", PATH_INFO="/spam;cookie=1234,5678") + self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni", + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + self.checkReqURI("http://127.0.0.1/spammity/spam", 0, + SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") + + def testFileWrapper(self): + self.checkFW("xyz"*50, 120, ["xyz"*40,"xyz"*10]) + + def testHopByHop(self): + for hop in ( + "Connection Keep-Alive Proxy-Authenticate Proxy-Authorization " + "TE Trailers Transfer-Encoding Upgrade" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.assertTrue(util.is_hop_by_hop(alt)) + + # Not comprehensive, just a few random header names + for hop in ( + "Accept Cache-Control Date Pragma Trailer Via Warning" + ).split(): + for alt in hop, hop.title(), hop.upper(), hop.lower(): + self.assertFalse(util.is_hop_by_hop(alt)) + +class HeaderTests(TestCase): + + def testMappingInterface(self): + test = [('x','y')] + self.assertEqual(len(Headers([])),0) + self.assertEqual(len(Headers(test[:])),1) + self.assertEqual(Headers(test[:]).keys(), ['x']) + self.assertEqual(Headers(test[:]).values(), ['y']) + self.assertEqual(Headers(test[:]).items(), test) + self.assertFalse(Headers(test).items() is test) # must be copy! + + h=Headers([]) + del h['foo'] # should not raise an error + + h['Foo'] = 'bar' + for m in h.has_key, h.__contains__, h.get, h.get_all, h.__getitem__: + self.assertTrue(m('foo')) + self.assertTrue(m('Foo')) + self.assertTrue(m('FOO')) + self.assertFalse(m('bar')) + + self.assertEqual(h['foo'],'bar') + h['foo'] = 'baz' + self.assertEqual(h['FOO'],'baz') + self.assertEqual(h.get_all('foo'),['baz']) + + self.assertEqual(h.get("foo","whee"), "baz") + self.assertEqual(h.get("zoo","whee"), "whee") + self.assertEqual(h.setdefault("foo","whee"), "baz") + self.assertEqual(h.setdefault("zoo","whee"), "whee") + self.assertEqual(h["foo"],"baz") + self.assertEqual(h["zoo"],"whee") + + def testRequireList(self): + self.assertRaises(TypeError, Headers, "foo") + + + def testExtras(self): + h = Headers([]) + self.assertEqual(str(h),'\r\n') + + h.add_header('foo','bar',baz="spam") + self.assertEqual(h['foo'], 'bar; baz="spam"') + self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n') + + h.add_header('Foo','bar',cheese=None) + self.assertEqual(h.get_all('foo'), + ['bar; baz="spam"', 'bar; cheese']) + + self.assertEqual(str(h), + 'foo: bar; baz="spam"\r\n' + 'Foo: bar; cheese\r\n' + '\r\n' + ) + + +class ErrorHandler(BaseCGIHandler): + """Simple handler subclass for testing BaseHandler""" + + # BaseHandler records the OS environment at import time, but envvars + # might have been changed later by other tests, which trips up + # HandlerTests.testEnviron(). + os_environ = dict(os.environ.items()) + + def __init__(self,**kw): + setup_testing_defaults(kw) + BaseCGIHandler.__init__( + self, StringIO(''), StringIO(), StringIO(), kw, + multithread=True, multiprocess=True + ) + +class TestHandler(ErrorHandler): + """Simple handler subclass for testing BaseHandler, w/error passthru""" + + def handle_error(self): + raise # for testing, we want to see what's happening + + + + + + + + + + + +class HandlerTests(TestCase): + + def checkEnvironAttrs(self, handler): + env = handler.environ + for attr in [ + 'version','multithread','multiprocess','run_once','file_wrapper' + ]: + if attr=='file_wrapper' and handler.wsgi_file_wrapper is None: + continue + self.assertEqual(getattr(handler,'wsgi_'+attr),env['wsgi.'+attr]) + + def checkOSEnviron(self,handler): + empty = {}; setup_testing_defaults(empty) + env = handler.environ + from os import environ + for k,v in environ.items(): + if k not in empty: + self.assertEqual(env[k],v) + for k,v in empty.items(): + self.assertIn(k, env) + + def testEnviron(self): + h = TestHandler(X="Y") + h.setup_environ() + self.checkEnvironAttrs(h) + self.checkOSEnviron(h) + self.assertEqual(h.environ["X"],"Y") + + def testCGIEnviron(self): + h = BaseCGIHandler(None,None,None,{}) + h.setup_environ() + for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors': + self.assertIn(key, h.environ) + + def testScheme(self): + h=TestHandler(HTTPS="on"); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'https') + h=TestHandler(); h.setup_environ() + self.assertEqual(h.environ['wsgi.url_scheme'],'http') + + + def testAbstractMethods(self): + h = BaseHandler() + for name in [ + '_flush','get_stdin','get_stderr','add_cgi_vars' + ]: + self.assertRaises(NotImplementedError, getattr(h,name)) + self.assertRaises(NotImplementedError, h._write, "test") + + + def testContentLength(self): + # Demo one reason iteration is better than write()... ;) + + def trivial_app1(e,s): + s('200 OK',[]) + return [e['wsgi.url_scheme']] + + def trivial_app2(e,s): + s('200 OK',[])(e['wsgi.url_scheme']) + return [] + + def trivial_app4(e,s): + # Simulate a response to a HEAD request + s('200 OK',[('Content-Length', '12345')]) + return [] + + h = TestHandler() + h.run(trivial_app1) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 4\r\n" + "\r\n" + "http") + + h = TestHandler() + h.run(trivial_app2) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n" + "http") + + + h = TestHandler() + h.run(trivial_app4) + self.assertEqual(h.stdout.getvalue(), + b'Status: 200 OK\r\n' + b'Content-Length: 12345\r\n' + b'\r\n') + + def testBasicErrorOutput(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + def error_app(e,s): + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(non_error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "Content-Length: 0\r\n" + "\r\n") + self.assertEqual(h.stderr.getvalue(),"") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: %s\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: %d\r\n" + "\r\n%s" % (h.error_status,len(h.error_body),h.error_body)) + + self.assertNotEqual(h.stderr.getvalue().find("AssertionError"), -1) + + def testErrorAfterOutput(self): + MSG = "Some output has been sent" + def error_app(e,s): + s("200 OK",[])(MSG) + raise AssertionError("This should be caught by handler") + + h = ErrorHandler() + h.run(error_app) + self.assertEqual(h.stdout.getvalue(), + "Status: 200 OK\r\n" + "\r\n"+MSG) + self.assertNotEqual(h.stderr.getvalue().find("AssertionError"), -1) + + + def testHeaderFormats(self): + + def non_error_app(e,s): + s('200 OK',[]) + return [] + + stdpat = ( + r"HTTP/%s 200 OK\r\n" + r"Date: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n" + r"%s" r"Content-Length: 0\r\n" r"\r\n" + ) + shortpat = ( + "Status: 200 OK\r\n" "Content-Length: 0\r\n" "\r\n" + ) + + for ssw in "FooBar/1.0", None: + sw = ssw and "Server: %s\r\n" % ssw or "" + + for version in "1.0", "1.1": + for proto in "HTTP/0.9", "HTTP/1.0", "HTTP/1.1": + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = False + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + self.assertEqual(shortpat,h.stdout.getvalue()) + + h = TestHandler(SERVER_PROTOCOL=proto) + h.origin_server = True + h.http_version = version + h.server_software = ssw + h.run(non_error_app) + if proto=="HTTP/0.9": + self.assertEqual(h.stdout.getvalue(),"") + else: + self.assertTrue( + re.match(stdpat%(version,sw), h.stdout.getvalue()), + (stdpat%(version,sw), h.stdout.getvalue()) + ) + +# This epilogue is needed for compatibility with the Python 2.5 regrtest module + +def test_main(): + test_support.run_unittest(__name__) + +if __name__ == "__main__": + test_main() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# the above lines intentionally left blank diff -Nru python-gevent-0.13.7/greentest/2.7/version python-gevent-1.0/greentest/2.7/version --- python-gevent-0.13.7/greentest/2.7/version 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/version 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1 @@ +2.7.3 diff -Nru python-gevent-0.13.7/greentest/2.7/wrongcert.pem python-gevent-1.0/greentest/2.7/wrongcert.pem --- python-gevent-0.13.7/greentest/2.7/wrongcert.pem 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/2.7/wrongcert.pem 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnH +FlbsVUg2Xtk6+bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6T +f9lnNTwpSoeK24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQAB +AoGAQFko4uyCgzfxr4Ezb4Mp5pN3Npqny5+Jey3r8EjSAX9Ogn+CNYgoBcdtFgbq +1yif/0sK7ohGBJU9FUCAwrqNBI9ZHB6rcy7dx+gULOmRBGckln1o5S1+smVdmOsW +7zUVLBVByKuNWqTYFlzfVd6s4iiXtAE2iHn3GCyYdlICwrECQQDhMQVxHd3EFbzg +SFmJBTARlZ2GKA3c1g/h9/XbkEPQ9/RwI3vnjJ2RaSnjlfoLl8TOcf0uOGbOEyFe +19RvCLXjAkEA1s+UE5ziF+YVkW3WolDCQ2kQ5WG9+ccfNebfh6b67B7Ln5iG0Sbg +ky9cjsO3jbMJQtlzAQnH1850oRD5Gi51dQJAIbHCDLDZU9Ok1TI+I2BhVuA6F666 +lEZ7TeZaJSYq34OaUYUdrwG9OdqwZ9sy9LUav4ESzu2lhEQchCJrKMn23QJAReqs +ZLHUeTjfXkVk7dHhWPWSlUZ6AhmIlA/AQ7Payg2/8wM/JkZEJEPvGVykms9iPUrv +frADRr+hAGe43IewnQJBAJWKZllPgKuEBPwoEldHNS8nRu61D7HzxEzQ2xnfj+Nk +2fgf1MAzzTRsikfGENhVsVWeqOcijWb6g5gsyCmlRpc= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICsDCCAhmgAwIBAgIJAOqYOYFJfEEoMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwHhcNMDgwNjI2MTgxNTUyWhcNMDkwNjI2MTgxNTUyWjBF +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnHFlbsVUg2Xtk6 ++bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6Tf9lnNTwpSoeK +24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQABo4GnMIGkMB0G +A1UdDgQWBBTctMtI3EO9OjLI0x9Zo2ifkwIiNjB1BgNVHSMEbjBsgBTctMtI3EO9 +OjLI0x9Zo2ifkwIiNqFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt +U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAOqYOYFJ +fEEoMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAQwa7jya/DfhaDn7E +usPkpgIX8WCL2B1SqnRTXEZfBPPVq/cUmFGyEVRVATySRuMwi8PXbVcOhXXuocA+ +43W+iIsD9pXapCZhhOerCq18TC1dWK98vLUsoK8PMjB6e5H/O8bqojv0EeC+fyCw +eSHj5jpC8iZKjCHBn+mAi4cQ514= +-----END CERTIFICATE----- diff -Nru python-gevent-0.13.7/greentest/bench_sendall.py python-gevent-1.0/greentest/bench_sendall.py --- python-gevent-0.13.7/greentest/bench_sendall.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/bench_sendall.py 2013-11-26 16:25:45.000000000 +0000 @@ -24,10 +24,10 @@ start = time.time() conn.sendall(data) spent = time.time() - start - print "%.2f MB/s" % (length / spent / 0x100000) + print ("%.2f MB/s" % (length / spent / 0x100000)) spent_total += spent - print "~ %.2f MB/s" % (length * N / spent_total / 0x100000) + print ("~ %.2f MB/s" % (length * N / spent_total / 0x100000)) server.stop() diff -Nru python-gevent-0.13.7/greentest/bench_sleep0.py python-gevent-1.0/greentest/bench_sleep0.py --- python-gevent-0.13.7/greentest/bench_sleep0.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/bench_sleep0.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,11 +1,53 @@ +"""Benchmarking sleep(0) performance.""" +import sys from time import time -from gevent import sleep -N = 10000 +def noop(p): + pass -start = time() -for _ in xrange(N): - sleep(0) -delta = time() - start -print 'sleep(0): %.1f microseconds' % (delta * 1000000.0 / N) +N = 100000 +ARG = 0 + + +def test(sleep, arg): + start = time() + for _ in xrange(N): + sleep(arg) + return time() - start + + +def bench_none(): + test(noop) + + +def bench_gevent(arg=0): + import gevent + from gevent import sleep + delta = test(sleep, arg) + print ('gevent %s (%s): sleep(%r): %.1f microseconds' % (gevent.__version__, gevent.__file__, arg, delta * 1000000. / N)) + + +def bench_eventlet(arg): + try: + import eventlet + except ImportError, ex: + sys.stderr.write('Failed to import eventlet: %s\n' % ex) + return + from eventlet.api import sleep + delta = test(sleep, arg) + print ('eventlet %s (%s): sleep(%r): %.1f microseconds' % (eventlet.__version__, eventlet.__file__, arg, delta * 1000000. / N)) + + +def main(): + global N + for arg in [0, -1, 0.00001]: + bench_gevent(arg) + bench_eventlet(arg) + N = 1000 + bench_gevent(0.001) + bench_eventlet(0.001) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/bench_spawn.py python-gevent-1.0/greentest/bench_spawn.py --- python-gevent-0.13.7/greentest/bench_spawn.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/bench_spawn.py 2013-11-26 16:25:45.000000000 +0000 @@ -29,13 +29,13 @@ for _ in xrange(N): spawn(incr, sleep, **kwargs) delta = time() - start - print 'spawning: %.1f microseconds per greenlet' % (delta * 1000000.0 / N) + print ('spawning: %.1f microseconds per greenlet' % (delta * 1000000.0 / N)) assert counter == 0, counter start = time() sleep(0) delta = time() - start assert counter == N, (counter, N) - print 'sleep(0): %.1f microseconds per greenlet' % (delta * 1000000.0 / N) + print ('sleep(0): %.1f microseconds per greenlet' % (delta * 1000000.0 / N)) def bench_none(options): @@ -45,26 +45,26 @@ incr(noop, **kwargs) delta = time() - start assert counter == N, (counter, N) - print '%.2f microseconds' % (delta * 1000000.0 / N) + print ('%.2f microseconds' % (delta * 1000000.0 / N)) def bench_gevent(options): import gevent - print 'using gevent from %s' % gevent.__file__ + print ('using gevent from %s' % gevent.__file__) from gevent import spawn, sleep test(spawn, sleep, options.kwargs) def bench_geventraw(options): import gevent - print 'using gevent from %s' % gevent.__file__ + print ('using gevent from %s' % gevent.__file__) from gevent import sleep, spawn_raw test(spawn_raw, sleep, options.kwargs) def bench_geventpool(options): import gevent - print 'using gevent from %s' % gevent.__file__ + print ('using gevent from %s' % gevent.__file__) from gevent import sleep from gevent.pool import Pool p = Pool() @@ -72,7 +72,7 @@ start = time() p.join() delta = time() - start - print 'joining: %.1f microseconds per greenlet' % (delta * 1000000.0 / N) + print ('joining: %.1f microseconds per greenlet' % (delta * 1000000.0 / N)) def bench_eventlet(options): @@ -82,7 +82,7 @@ if options.ignore_import_errors: return raise - print 'using eventlet from %s' % eventlet.__file__ + print ('using eventlet from %s' % eventlet.__file__) from eventlet.api import spawn, sleep, use_hub if options.eventlet_hub is not None: use_hub(options.eventlet_hub) @@ -96,13 +96,13 @@ if options.ignore_import_errors: return raise - print 'using eventlet from %s' % eventlet.__file__ + print ('using eventlet from %s' % eventlet.__file__) from eventlet.proc import spawn_greenlet as spawn from eventlet.api import sleep, use_hub if options.eventlet_hub: use_hub(options.eventlet_hub) if options.with_kwargs: - print 'eventlet.proc.spawn_greenlet does support kwargs' + print ('eventlet.proc.spawn_greenlet does support kwargs') return test(spawn, sleep, options.kwargs) @@ -114,28 +114,31 @@ random.shuffle(names) for func in names: cmd = '%s %s %s --ignore-import-errors' % (sys.executable, __file__, func) - print cmd + print (cmd) sys.stdout.flush() time.sleep(0.01) if os.system(cmd): error = 1 - print '%s failed' % cmd - print + print ('%s failed' % cmd) + print ('') for func in names: cmd = '%s %s --with-kwargs %s --ignore-import-errors' % (sys.executable, __file__, func) - print cmd + print (cmd) sys.stdout.flush() if os.system(cmd): error = 1 - print '%s failed' % cmd - print + print ('%s failed' % cmd) + print ('') if error: sys.exit(1) def all(): result = [x for x in globals() if x.startswith('bench_') and x != 'bench_all'] - result.sort(key=lambda x: globals()[x].func_code.co_firstlineno) + try: + result.sort(key=lambda x: globals()[x].func_code.co_firstlineno) + except AttributeError: + result.sort(key=lambda x: globals()[x].__code__.co_firstlineno) result = [x.replace('bench_', '') for x in result] return result diff -Nru python-gevent-0.13.7/greentest/greentest.py python-gevent-1.0/greentest/greentest.py --- python-gevent-0.13.7/greentest/greentest.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/greentest.py 2013-11-26 16:25:45.000000000 +0000 @@ -20,20 +20,19 @@ # THE SOFTWARE. # package is named greentest, not test, so it won't be confused with test in stdlib +from __future__ import with_statement import sys import unittest from unittest import TestCase as BaseTestCase import time -import traceback -import re import os from os.path import basename, splitext import gevent from patched_tests_setup import get_switch_expected -try: - from functools import wraps -except ImportError: - wraps = lambda *args: (lambda x: x) +from gevent.hub import _get_hub +from functools import wraps +import contextlib +import gc VERBOSE = sys.argv.count('-v') > 1 @@ -46,7 +45,47 @@ gettotalrefcount = getattr(sys, 'gettotalrefcount', None) -def wrap(method): +def wrap_switch_count_check(method): + @wraps(method) + def wrapped(self, *args, **kwargs): + initial_switch_count = getattr(_get_hub(), 'switch_count', None) + self.switch_expected = getattr(self, 'switch_expected', True) + if initial_switch_count is not None: + fullname = getattr(self, 'fullname', None) + if self.switch_expected == 'default' and fullname: + self.switch_expected = get_switch_expected(fullname) + result = method(self, *args, **kwargs) + if initial_switch_count is not None and self.switch_expected is not None: + switch_count = _get_hub().switch_count - initial_switch_count + if self.switch_expected is True: + assert switch_count >= 0 + if not switch_count: + raise AssertionError('%s did not switch' % fullname) + elif self.switch_expected is False: + if switch_count: + raise AssertionError('%s switched but not expected to' % fullname) + else: + raise AssertionError('Invalid value for switch_expected: %r' % (self.switch_expected, )) + return result + return wrapped + + +def wrap_timeout(timeout, method): + if timeout is None: + return method + + @wraps(method) + def wrapped(self, *args, **kwargs): + with gevent.Timeout(timeout, 'test timed out', ref=False): + return method(self, *args, **kwargs) + + return wrapped + + +def wrap_refcount(method): + if gettotalrefcount is None: + return method + @wraps(method) def wrapped(self, *args, **kwargs): import gc @@ -55,85 +94,133 @@ deltas = [] d = None try: - for _ in xrange(4): + while True: d = gettotalrefcount() + self.setUp() method(self, *args, **kwargs) - if hasattr(self, 'cleanup'): - self.cleanup() + self.tearDown() if 'urlparse' in sys.modules: sys.modules['urlparse'].clear_cache() d = gettotalrefcount() - d deltas.append(d) - if deltas[-1] == 0: + # the following configurations are classified as "no leak" + # [0, 0] + # [x, 0, 0] + # [... a, b, c, d] where a+b+c+d = 0 + # + # the following configurations are classified as "leak" + # [... z, z, z] where z > 0 + if deltas[-2:] == [0, 0] and len(deltas) in (2, 3): break - else: - raise AssertionError('refcount increased by %r' % (deltas, )) + elif deltas[-3:] == [0, 0, 0]: + break + elif len(deltas) >= 4 and sum(deltas[-4:]) == 0: + break + elif len(deltas) >= 3 and deltas[-1] > 0 and deltas[-1] == deltas[-2] and deltas[-2] == deltas[-3]: + raise AssertionError('refcount increased by %r' % (deltas, )) + # OK, we don't know for sure yet. Let's search for more + if sum(deltas[-3:]) <= 0 or sum(deltas[-4:]) <= 0 or deltas[-4:].count(0) >= 2: + # this is suspicious, so give a few more runs + limit = 11 + else: + limit = 7 + if len(deltas) >= limit: + raise AssertionError('refcount increased by %r' % (deltas, )) finally: gc.collect() gc.enable() + self.skipTearDown = True + + return wrapped + + +def wrap_error_fatal(method): + @wraps(method) + def wrapped(self, *args, **kwargs): + # XXX should also be able to do gevent.SYSTEM_ERROR = object + # which is a global default to all hubs + SYSTEM_ERROR = gevent.get_hub().SYSTEM_ERROR + gevent.get_hub().SYSTEM_ERROR = object + try: + return method(self, *args, **kwargs) + finally: + gevent.get_hub().SYSTEM_ERROR = SYSTEM_ERROR + return wrapped + + +def wrap_restore_handle_error(method): + @wraps(method) + def wrapped(self, *args, **kwargs): + old = gevent.get_hub().handle_error + try: + return method(self, *args, **kwargs) + finally: + gevent.get_hub().handle_error = old + if self.peek_error()[0] is not None: + gevent.getcurrent().throw(*self.peek_error()[1:]) return wrapped -class CheckRefcountMetaClass(type): +def _get_class_attr(classDict, bases, attr, default=AttributeError): + NONE = object() + value = classDict.get(attr, NONE) + if value is not NONE: + return value + for base in bases: + value = getattr(bases[0], attr, NONE) + if value is not NONE: + return value + if default is AttributeError: + raise AttributeError('Attribute %r not found\n%s\n%s\n' % (attr, classDict, bases)) + return default + + +class TestCaseMetaClass(type): + # wrap each test method with + # a) timeout check + # b) totalrefcount check def __new__(meta, classname, bases, classDict): - if classDict.get('check_totalrefcount', True): - for key, value in classDict.items(): - if (key.startswith('test_') or key == 'test') and callable(value): - classDict.pop(key) - classDict[key] = wrap(value) + timeout = classDict.get('__timeout__', 'NONE') + if timeout == 'NONE': + timeout = getattr(bases[0], '__timeout__', None) + if gettotalrefcount is not None and timeout is not None: + timeout *= 6 + check_totalrefcount = _get_class_attr(classDict, bases, 'check_totalrefcount', True) + error_fatal = _get_class_attr(classDict, bases, 'error_fatal', True) + for key, value in classDict.items(): + if key.startswith('test') and callable(value): + classDict.pop(key) + #value = wrap_switch_count_check(value) + value = wrap_timeout(timeout, value) + my_error_fatal = getattr(value, 'error_fatal', None) + if my_error_fatal is None: + my_error_fatal = error_fatal + if my_error_fatal: + value = wrap_error_fatal(value) + value = wrap_restore_handle_error(value) + if check_totalrefcount: + value = wrap_refcount(value) + classDict[key] = value return type.__new__(meta, classname, bases, classDict) -class TestCase0(BaseTestCase): +class TestCase(BaseTestCase): + __metaclass__ = TestCaseMetaClass __timeout__ = 1 switch_expected = 'default' - _switch_count = None - - def __init__(self, *args, **kwargs): - BaseTestCase.__init__(self, *args, **kwargs) - self._timer = None - self._hub = gevent.hub.get_hub() - self._switch_count = None + error_fatal = True def run(self, *args, **kwargs): if self.switch_expected == 'default': self.switch_expected = get_switch_expected(self.fullname) return BaseTestCase.run(self, *args, **kwargs) - def setUp(self): - gevent.sleep(0) # switch at least once to setup signal handlers - if hasattr(self._hub, 'switch_count'): - self._switch_count = self._hub.switch_count - self._timer = gevent.Timeout.start_new(self.__timeout__, RuntimeError('test is taking too long')) - def tearDown(self): + if getattr(self, 'skipTearDown', False): + return if hasattr(self, 'cleanup'): self.cleanup() - try: - if not hasattr(self, 'stderr'): - self.unhook_stderr() - if hasattr(self, 'stderr'): - sys.__stderr__.write(self.stderr) - except: - traceback.print_exc() - if getattr(self, '_timer', None) is not None: - self._timer.cancel() - self._timer = None - if self._switch_count is not None and hasattr(self._hub, 'switch_count'): - msg = '' - if self._hub.switch_count < self._switch_count: - msg = 'hub.switch_count decreased?\n' - elif self._hub.switch_count == self._switch_count: - if self.switch_expected: - msg = '%s.%s did not switch\n' % (type(self).__name__, self.testname) - elif self._hub.switch_count > self._switch_count: - if not self.switch_expected: - msg = '%s.%s switched but expected not to\n' % (type(self).__name__, self.testname) - if msg: - print >> sys.stderr, 'WARNING: ' + msg - else: - sys.stderr.write('WARNING: %s.setUp does not call base class setUp\n' % (type(self).__name__, )) @property def testname(self): @@ -145,97 +232,47 @@ @property def modulename(self): - test_method = getattr(self, self.testname) - try: - return test_method.__func__.func_code.co_filename - except AttributeError: - return test_method.im_func.func_code.co_filename + return os.path.basename(sys.modules[self.__class__.__module__].__file__).rsplit('.', 1)[0] @property def fullname(self): return splitext(basename(self.modulename))[0] + '.' + self.testcasename - def hook_stderr(self): - if VERBOSE: - return - from cStringIO import StringIO - self.new_stderr = StringIO() - self.old_stderr = sys.stderr - sys.stderr = self.new_stderr + _none = (None, None, None) + _error = _none - def unhook_stderr(self): - if VERBOSE: - return - try: - value = self.new_stderr.getvalue() - except AttributeError: - return None - sys.stderr = self.old_stderr - self.stderr = value - return value + def expect_one_error(self): + assert self._error == self._none, self._error + self._old_handle_error = gevent.get_hub().handle_error + gevent.get_hub().handle_error = self._store_error + + def _store_error(self, where, type, value, tb): + del tb + if self._error != self._none: + gevent.get_hub().parent.throw(type, value) + else: + self._error = (where, type, value) - def assert_no_stderr(self): - stderr = self.unhook_stderr() - assert not stderr, 'Expected no stderr, got:\n__________\n%s\n^^^^^^^^^^\n\n' % (stderr, ) + def peek_error(self): + return self._error - def assert_stderr_traceback(self, typ, value=None): - if VERBOSE: - return - if isinstance(typ, Exception): - if value is None: - value = str(typ) - typ = typ.__class__.__name__ - else: - typ = getattr(typ, '__name__', typ) - stderr = self.unhook_stderr() - assert stderr is not None, repr(stderr) - traceback_re = '^Traceback \\(most recent call last\\):\n( +.*?\n)+^(?P\w+): (?P.*?)$' - self.extract_re(traceback_re, type=typ, value=value) + def get_error(self): + try: + return self._error + finally: + self._error = self._none - def assert_stderr(self, message): - if VERBOSE: - return - exact_re = '^' + message + '.*?\n$.*' - if re.match(exact_re, self.stderr): - self.extract_re(exact_re) - else: - words_re = '^' + '.*?'.join(message.split()) + '.*?\n$' - if re.match(words_re, self.stderr): - self.extract_re(words_re) + def assert_error(self, type=None, value=None, error=None): + if error is None: + error = self.get_error() + if type is not None: + assert error[1] is type, error + if value is not None: + if isinstance(value, str): + assert str(error[2]) == value, error else: - if message.endswith('...'): - another_re = '^' + '.*?'.join(message.split()) + '.*?(\n +.*?$){2,5}\n\n' - self.extract_re(another_re) - else: - raise AssertionError('%r did not match:\n%r' % (message, self.stderr)) - - def assert_mainloop_assertion(self, message=None): - self.assert_stderr_traceback('AssertionError', 'Cannot switch to MAINLOOP from MAINLOOP') - if message is not None: - self.assert_stderr(message) - - def extract_re(self, regex, **kwargs): - assert self.stderr is not None - m = re.search(regex, self.stderr, re.DOTALL | re.M) - if m is None: - raise AssertionError('%r did not match:\n%r' % (regex, self.stderr)) - for key, expected_value in kwargs.items(): - real_value = m.group(key) - if expected_value is not None: - try: - self.assertEqual(real_value, expected_value) - except AssertionError: - print 'failed to process: %s' % self.stderr - raise - if DEBUG: - ate = '\n#ATE#: ' + self.stderr[m.start(0):m.end(0)].replace('\n', '\n#ATE#: ') + '\n' - sys.__stderr__.write(ate) - self.stderr = self.stderr[:m.start(0)] + self.stderr[m.end(0) + 1:] - - -class TestCase(TestCase0): - if gettotalrefcount is not None: - __metaclass__ = CheckRefcountMetaClass + assert error[2] is value, error + return error main = unittest.main @@ -246,19 +283,21 @@ switch_count = 0 - def switch(self): + def switch(self, *args): self.switch_count += 1 - return _original_Hub.switch(self) + return _original_Hub.switch(self, *args) -gevent.hub.Hub = CountingHub +if gettotalrefcount is None: + gevent.hub.Hub = CountingHub def test_outer_timeout_is_not_lost(self): - timeout = gevent.Timeout.start_new(0.001) + timeout = gevent.Timeout.start_new(0.001, ref=False) try: try: result = self.wait(timeout=1) - except gevent.Timeout, ex: + except gevent.Timeout: + ex = sys.exc_info()[1] assert ex is timeout, (ex, timeout) else: raise AssertionError('must raise Timeout (returned %r)' % (result, )) @@ -275,15 +314,17 @@ def test_returns_none_after_timeout(self): start = time.time() - result = self.wait(timeout=0.01) - # join and wait simply returns after timeout expires + result = self.wait(timeout=0.2) + # join and wait simply return after timeout expires delay = time.time() - start - assert 0.01 - 0.001 <= delay < 0.01 + 0.01, delay + assert 0.2 - 0.1 <= delay < 0.2 + 0.1, delay assert result is None, repr(result) class GenericGetTestCase(TestCase): + Timeout = gevent.Timeout + def wait(self, timeout): raise NotImplementedError('override me in subclass') @@ -294,7 +335,7 @@ def test_raises_timeout_number(self): start = time.time() - self.assertRaises(gevent.Timeout, self.wait, timeout=0.01) + self.assertRaises(self.Timeout, self.wait, timeout=0.01) # get raises Timeout after timeout expired delay = time.time() - start assert 0.01 - 0.001 <= delay < 0.01 + 0.01 + 0.1, delay @@ -305,7 +346,8 @@ timeout = gevent.Timeout(0.01) try: self.wait(timeout=timeout) - except gevent.Timeout, ex: + except gevent.Timeout: + ex = sys.exc_info()[1] assert ex is timeout, (ex, timeout) delay = time.time() - start assert 0.01 - 0.001 <= delay < 0.01 + 0.01 + 0.1, delay @@ -317,7 +359,8 @@ timeout = gevent.Timeout(0.01, exception=error) try: self.wait(timeout=timeout) - except RuntimeError, ex: + except RuntimeError: + ex = sys.exc_info()[1] assert ex is error, (ex, error) delay = time.time() - start assert 0.01 - 0.001 <= delay < 0.01 + 0.01 + 0.1, delay @@ -345,10 +388,50 @@ for p, m in walk_modules(path, modpath + fn + "."): yield p, m continue - if fn.endswith('.py') and fn not in ['__init__.py', 'core.py']: - yield path, modpath + fn[:-3] + if fn.endswith('.py'): + x = fn[:-3] + if x.endswith('_d'): + x = x[:-2] + if x not in ['__init__', 'core', 'ares', '_util', '_semaphore']: + yield path, modpath + x elif include_so and fn.endswith('.so'): if fn.endswith('_d.so'): yield path, modpath + fn[:-5] else: yield path, modpath + fn[:-3] + + +def bind_and_listen(sock, address=('', 0), backlog=50, reuse_addr=True): + from socket import SOL_SOCKET, SO_REUSEADDR, error + if reuse_addr: + try: + sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, sock.getsockopt(SOL_SOCKET, SO_REUSEADDR) | 1) + except error: + pass + sock.bind(address) + sock.listen(backlog) + + +def tcp_listener(address, backlog=50, reuse_addr=True): + """A shortcut to create a TCP socket, bind it and put it into listening state.""" + from gevent import socket + sock = socket.socket() + bind_and_listen(sock) + return sock + + +@contextlib.contextmanager +def disabled_gc(): + was_enabled = gc.isenabled() + gc.disable() + try: + yield + finally: + if was_enabled: + gc.enable() + + +def get_number_open_files(): + if os.path.exists('/proc/'): + fd_directory = '/proc/%d/fd' % os.getpid() + return len(os.listdir(fd_directory)) diff -Nru python-gevent-0.13.7/greentest/helper.py python-gevent-1.0/greentest/helper.py --- python-gevent-0.13.7/greentest/helper.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/helper.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -import sys -import os -import imp - -version = '%s.%s' % sys.version_info[:2] - -missing_modules = { - 'test_smtplib': ['2.4', '2.5'], - 'test_asyncore': ['2.4', '2.5'], - 'test_telnetlib': ['2.4', '2.5'], - 'test_httpservers': ['2.4', '2.5'], - 'test_ftplib': ['2.4', '2.5'], - 'test_wsgiref': ['2.4'], - 'test_socket_ssl': ['2.6', '2.7']} - - -class ContainsAll(object): - def __contains__(self, item): - return True - - -def patch_all(**kwargs): - timeout = kwargs.pop('timeout', None) - kwargs.setdefault('aggressive', True) - from gevent import monkey - monkey.patch_all(**kwargs) - import unittest - import greentest - unittest.TestCase = greentest.TestCase0 - if timeout is not None: - unittest.TestCase.__timeout__ = timeout - - -def imp_find_dotted_module(name): - """imp.find_module with dotted names""" - path = None - for x in name.split('.'): - result = imp.find_module(x, path) - path = [result[1]] - return result - - -def prepare_stdlib_test(filename, **kwargs): - kwargs.setdefault('timeout', 20) - patch_all(**kwargs) - import test - try: - from test import test_support - except ImportError: - sys.stderr.write('test.__file__ = %s\n' % test.__file__) - raise - test_support.use_resources = ContainsAll() - - name = os.path.splitext(os.path.basename(filename))[0].replace('_patched', '') - - os.environ['__module_name__'] = name - - try: - _f, _filename, _ = imp_find_dotted_module('test.%s' % name) - except: - if version in missing_modules.get(name, []): - sys.exit(0) - sys.stderr.write('Failed to import test.%s\n' % name) - raise - - module_source = _f.read() - from patched_tests_setup import disable_tests_in_the_source - module_source = disable_tests_in_the_source(module_source, name) - module_code = compile(module_source, _filename, 'exec') - - print >> sys.stderr, 'Testing %s with monkey patching' % _filename - return module_code diff -Nru python-gevent-0.13.7/greentest/monkey_test.py python-gevent-1.0/greentest/monkey_test.py --- python-gevent-0.13.7/greentest/monkey_test.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/monkey_test.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +import sys +import os + +kwargs = {} + +if sys.argv[1] == '--Event': + kwargs['Event'] = True + del sys.argv[1] +else: + kwargs['Event'] = False + +test_filename = sys.argv[1] +del sys.argv[1] + +print 'Running with patch_all(%s): %s' % (','.join('%s=%r' % x for x in kwargs.items()), test_filename) + +from gevent import monkey; monkey.patch_all(**kwargs) + +from patched_tests_setup import disable_tests_in_source +import test.test_support +test.test_support.is_resource_enabled = lambda *args: True +del test.test_support.use_resources + +if sys.version_info[:2] <= (2, 6): + test.test_support.TESTFN += '_%s' % os.getpid() + +__file__ = os.path.join(os.getcwd(), test_filename) + +test_name = os.path.splitext(test_filename)[0] +module_source = open(test_filename).read() +module_source = disable_tests_in_source(module_source, test_name) +module_code = compile(module_source, test_filename, 'exec') +exec module_code in globals() diff -Nru python-gevent-0.13.7/greentest/mysubprocess.py python-gevent-1.0/greentest/mysubprocess.py --- python-gevent-0.13.7/greentest/mysubprocess.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/mysubprocess.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -import sys -import os -import subprocess -import signal -from subprocess import PIPE, STDOUT - - -class Popen(subprocess.Popen): - - def send_signal(self, sig): - if sys.platform == 'win32': - sig = signal.SIGTERM - if hasattr(subprocess.Popen, 'send_signal'): - try: - return subprocess.Popen.send_signal(self, sig) - except Exception, ex: - sys.stderr.write('send_signal(%s, %s) failed: %s\n' % (self.pid, sig, ex)) - self.external_kill(str(ex)) - else: - if hasattr(os, 'kill'): - sys.stderr.write('Sending signal %s to %s\n' % (sig, self.pid)) - try: - os.kill(self.pid, sig) - except Exception, ex: - sys.stderr.write('Error while killing %s: %s\n' % (self.pid, ex)) - self.external_kill() - else: - self.external_kill() - - if not hasattr(subprocess.Popen, 'kill'): - - def kill(self): - return self.send_signal(getattr(signal, 'SIGTERM', 15)) - - if not hasattr(subprocess.Popen, 'terminate'): - - def terminate(self): - return self.send_signal(getattr(signal, 'SIGTERM', 9)) - - def interrupt(self): - sig = getattr(signal, 'SIGINT', 2) - return self.send_signal(sig) - - def external_kill(self, reason=''): - if sys.platform == 'win32': - sys.stderr.write('Killing %s: %s\n' % (self.pid, reason)) - os.system('taskkill /f /pid %s' % self.pid) - else: - sys.stderr.write('Cannot kill on this platform. Please kill %s\n' % self.pid) diff -Nru python-gevent-0.13.7/greentest/patched_test.py python-gevent-1.0/greentest/patched_test.py --- python-gevent-0.13.7/greentest/patched_test.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/patched_test.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/patched_tests_setup.py python-gevent-1.0/greentest/patched_tests_setup.py --- python-gevent-0.13.7/greentest/patched_tests_setup.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/patched_tests_setup.py 2013-11-26 16:25:45.000000000 +0000 @@ -3,62 +3,163 @@ # By default, test cases are expected to switch and emit warnings if there was none # If a test is found in this list, it's expected not to switch. -tests = '''test_select.SelectTestCase.test_error_conditions -test_ftplib.TestFTPClass.test_all_errors -test_ftplib.TestFTPClass.test_getwelcome -test_ftplib.TestFTPClass.test_sanitize -test_ftplib.TestFTPClass.test_set_pasv -test_ftplib.TestIPv6Environment.test_af -test_socket.TestExceptions.testExceptionTree -test_socket.Urllib2FileobjectTest.testClose -test_socket.TestLinuxAbstractNamespace.testLinuxAbstractNamespace -test_socket.TestLinuxAbstractNamespace.testMaxName -test_socket.TestLinuxAbstractNamespace.testNameOverflow -test_socket.GeneralModuleTests.* +no_switch_tests = '''test_patched_select.SelectTestCase.test_error_conditions +test_patched_ftplib.*.test_all_errors +test_patched_ftplib.*.test_getwelcome +test_patched_ftplib.*.test_sanitize +test_patched_ftplib.*.test_set_pasv +#test_patched_ftplib.TestIPv6Environment.test_af +test_patched_socket.TestExceptions.testExceptionTree +test_patched_socket.Urllib2FileobjectTest.testClose +test_patched_socket.TestLinuxAbstractNamespace.testLinuxAbstractNamespace +test_patched_socket.TestLinuxAbstractNamespace.testMaxName +test_patched_socket.TestLinuxAbstractNamespace.testNameOverflow +test_patched_socket.FileObjectInterruptedTestCase.* +test_patched_urllib.* +test_patched_asyncore.HelperFunctionTests.* +test_patched_httplib.BasicTest.* +test_patched_httplib.HTTPSTimeoutTest.test_attributes +test_patched_httplib.HeaderTests.* +test_patched_httplib.OfflineTest.* +test_patched_httplib.HTTPSTimeoutTest.test_host_port +test_patched_httplib.SourceAddressTest.testHTTPSConnectionSourceAddress +test_patched_select.SelectTestCase.test_error_conditions +test_patched_smtplib.NonConnectingTests.* +test_patched_urllib2net.OtherNetworkTests.* +test_patched_wsgiref.* +test_patched_subprocess.HelperFunctionTests.* ''' -tests = [x.strip().replace('\.', '\\.').replace('*', '.*?') for x in tests.split('\n') if x.strip()] -tests = re.compile('^%s$' % '|'.join(tests)) +ignore_switch_tests = ''' +test_patched_socket.GeneralModuleTests.* +test_patched_httpservers.BaseHTTPRequestHandlerTestCase.* +test_patched_queue.* +test_patched_signal.SiginterruptTest.* +test_patched_urllib2.* +test_patched_ssl.* +test_patched_signal.BasicSignalTests.* +test_patched_threading_local.* +test_patched_threading.* +''' + + +def make_re(tests): + tests = [x.strip().replace('\.', '\\.').replace('*', '.*?') for x in tests.split('\n') if x.strip()] + tests = re.compile('^%s$' % '|'.join(tests)) + return tests + + +no_switch_tests = make_re(no_switch_tests) +ignore_switch_tests = make_re(ignore_switch_tests) def get_switch_expected(fullname): """ - >>> get_switch_expected('test_select.SelectTestCase.test_error_conditions') + >>> get_switch_expected('test_patched_select.SelectTestCase.test_error_conditions') False - >>> get_switch_expected('test_socket.GeneralModuleTests.testCrucialConstants') + >>> get_switch_expected('test_patched_socket.GeneralModuleTests.testCrucialConstants') False - >>> get_switch_expected('test_socket.SomeOtherTest.testHello') + >>> get_switch_expected('test_patched_socket.SomeOtherTest.testHello') True + >>> get_switch_expected("test_patched_httplib.BasicTest.test_bad_status_repr") + False """ - if tests.match(fullname) is not None: - print fullname + if ignore_switch_tests.match(fullname) is not None: + return None + if no_switch_tests.match(fullname) is not None: return False return True -disabled_tests = [ - # uses signal module which does not work with gevent (use gevent.signal()) - 'test_socket.TCPTimeoutTest.testInterruptedTimeout', - +disabled_tests = \ + [ 'test_threading.ThreadTests.test_PyThreadState_SetAsyncExc' # uses some internal C API of threads not available when threads are emulated with greenlets - 'test_threading.ThreadTests.test_PyThreadState_SetAsyncExc', - - # access _sock.gettimeout() which is always in non-blocking mode - 'test_urllib2net.TimeoutTest.test_ftp_no_timeout', - 'test_urllib2net.TimeoutTest.test_ftp_timeout', - 'test_urllib2net.TimeoutTest.test_http_no_timeout', - 'test_urllib2net.TimeoutTest.test_http_timeout', - # this test seems to have a bug which makes it fail with error: (107, 'Transport endpoint is not connected') - # (they create TCP socket, not UDP) - 'test_socket.UDPTimeoutTest.testUDPTimeout'] + , 'test_threading.ThreadTests.test_join_nondaemon_on_shutdown' + # asserts that repr(sleep) is '' -if sys.version_info[:2] < (2, 7): - # On Python 2.6, this test fails even without monkey patching - disabled_tests.append('test_threading.ThreadTests.test_foreign_thread') + , 'test_urllib2net.TimeoutTest.test_ftp_no_timeout' + , 'test_urllib2net.TimeoutTest.test_ftp_timeout' + , 'test_urllib2net.TimeoutTest.test_http_no_timeout' + , 'test_urllib2net.TimeoutTest.test_http_timeout' + # accesses _sock.gettimeout() which is always in non-blocking mode + + , 'test_urllib2net.OtherNetworkTests.test_urlwithfrag' + # fails dues to some changes on python.org + + , 'test_urllib2net.OtherNetworkTests.test_sites_no_connection_close' + # flaky + + , 'test_socket.UDPTimeoutTest.testUDPTimeout' + # has a bug which makes it fail with error: (107, 'Transport endpoint is not connected') + # (it creates a TCP socket, not UDP) + + , 'test_socket.GeneralModuleTests.testRefCountGetNameInfo' + # fails with "socket.getnameinfo loses a reference" while the reference is only "lost" + # because it is referenced by the traceback - any Python function would lose a reference like that. + # the original getnameinfo does not "lose" it because it's in C. + + , 'test_socket.NetworkConnectionNoServer.test_create_connection_timeout' + # replaces socket.socket with MockSocket and then calls create_connection. + # this unfortunately does not work with monkey patching, because gevent.socket.create_connection + # is bound to gevent.socket.socket and updating socket.socket does not affect it. + # this issues also manifests itself when not monkey patching DNS: http://code.google.com/p/gevent/issues/detail?id=54 + # create_connection still uses gevent.socket.getaddrinfo while it should be using socket.getaddrinfo + + , 'test_asyncore.BaseTestAPI.test_handle_expt' + # sends some OOB data and expect it to be detected as such; gevent.select.select does not support that + + , 'test_signal.WakeupSignalTests.test_wakeup_fd_early' + # expects time.sleep() to return prematurely in case of a signal; + # gevent.sleep() is better than that and does not get interrupted (unless signal handler raises an error) + + , 'test_signal.WakeupSignalTests.test_wakeup_fd_during' + # expects select.select() to raise select.error(EINTR, 'interrupted system call') + # gevent.select.select() does not get interrupted (unless signal handler raises an error) + # maybe it should? + + , 'test_signal.SiginterruptTest.test_without_siginterrupt' + , 'test_signal.SiginterruptTest.test_siginterrupt_on' + # these rely on os.read raising EINTR which never happens with gevent.os.read + + , 'test_subprocess.test_leak_fast_process_del_killed' + , 'test_subprocess.test_zombie_fast_process_del' + # relies on subprocess._active which we don't use + + , 'test_ssl.ThreadedTests.test_default_ciphers' + , 'test_ssl.ThreadedTests.test_empty_cert' + , 'test_ssl.ThreadedTests.test_malformed_cert' + , 'test_ssl.ThreadedTests.test_malformed_key' + , 'test_ssl.NetworkedTests.test_non_blocking_connect_ex' + # XXX needs investigating + + , 'test_urllib2.HandlerTests.test_cookie_redirect' + # this uses cookielib which we don't care about + + , 'test_thread.ThreadRunningTests.test__count' + , 'test_thread.TestForkInThread.test_forkinthread' + # XXX needs investigating + +] + + +if sys.platform == 'darwin': + disabled_tests += [ + 'test_subprocess.POSIXProcessTestCase.test_run_abort' + # causes Mac OS X to show "Python crashes" dialog box which is annoying + ] + + +# if 'signalfd' in os.environ.get('GEVENT_BACKEND', ''): +# # tests that don't interact well with signalfd +# disabled_tests.extend([ +# 'test_signal.SiginterruptTest.test_siginterrupt_off', +# 'test_socketserver.SocketServerTest.test_ForkingTCPServer', +# 'test_socketserver.SocketServerTest.test_ForkingUDPServer', +# 'test_socketserver.SocketServerTest.test_ForkingUnixStreamServer']) -def disable_tests_in_the_source(source, name): +def disable_tests_in_source(source, name): my_disabled_tests = [x for x in disabled_tests if x.startswith(name + '.')] if not my_disabled_tests: return source diff -Nru python-gevent-0.13.7/greentest/six.py python-gevent-1.0/greentest/six.py --- python-gevent-0.13.7/greentest/six.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/six.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +import sys +from gevent.hub import PY3 + +if PY3: + advance_iterator = next +else: + def advance_iterator(it): + return it.next() + +if PY3: + import builtins + exec_ = getattr(builtins, "exec") + + def reraise(tp, value, tb=None): + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value + + print_ = getattr(builtins, "print") + del builtins + +else: + def exec_(code, globs=None, locs=None): + """Execute code in a namespace.""" + if globs is None: + frame = sys._getframe(1) + globs = frame.f_globals + if locs is None: + locs = frame.f_locals + del frame + elif locs is None: + locs = globs + exec("""exec code in globs, locs""") diff -Nru python-gevent-0.13.7/greentest/test__all__.py python-gevent-1.0/greentest/test__all__.py --- python-gevent-0.13.7/greentest/test__all__.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__all__.py 2013-11-26 16:25:45.000000000 +0000 @@ -5,8 +5,14 @@ from greentest import walk_modules -SKIP = ['sslold'] -MAPPING = {'gevent.local': '_threading_local'} +MAPPING = {'gevent.local': '_threading_local', + 'gevent.socket': 'socket', + 'gevent.select': 'select', + 'gevent.ssl': 'ssl', + 'gevent.thread': 'thread', + 'gevent.subprocess': 'subprocess', + 'gevent.os': 'os', + 'gevent.threading': 'threading'} class ANY(object): @@ -16,19 +22,25 @@ ANY = ANY() NOT_IMPLEMENTED = { - 'socket': ['CAPI', 'gethostbyaddr', 'gethostbyname_ex', 'getnameinfo'], + 'socket': ['CAPI'], 'thread': ['allocate', 'exit_thread', 'interrupt_main', 'start_new'], 'select': ANY, - 'httplib': ANY} + 'os': ANY, + 'threading': ANY} COULD_BE_MISSING = { 'socket': ['create_connection', 'RAND_add', 'RAND_egd', 'RAND_status']} +NO_ALL = ['gevent.threading', 'gevent._util'] + class Test(unittest.TestCase): def check_all(self): "Check that __all__ is present and does not contain invalid entries" + if not hasattr(self.module, '__all__'): + assert self.modname in NO_ALL + return names = {} exec ("from %s import *" % self.modname) in names names.pop('__builtins__', None) @@ -57,8 +69,13 @@ def check_implements_subset_of_stdlib_all(self): "Check that __implements__ + __imports__ is a subset of the corresponding standard module __all__ or dir()" for name in self.__implements__ + self.__imports__: - if name not in self.stdlib_all and name not in COULD_BE_MISSING.get(self.stdlib_name, []): - raise AssertionError('%r is not found in %r.__all__' % (name, self.stdlib_module)) + if name in self.stdlib_all: + continue + if name in COULD_BE_MISSING.get(self.stdlib_name, []): + continue + if name in dir(self.stdlib_module): # like thread._local which is not in thread.__all__ + continue + raise AssertionError('%r is not found in %r.__all__ nor in dir(%r)' % (name, self.stdlib_module, self.stdlib_module)) def check_implements_actually_implements(self): """Check that the module actually implements the entries from __implements__""" @@ -66,7 +83,7 @@ item = getattr(self.module, name) try: stdlib_item = getattr(self.stdlib_module, name) - assert item is not stdlib_item, (item, stdlib_item) + assert item is not stdlib_item, (name, item, stdlib_item) except AttributeError: if name not in COULD_BE_MISSING.get(self.stdlib_name, []): raise @@ -76,7 +93,7 @@ for name in self.__imports__: item = getattr(self.module, name) stdlib_item = getattr(self.stdlib_module, name) - assert item is stdlib_item, (item, stdlib_item) + assert item is stdlib_item, (name, item, stdlib_item) def check_extensions_actually_extend(self): """Check that the module actually defines new entries in __extensions__""" @@ -87,7 +104,7 @@ """Check that __all__ (or dir()) of the corresponsing stdlib is a subset of __all__ of this module""" missed = [] for name in self.stdlib_all: - if name not in self.module.__all__: + if name not in getattr(self.module, '__all__', []): missed.append(name) # handle stuff like ssl.socket and ssl.socket_error which have no reason to be in gevent.ssl.__all__ @@ -102,7 +119,7 @@ result = [] for name in missed[:]: if name in not_implemented: - print 'IncompleteImplWarning: gevent.%s.%s' % (self.modname, name) + print ('IncompleteImplWarning: %s.%s' % (self.modname, name)) else: result.append(name) missed = result @@ -132,26 +149,23 @@ self.__extensions__ = getattr(self.module, '__extensions__', []) self.stdlib_name = MAPPING.get(modname) - if self.stdlib_name is None: - self.stdlib_name = modname.replace('gevent.', '') - try: - self.stdlib_module = __import__(self.stdlib_name) - except ImportError: - self.stdlib_module = None + self.stdlib_module = None + + if self.stdlib_name is not None: + try: + self.stdlib_module = __import__(self.stdlib_name) + except ImportError: + pass self.check_implements_presence_justified() + if self.stdlib_module is None: + return + # use __all__ as __implements__ if self.__implements__ is None: self.__implements__ = sorted(self.module.__all__) - if modname == 'gevent.greenlet': - # 'greenlet' is not a corresponding standard module for gevent.greenlet - return - - if self.stdlib_module is None: - return - self.set_stdlib_all() self.check_implements_subset_of_stdlib_all() self.check_implements_actually_implements() @@ -160,9 +174,8 @@ self.check_completeness() for path, modname in walk_modules(include_so=True): - modname = modname.replace('gevent.', '') - if modname not in SKIP: - exec '''def test_%s(self): self._test("gevent.%s")''' % (modname, modname) + modname = modname.replace('gevent.', '').split('.')[0] + exec ('''def test_%s(self): self._test("gevent.%s")''' % (modname, modname)) del path, modname diff -Nru python-gevent-0.13.7/greentest/test__api.py python-gevent-1.0/greentest/test__api.py --- python-gevent-0.13.7/greentest/test__api.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__api.py 2013-11-26 16:25:45.000000000 +0000 @@ -55,27 +55,43 @@ def test_sleep_invalid_switch(self): p = gevent.spawn(util.wrap_errors(AssertionError, gevent.sleep), 2) + gevent.sleep(0) # wait for p to start, because actual order of switching is reversed switcher = gevent.spawn(p.switch, None) result = p.get() assert isinstance(result, AssertionError), result assert 'Invalid switch' in str(result), repr(str(result)) switcher.kill() - def test_wait_read_invalid_switch(self): - p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_read), 0) - switcher = gevent.spawn(p.switch, None) - result = p.get() - assert isinstance(result, AssertionError), result - assert 'Invalid switch' in str(result), repr(str(result)) - switcher.kill() + if hasattr(socket, 'socketpair'): - def test_wait_write_invalid_switch(self): - p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_write), 0) - switcher = gevent.spawn(p.switch, None) - result = p.get() - assert isinstance(result, AssertionError), result - assert 'Invalid switch' in str(result), repr(str(result)) - switcher.kill() + def _test_wait_read_invalid_switch(self, sleep): + sock1, sock2 = socket.socketpair() + try: + p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_read), sock1.fileno()) + gevent.get_hub().loop.run_callback(switch_None, p) + if sleep is not None: + gevent.sleep(sleep) + result = p.get() + assert isinstance(result, AssertionError), result + assert 'Invalid switch' in str(result), repr(str(result)) + finally: + sock1.close() + sock2.close() + + def test_invalid_switch_None(self): + self._test_wait_read_invalid_switch(None) + + def test_invalid_switch_0(self): + self._test_wait_read_invalid_switch(0) + + def test_invalid_switch_1(self): + self._test_wait_read_invalid_switch(0.001) + + # we don't test wait_write the same way, because socket is always ready to write + + +def switch_None(g): + g.switch(None) class TestTimers(greentest.TestCase): diff -Nru python-gevent-0.13.7/greentest/test__api_timeout.py python-gevent-1.0/greentest/test__api_timeout.py --- python-gevent-0.13.7/greentest/test__api_timeout.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__api_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -49,7 +49,8 @@ try: with Timeout(DELAY) as t: sleep(DELAY * 2) - except Timeout, ex: + except Timeout: + ex = sys.exc_info()[1] assert ex is t, (ex, t) else: raise AssertionError('must raise Timeout') @@ -58,7 +59,8 @@ try: with Timeout(DELAY, IOError("Operation takes way too long")): sleep(DELAY * 2) - except IOError, ex: + except IOError: + ex = sys.exc_info()[1] assert str(ex) == "Operation takes way too long", repr(ex) # Providing classes instead of values should be possible too: @@ -117,7 +119,8 @@ with Timeout(DELAY * 2) as t2: try: sleep(DELAY * 3) - except Timeout, ex: + except Timeout: + ex = sys.exc_info()[1] assert ex is t1, (ex, t1) assert not t1.pending, t1 assert t2.pending, t2 @@ -127,7 +130,8 @@ with Timeout(DELAY) as t2: try: sleep(DELAY * 3) - except Timeout, ex: + except Timeout: + ex = sys.exc_info()[1] assert ex is t2, (ex, t2) assert t1.pending, t1 assert not t2.pending, t2 diff -Nru python-gevent-0.13.7/greentest/test__ares_host_result.py python-gevent-1.0/greentest/test__ares_host_result.py --- python-gevent-0.13.7/greentest/test__ares_host_result.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__ares_host_result.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +import pickle +import greentest +from gevent.ares import ares_host_result + + +class TestPickle(greentest.TestCase): + # Issue 104: ares.ares_host_result unpickleable + + def _test(self, protocol): + r = ares_host_result('family', ('arg1', 'arg2', )) + dumped = pickle.dumps(r, protocol) + loaded = pickle.loads(dumped) + assert r == loaded, (r, loaded) + assert r.family == loaded.family, (r, loaded) + + def test0(self): + return self._test(0) + + def test1(self): + return self._test(1) + + def test2(self): + return self._test(2) + + if pickle.HIGHEST_PROTOCOL == 3: + def test3(self): + return self._test(3) + else: + assert pickle.HIGHEST_PROTOCOL == 2, pickle.HIGHEST_PROTOCOL + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_ares_timeout.py python-gevent-1.0/greentest/test_ares_timeout.py --- python-gevent-0.13.7/greentest/test_ares_timeout.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test_ares_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,31 @@ +import sys +import gevent +from gevent.resolver_ares import Resolver +from gevent import socket +print gevent.__file__ + +address = ('127.0.0.10', 53) +listener = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +try: + listener.bind(address) +except socket.error, ex: + if 'permission denied' in str(ex).lower(): + sys.stderr.write('This test binds on port 53 and thus must be run as root.\n') + sys.exit(0) + raise + + +def reader(): + while True: + print listener.recvfrom(10000) + +gevent.spawn(reader) + +r = gevent.get_hub().resolver = Resolver(servers=['127.0.0.10'], timeout=0.001, tries=1) +try: + result = r.gethostbyname('www.google.com') +except socket.gaierror, ex: + if 'ARES_ETIMEOUT' not in str(ex): + raise +else: + raise AssertionError('Expected timeout, got %r' % (result, )) diff -Nru python-gevent-0.13.7/greentest/test__backdoor.py python-gevent-1.0/greentest/test__backdoor.py --- python-gevent-0.13.7/greentest/test__backdoor.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__backdoor.py 2013-11-26 16:25:45.000000000 +0000 @@ -14,6 +14,12 @@ return read +def create_connection(address): + conn = socket.socket() + conn.connect(address) + return conn + + class Test(greentest.TestCase): def test(self): @@ -21,7 +27,7 @@ server.start() def connect(): - conn = socket.create_connection(('127.0.0.1', server.server_port)) + conn = create_connection(('127.0.0.1', server.server_port)) read_until(conn, '>>> ') conn.sendall('2+2\r\n') line = conn.makefile().readline() @@ -29,14 +35,14 @@ jobs = [gevent.spawn(connect) for _ in xrange(10)] gevent.joinall(jobs) - server.kill() + server.close() #self.assertEqual(conn.recv(1), '') def test_quit(self): server = backdoor.BackdoorServer(('127.0.0.1', 0)) server.start() try: - conn = socket.create_connection(('127.0.0.1', server.server_port)) + conn = create_connection(('127.0.0.1', server.server_port)) read_until(conn, '>>> ') conn.sendall('quit()\r\n') line = conn.makefile().read() @@ -48,7 +54,7 @@ server = backdoor.BackdoorServer(('127.0.0.1', 0)) server.start() try: - conn = socket.create_connection(('127.0.0.1', server.server_port)) + conn = create_connection(('127.0.0.1', server.server_port)) read_until(conn, '>>> ') conn.sendall('import sys; sys.exit(0)\r\n') line = conn.makefile().read() @@ -56,6 +62,29 @@ finally: server.stop() + def test_banner(self): + banner = "Welcome stranger!" + server = backdoor.BackdoorServer(('127.0.0.1', 0), banner=banner) + server.start() + try: + conn = create_connection(('127.0.0.1', server.server_port)) + response = read_until(conn, '>>> ') + self.assertEqual(response[:len(banner)], banner) + finally: + server.stop() + + def test_builtins(self): + server = backdoor.BackdoorServer(('127.0.0.1', 0)) + server.start() + try: + conn = create_connection(('127.0.0.1', server.server_port)) + read_until(conn, '>>> ') + conn.sendall('locals()["__builtins__"]\r\n') + response = read_until(conn, '>>> ') + self.assertTrue(len(response) < 300, msg="locals() unusable: %s..." % response[:100]) + finally: + server.stop() + if __name__ == '__main__': greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__benchmarks.py python-gevent-1.0/greentest/test__benchmarks.py --- python-gevent-0.13.7/greentest/test__benchmarks.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__benchmarks.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -import sys -import glob -import mysubprocess as subprocess -import time - - -def system(command): - p = subprocess.Popen(command, shell=True) - try: - start = time.time() - while time.time() < start + 10 and p.poll() is None: - time.sleep(0.1) - if p.poll() is None: - p.kill() - return 'KILLED' - return p.poll() - finally: - if p.poll() is None: - p.kill() - - -modules = set() - -for path in glob.glob('bench_*.py'): - modules.add(path) - -assert modules - -error = 0 - -if __name__ == '__main__': - - for path in modules: - print path - sys.stdout.flush() - res = system('%s %s all' % (sys.executable, path)) - if res: - error = 1 - print path, 'failed' - print '-----' - - if error: - sys.exit(1) diff -Nru python-gevent-0.13.7/greentest/test_close_backend_fd.py python-gevent-1.0/greentest/test_close_backend_fd.py --- python-gevent-0.13.7/greentest/test_close_backend_fd.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test_close_backend_fd.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,27 @@ +import os +import gevent +from gevent import core + + +for count in xrange(2): + for backend in core.supported_backends(): + hub = gevent.get_hub(backend, default=False) + assert hub.loop.backend == backend, (hub.loop.backend, backend) + gevent.sleep(0.001) + fileno = hub.loop.fileno() + if fileno is not None: + print '%s. Testing %r: %r' % (count, backend, hub) + os.close(fileno) + try: + gevent.sleep(0.001) + except SystemError, ex: + if '(libev)' in str(ex): + print 'The error is expected: %s' % ex + else: + raise + else: + raise AssertionError('gevent.sleep() is expected to fail after loop fd was closed') + else: + print '%s. %r lacks fileno()' % (count, backend) + hub.destroy() + assert 'destroyed' in repr(hub), repr(hub) diff -Nru python-gevent-0.13.7/greentest/test__core_active_event.py python-gevent-1.0/greentest/test__core_active_event.py --- python-gevent-0.13.7/greentest/test__core_active_event.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_active_event.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -import gevent - -called = [] - - -def f(): - called.append(1) - -x = gevent.core.active_event(f) -assert x.pending == 1, x.pending -gevent.sleep(0) -assert x.pending == 0, x.pending -assert called == [1], called - -x = gevent.core.active_event(f) -assert x.pending == 1, x.pending -x.cancel() -assert x.pending == 0, x.pending -gevent.sleep(0) -assert called == [1], called -assert x.pending == 0, x.pending diff -Nru python-gevent-0.13.7/greentest/test__core_async.py python-gevent-1.0/greentest/test__core_async.py --- python-gevent-0.13.7/greentest/test__core_async.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_async.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,18 @@ +from __future__ import with_statement +import gevent +import gevent.core +import time +import thread + + +hub = gevent.get_hub() +watcher = hub.loop.async() + +gevent.spawn_later(0.1, thread.start_new_thread, watcher.send, ()) + +start = time.time() + +with gevent.Timeout(0.3): + hub.wait(watcher) + +print 'Watcher %r reacted after %.6f seconds' % (watcher, time.time() - start - 0.1) diff -Nru python-gevent-0.13.7/greentest/test__core_callback.py python-gevent-1.0/greentest/test__core_callback.py --- python-gevent-0.13.7/greentest/test__core_callback.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_callback.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,31 @@ +import gevent +from gevent.hub import get_hub + +called = [] + + +def f(): + called.append(1) + + +def main(): + loop = get_hub().loop + x = loop.run_callback(f) + + assert x, x + gevent.sleep(0) + assert called == [1], called + assert not x, (x, bool(x)) + + x = loop.run_callback(f) + assert x, x + x.stop() + assert not x, x + gevent.sleep(0) + assert called == [1], called + assert not x, x + + +if __name__ == '__main__': + called[:] = [] + main() diff -Nru python-gevent-0.13.7/greentest/test__core_loop_run.py python-gevent-1.0/greentest/test__core_loop_run.py --- python-gevent-0.13.7/greentest/test__core_loop_run.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_loop_run.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,19 @@ +import sys +from gevent import core, signal +loop = core.loop() + + +signal = signal(2, sys.stderr.write, 'INTERRUPT!') + +print ('must exit immediatelly...') +loop.run() # must exit immediatelly +print ('...and once more...') +loop.run() # repeating does not fail +print ('..done') + +print ('must exit after 0.5 seconds.') +timer = loop.timer(0.5) +timer.start(lambda: None) +loop.run() + +del loop diff -Nru python-gevent-0.13.7/greentest/test__core.py python-gevent-1.0/greentest/test__core.py --- python-gevent-0.13.7/greentest/test__core.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,52 @@ +import sys +from greentest import TestCase, main +from gevent import core + + +class Test(TestCase): + switch_expected = False + __timeout__ = None + + def test_get_version(self): + version = core.get_version() + assert isinstance(version, str), repr(version) + assert version, repr(version) + header_version = core.get_header_version() + assert isinstance(header_version, str), repr(header_version) + assert header_version, repr(header_version) + self.assertEqual(version, header_version) + + def test_flags_conversion(self): + if sys.platform != 'win32': + self.assertEqual(core.loop(2, default=False).backend_int, 2) + self.assertEqual(core.loop('select', default=False).backend, 'select') + self.assertEqual(core._flags_to_int(None), 0) + self.assertEqual(core._flags_to_int(['kqueue', 'SELECT']), core.BACKEND_KQUEUE | core.BACKEND_SELECT) + self.assertEqual(core._flags_to_list(core.BACKEND_PORT | core.BACKEND_POLL), ['port', 'poll']) + self.assertRaises(ValueError, core.loop, ['port', 'blabla']) + self.assertRaises(TypeError, core.loop, object()) + + def test_events_conversion(self): + self.assertEqual(core._events_to_str(core.READ | core.WRITE), 'READ|WRITE') + + def test_EVENTS(self): + self.assertEqual(str(core.EVENTS), 'gevent.core.EVENTS') + self.assertEqual(repr(core.EVENTS), 'gevent.core.EVENTS') + + def test_io(self): + if sys.platform == 'win32': + Error = IOError + else: + Error = ValueError + self.assertRaises(Error, core.loop().io, -1, 1) + self.assertRaises(ValueError, core.loop().io, 1, core.TIMER) + + def test_timer(self): + self.assertRaises(ValueError, core.loop().timer, 1, -1) + + def test_signal(self): + self.assertRaises(ValueError, core.loop().signal, 1000) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__core_stat.py python-gevent-1.0/greentest/test__core_stat.py --- python-gevent-0.13.7/greentest/test__core_stat.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_stat.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,59 @@ +from __future__ import with_statement +import gevent +import gevent.core +import os +import time + + +filename = 'tmp.test__core_stat.%s' % os.getpid() + +hub = gevent.get_hub() + +DELAY = 0.5 + +EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None) + +try: + open(filename, 'wb', buffering=0).close() + assert os.path.exists(filename), filename + + def write(): + f = open(filename, 'wb', buffering=0) + f.write('x') + f.close() + + greenlet = gevent.spawn_later(DELAY, write) + watcher = hub.loop.stat(filename) + + start = time.time() + + with gevent.Timeout(5 + DELAY + 0.5): + hub.wait(watcher) + + reaction = time.time() - start - DELAY + print 'Watcher %s reacted after %.4f seconds (write)' % (watcher, reaction) + if reaction >= DELAY and EV_USE_INOTIFY: + print 'WARNING: inotify failed (write)' + assert reaction >= 0.0, 'Watcher %s reacted too early (write): %.3fs' % (watcher, reaction) + assert watcher.attr is not None, watcher.attr + assert watcher.prev is not None, watcher.prev + + greenlet.join() + gevent.spawn_later(DELAY, os.unlink, filename) + + start = time.time() + + with gevent.Timeout(5 + DELAY + 0.5): + hub.wait(watcher) + + reaction = time.time() - start - DELAY + print 'Watcher %s reacted after %.4f seconds (unlink)' % (watcher, reaction) + if reaction >= DELAY and EV_USE_INOTIFY: + print 'WARNING: inotify failed (unlink)' + assert reaction >= 0.0, 'Watcher %s reacted too early (unlink): %.3fs' % (watcher, reaction) + assert watcher.attr is None, watcher.attr + assert watcher.prev is not None, watcher.prev + +finally: + if os.path.exists(filename): + os.unlink(filename) diff -Nru python-gevent-0.13.7/greentest/test__core_timer.py python-gevent-1.0/greentest/test__core_timer.py --- python-gevent-0.13.7/greentest/test__core_timer.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_timer.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,41 @@ +from gevent import core + +called = [] + + +def f(): + called.append(1) + + +def main(): + loop = core.loop(default=True) + x = loop.timer(0.001) + x.start(f) + + assert x.active, x.pending + try: + x.priority = 1 + raise AssertionError('must not be able to change priority of active watcher') + except AttributeError: + pass + loop.run() + assert x.pending == 0, x.pending + assert called == [1], called + assert x.callback is None, x.callback + assert x.args is None, x.args + assert x.priority == 0, x + x.priority = 1 + assert x.priority == 1, x + x.stop() + + +if __name__ == '__main__': + import sys + gettotalrefcount = getattr(sys, 'gettotalrefcount', None) + called[:] = [] + if gettotalrefcount is not None: + print (gettotalrefcount()) + main() + called[:] = [] + if gettotalrefcount is not None: + print (gettotalrefcount()) diff -Nru python-gevent-0.13.7/greentest/test__core_watcher.py python-gevent-1.0/greentest/test__core_watcher.py --- python-gevent-0.13.7/greentest/test__core_watcher.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__core_watcher.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,67 @@ +import greentest +from gevent import core + + +class Test(greentest.TestCase): + + __timeout__ = None + + def test_types(self): + loop = core.loop() + lst = [] + + io = loop.timer(0.01) + + # test that cannot pass non-callable thing to start() + self.assertRaises(TypeError, io.start, None) + self.assertRaises(TypeError, io.start, 5) + # test that cannot set 'callback' to non-callable thing later either + io.start(lambda *args: lst.append(args)) + self.assertEqual(io.args, ()) + try: + io.callback = False + raise AssertionError('"io.callback = False" must raise TypeError') + except TypeError: + pass + try: + io.callback = 5 + raise AssertionError('"io.callback = 5" must raise TypeError') + except TypeError: + pass + # test that args can be changed later + io.args = (1, 2, 3) + # test that only tuple and None are accepted by 'args' attribute + try: + io.args = 5 + raise AssertionError('"io.args = 5" must raise TypeError') + except TypeError: + pass + self.assertEqual(io.args, (1, 2, 3)) + try: + io.args = [4, 5] + raise AssertionError('"io.args = [4, 5]" must raise TypeError') + except TypeError: + pass + self.assertEqual(io.args, (1, 2, 3)) + # None also works, means empty tuple + io.args = None + start = core.time() + loop.run() + took = core.time() - start + self.assertEqual(lst, [()]) + assert took < 1, took + + io.start(reset, io, lst) + del io + loop.run() + self.assertEqual(lst, [(), 25]) + + +def reset(watcher, lst): + watcher.args = None + watcher.callback = lambda: None + lst.append(25) + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__destroy.py python-gevent-1.0/greentest/test__destroy.py --- python-gevent-0.13.7/greentest/test__destroy.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__destroy.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,27 @@ +import gevent +# Loop of initial Hub is default loop. +hub = gevent.get_hub() +assert hub.loop.default, hub + +# Destroy hub. Does not destroy default loop if not explicitly told to. +hub.destroy() +hub = gevent.get_hub() +assert hub.loop.default, hub + +saved_loop = hub.loop +# Destroy hub including default loop. +hub.destroy(destroy_loop=True) +assert saved_loop.fileno() is None, saved_loop +print hub, saved_loop + +# Create new hub and explicitly request creation of a new default loop. +hub = gevent.get_hub(default=True) +assert hub.loop.default, hub + +# Destroy hub including default loop. +hub.destroy(destroy_loop=True) + +# Create new non-default loop in new hub. +hub = gevent.get_hub() +assert not hub.loop.default, hub +hub.destroy() diff -Nru python-gevent-0.13.7/greentest/test__dns.py python-gevent-1.0/greentest/test__dns.py --- python-gevent-0.13.7/greentest/test__dns.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__dns.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -#!/usr/bin/python -import greentest -from gevent import dns -from gevent import core -from gevent.dns import DNSError - -funcs = [dns.resolve_ipv4, dns.resolve_ipv6, - dns.resolve_reverse, dns.resolve_reverse_ipv6] - - -class TestNoSwitch(greentest.TestCase): - - switch_expected = False - - def test_type_error(self): - for func in funcs: - self.assertRaises(TypeError, func, None) - self.assertRaises(TypeError, func, 15) - self.assertRaises(TypeError, func, object()) - - def test_dns_err_to_string(self): - for err in range(-100, 100): - result = core.dns_err_to_string(err) - assert result, result - assert isinstance(result, str) - - -class TestSwitch(greentest.TestCase): - - switch_expected = True - __timeout__ = 10 - - def test_empty_string(self): - self.assertRaises(DNSError, dns.resolve_ipv4, '') - self.assertRaises(DNSError, dns.resolve_ipv6, '') - self.assertRaises(DNSError, dns.resolve_reverse, '') - self.assertRaises(DNSError, dns.resolve_reverse_ipv6, '') - - -if __name__ == '__main__': - greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__doctests.py python-gevent-1.0/greentest/test__doctests.py --- python-gevent-0.13.7/greentest/test__doctests.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__doctests.py 2013-11-26 16:25:45.000000000 +0000 @@ -14,13 +14,14 @@ def myfunction(*args, **kwargs): pass + if __name__ == '__main__': cwd = os.getcwd() try: allowed_modules = sys.argv[1:] sys.path.append('.') base = os.path.dirname(gevent.__file__) - print base + print (base) os.chdir('..') globs = {'myfunction': myfunction, 'gevent': gevent, 'socket': socket} @@ -46,14 +47,14 @@ if re.search('^\s*>>> ', open(path).read(), re.M): try: s = doctest.DocTestSuite(m, extraglobs=globs) - print '%s (from %s): %s tests' % (m, path, len(s._tests)) + print ('%s (from %s): %s tests' % (m, path, len(s._tests))) suite.addTest(s) modules_count += 1 tests_count += len(s._tests) except Exception: traceback.print_exc() sys.stderr.write('Failed to process %s\n\n' % path) - print 'Total: %s tests in %s modules' % (tests_count, modules_count) + print ('Total: %s tests in %s modules' % (tests_count, modules_count)) runner = unittest.TextTestRunner(verbosity=2) runner.run(suite) finally: diff -Nru python-gevent-0.13.7/greentest/test__environ.py python-gevent-1.0/greentest/test__environ.py --- python-gevent-0.13.7/greentest/test__environ.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__environ.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,12 @@ +import os +import sys +import gevent +import subprocess + +if sys.argv[1:] == []: + os.environ['GEVENT_BACKEND'] = 'select' + popen = subprocess.Popen([sys.executable, 'test__environ.py', '1']) + assert popen.wait() == 0, popen.poll() +else: + hub = gevent.get_hub() + assert hub.loop.backend == 'select', hub.loop.backend diff -Nru python-gevent-0.13.7/greentest/test__event.py python-gevent-1.0/greentest/test__event.py --- python-gevent-0.13.7/greentest/test__event.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__event.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,5 +1,6 @@ import greentest import gevent +import sys from gevent.event import Event, AsyncResult DELAY = 0.01 @@ -11,12 +12,24 @@ Event().wait(timeout=timeout) +class TestWaitEvent(greentest.GenericWaitTestCase): + + def wait(self, timeout): + gevent.wait([Event()], timeout=timeout) + + class TestAsyncResultWait(greentest.GenericWaitTestCase): def wait(self, timeout): AsyncResult().wait(timeout=timeout) +class TestWaitAsyncResult(greentest.GenericWaitTestCase): + + def wait(self, timeout): + gevent.wait([AsyncResult()], timeout=timeout) + + class TestAsyncResultGet(greentest.GenericGetTestCase): def wait(self, timeout): @@ -33,7 +46,8 @@ try: result = e.get() log.append(('received', result)) - except Exception, ex: + except Exception: + ex = sys.exc_info()[1] log.append(('catched', ex)) gevent.spawn(waiter) obj = Exception() @@ -59,7 +73,8 @@ g.kill() -class TestAsync_ResultAsLinkTarget(greentest.TestCase): +class TestAsyncResultAsLinkTarget(greentest.TestCase): + error_fatal = False def test_set(self): g = gevent.spawn(lambda: 1) @@ -73,7 +88,7 @@ def test_set_exception(self): def func(): - raise greentest.ExpectedException('TestAsync_ResultAsLinkTarget.test_set_exception') + raise greentest.ExpectedException('TestAsyncResultAsLinkTarget.test_set_exception') g = gevent.spawn(func) s1, s2, s3 = AsyncResult(), AsyncResult(), AsyncResult() g.link(s1) @@ -89,7 +104,7 @@ def test(self): e = Event() - waiters = [gevent.spawn(e.wait) for i in xrange(self.N)] + waiters = [gevent.spawn(e.wait) for i in range(self.N)] gevent.sleep(0.001) e.set() e.clear() @@ -105,6 +120,52 @@ N = 1000 +class TestWait(greentest.TestCase): + N = 5 + count = None + timeout = 1 + period = 0.01 + + def _sender(self, events, asyncs): + while events or asyncs: + gevent.sleep(self.period) + if events: + events.pop().set() + gevent.sleep(self.period) + if asyncs: + asyncs.pop().set() + + def test(self): + events = [Event() for _ in xrange(self.N)] + asyncs = [AsyncResult() for _ in xrange(self.N)] + max_len = len(events) + len(asyncs) + sender = gevent.spawn(self._sender, events, asyncs) + results = gevent.wait(events + asyncs, count=self.count, timeout=self.timeout) + if self.timeout is None: + expected_len = max_len + else: + expected_len = min(max_len, self.timeout / self.period) + if self.count is None: + assert sender.ready() + else: + expected_len = min(self.count, expected_len) + assert not sender.ready() + sender.kill() + assert expected_len == len(results), (expected_len, results) + + +class TestWait_notimeout(TestWait): + timeout = None + + +class TestWait_count1(TestWait): + count = 1 + + +class TestWait_count2(TestWait): + count = 2 + + X = object() if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__example_echoserver.py python-gevent-1.0/greentest/test__example_echoserver.py --- python-gevent-0.13.7/greentest/test__example_echoserver.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__example_echoserver.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,28 @@ +from __future__ import with_statement +from gevent.socket import create_connection, timeout +from unittest import main +import gevent + +import util + + +class Test(util.TestServer): + server = 'echoserver.py' + + def _run_all_tests(self): + def test_client(message): + conn = create_connection(('127.0.0.1', 6000)).makefile(bufsize=1) + welcome = conn.readline() + assert 'Welcome' in welcome, repr(welcome) + conn.write(message) + received = conn.read(len(message)) + self.assertEqual(received, message) + conn._sock.settimeout(0.1) + self.assertRaises(timeout, conn.read, 1) + client1 = gevent.spawn(test_client, 'hello\r\n') + client2 = gevent.spawn(test_client, 'world\r\n') + gevent.joinall([client1, client2], raise_error=True) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__example_portforwarder.py python-gevent-1.0/greentest/test__example_portforwarder.py --- python-gevent-0.13.7/greentest/test__example_portforwarder.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__example_portforwarder.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,65 @@ +from __future__ import with_statement +from gevent import monkey; monkey.patch_all() +import sys +import socket +from time import sleep + +import gevent +from gevent.server import StreamServer + +import util + + +class Test(util.TestServer): + server = 'portforwarder.py' + args = ['127.0.0.1:10011', '127.0.0.1:10012'] + + def after(self): + if sys.platform == 'win32': + assert self.popen.poll() is not None + else: + self.assertEqual(self.popen.poll(), 0) + + def _run_all_tests(self): + log = [] + + def handle(socket, address): + while True: + data = socket.recv(1024) + print 'got %r' % data + if not data: + break + log.append(data) + + server = StreamServer(self.args[1], handle) + server.start() + try: + conn = socket.create_connection(('127.0.0.1', 10011)) + conn.sendall('msg1') + sleep(0.1) + self.popen.send_signal(15) + sleep(0.1) + try: + conn.sendall('msg2') + conn.close() + except socket.error: + if sys.platform != 'win32': + raise + # On Windows, signal/15 kills the process rather than actually sends a signal + # so, sendall('msg2') fails with + # error: [Errno 10054] An existing connection was forcibly closed by the remote host + # XXX maybe it could be made working with CTRL_C_EVENT somehow? + with gevent.Timeout(0.1): + self.popen.wait() + finally: + server.close() + + if sys.platform == 'win32': + self.assertEqual(['msg1'], log) + else: + self.assertEqual(['msg1', 'msg2'], log) + + +if __name__ == '__main__': + from unittest import main + main() diff -Nru python-gevent-0.13.7/greentest/test___example_servers.py python-gevent-1.0/greentest/test___example_servers.py --- python-gevent-0.13.7/greentest/test___example_servers.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test___example_servers.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,72 @@ +import sys +import time +from unittest import main +if sys.version_info[0] == 3: + from urllib import request as urllib2 +else: + import urllib2 + +import util + + +class Test_wsgiserver(util.TestServer): + server = 'wsgiserver.py' + URL = 'http://127.0.0.1:8088' + not_found_message = '

Not Found

' + + def read(self, path='/'): + url = self.URL + path + try: + response = urllib2.urlopen(url) + except urllib2.HTTPError: + response = sys.exc_info()[1] + return '%s %s' % (response.code, response.msg), response.read() + + def _test_hello(self): + status, data = self.read('/') + self.assertEqual(status, '200 OK') + self.assertEqual(data, "hello world") + + def _test_not_found(self): + status, data = self.read('/xxx') + self.assertEqual(status, '404 Not Found') + self.assertEqual(data, self.not_found_message) + + +class Test_wsgiserver_ssl(Test_wsgiserver): + server = 'wsgiserver_ssl.py' + URL = 'https://127.0.0.1:8443' + + +class Test_webproxy(Test_wsgiserver): + server = 'webproxy.py' + + def _run_all_tests(self): + status, data = self.read('/') + self.assertEqual(status, '200 OK') + assert "gevent example" in data, repr(data) + status, data = self.read('/http://www.google.com') + self.assertEqual(status, '200 OK') + assert 'google' in data.lower(), repr(data) + + +class Test_webpy(Test_wsgiserver): + server = 'webpy.py' + not_found_message = 'not found' + + def _test_hello(self): + status, data = self.read('/') + self.assertEqual(status, '200 OK') + assert "Hello, world" in data, repr(data) + + def _test_long(self): + start = time.time() + status, data = self.read('/long') + delay = time.time() - start + assert 10 - 0.5 < delay < 10 + 0.5, delay + self.assertEqual(status, '200 OK') + self.assertEqual(data, 'Hello, 10 seconds later') + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__examples.py python-gevent-1.0/greentest/test__examples.py --- python-gevent-0.13.7/greentest/test__examples.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__examples.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,203 +1,51 @@ import sys import os import glob -from os.path import join, abspath, dirname, normpath, basename -import unittest -import urllib2 import time -import signal -import re -import gevent -from gevent import socket -import mysubprocess as subprocess +import util -# Ignore tracebacks: KeyboardInterrupt -base_dir = normpath(join(dirname(abspath(__file__)), '..')) -glob_expression = join(base_dir, 'examples', '*.py') -examples = glob.glob(glob_expression) -simple_examples = [] -examples_directory = dirname(examples[0]) +cwd = '../examples/' +ignore = ['wsgiserver.py', 'wsgiserver_ssl.py', 'webproxy.py', 'webpy.py', 'unixsocket_server.py', 'unixsocket_client.py'] +if sys.platform == 'win32': + ignore += ['geventsendfile.py', 'psycopg2_pool.py'] +ignore += [x[14:] for x in glob.glob('test__example_*.py')] -for example in examples: - if 'serve_forever' not in open(example).read(): - simple_examples.append(example) +default_time_range = (2, 4) +time_ranges = { + 'concurrent_download.py': (0, 30), + 'geventsendfile.py': (0, 4), + 'processes.py': (0, 4)} -print '\n'.join(examples) +def main(tests=None): + if not tests: + tests = set(os.path.basename(x) for x in glob.glob('../examples/*.py')) + tests = sorted(tests) -def make_test(path): + failed = [] - if ' ' in path: - path = '"%s"' % path + for filename in tests: + if filename in ignore: + continue + min_time, max_time = time_ranges.get(filename, default_time_range) - class TestExample(unittest.TestCase): - - def test(self): - exe = sys.executable - if ' ' in exe: - exe = '"%s"' % exe - cmd = '%s %s' % (exe, path) - print >> sys.stderr, cmd - res = os.system(cmd) - assert not res, '%s failed with %s' % (path, res) - - TestExample.__name__ = 'TestExample_' + basename(path).split('.')[0] - - return TestExample - - -for example in simple_examples: - test = make_test(example) - globals()[test.__name__] = test - print 'Added %s' % test.__name__ - del test - - -class BaseTestServer(unittest.TestCase): - - def setUp(self): - self.process = subprocess.Popen([sys.executable, join(examples_directory, self.path)], cwd=examples_directory) - time.sleep(1) - - def tearDown(self): - self.assertEqual(self.process.poll(), None) - self.process.interrupt() - time.sleep(0.5) - - -class Test_httpserver(BaseTestServer): - path = 'httpserver.py' - URL = 'http://localhost:8088' - not_found_message = '

Not Found

' - - def read(self, path='/'): - url = self.URL + path - try: - response = urllib2.urlopen(url) - except urllib2.HTTPError, response: - pass - return '%s %s' % (response.code, response.msg), response.read() - - def _test_hello(self): - status, data = self.read('/') - self.assertEqual(status, '200 OK') - self.assertEqual(data, "hello world") - - def _test_not_found(self): - status, data = self.read('/xxx') - self.assertEqual(status, '404 Not Found') - self.assertEqual(data, self.not_found_message) - - def test(self): - # running all the test methods now so that we don't set up a server more than once - for method in dir(self): - if method.startswith('_test'): - function = getattr(self, method) - if callable(function): - function() - - -class Test_wsgiserver(Test_httpserver): - path = 'wsgiserver.py' - - -if hasattr(socket, 'ssl'): - - class Test_wsgiserver_ssl(Test_httpserver): - path = 'wsgiserver_ssl.py' - URL = 'https://localhost:8443' - -else: - - class Test_wsgiserver_ssl(unittest.TestCase): - path = 'wsgiserver_ssl.py' - - def setUp(self): - self.process = subprocess.Popen([sys.executable, join(examples_directory, self.path)], - cwd=examples_directory, stderr=subprocess.PIPE) - time.sleep(1) - - def test(self): - self.assertEqual(self.process.poll(), 1) - stderr = self.process.stderr.read().strip() - m = re.match('Traceback \(most recent call last\):.*?ImportError: .*?ssl.*', stderr, re.DOTALL) - assert m is not None, repr(stderr) - - def tearDown(self): - if self.process.poll() is None: - try: - SIGINT = getattr(signal, 'SIGINT', None) - if SIGINT is not None: - os.kill(self.process.pid, SIGINT) - time.sleep(0.1) - self.assertEqual(self.process.poll(), 1) - finally: - if self.process.poll() is None: - self.process.kill() - - -class Test_webpy(Test_httpserver): - path = 'webpy.py' - not_found_message = 'not found' - - def _test_hello(self): - status, data = self.read('/') - self.assertEqual(status, '200 OK') - assert "Hello, world" in data, repr(data) - - def _test_long(self): start = time.time() - status, data = self.read('/long') - delay = time.time() - start - assert 10 - 0.1 < delay < 10 + 0.1, delay - self.assertEqual(status, '200 OK') - self.assertEqual(data, 'Hello, 10 seconds later') - - -class Test_webproxy(Test_httpserver): - path = 'webproxy.py' - - def test(self): - status, data = self.read('/') - self.assertEqual(status, '200 OK') - assert "gevent example" in data, repr(data) - status, data = self.read('/http://www.google.com') - self.assertEqual(status, '200 OK') - assert 'google' in data.lower(), repr(data) - - -class Test_echoserver(BaseTestServer): - path = 'echoserver.py' - - def test(self): - def test_client(message): - conn = socket.create_connection(('127.0.0.1', 6000)).makefile(bufsize=1) - welcome = conn.readline() - assert 'Welcome' in welcome, repr(welcome) - conn.write(message) - received = conn.read(len(message)) - self.assertEqual(received, message) - conn._sock.settimeout(0.1) - self.assertRaises(socket.timeout, conn.read, 1) - client1 = gevent.spawn_link_exception(test_client, 'hello\r\n') - client2 = gevent.spawn_link_exception(test_client, 'world\r\n') - gevent.joinall([client1, client2]) - - -class TestAllTested(unittest.TestCase): - - def test(self): - tests = set() - for klass in globals(): - if klass.startswith('Test'): - path = getattr(globals()[klass], 'path', None) - if path is not None: - tests.add(path) - untested = set(examples) - set(simple_examples) - untested = set(basename(path) for path in untested) - tests - assert not untested, 'The following examples have not been tested: %s' % '\n'.join(untested) + if util.run([sys.executable, '-u', filename], timeout=max_time, cwd=cwd): + failed.append(filename) + else: + took = time.time() - start + if took < min_time: + util.log('! Failed example %s: exited too quickly, after %.1fs (expected %.1fs)', filename, took, min_time) + failed.append(filename) + + if failed: + util.log('! Failed examples:\n! - %s', '\n! - '.join(failed)) + sys.exit(1) + + if not tests: + sys.exit('No tests.') if __name__ == '__main__': - unittest.main() + main() diff -Nru python-gevent-0.13.7/greentest/test__example_udp_client.py python-gevent-1.0/greentest/test__example_udp_client.py --- python-gevent-0.13.7/greentest/test__example_udp_client.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__example_udp_client.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,27 @@ +from gevent import monkey; monkey.patch_all() +import sys +from gevent.server import DatagramServer +from unittest import TestCase, main +from util import run + + +class Test_udp_client(TestCase): + + def test(self): + log = [] + + def handle(message, address): + log.append(message) + server.sendto('reply-from-server', address) + + server = DatagramServer('127.0.0.1:9000', handle) + server.start() + try: + run([sys.executable, '-u', 'udp_client.py', 'Test_udp_client'], timeout=10, cwd='../examples/') + finally: + server.close() + self.assertEqual(log, ['Test_udp_client']) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__example_udp_server.py python-gevent-1.0/greentest/test__example_udp_server.py --- python-gevent-0.13.7/greentest/test__example_udp_server.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__example_udp_server.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,18 @@ +import socket +from unittest import main +import util + + +class Test(util.TestServer): + server = 'udp_server.py' + + def _run_all_tests(self): + sock = socket.socket(type=socket.SOCK_DGRAM) + sock.connect(('127.0.0.1', 9000)) + sock.send('Test udp_server') + data, address = sock.recvfrom(8192) + self.assertEqual(data, 'Received 15 bytes') + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__exc_info.py python-gevent-1.0/greentest/test__exc_info.py --- python-gevent-0.13.7/greentest/test__exc_info.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__exc_info.py 2013-11-26 16:25:45.000000000 +0000 @@ -17,6 +17,13 @@ raise expected_error +def hello2(): + try: + hello() + except ExpectedError: + pass + + error = Exception('hello') @@ -26,23 +33,22 @@ try: raise error except: - self.hook_stderr() + self.expect_one_error() g = gevent.spawn(hello) g.join() - self.assert_stderr_traceback(expected_error) - self.assert_stderr(' failed with ExpectedError') + self.assert_error(ExpectedError, expected_error) if not isinstance(g.exception, ExpectedError): raise g.exception try: raise - except Exception, ex: + except Exception: + ex = sys.exc_info()[1] assert ex is error, (ex, error) def test2(self): - gevent.core.timer(0, hello) - self.hook_stderr() + timer = gevent.get_hub().loop.timer(0) + timer.start(hello2) gevent.sleep(0.1) - self.assert_stderr_traceback(expected_error) assert sys.exc_info() == (None, None, None), sys.exc_info() diff -Nru python-gevent-0.13.7/greentest/test__execmodules.py python-gevent-1.0/greentest/test__execmodules.py --- python-gevent-0.13.7/greentest/test__execmodules.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__execmodules.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,11 +1,28 @@ -import sys -import traceback -from greentest import walk_modules +from greentest import walk_modules, BaseTestCase, main +import six + + +class TestExec(BaseTestCase): + pass + + +def make_exec_test(path, module): + + def test(self): + #sys.stderr.write('%s %s\n' % (module, path)) + f = open(path) + src = f.read() + f.close() + six.exec_(src, {}) + + name = "test_" + module.replace(".", "_") + test.__name__ = name + setattr(TestExec, name, test) for path, module in walk_modules(): - sys.stderr.write('%s %s\n' % (module, path)) - try: - execfile(path) - except Exception: - traceback.print_exc() + make_exec_test(path, module) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__fileobject.py python-gevent-1.0/greentest/test__fileobject.py --- python-gevent-0.13.7/greentest/test__fileobject.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__fileobject.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,95 @@ +import os +import greentest +import gevent +from gevent.fileobject import FileObject, FileObjectThread + + +class Test(greentest.TestCase): + + def _test_del(self, **kwargs): + r, w = os.pipe() + s = FileObject(w, 'wb') + s.write('x') + s.flush() + del s + try: + os.close(w) + except OSError: + pass # expected, because SocketAdapter already closed it + else: + raise AssertionError('os.close(%r) must not succeed' % w) + self.assertEqual(FileObject(r).read(), 'x') + + def test_del(self): + self._test_del() + + def test_del_close(self): + self._test_del(close=True) + + if FileObject is not FileObjectThread: + + def test_del_noclose(self): + r, w = os.pipe() + s = FileObject(w, 'wb', close=False) + s.write('x') + s.flush() + del s + os.close(w) + self.assertEqual(FileObject(r).read(), 'x') + + def test_newlines(self): + r, w = os.pipe() + lines = ['line1\n', 'line2\r', 'line3\r\n', 'line4\r\nline5', '\nline6'] + g = gevent.spawn(writer, FileObject(w, 'wb'), lines) + try: + result = FileObject(r, 'rU').read() + self.assertEqual('line1\nline2\nline3\nline4\nline5\nline6', result) + finally: + g.kill() + + +def writer(fobj, line): + for character in line: + fobj.write(character) + fobj.flush() + fobj.close() + + +try: + from gevent.fileobject import SocketAdapter +except ImportError: + pass +else: + + class TestSocketAdapter(greentest.TestCase): + + def _test_del(self, **kwargs): + r, w = os.pipe() + s = SocketAdapter(w) + s.sendall('x') + del s + try: + os.close(w) + except OSError: + pass # expected, because SocketAdapter already closed it + else: + raise AssertionError('os.close(%r) must not succeed' % w) + self.assertEqual(FileObject(r).read(), 'x') + + def test_del(self): + self._test_del() + + def test_del_close(self): + self._test_del(close=True) + + def test_del_noclose(self): + r, w = os.pipe() + s = SocketAdapter(w, close=False) + s.sendall('x') + del s + os.close(w) + self.assertEqual(FileObject(r).read(), 'x') + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__greenio.py python-gevent-1.0/greentest/test__greenio.py --- python-gevent-0.13.7/greentest/test__greenio.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__greenio.py 2013-11-26 16:25:45.000000000 +0000 @@ -17,7 +17,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from greentest import TestCase, main +from greentest import TestCase, main, tcp_listener import gevent from gevent import socket @@ -65,12 +65,12 @@ assert fd.read() == '' fd.close() - server = socket.tcp_listener(('0.0.0.0', 0)) + server = tcp_listener(('0.0.0.0', 0)) server_greenlet = gevent.spawn(accept_close_early, server) did_it_work(server) server_greenlet.kill() - server = socket.tcp_listener(('0.0.0.0', 0)) + server = tcp_listener(('0.0.0.0', 0)) server_greenlet = gevent.spawn(accept_close_late, server) did_it_work(server) server_greenlet.kill() @@ -92,7 +92,7 @@ finally: listener.close() - server = socket.tcp_listener(('0.0.0.0', 0)) + server = tcp_listener(('0.0.0.0', 0)) gevent.spawn(accept_once, server) client = socket.create_connection(('127.0.0.1', server.getsockname()[1])) fd = client.makefile() diff -Nru python-gevent-0.13.7/greentest/test__GreenletExit.py python-gevent-1.0/greentest/test__GreenletExit.py --- python-gevent-0.13.7/greentest/test__GreenletExit.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__GreenletExit.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,4 @@ +from gevent import GreenletExit + +assert issubclass(GreenletExit, BaseException) +assert not issubclass(GreenletExit, Exception) diff -Nru python-gevent-0.13.7/greentest/test__greenlet.py python-gevent-1.0/greentest/test__greenlet.py --- python-gevent-0.13.7/greentest/test__greenlet.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__greenlet.py 2013-11-26 16:25:45.000000000 +0000 @@ -26,9 +26,10 @@ from gevent import sleep, with_timeout, getcurrent from gevent import greenlet from gevent.event import AsyncResult -from gevent.queue import Queue +from gevent.queue import Queue, Channel DELAY = 0.01 +greentest.TestCase.error_fatal = False class ExpectedError(Exception): @@ -49,31 +50,13 @@ raise raise AssertionError('%s not raised, returned %r' % (err, result)) - def test_link_to_greenlet(self): - p = gevent.spawn(lambda: 100) - receiver = gevent.spawn(sleep, 1) - p.link(receiver) - self.assertRaises(greenlet.LinkedCompleted, receiver.get) - receiver2 = gevent.spawn(sleep, 1) - p.link(receiver2) - self.assertRaises(greenlet.LinkedCompleted, receiver2.get) - - def test_link_to_inactive_greenlet(self): - p = gevent.spawn(lambda: 100) - receiver = gevent.spawn_later(10000, sleep, 1) - try: - p.link(receiver) - self.assertRaises(greenlet.LinkedCompleted, receiver.get) - finally: - receiver.kill() - def test_link_to_asyncresult(self): p = gevent.spawn(lambda: 100) event = AsyncResult() p.link(event) self.assertEqual(event.get(), 100) - for i in xrange(3): + for i in range(3): event2 = AsyncResult() p.link(event2) self.assertEqual(event2.get(), 100) @@ -85,10 +68,10 @@ p.link(event) self.assertRaises(err, event.get) - for i in xrange(3): + for i in range(3): event2 = AsyncResult() p.link(event2) - self.assertRaises(err, event.get) + self.assertRaises(err, event2.get) def test_link_to_queue(self): p = gevent.spawn(lambda: 100) @@ -96,7 +79,7 @@ p.link(q.put) self.assertEqual(q.get().get(), 100) - for i in xrange(3): + for i in range(3): p.link(q.put) self.assertEqual(q.get().get(), 100) @@ -104,69 +87,40 @@ p1 = gevent.spawn(lambda: 101) p2 = gevent.spawn(lambda: 102) p3 = gevent.spawn(lambda: 103) - q = Queue(0) + q = Channel() p1.link(q.put) p2.link(q.put) p3.link(q.put) results = [q.get().get(), q.get().get(), q.get().get()] assert sorted(results) == [101, 102, 103], results - def test_link_to_current(self): - p = gevent.spawn(lambda: 100) - p.link() - self.assertRaises(greenlet.LinkedCompleted, sleep, 0.1) - self.assertRaises(greenlet.LinkedCompleted, p.link) - class TestUnlink(greentest.TestCase): switch_expected = False - def setUp(self): - greentest.TestCase.setUp(self) - self.p = gevent.spawn(test_func) - - def _test_func(self, link): - p = self.p - link(test_func) + def _test_func(self, p, link): + link(dummy_test_func) assert len(p._links) == 1, p._links - p.unlink(test_func) + p.unlink(dummy_test_func) assert not p._links, p._links link(self.setUp) assert len(p._links) == 1, p._links p.unlink(self.setUp) assert not p._links, p._links + p.kill() def test_func_link(self): - self._test_func(self.p.link) + p = gevent.spawn(dummy_test_func) + self._test_func(p, p.link) def test_func_link_value(self): - self._test_func(self.p.link_value) + p = gevent.spawn(dummy_test_func) + self._test_func(p, p.link_value) def test_func_link_exception(self): - self._test_func(self.p.link_exception) - - def _test_greenlet(self, link): - p = self.p - link(getcurrent()) - assert len(p._links) == 1, p._links - p.unlink(getcurrent()) - assert not p._links, p._links - - g = gevent.Greenlet() - link(g) - assert len(p._links) == 1, p._links - p.unlink(g) - assert not p._links, p._links - - def test_greenlet_link(self): - self._test_greenlet(self.p.link) - - def test_greenlet_link_value(self): - self._test_greenlet(self.p.link_value) - - def test_greenlet_link_exception(self): - self._test_greenlet(self.p.link_exception) + p = gevent.spawn(dummy_test_func) + self._test_func(p, p.link_exception) class LinksTestCase(greentest.TestCase): @@ -174,30 +128,13 @@ def link(self, p, listener=None): getattr(p, self.link_method)(listener) - def receiverf(self, proc_flag): - sleep(DELAY) - proc_flag.append('finished') - - def set_links(self, p, first_time, kill_exc_type): + def set_links(self, p): event = AsyncResult() self.link(p, event) - proc_flag = [] - - receiver = gevent.spawn(self.receiverf, proc_flag) - self.link(p, receiver) - queue = Queue(1) self.link(p, queue.put) - try: - self.link(p) - except kill_exc_type: - if first_time: - raise - else: - assert first_time, 'not raising here only first time' - callback_flag = ['initial'] self.link(p, lambda *args: callback_flag.remove('initial')) @@ -205,32 +142,20 @@ self.link(p, AsyncResult()) self.link(p, Queue(1).put) - return event, receiver, proc_flag, queue, callback_flag - - def myprocf(self, proc_finished_flag): - sleep(10) - proc_finished_flag.append('finished') - return 555 + return event, queue, callback_flag def set_links_timeout(self, link): # stuff that won't be touched event = AsyncResult() link(event) - proc_finished_flag = [] - myproc = gevent.spawn(self.myprocf, proc_finished_flag) - link(myproc) - - queue = Queue(0) + queue = Channel() link(queue.put) - return event, myproc, proc_finished_flag, queue + return event, queue - def check_timed_out(self, event, myproc, proc_finished_flag, queue): + def check_timed_out(self, event, queue): assert with_timeout(DELAY, event.get, timeout_value=X) is X, repr(event.get()) assert with_timeout(DELAY, queue.get, timeout_value=X) is X, queue.get() - assert with_timeout(DELAY, gevent.joinall, [myproc], timeout_value=X) is X - assert proc_finished_flag == [], proc_finished_flag - myproc.kill() def return25(): @@ -250,70 +175,47 @@ def test_return(self): self.p = gevent.spawn(return25) - self._test_return(self.p, True, 25, greenlet.LinkedCompleted, sleep0) - # repeating the same with dead process - for _ in xrange(3): - self._test_return(self.p, False, 25, greenlet.LinkedCompleted, sleep0) - self.cleanup() + for _ in range(3): + self._test_return(self.p, 25, sleep0) self.p.kill() - def _test_return(self, p, first_time, result, kill_exc_type, action): - event, receiver, proc_flag, queue, callback_flag = self.set_links(p, first_time, kill_exc_type) + def _test_return(self, p, result, action): + event, queue, callback_flag = self.set_links(p) # stuff that will time out because there's no unhandled exception: xxxxx = self.set_links_timeout(p.link_exception) - try: - sleep(DELAY * 2) - except kill_exc_type: - assert first_time, 'raising here only first time' - else: - assert not first_time, 'Should not raise LinkedKilled here after first time' - + sleep(DELAY * 2) assert not p, p self.assertEqual(event.get(), result) self.assertEqual(queue.get().get(), result) - self.assertRaises(kill_exc_type, receiver.get) - self.assertRaises(kill_exc_type, gevent.joinall, [receiver], raise_error=True) sleep(DELAY) - assert not proc_flag, proc_flag assert not callback_flag, callback_flag self.check_timed_out(*xxxxx) - def _test_kill(self, p, first_time, kill_exc_type): - event, receiver, proc_flag, queue, callback_flag = self.set_links(p, first_time, kill_exc_type) + def _test_kill(self, p): + event, queue, callback_flag = self.set_links(p) xxxxx = self.set_links_timeout(p.link_exception) p.kill() - try: - sleep(DELAY) - except kill_exc_type: - assert first_time, 'raising here only first time' - else: - assert not first_time, 'Should not raise LinkedKilled here after first time' - + sleep(DELAY) assert not p, p assert isinstance(event.get(), greenlet.GreenletExit), event.get() assert isinstance(queue.get().get(), greenlet.GreenletExit), queue.get().get() - self.assertRaises(kill_exc_type, gevent.joinall, [receiver], raise_error=True) - self.assertRaises(kill_exc_type, receiver.get) sleep(DELAY) - assert not proc_flag, proc_flag assert not callback_flag, callback_flag self.check_timed_out(*xxxxx) def test_kill(self): p = self.p = gevent.spawn(sleep, DELAY) - self._test_kill(p, True, greenlet.LinkedKilled) - # repeating the same with dead process - for _ in xrange(3): - self._test_kill(p, False, greenlet.LinkedKilled) + for _ in range(3): + self._test_kill(p) class TestReturn_link_value(TestReturn_link): @@ -323,35 +225,24 @@ class TestRaise_link(LinksTestCase): link_method = 'link' - def _test_raise(self, p, first_time, kill_exc_type): - event, receiver, proc_flag, queue, callback_flag = self.set_links(p, first_time, kill_exc_type) + def _test_raise(self, p): + event, queue, callback_flag = self.set_links(p) xxxxx = self.set_links_timeout(p.link_value) - try: - sleep(DELAY) - except kill_exc_type: - assert first_time, 'raising here only first time' - else: - assert not first_time, 'Should not raise LinkedKilled here after first time' - + sleep(DELAY) assert not p, p self.assertRaises(ExpectedError, event.get) self.assertEqual(queue.get(), p) - self.assertRaises(kill_exc_type, receiver.get) - self.assertRaises(kill_exc_type, gevent.joinall, [receiver], raise_error=True) sleep(DELAY) - assert not proc_flag, proc_flag assert not callback_flag, callback_flag self.check_timed_out(*xxxxx) def test_raise(self): p = self.p = gevent.spawn(lambda: getcurrent().throw(ExpectedError('test_raise'))) - self._test_raise(p, True, greenlet.LinkedFailed) - # repeating the same with dead process - for _ in xrange(3): - self._test_raise(p, False, greenlet.LinkedFailed) + for _ in range(3): + self._test_raise(p) class TestRaise_link_exception(TestRaise_link): @@ -373,23 +264,16 @@ e = AsyncResult() x.link(e) self.assertEqual(e.get(), 1) - #self.assertEqual([proc.waitall([X]) for X in [x, y, z]], [[1], [2], [3]]) def test_wait_error(self): def x(): sleep(DELAY) return 1 x = gevent.spawn(x) - z = gevent.spawn(lambda: 3) y = gevent.spawn(lambda: getcurrent().throw(ExpectedError('test_wait_error'))) - y.link(x) - x.link(y) - y.link(z) - z.link(y) - self.assertRaises(ExpectedError, gevent.joinall, [x, y, z], raise_error=True) - self.assertRaises(greenlet.LinkedFailed, gevent.joinall, [x], raise_error=True) - self.assertEqual(z.get(), 3) + self.assertRaises(ExpectedError, gevent.joinall, [x, y], raise_error=True) self.assertRaises(ExpectedError, gevent.joinall, [y], raise_error=True) + x.join() def test_joinall_exception_order(self): # if there're several exceptions raised, the earliest one must be raised by joinall @@ -400,7 +284,8 @@ b = gevent.spawn(lambda: getcurrent().throw(ExpectedError('second'))) try: gevent.joinall([a, b], raise_error=True) - except ExpectedError, ex: + except ExpectedError: + ex = sys.exc_info()[1] assert 'second' in str(ex), repr(str(ex)) gevent.joinall([a, b]) @@ -488,19 +373,12 @@ raise ExpectedError('test_killing_unlinked') except: e.set_exception(sys.exc_info()[1]) + gevent.sleep(0) - p = gevent.spawn_link(func) - try: - try: - e.wait() - except ExpectedError: - pass - finally: - p.unlink() # this disables LinkedCompleted that otherwise would be raised by the next line sleep(DELAY) -def test_func(*args): +def dummy_test_func(*args): pass @@ -515,12 +393,12 @@ class TestStr(greentest.TestCase): def test_function(self): - g = gevent.Greenlet.spawn(test_func) - self.assertEqual(hexobj.sub('X', str(g)), '') + g = gevent.Greenlet.spawn(dummy_test_func) + self.assertEqual(hexobj.sub('X', str(g)), '') assert_not_ready(g) g.join() assert_ready(g) - self.assertEqual(hexobj.sub('X', str(g)), '') + self.assertEqual(hexobj.sub('X', str(g)), '') def test_method(self): g = gevent.Greenlet.spawn(A().method) @@ -538,31 +416,39 @@ class TestJoin(greentest.GenericWaitTestCase): def wait(self, timeout): - self.g = gevent.spawn(gevent.sleep, 10) - return self.g.join(timeout=timeout) - - def cleanup(self): - self.g.kill() + g = gevent.spawn(gevent.sleep, 10) + try: + return g.join(timeout=timeout) + finally: + g.kill() class TestGet(greentest.GenericGetTestCase): def wait(self, timeout): - self.g = gevent.spawn(gevent.sleep, 10) - return self.g.get(timeout=timeout) + g = gevent.spawn(gevent.sleep, 10) + try: + return g.get(timeout=timeout) + finally: + g.kill() - def cleanup(self): - self.g.kill() +class TestJoinAll0(greentest.GenericWaitTestCase): -class TestJoinAll(greentest.GenericWaitTestCase): + g = gevent.Greenlet() def wait(self, timeout): - self.g = gevent.spawn(gevent.sleep, 10) gevent.joinall([self.g], timeout=timeout) - def cleanup(self): - self.g.kill() + +class TestJoinAll(greentest.GenericWaitTestCase): + + def wait(self, timeout): + g = gevent.spawn(gevent.sleep, 10) + try: + gevent.joinall([g], timeout=timeout) + finally: + g.kill() class TestBasic(greentest.TestCase): @@ -576,7 +462,7 @@ g = gevent.Greenlet(func, 0.01, return_value=5) g.link(lambda x: link_test.append(x)) - assert not g + assert not g, bool(g) assert not g.dead assert not g.started assert not g.ready() @@ -585,7 +471,7 @@ assert g.exception is None g.start() - assert not g + assert g # changed assert not g.dead assert g.started # changed assert not g.ready() @@ -594,7 +480,7 @@ assert g.exception is None gevent.sleep(0.001) - assert g # changed + assert g assert not g.dead assert g.started assert not g.ready() @@ -708,8 +594,8 @@ link_test = [] g = gevent.spawn(gevent.sleep, 10) g.link(lambda x: link_test.append(x)) - gevent.sleep(0.01) self._test_kill(g, block=block) + gevent.sleep(0.01) assert link_test == [g] def test_kill_running_block(self): @@ -719,6 +605,23 @@ self._test_kill_running(block=False) +class TestStart(greentest.TestCase): + + def test(self): + g = gevent.spawn(gevent.sleep, 0.01) + assert g.started + assert not g.dead + g.start() + assert g.started + assert not g.dead + g.join() + assert not g.started + assert g.dead + g.start() + assert not g.started + assert g.dead + + def assert_ready(g): assert g.dead, g assert g.ready(), g @@ -730,6 +633,24 @@ assert not g.ready(), g +class TestRef(greentest.TestCase): + + def test_init(self): + self.switch_expected = False + # in python-dbg mode this will check that Greenlet() does not create any circular refs + gevent.Greenlet() + + def test_kill_scheduled(self): + gevent.spawn(gevent.sleep, 10).kill() + + def test_kill_started(self): + g = gevent.spawn(gevent.sleep, 10) + try: + gevent.sleep(0.001) + finally: + g.kill() + + X = object() if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__greenletset.py python-gevent-1.0/greentest/test__greenletset.py --- python-gevent-0.13.7/greentest/test__greenletset.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__greenletset.py 2013-11-26 16:25:45.000000000 +0000 @@ -70,9 +70,9 @@ assert len(s) == 2, s s.kill(block=False) assert len(s) == 2, s - gevent.sleep(0) - assert not s, s + gevent.sleep(0.0001) assert len(s) == 0, s + assert not s, s def test_kill_fires_once(self): u1 = Undead() diff -Nru python-gevent-0.13.7/greentest/test__greenness.py python-gevent-1.0/greentest/test__greenness.py --- python-gevent-0.13.7/greentest/test__greenness.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__greenness.py 2013-11-26 16:25:45.000000000 +0000 @@ -23,12 +23,18 @@ To do that spawn a green server and then access it using a green socket. If either operation blocked the whole script would block and timeout. """ +import greentest from gevent import monkey monkey.patch_all() - -import greentest -import urllib2 -import BaseHTTPServer +import sys +try: + import urllib2 +except ImportError: + from urllib import request as urllib2 +try: + import BaseHTTPServer +except ImportError: + from http import server as BaseHTTPServer import gevent @@ -50,9 +56,10 @@ try: urllib2.urlopen('http://127.0.0.1:%s' % port) assert False, 'should not get there' - except urllib2.HTTPError, ex: + except urllib2.HTTPError: + ex = sys.exc_info()[1] assert ex.code == 501, repr(ex) - server.join(0.01) + server.get(0.01) self.assertEqual(self.httpd.request_count, 1) self.httpd.server_close() self.httpd = None diff -Nru python-gevent-0.13.7/greentest/test__httplib.py python-gevent-1.0/greentest/test__httplib.py --- python-gevent-0.13.7/greentest/test__httplib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__httplib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -import unittest -from gevent import httplib - - -class Test(unittest.TestCase): - - def test(self): - conn = httplib.HTTPConnection('www.google.com') - conn.request('GET', '/') - conn.getresponse() - - -if __name__ == "__main__": - unittest.main() diff -Nru python-gevent-0.13.7/greentest/test__http.py python-gevent-1.0/greentest/test__http.py --- python-gevent-0.13.7/greentest/test__http.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__http.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ -from gevent import monkey; monkey.patch_socket() -import gevent -from gevent import http -import greentest -import os -import socket -import errno -from test__pywsgi import read_http - -# add test for "chunked POST input -> chunked output" - - -class BoundTestCase(greentest.TestCase): - - address = ('127.0.0.1', 0) - - def setUp(self): - greentest.TestCase.setUp(self) - self.server = http.HTTPServer(self.address, self.handle) - self.server.start() - - def tearDown(self): - #self.print_netstat('before stop') - timeout = gevent.Timeout.start_new(0.1) - try: - self.server.stop() - finally: - timeout.cancel() - self.check_refused() - greentest.TestCase.tearDown(self) - - def print_netstat(self, comment=''): - cmd = 'echo "%s" && netstat -anp 2>&1 | grep %s' % (comment, self.server.server_port) - os.system(cmd) - - def connect(self): - s = socket.socket() - s.connect((self.server.server_host, self.server.server_port)) - return s - - def urlopen(self, *args, **kwargs): - fd = self.connect().makefile(bufsize=1) - fd.write('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') - return read_http(fd, *args, **kwargs) - - def check_refused(self): - try: - self.connect() - except socket.error, ex: - if ex[0] != errno.ECONNREFUSED: - raise - except IOError, e: - print 'WARNING: instead of ECONNREFUSED got IOError: %s' % e - - -class TestNoop(BoundTestCase): - - def handle(self, r): - pass - - def test(self): - self.urlopen(code=500) - - -class TestClientCloses(BoundTestCase): - - # this test is useless. currently there's no way to know that the client closed the connection, - # because libevent calls close_cb callback after you've tried to push something to the client - - def handle(self, r): - self.log.append('reply') - gevent.sleep(0.1) - r.send_reply(200, 'OK', 'hello world') - # QQQ should I get an exception here because the connection is closed? - self.log.append('reply_done') - - def test(self): - self.log = ['hey'] - s = self.connect() - s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: 100\r\n\r\n') - s.close() - gevent.sleep(0.2) - self.assertEqual(self.log, ['hey', 'reply', 'reply_done']) - - -class TestStop(BoundTestCase): - - # this triggers if connection_closed is not handled properly - #p: http.c:1921: evhttp_send: Assertion `((&evcon->requests)->tqh_first) == req' failed. - - def reply(self, r): - # at this point object that was wrapped by r no longer exists - r.send_reply(200, 'OK', 'hello world') - - def handle(self, r): - # gonna reply later, when the connection is closed by the client - return gevent.spawn_later(0.01, self.reply, r) - - def test(self): - server = http.HTTPServer(self.address, self.handle) - server.start() - s = self.connect() - s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') - s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') - s.close() - server.stop() - gevent.sleep(0.02) - # stopping what already stopped is OK - server.stop() - - -class TestSendReply(BoundTestCase): - - def handle(self, r): - r.send_reply(200, 'OK', 'hello world') - - def test(self): - self.urlopen(body='hello world') - - def test_keepalive(self): - s = self.connect() - s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') - s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') - - -class TestException(BoundTestCase): - - def handle(self, r): - raise greentest.ExpectedException('TestException.handle') - - def test(self): - self.urlopen(code=500) - - -class TestSendReplyLater(BoundTestCase): - - def handle(self, r): - gevent.sleep(0.01) - r.send_reply(200, 'OK', 'hello world') - - def test(self): - self.urlopen(body='hello world') - - def test_client_closes_10(self): - s = self.connect() - s.sendall('GET / HTTP/1.0\r\n\r\n') - s.close() - gevent.sleep(0.02) - - def test_client_closes_11(self): - s = self.connect() - s.sendall('GET / HTTP/1.1\r\n\r\n') - s.close() - gevent.sleep(0.02) - - -class TestDetach(BoundTestCase): - - def handle(self, r): - input = r.input_buffer - output = r.output_buffer - assert r.input_buffer is input - assert r.output_buffer is output - assert input._obj - assert output._obj - r.detach() - assert not input._obj - assert not output._obj - assert input.read() == '' - assert output.read() == '' - self.handled = True - gevent.kill(self.current, Exception('test done')) - - def test(self): - self.current = gevent.getcurrent() - try: - try: - self.urlopen() - except Exception, ex: - assert str(ex) == 'test done', ex - finally: - self.current = None - assert self.handled - - -# class TestSendReplyStartChunk(BoundTestCase): -# spawn = True -# -# def handle(self, r): -# r.send_reply_start(200, 'OK') -# gevent.sleep(0.2) -# print 'handler sending chunk' -# r.send_reply_chunk('hi') -# print 'handler done' -# -# def test(self): -# response = urlopen(self.url) -# print 'connected to %s' % self.url -# assert response.code == 200, response -# assert response.msg == 'OK', response -# with gevent.Timeout(0.1, False): -# data = response.read() -# assert 'should not read anything', repr(data) -# self.print_netstat('before response.close') -# response.close() -# self.print_netstat('after response.close') -# print 123 -# gevent.sleep(0.5) -# print 1234 -# -# def test_client_closes(self): -# s = self.connect() -# s.sendall('GET / HTTP/1.0\r\n\r\n') -# gevent.sleep(0.1) -# #self.print_netstat('before close') -# s.close() -# #self.print_netstat('after close') -# gevent.sleep(0.5) - - -if __name__ == '__main__': - greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_hub_join.py python-gevent-1.0/greentest/test_hub_join.py --- python-gevent-0.13.7/greentest/test_hub_join.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test_hub_join.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,13 @@ +import gevent + +# hub.join() guarantees that loop has exited cleanly +res = gevent.get_hub().join() +assert res is True, res +res = gevent.get_hub().join() +assert res is True, res + +# but it is still possible to use gevent afterwards +gevent.sleep(0.01) + +res = gevent.get_hub().join() +assert res is True, res diff -Nru python-gevent-0.13.7/greentest/test_hub_join_timeout.py python-gevent-1.0/greentest/test_hub_join_timeout.py --- python-gevent-0.13.7/greentest/test_hub_join_timeout.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test_hub_join_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,90 @@ +from __future__ import with_statement +from contextlib import contextmanager +import gevent +from gevent.event import Event +from time import time + + +SMALL = 0.1 +FUZZY = SMALL / 2 + +# setting up signal does not affect join() +gevent.signal(1, lambda: None) # wouldn't work on windows + + +@contextmanager +def expected_time(expected, fuzzy=None): + if fuzzy is None: + fuzzy = expected / 2. + start = time() + yield + elapsed = time() - start + assert expected - fuzzy <= elapsed <= expected + fuzzy, 'Expected: %r; elapsed: %r' % (expected, elapsed) + + +def no_time(fuzzy=0.001): + return expected_time(0, fuzzy=fuzzy) + + +for _a in xrange(2): + + # exiting because the spawned greenlet finished execution (spawn (=callback) variant) + for _ in xrange(2): + x = gevent.spawn(lambda: 5) + with no_time(SMALL): + result = gevent.wait(timeout=10) + assert result is True, repr(result) + assert x.dead, x + assert x.value == 5, x + + # exiting because the spawned greenlet finished execution (spawn_later (=timer) variant) + for _ in xrange(2): + x = gevent.spawn_later(SMALL, lambda: 5) + with expected_time(SMALL): + result = gevent.wait(timeout=10) + assert result is True, repr(result) + assert x.dead, x + + # exiting because of timeout (the spawned greenlet still runs) + for _ in xrange(2): + x = gevent.spawn_later(10, lambda: 5) + with expected_time(SMALL): + result = gevent.wait(timeout=SMALL) + assert result is False, repr(result) + assert not x.dead, x + x.kill() + with no_time(): + result = gevent.wait() + assert result is True + + # exiting because of event (the spawned greenlet still runs) + for _ in xrange(2): + x = gevent.spawn_later(10, lambda: 5) + event = Event() + event_set = gevent.spawn_later(SMALL, event.set) + with expected_time(SMALL): + result = gevent.wait([event]) + assert result == [event], repr(result) + assert not x.dead, x + assert event_set.dead + assert event.is_set() + x.kill() + with no_time(): + result = gevent.wait() + assert result is True + + # checking "ref=False" argument + for _ in xrange(2): + gevent.get_hub().loop.timer(10, ref=False).start(lambda: None) + with no_time(): + result = gevent.wait() + assert result is True + + # checking "ref=False" attribute + for _d in xrange(2): + w = gevent.get_hub().loop.timer(10) + w.start(lambda: None) + w.ref = False + with no_time(): + result = gevent.wait() + assert result is True diff -Nru python-gevent-0.13.7/greentest/test__hub.py python-gevent-1.0/greentest/test__hub.py --- python-gevent-0.13.7/greentest/test__hub.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__hub.py 2013-11-26 16:25:45.000000000 +0000 @@ -20,34 +20,21 @@ # THE SOFTWARE. import greentest -import unittest import time import re -import sys import gevent -from gevent import core from gevent import socket -from gevent.hub import Waiter -import signal +from gevent.hub import Waiter, get_hub DELAY = 0.1 -class TestScheduleCall(greentest.TestCase): - - def test_global(self): - lst = [1] - gevent.spawn(core.timer, DELAY, lst.pop) - gevent.sleep(DELAY * 2) - assert lst == [], lst - - class TestCloseSocketWhilePolling(greentest.TestCase): def test(self): try: sock = socket.socket() - core.timer(0, sock.close) + get_hub().loop.timer(0, sock.close) sock.connect(('python.org', 81)) except Exception: gevent.sleep(0) @@ -65,56 +52,23 @@ assert delay >= DELAY * 0.9, 'sleep returned after %s seconds (was scheduled for %s)' % (delay, DELAY) + error = greentest.ExpectedException('TestExceptionInMainloop.test_sleep/fail') + def fail(): - raise greentest.ExpectedException('TestExceptionInMainloop.test_sleep/fail') + raise error - core.timer(0, fail) + t = get_hub().loop.timer(0.001) + t.start(fail) + + self.expect_one_error() start = time.time() gevent.sleep(DELAY) delay = time.time() - start - assert delay >= DELAY * 0.9, 'sleep returned after %s seconds (was scheduled for %s)' % (delay, DELAY) - - -class TestShutdown(unittest.TestCase): - - def _shutdown(self, seconds=0, fuzzy=None): - if fuzzy is None: - fuzzy = max(0.05, seconds / 2.) - start = time.time() - gevent.hub.shutdown() - delta = time.time() - start - assert seconds - fuzzy < delta < seconds + fuzzy, (seconds - fuzzy, delta, seconds + fuzzy) - - def assert_hub(self): - assert 'hub' in gevent.hub._threadlocal.__dict__ - - def assert_no_hub(self): - assert 'hub' not in gevent.hub._threadlocal.__dict__, gevent.hub._threadlocal.__dict__ - - def test(self): - # make sure Hub is started. For the test case when hub is not started, see test_hub_shutdown.py - gevent.sleep(0) - assert not gevent.hub.get_hub().dead - self._shutdown() - self.assert_no_hub() - - # shutting down dead hub is silent - self._shutdown() - self._shutdown() - self.assert_no_hub() - - # ressurect - gevent.sleep(0) - self.assert_hub() + self.assert_error(value=error) - gevent.core.timer(0.1, lambda: None) - self.assert_hub() - self._shutdown(seconds=0.1) - self.assert_no_hub() - self._shutdown(seconds=0) - self.assert_no_hub() + assert delay >= DELAY * 0.9, 'sleep returned after %s seconds (was scheduled for %s)' % (delay, DELAY) class TestSleep(greentest.GenericWaitTestCase): @@ -122,62 +76,29 @@ def wait(self, timeout): gevent.sleep(timeout) - def test_negative(self): - self.switch_expected = False - self.assertRaises(IOError, gevent.sleep, -1) - if sys.platform != 'win32': - from time import sleep as real_sleep - try: - real_sleep(-0.1) - except IOError, real_ex: - pass - else: - # XXX real_sleep(-0.1) hangs on win32 - real_ex = "[Errno 22] Invalid argument" - try: - gevent.sleep(-0.1) - except IOError, gevent_ex: - pass - self.assertEqual(str(gevent_ex), str(real_ex)) - - -class Expected(Exception): - pass - - -if hasattr(signal, 'SIGALRM'): - - class TestSignal(greentest.TestCase): - - __timeout__ = 2 - - def test_exception_goes_to_MAIN(self): - def handler(): - raise Expected('TestSignal') - gevent.signal(signal.SIGALRM, handler) - signal.alarm(1) - try: - gevent.spawn(gevent.sleep, 2).join() - raise AssertionError('must raise Expected') - except Expected, ex: - assert str(ex) == 'TestSignal', ex + def test_simple(self): + gevent.sleep(0) -class TestWaiter(greentest.GenericWaitTestCase): +class TestWaiterGet(greentest.GenericWaitTestCase): def setUp(self): - super(TestWaiter, self).setUp() + super(TestWaiterGet, self).setUp() self.waiter = Waiter() def wait(self, timeout): - evt = core.timer(timeout, self.waiter.switch, None) + evt = get_hub().loop.timer(timeout) + evt.start(self.waiter.switch) try: return self.waiter.get() finally: - evt.cancel() + evt.stop() + + +class TestWaiter(greentest.TestCase): def test(self): - waiter = self.waiter + waiter = Waiter() self.assertEqual(str(waiter), '') waiter.switch(25) self.assertEqual(str(waiter), '') diff -Nru python-gevent-0.13.7/greentest/test_hub_shutdown.py python-gevent-1.0/greentest/test_hub_shutdown.py --- python-gevent-0.13.7/greentest/test_hub_shutdown.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_hub_shutdown.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -"""Tests that Hub.shutdown() works even when hub is not yet started""" -import gevent.hub -res = gevent.hub.get_hub().shutdown() -assert res is None, res -assert 'hub' not in gevent.hub._threadlocal.__dict__, gevent.hub._threadlocal.__dict__ diff -Nru python-gevent-0.13.7/greentest/test_issue112.py python-gevent-1.0/greentest/test_issue112.py --- python-gevent-0.13.7/greentest/test_issue112.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test_issue112.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,6 @@ +import threading +import gevent.monkey +gevent.monkey.patch_all() +import gevent + +assert threading._sleep is gevent.sleep, threading._sleep diff -Nru python-gevent-0.13.7/greentest/test__issue302monkey.py python-gevent-1.0/greentest/test__issue302monkey.py --- python-gevent-0.13.7/greentest/test__issue302monkey.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__issue302monkey.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,14 @@ +import sys + + +if 'gevent' not in sys.modules: + from subprocess import Popen, PIPE + args = [sys.executable, '-m', 'gevent.monkey', __file__] + p = Popen(args) + code = p.wait() + assert code == 0, code + +else: + import socket + assert 'gevent' in repr(socket.socket), repr(socket.socket) + assert __file__ == 'test__issue302monkey.py', repr(__file__) diff -Nru python-gevent-0.13.7/greentest/test__issue58.py python-gevent-1.0/greentest/test__issue58.py --- python-gevent-0.13.7/greentest/test__issue58.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__issue58.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -import sys -import gevent -from gevent import wsgi -from gevent import socket - - -def error(env, start_response): - try: - raise ValueError('hello') - except Exception: - exc = sys.exc_info() - raise - -server = wsgi.WSGIServer(('', 0), error) -server.start() -conn = socket.create_connection(('127.0.0.1', server.server_port)) -conn.sendall('GET / HTTP/1.1\r\nConnection: close\r\n\r\n') -timeout = gevent.Timeout.start_new(0.1) -try: - conn.makefile(bufsize=1).read() -finally: - timeout.cancel() diff -Nru python-gevent-0.13.7/greentest/test__issue6.py python-gevent-1.0/greentest/test__issue6.py --- python-gevent-0.13.7/greentest/test__issue6.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__issue6.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,25 @@ +import sys + + +if not sys.argv[1:]: + from subprocess import Popen, PIPE + p = Popen([sys.executable, __file__, 'subprocess'], stdin=PIPE, stdout=PIPE, stderr=PIPE) + out, err = p.communicate('hello world\n') + code = p.poll() + assert p.poll() == 0, (out, err, code) + assert out.strip() == '11 chars.', (out, err, code) + assert err == '', (out, err, code) + +elif sys.argv[1:] == ['subprocess']: + import gevent + import gevent.monkey + gevent.monkey.patch_all(sys=True) + + def printline(): + line = raw_input() + print '%s chars.' % len(line) + + gevent.spawn(printline).join() + +else: + sys.exit('Invalid arguments: %r' % (sys.argv, )) diff -Nru python-gevent-0.13.7/greentest/test__joinall.py python-gevent-1.0/greentest/test__joinall.py --- python-gevent-0.13.7/greentest/test__joinall.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__joinall.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,10 @@ +import gevent + + +def func(): + pass + + +a = gevent.spawn(func) +b = gevent.spawn(func) +gevent.joinall([a, b, a]) diff -Nru python-gevent-0.13.7/greentest/test__local.py python-gevent-1.0/greentest/test__local.py --- python-gevent-0.13.7/greentest/test__local.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__local.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,23 +1,28 @@ -import unittest +import greentest from copy import copy # Comment the line below to see that the standard thread.local is working correct from gevent import monkey; monkey.patch_all() from threading import local + + class A(local): - __slots__ = ['initialized','obj'] + __slots__ = ['initialized', 'obj'] path = '' + def __init__(self, obj): - if not hasattr(self, 'initialized'): + if not hasattr(self, 'initialized'): self.obj = obj self.path = '' + class Obj(object): pass -class GeventLocalTestCase(unittest.TestCase): + +class GeventLocalTestCase(greentest.TestCase): def test_copy(self): a = A(Obj()) @@ -45,7 +50,7 @@ """ a = A({}) a.path = '123' - b = A({'one':2}) + b = A({'one': 2}) b.path = '123' self.assertEqual(a.path, b.path, 'The values in the two objects must be equal') @@ -54,4 +59,4 @@ self.assertNotEqual(a.path, b.path, 'The values in the two objects must be different') if __name__ == '__main__': - unittest.main() + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__loop_callback.py python-gevent-1.0/greentest/test__loop_callback.py --- python-gevent-0.13.7/greentest/test__loop_callback.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__loop_callback.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,13 @@ +from gevent.core import loop + +count = 0 + + +def incr(): + global count + count += 1 + +loop = loop() +loop.run_callback(incr) +loop.run() +assert count == 1, count diff -Nru python-gevent-0.13.7/greentest/test__memleak.py python-gevent-1.0/greentest/test__memleak.py --- python-gevent-0.13.7/greentest/test__memleak.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__memleak.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,4 +1,6 @@ import sys + + from greentest import TestCase, main import gevent from gevent.timeout import Timeout @@ -45,5 +47,8 @@ assert b == c, 'total refcount mismatch: %s' % result +if not hasattr(sys, 'gettotalrefcount'): + del TestQueue + if __name__ == '__main__': main() diff -Nru python-gevent-0.13.7/greentest/test___monkey_patching.py python-gevent-1.0/greentest/test___monkey_patching.py --- python-gevent-0.13.7/greentest/test___monkey_patching.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test___monkey_patching.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,47 @@ +import sys +import os +import glob +import util +import atexit + + +TIMEOUT = 60 +directory = '%s.%s' % sys.version_info[:2] +version = '%s.%s.%s' % sys.version_info[:3] + + +def get_absolute_pythonpath(): + paths = [os.path.abspath(p) for p in os.environ.get('PYTHONPATH', '').split(os.pathsep)] + return os.pathsep.join(paths) + + +def TESTRUNNER(tests=None): + preferred_version = open(os.path.join(directory, 'version')).read().strip() + if preferred_version != version: + util.log('WARNING: The tests in %s/ are from version %s and your Python is %s', directory, preferred_version, version) + + if not tests: + tests = sorted(glob.glob('%s/test_*.py' % directory)) + + PYTHONPATH = (os.getcwd() + os.pathsep + get_absolute_pythonpath()).rstrip(':') + + tests = [os.path.basename(x) for x in tests] + options = {'cwd': directory, + 'timeout': TIMEOUT, + 'setenv': {'PYTHONPATH': PYTHONPATH}} + + if tests: + atexit.register(os.system, 'rm -f */@test*') + + for filename in tests: + yield [sys.executable, '-u', '-m', 'monkey_test', filename], options.copy() + yield [sys.executable, '-u', '-m', 'monkey_test', '--Event', filename], options.copy() + + +def main(): + import testrunner + return testrunner.run_many(list(TESTRUNNER(sys.argv[1:]))) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test__monkey.py python-gevent-1.0/greentest/test__monkey.py --- python-gevent-0.13.7/greentest/test__monkey.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__monkey.py 2013-11-26 16:25:45.000000000 +0000 @@ -9,3 +9,13 @@ assert 'built-in' not in repr(thread.start_new_thread), repr(thread.start_new_thread) assert 'built-in' not in repr(threading._start_new_thread), repr(threading._start_new_thread) assert 'built-in' not in repr(threading._sleep), repr(threading._sleep) + +import socket +from gevent import socket as gevent_socket +assert socket.create_connection is gevent_socket.create_connection + +import os +if hasattr(os, 'fork'): + assert 'built-in' not in repr(os.fork), repr(os.fork) + +assert monkey.saved diff -Nru python-gevent-0.13.7/greentest/test__nondefaultloop.py python-gevent-1.0/greentest/test__nondefaultloop.py --- python-gevent-0.13.7/greentest/test__nondefaultloop.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__nondefaultloop.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,12 @@ +# test for issue #210 +from gevent import core +from util import alarm + + +alarm(1) + +log = [] +loop = core.loop(default=False) +loop.run_callback(log.append, 1) +loop.run() +assert log == [1], log diff -Nru python-gevent-0.13.7/greentest/test__order.py python-gevent-1.0/greentest/test__order.py --- python-gevent-0.13.7/greentest/test__order.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__order.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,60 @@ +import gevent +import greentest + + +class appender(object): + + def __init__(self, lst, item): + self.lst = lst + self.item = item + + def __call__(self, *args): + self.lst.append(self.item) + + +class Test(greentest.TestCase): + + count = 2 + + def test_greenlet_link(self): + lst = [] + + # test that links are executed in the same order as they were added + g = gevent.spawn(lst.append, 0) + + for i in xrange(1, self.count): + g.link(appender(lst, i)) + g.join() + self.assertEqual(lst, range(self.count)) + + +class Test3(Test): + count = 3 + + +class Test4(Test): + count = 4 + + +class TestM(Test): + count = 1000 + + +class TestSleep0(greentest.TestCase): + + def test(self): + lst = [] + gevent.spawn(sleep0, lst, '1') + gevent.spawn(sleep0, lst, '2') + gevent.wait() + self.assertEqual(' '.join(lst), '1A 2A 1B 2B') + + +def sleep0(lst, param): + lst.append(param + 'A') + gevent.sleep(0) + lst.append(param + 'B') + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__os.py python-gevent-1.0/greentest/test__os.py --- python-gevent-0.13.7/greentest/test__os.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__os.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,79 @@ +from os import pipe +from gevent import os +from greentest import TestCase, main +from gevent import Greenlet, joinall +try: + import fcntl +except ImportError: + fcntl = None + +try: + import errno +except ImportError: + errno = None + + +class TestOS_tp(TestCase): + + __timeout__ = 5 + + def pipe(self): + return pipe() + + def read(self, *args): + return os.tp_read(*args) + + def write(self, *args): + return os.tp_write(*args) + + def test_if_pipe_blocks(self): + r, w = self.pipe() + # set nbytes such that for sure it is > maximum pipe buffer + nbytes = 1000000 + block = 'x' * 4096 + buf = buffer(block) + # Lack of "nonlocal" keyword in Python 2.x: + bytesread = [0] + byteswritten = [0] + + def produce(): + while byteswritten[0] != nbytes: + bytesleft = nbytes - byteswritten[0] + byteswritten[0] += self.write(w, buf[:min(bytesleft, 4096)]) + + def consume(): + while bytesread[0] != nbytes: + bytesleft = nbytes - bytesread[0] + bytesread[0] += len(self.read(r, min(bytesleft, 4096))) + + producer = Greenlet(produce) + producer.start() + consumer = Greenlet(consume) + consumer.start_later(1) + # If patching was not succesful, the producer will have filled + # the pipe before the consumer starts, and would block the entire + # process. Therefore the next line would never finish. + joinall([producer, consumer]) + assert bytesread[0] == nbytes + assert bytesread[0] == byteswritten[0] + + +if hasattr(os, 'make_nonblocking'): + + class TestOS_nb(TestOS_tp): + + def pipe(self): + r, w = pipe() + os.make_nonblocking(r) + os.make_nonblocking(w) + return r, w + + def read(self, *args): + return os.nb_read(*args) + + def write(self, *args): + return os.nb_write(*args) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/greentest/test_patched_asyncore.py python-gevent-1.0/greentest/test_patched_asyncore.py --- python-gevent-0.13.7/greentest/test_patched_asyncore.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_asyncore.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_ftplib.py python-gevent-1.0/greentest/test_patched_ftplib.py --- python-gevent-0.13.7/greentest/test_patched_ftplib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_ftplib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_httplib2.py python-gevent-1.0/greentest/test_patched_httplib2.py --- python-gevent-0.13.7/greentest/test_patched_httplib2.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_httplib2.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -# run test_httplib.py with gevent.httplib -import helper -exec helper.prepare_stdlib_test('test_httplib.py', httplib=True) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_httplib.py python-gevent-1.0/greentest/test_patched_httplib.py --- python-gevent-0.13.7/greentest/test_patched_httplib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_httplib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_httpservers.py python-gevent-1.0/greentest/test_patched_httpservers.py --- python-gevent-0.13.7/greentest/test_patched_httpservers.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_httpservers.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_queue.py python-gevent-1.0/greentest/test_patched_queue.py --- python-gevent-0.13.7/greentest/test_patched_queue.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_queue.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_select.py python-gevent-1.0/greentest/test_patched_select.py --- python-gevent-0.13.7/greentest/test_patched_select.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_select.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_smtplib.py python-gevent-1.0/greentest/test_patched_smtplib.py --- python-gevent-0.13.7/greentest/test_patched_smtplib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_smtplib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_socket.py python-gevent-1.0/greentest/test_patched_socket.py --- python-gevent-0.13.7/greentest/test_patched_socket.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_socket.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_socket_ssl.py python-gevent-1.0/greentest/test_patched_socket_ssl.py --- python-gevent-0.13.7/greentest/test_patched_socket_ssl.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_socket_ssl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_ssl.py python-gevent-1.0/greentest/test_patched_ssl.py --- python-gevent-0.13.7/greentest/test_patched_ssl.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_ssl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_telnetlib.py python-gevent-1.0/greentest/test_patched_telnetlib.py --- python-gevent-0.13.7/greentest/test_patched_telnetlib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_telnetlib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_threading_local.py python-gevent-1.0/greentest/test_patched_threading_local.py --- python-gevent-0.13.7/greentest/test_patched_threading_local.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_threading_local.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_threading.py python-gevent-1.0/greentest/test_patched_threading.py --- python-gevent-0.13.7/greentest/test_patched_threading.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_threading.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_timeout.py python-gevent-1.0/greentest/test_patched_timeout.py --- python-gevent-0.13.7/greentest/test_patched_timeout.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_timeout.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_urllib2_localnet.py python-gevent-1.0/greentest/test_patched_urllib2_localnet.py --- python-gevent-0.13.7/greentest/test_patched_urllib2_localnet.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_urllib2_localnet.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_urllib2net.py python-gevent-1.0/greentest/test_patched_urllib2net.py --- python-gevent-0.13.7/greentest/test_patched_urllib2net.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_urllib2net.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_urllib2.py python-gevent-1.0/greentest/test_patched_urllib2.py --- python-gevent-0.13.7/greentest/test_patched_urllib2.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_urllib2.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_urllib.py python-gevent-1.0/greentest/test_patched_urllib.py --- python-gevent-0.13.7/greentest/test_patched_urllib.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_urllib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test_patched_wsgiref.py python-gevent-1.0/greentest/test_patched_wsgiref.py --- python-gevent-0.13.7/greentest/test_patched_wsgiref.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_patched_wsgiref.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -import helper -exec helper.prepare_stdlib_test(__file__) in globals() diff -Nru python-gevent-0.13.7/greentest/test__pool.py python-gevent-1.0/greentest/test__pool.py --- python-gevent-0.13.7/greentest/test__pool.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__pool.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,11 +1,17 @@ +from __future__ import with_statement from time import time import gevent from gevent import pool from gevent.event import Event import greentest +import random +from greentest import ExpectedException +import six +import unittest -class TestCoroutinePool(greentest.TestCase): + +class TestCoroutinePool(unittest.TestCase): klass = pool.Pool def test_apply_async(self): @@ -33,6 +39,7 @@ results = [] def producer(): + gevent.sleep(0.001) results.append('prod') evt.set() @@ -45,7 +52,7 @@ done = pool.spawn(consumer) pool.apply_async(producer) done.get() - self.assertEquals(['cons1', 'prod', 'cons2'], results) + self.assertEqual(['cons1', 'prod', 'cons2'], results) def dont_test_timer_cancel(self): timer_fired = [] @@ -59,24 +66,14 @@ pool = self.klass(2) pool.apply(some_work) gevent.sleep(0) - self.assertEquals(timer_fired, []) + self.assertEqual(timer_fired, []) def test_reentrant(self): pool = self.klass(1) - - def reenter(): - result = pool.apply(lambda a: a, ('reenter', )) - self.assertEqual('reenter', result) - - pool.apply(reenter) - + result = pool.apply(pool.apply, (lambda a: a + 1, (5, ))) + self.assertEqual(result, 6) evt = Event() - - def reenter_async(): - pool.apply_async(lambda a: a, ('reenter', )) - evt.set() - - pool.apply_async(reenter_async) + pool.apply_async(evt.set) evt.wait() def test_stderr_raising(self): @@ -92,7 +89,8 @@ try: sys.stderr = FakeFile() waiter = pool.spawn(crash) - self.assertRaises(RuntimeError, waiter.get) + with gevent.Timeout(2): + self.assertRaises(RuntimeError, waiter.get) # the pool should have something free at this point since the # waiter returned # pool.Pool change: if an exception is raised during execution of a link, @@ -117,7 +115,9 @@ class FakeFile(object): - write = crash + + def write(*args): + raise RuntimeError('Whaaa') class PoolBasicTests(greentest.TestCase): @@ -148,16 +148,51 @@ p.apply_async(r.append, (4, )) self.assertEqual(r, [1]) gevent.sleep(0.01) - self.assertEqual(r, [1, 2, 3, 4]) + self.assertEqual(sorted(r), [1, 2, 3, 4]) + + def test_discard(self): + p = self.klass(size=1) + first = p.spawn(gevent.sleep, 1000) + p.discard(first) + first.kill() + assert not first, first + self.assertEqual(len(p), 0) + self.assertEqual(p._semaphore.counter, 1) - def test_execute(self): + def test_add_method(self): + p = self.klass(size=1) + first = gevent.spawn(gevent.sleep, 1000) + try: + second = gevent.spawn(gevent.sleep, 1000) + try: + self.assertEqual(p.free_count(), 1) + self.assertEqual(len(p), 0) + p.add(first) + timeout = gevent.Timeout(0.1) + timeout.start() + try: + p.add(second) + except gevent.Timeout: + pass + else: + raise AssertionError('Expected timeout') + finally: + timeout.cancel() + self.assertEqual(p.free_count(), 0) + self.assertEqual(len(p), 1) + finally: + second.kill() + finally: + first.kill() + + def test_apply(self): p = self.klass() result = p.apply(lambda a: ('foo', a), (1, )) self.assertEqual(result, ('foo', 1)) - def test_init_zerosize(self): + def test_init_error(self): self.switch_expected = False - self.assertRaises(ValueError, self.klass, 0) + self.assertRaises(ValueError, self.klass, -1) # # tests from standard library test/test_multiprocessing.py @@ -181,6 +216,16 @@ gevent.sleep(wait) return x * x + +def squared(x): + return x * x + + +def sqr_random_sleep(x): + gevent.sleep(random.random() * 0.1) + return x * x + + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.082, 0.035, 0.14 @@ -197,13 +242,13 @@ def test_apply(self): papply = self.pool.apply - self.assertEqual(papply(sqr, (5,)), sqr(5)) - self.assertEqual(papply(sqr, (), {'x': 3}), sqr(x=3)) + self.assertEqual(papply(sqr, (5,)), 25) + self.assertEqual(papply(sqr, (), {'x': 3}), 9) def test_map(self): pmap = self.pool.map - self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) - self.assertEqual(pmap(sqr, range(100)), map(sqr, range(100))) + self.assertEqual(pmap(sqr, range(10)), list(map(squared, range(10)))) + self.assertEqual(pmap(sqr, range(100)), list(map(squared, range(100)))) def test_async(self): res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) @@ -229,24 +274,41 @@ def test_imap(self): it = self.pool.imap(sqr, range(10)) - self.assertEqual(list(it), map(sqr, range(10))) + self.assertEqual(list(it), list(map(squared, range(10)))) it = self.pool.imap(sqr, range(10)) for i in range(10): - self.assertEqual(it.next(), i * i) - self.assertRaises(StopIteration, it.next) + self.assertEqual(six.advance_iterator(it), i * i) + self.assertRaises(StopIteration, lambda: six.advance_iterator(it)) it = self.pool.imap(sqr, range(1000)) for i in range(1000): - self.assertEqual(it.next(), i * i) - self.assertRaises(StopIteration, it.next) + self.assertEqual(six.advance_iterator(it), i * i) + self.assertRaises(StopIteration, lambda: six.advance_iterator(it)) + + def test_imap_random(self): + it = self.pool.imap(sqr_random_sleep, range(10)) + self.assertEqual(list(it), list(map(squared, range(10)))) def test_imap_unordered(self): it = self.pool.imap_unordered(sqr, range(1000)) - self.assertEqual(sorted(it), map(sqr, range(1000))) + self.assertEqual(sorted(it), list(map(squared, range(1000)))) it = self.pool.imap_unordered(sqr, range(1000)) - self.assertEqual(sorted(it), map(sqr, range(1000))) + self.assertEqual(sorted(it), list(map(squared, range(1000)))) + + def test_imap_unordered_random(self): + it = self.pool.imap_unordered(sqr_random_sleep, range(10)) + self.assertEqual(sorted(it), list(map(squared, range(10)))) + + def test_empty(self): + it = self.pool.imap_unordered(sqr, []) + self.assertEqual(list(it), []) + + it = self.pool.imap(sqr, []) + self.assertEqual(list(it), []) + + self.assertEqual(self.pool.map(sqr, []), []) def test_terminate(self): result = self.pool.map_async(gevent.sleep, [0.1] * ((self.size or 10) * 2)) @@ -330,5 +392,57 @@ self.assertEqual(len(p), 0) +def error_iter(): + yield 1 + yield 2 + raise ExpectedException + + +class TestErrorInIterator(greentest.TestCase): + error_fatal = False + + def test(self): + p = pool.Pool(3) + self.assertRaises(ExpectedException, p.map, lambda x: None, error_iter()) + gevent.sleep(0.001) + + def test_unordered(self): + p = pool.Pool(3) + + def unordered(): + return list(p.imap_unordered(lambda x: None, error_iter())) + + self.assertRaises(ExpectedException, unordered) + gevent.sleep(0.001) + + +def divide_by(x): + return 1.0 / x + + +class TestErrorInHandler(greentest.TestCase): + error_fatal = False + + def test_map(self): + p = pool.Pool(3) + self.assertRaises(ZeroDivisionError, p.map, divide_by, [1, 0, 2]) + + def test_imap(self): + p = pool.Pool(1) + it = p.imap(divide_by, [1, 0, 2]) + self.assertEqual(it.next(), 1.0) + self.assertRaises(ZeroDivisionError, it.next) + self.assertEqual(it.next(), 0.5) + self.assertRaises(StopIteration, it.next) + + def test_imap_unordered(self): + p = pool.Pool(1) + it = p.imap_unordered(divide_by, [1, 0, 2]) + self.assertEqual(it.next(), 1.0) + self.assertRaises(ZeroDivisionError, it.next) + self.assertEqual(it.next(), 0.5) + self.assertRaises(StopIteration, it.next) + + if __name__ == '__main__': greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__pywsgi.py python-gevent-1.0/greentest/test__pywsgi.py --- python-gevent-0.13.7/greentest/test__pywsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__pywsgi.py 2013-11-26 16:25:45.000000000 +0000 @@ -23,6 +23,7 @@ import cgi import os import sys +import StringIO try: from wsgiref.validate import validator except ImportError: @@ -33,6 +34,8 @@ import greentest import gevent from gevent import socket +from gevent import pywsgi +from gevent.pywsgi import Input CONTENT_LENGTH = 'Content-Length' @@ -135,7 +138,7 @@ def assertHeader(self, header, value): real_value = self.headers.get(header, False) assert real_value == value, \ - 'Unexpected header %r: %r (expected %r)\n%s' % (header, real_value, value, self) + 'Unexpected header %r: %r (expected %r)\n%s' % (header, real_value, value, self) def assertBody(self, body): assert self.body == body, 'Unexpected body: %r (expected %r)\n%s' % (self.body, body, self) @@ -211,14 +214,10 @@ class TestCase(greentest.TestCase): - def get_wsgi_module(self): - from gevent import pywsgi - return pywsgi - validator = staticmethod(validator) def init_server(self, application): - self.server = self.get_wsgi_module().WSGIServer(('127.0.0.1', 0), application) + self.server = pywsgi.WSGIServer(('127.0.0.1', 0), application) def setUp(self): application = self.application @@ -278,7 +277,8 @@ fd.close() finally: timeout.cancel() - except AssertionError, ex: + except AssertionError: + ex = sys.exc_info()[1] if ex is not exception: raise @@ -294,8 +294,9 @@ try: result = fd.readline() assert not result, 'The remote side is expected to close the connection, but it send %r' % (result, ) - except socket.error, ex: - if ex[0] not in CONN_ABORTED_ERRORS: + except socket.error: + ex = sys.exc_info()[1] + if ex.args[0] not in CONN_ABORTED_ERRORS: raise def SKIP_test_006_reject_long_urls(self): @@ -370,6 +371,44 @@ yield "not found" +if sys.version_info[:2] >= (2, 6): + + class TestBytearray(CommonTests): + + validator = None + + @staticmethod + def application(env, start_response): + path = env['PATH_INFO'] + if path == '/': + start_response('200 OK', [('Content-Type', 'text/plain')]) + return [bytearray("hello "), bytearray("world")] + else: + start_response('404 Not Found', [('Content-Type', 'text/plain')]) + return [bytearray("not found")] + + +class MultiLineHeader(TestCase): + @staticmethod + def application(env, start_response): + assert "test.submit" in env["CONTENT_TYPE"] + start_response('200 OK', [('Content-Type', 'text/plain')]) + return ["ok"] + + def test_multiline_116(self): + """issue #116""" + request = '\r\n'.join(( + 'POST / HTTP/1.0', + 'Host: localhost', + 'Content-Type: multipart/related; boundary="====XXXX====";', + ' type="text/xml";start="test.submit"', + 'Content-Length: 0', + '', '')) + fd = self.makefile() + fd.write(request) + read_http(fd) + + class TestGetArg(TestCase): @staticmethod @@ -392,7 +431,7 @@ # send some junk after the actual request fd.write('01234567890123456789') - read_http(fd, version='1.0', body='a is a, body is a=a') + read_http(fd, body='a is a, body is a=a') fd.close() @@ -423,7 +462,7 @@ def test_no_chunked_http_1_0(self): fd = self.makefile() fd.write('GET / HTTP/1.0\r\nHost: localhost\r\nConnection: close\r\n\r\n') - response = read_http(fd, version='1.0') + response = read_http(fd) self.assertEqual(response.body, self.body()) self.assertEqual(response.headers.get('Transfer-Encoding'), None) content_length = response.headers.get('Content-Length') @@ -525,7 +564,7 @@ keyfile = os.path.join(os.path.dirname(__file__), 'test_server.key') def init_server(self, application): - self.server = self.get_wsgi_module().WSGIServer(('127.0.0.1', 0), application, certfile=self.certfile, keyfile=self.keyfile) + self.server = pywsgi.WSGIServer(('127.0.0.1', 0), application, certfile=self.certfile, keyfile=self.keyfile) def urlopen(self, method='GET', post_body=None, **kwargs): import ssl @@ -645,20 +684,25 @@ class TestError(TestCase): - @staticmethod - def application(env, start_response): - raise greentest.ExpectedException('TestError.application') + error = greentest.ExpectedException('TestError.application') + error_fatal = False + + def application(self, env, start_response): + raise self.error def test(self): + self.expect_one_error() self.urlopen(code=500) + self.assert_error(greentest.ExpectedException, self.error) class TestError_after_start_response(TestError): - @staticmethod - def application(env, start_response): + error = greentest.ExpectedException('TestError_after_start_response.application') + + def application(self, env, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) - raise greentest.ExpectedException('TestError_after_start_response.application') + raise self.error class TestEmptyYield(TestCase): @@ -723,6 +767,69 @@ self.assert_(garbage == "", "got garbage: %r" % garbage) +class TestContentLength304(TestCase): + validator = None + + def application(self, env, start_response): + try: + start_response('304 Not modified', [('Content-Length', '100')]) + except AssertionError, ex: + start_response('200 Raised', []) + return [str(ex)] + else: + raise AssertionError('start_response did not fail but it should') + + def test_err(self): + fd = self.connect().makefile(bufsize=1) + fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n') + body = "Invalid Content-Length for 304 response: '100' (must be absent or zero)" + read_http(fd, code=200, reason='Raised', body=body, chunks=False) + garbage = fd.read() + self.assert_(garbage == "", "got garbage: %r" % garbage) + + +class TestBody304(TestCase): + validator = None + + def application(self, env, start_response): + start_response('304 Not modified', []) + return ['body'] + + def test_err(self): + fd = self.connect().makefile(bufsize=1) + fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n') + try: + read_http(fd) + except AssertionError, ex: + self.assertEqual(str(ex), 'The 304 response must have no body') + else: + raise AssertionError('AssertionError must be raised') + + +class TestWrite304(TestCase): + validator = None + + def application(self, env, start_response): + write = start_response('304 Not modified', []) + self.error_raised = False + try: + write('body') + except AssertionError: + self.error_raised = True + raise + + def test_err(self): + fd = self.connect().makefile(bufsize=1) + fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n') + try: + read_http(fd) + except AssertionError, ex: + self.assertEqual(str(ex), 'The 304 response must have no body') + else: + raise AssertionError('write() must raise') + assert self.error_raised, 'write() must raise' + + class TestEmptyWrite(TestEmptyYield): @staticmethod @@ -746,13 +853,13 @@ self.content_length = '-100' fd = self.connect().makefile(bufsize=1) fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: %s\r\n\r\n' % self.content_length) - read_http(fd, code=(200, 400), version=None) + read_http(fd, code=(200, 400)) def test_illegal_content_length(self): self.content_length = 'abc' fd = self.connect().makefile(bufsize=1) fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: %s\r\n\r\n' % self.content_length) - read_http(fd, code=(200, 400), version=None) + read_http(fd, code=(200, 400)) class ChunkedInputTests(TestCase): @@ -784,10 +891,7 @@ if dirt is None: dirt = self.dirt - b = "" - for c in chunks: - b += "%x%s\r\n%s\r\n" % (len(c), dirt, c) - return b + return chunk_encode(chunks, dirt=dirt) def body(self, dirt=None): return self.chunk_encode(["this", " is ", "chunked", "\nline", " 2", "\n", "line3", ""], dirt=dirt) @@ -844,7 +948,8 @@ fd.write(req) try: read_http(fd, body="pong") - except AssertionError, ex: + except AssertionError: + ex = sys.exc_info()[1] if str(ex).startswith('Unexpected code: 400'): if not server_implements_chunked: print 'ChunkedNotImplementedWarning' @@ -862,7 +967,8 @@ read_http(fd, body='this is chunked\nline 2\nline3') def test_close_before_finished(self): - self.hook_stderr() + if server_implements_chunked: + self.expect_one_error() body = '4\r\nthi' req = "POST /short-read HTTP/1.1\r\ntransfer-encoding: Chunked\r\n\r\n" + body fd = self.connect().makefile(bufsize=1) @@ -870,18 +976,22 @@ fd.close() gevent.sleep(0.01) if server_implements_chunked: - self.assert_stderr_traceback(IOError, 'unexpected end of file while parsing chunked data') + self.assert_error(IOError, 'unexpected end of file while parsing chunked data') class Expect100ContinueTests(TestCase): validator = None def application(self, environ, start_response): - if int(environ['CONTENT_LENGTH']) > 1024: + content_length = int(environ['CONTENT_LENGTH']) + if content_length > 1024: start_response('417 Expectation Failed', [('Content-Length', '7'), ('Content-Type', 'text/plain')]) return ['failure'] else: - text = environ['wsgi.input'].read() + # pywsgi did sent a "100 continue" for each read + # see http://code.google.com/p/gevent/issues/detail?id=93 + text = environ['wsgi.input'].read(1) + text += environ['wsgi.input'].read(content_length - 1) start_response('200 OK', [('Content-Length', str(len(text))), ('Content-Type', 'text/plain')]) return [text] @@ -891,7 +1001,8 @@ fd.write('PUT / HTTP/1.1\r\nHost: localhost\r\nContent-length: 1025\r\nExpect: 100-continue\r\n\r\n') try: read_http(fd, code=417, body="failure") - except AssertionError, ex: + except AssertionError: + ex = sys.exc_info()[1] if str(ex).startswith('Unexpected code: 400'): if not server_implements_100continue: print '100ContinueNotImplementedWarning' @@ -941,13 +1052,13 @@ fd = self.connect().makefile(bufsize=1) fd.write("GET / HTTP/1.0\r\nConnection: close\r\n\r\n") d = fd.read() - assert d.startswith("HTTP/1.0 200 OK"), "bad response" + assert d.startswith("HTTP/1.1 200 OK"), "bad response: %r" % d def test_connection_close_leak_frame(self): fd = self.connect().makefile(bufsize=1) fd.write("GET /leak-frame HTTP/1.0\r\nConnection: close\r\n\r\n") d = fd.read() - assert d.startswith("HTTP/1.0 200 OK"), "bad response" + assert d.startswith("HTTP/1.1 200 OK"), "bad response: %r" % d self._leak_environ.pop('_leak') @@ -966,12 +1077,31 @@ def test(self): fd = self.makefile() fd.write('GET / HTTP/1.0\r\nHost: localhost\r\n\r\n') - read_http(fd, version='1.0') + read_http(fd) fd = self.makefile() fd.write('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') read_http(fd) +class Handler(pywsgi.WSGIHandler): + + def read_requestline(self): + data = self.rfile.read(7) + if data[0] == '<': + try: + data += self.rfile.read(15) + if data.lower() == '': + self.socket.sendall('HELLO') + else: + self.log_error('Invalid request: %r', data) + finally: + self.socket.shutdown(socket.SHUT_WR) + self.socket.close() + self.socket = None + else: + return data + self.rfile.readline() + + class TestSubclass1(TestCase): validator = None @@ -981,27 +1111,7 @@ return [] def init_server(self, application): - WSGIHandler = self.get_wsgi_module().WSGIHandler - - class Handler(WSGIHandler): - - def read_requestline(self): - data = self.rfile.read(7) - if data[0] == '<': - try: - data += self.rfile.read(15) - if data.lower() == '': - self.socket.sendall('HELLO') - else: - self.log_error('Invalid request: %r', data) - finally: - self.socket.shutdown(socket.SHUT_WR) - self.socket.close() - self.socket = None - else: - return data + self.rfile.readline() - - self.server = self.get_wsgi_module().WSGIServer(('127.0.0.1', 0), application, handler_class=Handler) + self.server = pywsgi.WSGIServer(('127.0.0.1', 0), application, handler_class=Handler) def test(self): fd = self.makefile() @@ -1017,6 +1127,111 @@ self.assertEqual(fd.read(), '') +class TestErrorAfterChunk(TestCase): + validator = None + + @staticmethod + def application(env, start_response): + start_response('200 OK', [('Content-Type', 'text/plain')]) + yield "hello" + raise greentest.ExpectedException('TestErrorAfterChunk') + + def test(self): + fd = self.connect().makefile(bufsize=1) + self.expect_one_error() + fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\n\r\n') + self.assertRaises(ValueError, read_http, fd) + self.assert_error(greentest.ExpectedException) + + +def chunk_encode(chunks, dirt=None): + if dirt is None: + dirt = "" + + b = "" + for c in chunks: + b += "%x%s\r\n%s\r\n" % (len(c), dirt, c) + return b + + +class TestInputRaw(greentest.BaseTestCase): + def make_input(self, data, content_length=None, chunked_input=False): + if isinstance(data, list): + data = chunk_encode(data) + chunked_input = True + + return Input(StringIO.StringIO(data), content_length=content_length, chunked_input=chunked_input) + + def test_short_post(self): + i = self.make_input("1", content_length=2) + self.assertRaises(IOError, i.read) + + def test_short_post_read_with_length(self): + i = self.make_input("1", content_length=2) + self.assertRaises(IOError, i.read, 2) + + def test_short_post_readline(self): + i = self.make_input("1", content_length=2) + self.assertRaises(IOError, i.readline) + + def test_post(self): + i = self.make_input("12", content_length=2) + data = i.read() + self.assertEqual(data, "12") + + def test_post_read_with_length(self): + i = self.make_input("12", content_length=2) + data = i.read(10) + self.assertEqual(data, "12") + + def test_chunked(self): + i = self.make_input(["1", "2", ""]) + data = i.read() + self.assertEqual(data, "12") + + def test_chunked_read_with_length(self): + i = self.make_input(["1", "2", ""]) + data = i.read(10) + self.assertEqual(data, "12") + + def test_chunked_missing_chunk(self): + i = self.make_input(["1", "2"]) + self.assertRaises(IOError, i.read) + + def test_chunked_missing_chunk_read_with_length(self): + i = self.make_input(["1", "2"]) + self.assertRaises(IOError, i.read, 10) + + def test_chunked_missing_chunk_readline(self): + i = self.make_input(["1", "2"]) + self.assertRaises(IOError, i.readline) + + def test_chunked_short_chunk(self): + i = self.make_input("2\r\n1", chunked_input=True) + self.assertRaises(IOError, i.read) + + def test_chunked_short_chunk_read_with_length(self): + i = self.make_input("2\r\n1", chunked_input=True) + self.assertRaises(IOError, i.read, 2) + + def test_chunked_short_chunk_readline(self): + i = self.make_input("2\r\n1", chunked_input=True) + self.assertRaises(IOError, i.readline) + + +class Test414(TestCase): + + @staticmethod + def application(env, start_response): + raise AssertionError('should not get there') + + def test(self): + fd = self.makefile() + longline = 'x' * 20000 + fd.write('''GET /%s HTTP/1.0\r\nHello: world\r\n\r\n''' % longline) + read_http(fd, code=414) + + del CommonTests if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__queue.py python-gevent-1.0/greentest/test__queue.py --- python-gevent-0.13.7/greentest/test__queue.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,7 +1,10 @@ -from greentest import TestCase, main +from __future__ import with_statement +from greentest import TestCase, main, GenericGetTestCase import gevent -from gevent import util, core +from gevent.hub import get_hub +from gevent import util from gevent import queue +from gevent.queue import Empty, Full from gevent.event import AsyncResult @@ -17,11 +20,8 @@ q = queue.Queue() def waiter(q): - timer = gevent.Timeout.start_new(0.1) - try: + with gevent.Timeout(0.1): self.assertEquals(q.get(), 'hi2') - finally: - timer.cancel() return "OK" p = gevent.spawn(waiter, q) @@ -54,7 +54,7 @@ assert p.get(timeout=0) == "OK" def test_zero_max_size(self): - q = queue.Queue(0) + q = queue.Channel() def sender(evt, q): q.put('hi') @@ -73,11 +73,8 @@ p2 = gevent.spawn(receiver, e2, q) self.assertEquals(e2.get(), 'hi') self.assertEquals(e1.get(), 'done') - timeout = gevent.Timeout.start_new(0) - try: + with gevent.Timeout(0): gevent.joinall([p1, p2]) - finally: - timeout.cancel() def test_multiple_waiters(self): # tests that multiple waiters get their results back @@ -89,22 +86,19 @@ sendings = ['1', '2', '3', '4'] evts = [AsyncResult() for x in sendings] for i, x in enumerate(sendings): - gevent.spawn(waiter, q, evts[i]) # use waitall for them + gevent.spawn(waiter, q, evts[i]) # XXX use waitall for them gevent.sleep(0.01) # get 'em all waiting results = set() def collect_pending_results(): - for i, e in enumerate(evts): - timer = gevent.Timeout.start_new(0.001) - try: + for e in evts: + with gevent.Timeout(0.001, False): x = e.get() results.add(x) - timer.cancel() - except gevent.Timeout: - pass # no pending result at that event return len(results) + q.put(sendings[0]) self.assertEquals(collect_pending_results(), 1) q.put(sendings[1]) @@ -117,12 +111,12 @@ q = queue.Queue() def do_receive(q, evt): - gevent.Timeout.start_new(0, RuntimeError()) - try: - result = q.get() - evt.set(result) - except RuntimeError: - evt.set('timed out') + with gevent.Timeout(0, RuntimeError()): + try: + result = q.get() + evt.set(result) + except RuntimeError: + evt.set('timed out') evt = AsyncResult() gevent.spawn(do_receive, q, evt) @@ -146,42 +140,38 @@ evt.set(q.get()) def do_receive(q, evt): - timeout = gevent.Timeout.start_new(0, RuntimeError()) - try: + with gevent.Timeout(0, RuntimeError()): try: result = q.get() evt.set(result) except RuntimeError: evt.set('timed out') - finally: - timeout.cancel() q = queue.Queue() dying_evt = AsyncResult() waiting_evt = AsyncResult() gevent.spawn(do_receive, q, dying_evt) gevent.spawn(waiter, q, waiting_evt) - gevent.sleep(0) + gevent.sleep(0.1) q.put('hi') self.assertEquals(dying_evt.get(), 'timed out') self.assertEquals(waiting_evt.get(), 'hi') def test_two_bogus_waiters(self): def do_receive(q, evt): - gevent.Timeout.start_new(0, RuntimeError()) - try: - result = q.get() - evt.set(result) - except RuntimeError: - evt.set('timed out') - # XXX finally = timeout + with gevent.Timeout(0, RuntimeError()): + try: + result = q.get() + evt.set(result) + except RuntimeError: + evt.set('timed out') q = queue.Queue() e1 = AsyncResult() e2 = AsyncResult() gevent.spawn(do_receive, q, e1) gevent.spawn(do_receive, q, e2) - gevent.sleep(0) + gevent.sleep(0.1) q.put('sent') self.assertEquals(e1.get(), 'timed out') self.assertEquals(e2.get(), 'timed out') @@ -191,7 +181,7 @@ class TestChannel(TestCase): def test_send(self): - channel = queue.Queue(0) + channel = queue.Channel() events = [] @@ -211,7 +201,7 @@ g.get() def test_wait(self): - channel = queue.Queue(0) + channel = queue.Channel() events = [] def another_greenlet(): @@ -252,11 +242,13 @@ def store_result(func, *args): result.append(func(*args)) - core.active_event(store_result, util.wrap_errors(Exception, q.put_nowait), 2) - core.active_event(store_result, util.wrap_errors(Exception, q.put_nowait), 3) + run_callback = get_hub().loop.run_callback + + run_callback(store_result, util.wrap_errors(Full, q.put_nowait), 2) + run_callback(store_result, util.wrap_errors(Full, q.put_nowait), 3) gevent.sleep(0) assert len(result) == 2, result - assert result[0] == None, result + assert result[0] is None, result assert isinstance(result[1], queue.Full), result def test_get_nowait_simple(self): @@ -267,8 +259,10 @@ def store_result(func, *args): result.append(func(*args)) - core.active_event(store_result, util.wrap_errors(Exception, q.get_nowait)) - core.active_event(store_result, util.wrap_errors(Exception, q.get_nowait)) + run_callback = get_hub().loop.run_callback + + run_callback(store_result, util.wrap_errors(Empty, q.get_nowait)) + run_callback(store_result, util.wrap_errors(Empty, q.get_nowait)) gevent.sleep(0) assert len(result) == 2, result assert result[0] == 4, result @@ -277,19 +271,38 @@ # get_nowait must work from the mainloop def test_get_nowait_unlock(self): result = [] - q = queue.Queue(0) + q = queue.Queue(1) p = gevent.spawn(q.put, 5) def store_result(func, *args): result.append(func(*args)) assert q.empty(), q + gevent.sleep(0) assert q.full(), q + get_hub().loop.run_callback(store_result, q.get_nowait) gevent.sleep(0) assert q.empty(), q + assert result == [5], result + assert p.ready(), p + assert p.dead, p + assert q.empty(), q + + def test_get_nowait_unlock_channel(self): + result = [] + q = queue.Channel() + p = gevent.spawn(q.put, 5) + + def store_result(func, *args): + result.append(func(*args)) + + assert q.empty(), q assert q.full(), q - core.active_event(store_result, util.wrap_errors(Exception, q.get_nowait)) - gevent.sleep(0) + gevent.sleep(0.001) + assert q.empty(), q + assert q.full(), q + get_hub().loop.run_callback(store_result, q.get_nowait) + gevent.sleep(0.001) assert q.empty(), q assert q.full(), q assert result == [5], result @@ -300,23 +313,23 @@ # put_nowait must work from the mainloop def test_put_nowait_unlock(self): result = [] - q = queue.Queue(0) + q = queue.Queue() p = gevent.spawn(q.get) def store_result(func, *args): result.append(func(*args)) assert q.empty(), q - assert q.full(), q - gevent.sleep(0) + assert not q.full(), q + gevent.sleep(0.001) assert q.empty(), q - assert q.full(), q - core.active_event(store_result, util.wrap_errors(Exception, q.put_nowait), 10) + assert not q.full(), q + get_hub().loop.run_callback(store_result, q.put_nowait, 10) assert not p.ready(), p - gevent.sleep(0) + gevent.sleep(0.001) assert result == [None], result assert p.ready(), p - assert q.full(), q + assert not q.full(), q assert q.empty(), q @@ -329,5 +342,48 @@ q.join() +def make_get_interrupt(queue_type): + + class TestGetInterrupt(GenericGetTestCase): + + Timeout = Empty + + def wait(self, timeout): + return queue_type().get(timeout=timeout) + + TestGetInterrupt.__name__ += '_' + queue_type.__name__ + return TestGetInterrupt + + +for queue_type in [queue.Queue, queue.JoinableQueue, queue.LifoQueue, queue.PriorityQueue, queue.Channel]: + klass = make_get_interrupt(queue_type) + globals()[klass.__name__] = klass +del klass, queue_type + + +def make_put_interrupt(queue): + + class TestPutInterrupt(GenericGetTestCase): + + Timeout = Full + + def wait(self, timeout): + while not queue.full(): + queue.put(1) + return queue.put(2, timeout=timeout) + + TestPutInterrupt.__name__ += '_' + queue.__class__.__name__ + return TestPutInterrupt + + +for obj in [queue.Queue(1), queue.JoinableQueue(1), queue.LifoQueue(1), queue.PriorityQueue(1), queue.Channel()]: + klass = make_put_interrupt(obj) + globals()[klass.__name__] = klass +del klass, obj + + +del GenericGetTestCase + + if __name__ == '__main__': main() diff -Nru python-gevent-0.13.7/greentest/test_queue.py python-gevent-1.0/greentest/test_queue.py --- python-gevent-0.13.7/greentest/test_queue.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_queue.py 2013-11-26 16:25:45.000000000 +0000 @@ -90,7 +90,7 @@ def simple_queue_test(self, q): if not q.empty(): - raise RuntimeError, "Call this function with an empty queue" + raise RuntimeError("Call this function with an empty queue") # I guess we better check things actually queue correctly a little :) q.put(111) q.put(333) @@ -218,19 +218,19 @@ def _put(self, item): if self.fail_next_put: self.fail_next_put = False - raise FailingQueueException, "You Lose" + raise FailingQueueException("You Lose") return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: self.fail_next_get = False - raise FailingQueueException, "You Lose" + raise FailingQueueException("You Lose") return Queue.Queue._get(self) class FailingQueueTest(unittest.TestCase, BlockingTestMixin): def failing_queue_test(self, q): if not q.empty(): - raise RuntimeError, "Call this function with an empty queue" + raise RuntimeError("Call this function with an empty queue") for i in range(QUEUE_SIZE-1): q.put(i) # Test a failing non-blocking put. diff -Nru python-gevent-0.13.7/greentest/test__refcount.py python-gevent-1.0/greentest/test__refcount.py --- python-gevent-0.13.7/greentest/test__refcount.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__refcount.py 2013-11-26 16:25:45.000000000 +0000 @@ -19,7 +19,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""This test checks that socket instances (not gevent.socket.socket but underlying sockets) +"""This test checks that underlying socket instances (gevent.socket.socket._sock) are not leaked by the hub. """ from _socket import socket @@ -31,10 +31,9 @@ import _socket _socket.socket = Socket +import greentest from gevent import monkey; monkey.patch_all() -#import sys -import greentest from pprint import pformat from thread import start_new_thread from time import sleep diff -Nru python-gevent-0.13.7/greentest/testrunner.py python-gevent-1.0/greentest/testrunner.py --- python-gevent-0.13.7/greentest/testrunner.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/testrunner.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,548 +1,168 @@ -#!/usr/bin/python -"""Unit test runner. - -This test runner runs each test module isolated in a subprocess, thus allowing them to -mangle globals freely (i.e. do monkey patching). - -To report the results and generate statistics sqlite3 database is used. - -Additionally, the subprocess is killed after a timeout has passed. The test case remains -in the database logged with the result 'TIMEOUT'. - -The --db option, when provided, specifies sqlite3 database that holds the test results. -By default 'testresults.sqlite3' is used in the current directory. - -The results are stored in the following 2 tables: - -testcase: - - runid | test | testcase | result | time | - --------+--------+-----------------+------------------------+------+ - abc123 | module | class.function | PASSED|FAILED|TIMEOUT | 0.01 | - -test: - - runid | test | python | output | retcode | changeset | uname | started_at | - --------+---------+--------+--------+---------+-------------+-------+------------+ - abc123 | module | 2.6.4 | ... | 1 | 123_fe43ca+ | Linux | | - -Set runid with --runid option. It must not exists in the database. The random -one will be selected if not provided. -""" - -# Known issues: -# - screws up warnings location, causing them to appear as originated from testrunner.py - -# the number of seconds each test script is allowed to run -DEFAULT_TIMEOUT = 120 - -# the number of bytes of output that is recorded; the rest is thrown away -OUTPUT_LIMIT = 50000 - -ignore_tracebacks = ['ExpectedException', 'test_support.TestSkipped', 'test.test_support.TestSkipped'] - +#!/usr/bin/env python +import gevent +gevent.get_hub('select') # this is just to make sure we don't pass any fds to children +from gevent import monkey; monkey.patch_all() import sys import os import glob -import re import traceback -from unittest import _TextTestResult, defaultTestLoader, TextTestRunner -import platform +from time import time + +from gevent.pool import Pool +import util + + +TIMEOUT = 180 +NWORKERS = int(os.environ.get('NWORKERS') or 8) +pool = None + + +def spawn(*args, **kwargs): + g = pool.spawn(*args, **kwargs) + g.link_exception(lambda *args: sys.exit('Internal error in testrunner.py: %s %s' % (g, g.exception))) + return g + + +def run_many(tests, expected=None, failfast=False): + global NWORKERS, pool + start = time() + total = 0 + failed = {} + + NWORKERS = min(len(tests), NWORKERS) + pool = Pool(NWORKERS) + util.BUFFER_OUTPUT = NWORKERS > 1 + + def run_one(cmd, **kwargs): + result = util.run(cmd, **kwargs) + if result: + if failfast: + sys.exit(1) + # the tests containing AssertionError might have failed because + # we spawned more workers than CPUs + # we therefore will retry them sequentially + failed[result.name] = [cmd, kwargs, 'AssertionError' in (result.output or '')] -try: - import sqlite3 -except ImportError, ex: - sys.stderr.write('Failed to import sqlite3: %s\n' % ex) try: - import pysqlite2.dbapi2 as sqlite3 - except ImportError, ex: - sys.stderr.write('Failed to import pysqlite2.dbapi2: %s\n' % ex) - sqlite3 = None - -_column_types = {'time': 'real'} - - -def store_record(database_path, table, dictionary, _added_colums_per_db={}): - if sqlite3 is None: - return - conn = sqlite3.connect(database_path) - _added_columns = _added_colums_per_db.setdefault(database_path, set()) - keys = dictionary.keys() - for key in keys: - if key not in _added_columns: + try: + for cmd, options in tests: + total += 1 + spawn(run_one, cmd, **(options or {})) + gevent.wait() + except KeyboardInterrupt: try: - sql = '''alter table %s add column %s %s''' % (table, key, _column_types.get(key)) - conn.execute(sql) - conn.commit() - _added_columns.add(key) - except sqlite3.OperationalError, ex: - if 'duplicate column' not in str(ex).lower(): - raise - sql = 'insert or replace into %s (%s) values (%s)' % (table, ', '.join(keys), ', '.join(':%s' % key for key in keys)) - cursor = conn.cursor() - try: - cursor.execute(sql, dictionary) - except sqlite3.Error: - print 'sql=%r\ndictionary=%r' % (sql, dictionary) + if pool: + util.log('Waiting for currently running to finish...') + pool.join() + except KeyboardInterrupt: + util.report(total, failed, exit=False, took=time() - start, expected=expected) + util.log('(partial results)\n') + raise + except: + traceback.print_exc() + pool.kill() # this needed to kill the processes raise - conn.commit() - return cursor.lastrowid - -class DatabaseTestResult(_TextTestResult): - separator1 = '=' * 70 - separator2 = '-' * 70 - - def __init__(self, database_path, runid, module_name, stream, descriptions, verbosity): - _TextTestResult.__init__(self, stream, descriptions, verbosity) - self.database_path = database_path - self.params = {'runid': runid, - 'test': module_name} - - def startTest(self, test): - _TextTestResult.startTest(self, test) - self.params['testcase'] = test.id().replace('__main__.', '') - self.params['result'] = 'TIMEOUT' - row_id = store_record(self.database_path, 'testcase', self.params) - self.params['id'] = row_id - from time import time - self.time = time() - - def _store_result(self, test, result): - self.params['result'] = result - from time import time - self.params['time'] = time() - self.time - store_record(self.database_path, 'testcase', self.params) - self.params.pop('id', None) - - def addSuccess(self, test): - _TextTestResult.addSuccess(self, test) - self._store_result(test, 'PASSED') - - def addError(self, test, err): - _TextTestResult.addError(self, test, err) - self._store_result(test, format_exc_info(err)) - - def addFailure(self, test, err): - _TextTestResult.addFailure(self, test, err) - self._store_result(test, format_exc_info(err)) + toretry = [key for (key, (cmd, kwargs, can_retry)) in failed.items() if can_retry] + failed_then_succeeded = [] + if NWORKERS > 1 and toretry: + util.log('\nWill retry %s failed tests sequentially:\n- %s\n', len(toretry), '\n- '.join(toretry)) + for name, (cmd, kwargs, _ignore) in failed.items(): + if not util.run(cmd, buffer_output=False, **kwargs): + failed.pop(name) + failed_then_succeeded.append(name) -def format_exc_info(exc_info): - try: - return '%s: %s' % (exc_info[0].__name__, exc_info[1]) - except Exception: - return str(exc_info[1]) or str(exc_info[0]) or 'FAILED' + if failed_then_succeeded: + util.log('\n%s tests failed during concurrent run but succeeded when ran sequentially:', len(failed_then_succeeded)) + util.log('- ' + '\n- '.join(failed_then_succeeded)) + util.log('gevent version %s from %s', gevent.__version__, gevent.__file__) + util.report(total, failed, took=time() - start, expected=expected) + assert not pool, pool -class DatabaseTestRunner(TextTestRunner): - def __init__(self, database_path, runid, module_name, stream=sys.stderr, descriptions=1, verbosity=1): - self.database_path = database_path - self.runid = runid - self.module_name = module_name - TextTestRunner.__init__(self, stream=stream, descriptions=descriptions, verbosity=verbosity) +def discover(tests=None, ignore=None): + if isinstance(ignore, basestring): + ignore = load_list_from_file(ignore) - def _makeResult(self): - return DatabaseTestResult(self.database_path, self.runid, self.module_name, self.stream, self.descriptions, self.verbosity) + ignore = set(ignore or []) + if not tests: + tests = set(glob.glob('test_*.py')) - set(['test_support.py']) + if ignore: + tests -= ignore + tests = sorted(tests) -def get_changeset(): - try: - diff = os.popen(r"hg diff 2> /dev/null").read().strip() - except Exception: - diff = None - try: - changeset = os.popen(r"hg log -r tip 2> /dev/null | grep changeset").readlines()[0] - changeset = changeset.replace('changeset:', '').strip().replace(':', '_') - if diff: - changeset += '+' - except Exception: - changeset = '' - return changeset - - -def get_libevent_version(): - from gevent import core - libevent_version = core.get_version() - if core.get_header_version() != core.get_version() and core.get_header_version() is not None: - libevent_version += '/headers=%s' % core.get_header_version() - return libevent_version - - -def get_tempnam(): - import warnings - warnings.filterwarnings('ignore', 'tempnam is a potential security risk to your program') - try: - tempnam = os.tempnam() - finally: - del warnings.filters[0] - return os.path.join(os.path.dirname(tempnam), 'testresults.sqlite3') - - -def run_tests(options, args): - arg = args[0] - module_name = arg - if module_name.endswith('.py'): - module_name = module_name[:-3] - - class _runner(object): - - def __new__(cls, *args, **kawrgs): - return DatabaseTestRunner(database_path=options.db, runid=options.runid, module_name=module_name, verbosity=options.verbosity) - - if options.db: - import unittest - unittest.TextTestRunner = _runner - import test_support - test_support.BasicTestRunner = _runner + to_process = [] + default_options = {'timeout': TIMEOUT} - sys.argv = args - globals()['__file__'] = arg + for filename in tests: + if 'TESTRUNNER' in open(filename).read(): + module = __import__(filename.rsplit('.', 1)[0]) + for cmd, options in module.TESTRUNNER(): + if remove_options(cmd)[-1] in ignore: + continue + to_process.append((cmd, options)) + else: + to_process.append(([sys.executable, '-u', filename], default_options.copy())) - if os.path.exists(arg): - execfile(arg, globals()) - else: - test = defaultTestLoader.loadTestsFromName(arg) - result = _runner().run(test) - sys.exit(not result.wasSuccessful()) - - -def run_subprocess(args, options): - from threading import Timer - from mysubprocess import Popen, PIPE, STDOUT - - popen_args = [sys.executable, sys.argv[0], '--record', - '--runid', options.runid, - '--verbosity', options.verbosity] - if options.db: - popen_args += ['--db', options.db] - popen_args += args - popen_args = [str(x) for x in popen_args] - if options.capture: - popen = Popen(popen_args, stdout=PIPE, stderr=STDOUT, shell=False) - else: - popen = Popen(popen_args, shell=False) + return to_process - retcode = [] - def killer(): - retcode.append('TIMEOUT') - print >> sys.stderr, 'Killing %s (%s) because of timeout' % (popen.pid, args) - popen.kill() - - timeout = Timer(options.timeout, killer) - timeout.start() - output = '' - output_printed = False - try: - try: - if options.capture: - while True: - data = popen.stdout.read(1) - if not data: - break - output += data - if options.verbosity >= 2: - sys.stdout.write(data) - output_printed = True - retcode.append(popen.wait()) - except Exception: - popen.kill() - raise - finally: - timeout.cancel() - # QQQ compensating for run_tests' screw up - module_name = args[0] - if module_name.endswith('.py'): - module_name = module_name[:-3] - output = output.replace(' (__main__.', ' (' + module_name + '.') - return retcode[0], output, output_printed - - -def spawn_subprocess(args, options, base_params): - success = False - if options.db: - module_name = args[0] - if module_name.endswith('.py'): - module_name = module_name[:-3] - from datetime import datetime - params = base_params.copy() - params.update({'started_at': datetime.now(), - 'test': module_name}) - row_id = store_record(options.db, 'test', params) - params['id'] = row_id - retcode, output, output_printed = run_subprocess(args, options) - if len(output) > OUTPUT_LIMIT: - warn = '' - output = output[:OUTPUT_LIMIT - len(warn)] + warn - if retcode: - if retcode == 1 and 'test_support.TestSkipped' in output: - pass - else: - if not output_printed and options.verbosity >= -1: - sys.stdout.write(output) - print '%s failed with code %s' % (' '.join(args), retcode) - elif retcode == 0: - if not output_printed and options.verbosity >= 1: - sys.stdout.write(output) - if options.verbosity >= 0: - print '%s passed' % ' '.join(args) - success = True - else: - print '%s timed out' % ' '.join(args) - if options.db: - params['output'] = output - params['retcode'] = retcode - store_record(options.db, 'test', params) - return success - - -def spawn_subprocesses(options, args): - params = {'runid': options.runid, - 'python': '%s.%s.%s' % sys.version_info[:3], - 'changeset': get_changeset(), - 'libevent_version': get_libevent_version(), - 'uname': platform.uname()[0], - 'retcode': 'TIMEOUT'} - success = True - if not args: - args = glob.glob('test_*.py') - args.remove('test_support.py') - real_args = [] - for arg in args: - if os.path.exists(arg): - real_args.append([arg]) - else: - real_args[-1].append(arg) - for arg in real_args: - try: - success = spawn_subprocess(arg, options, params) and success - except Exception: - traceback.print_exc() - if options.db: - try: - print '-' * 80 - if print_stats(options): - success = False - except sqlite3.OperationalError: - traceback.print_exc() - print 'To view stats again for this run, use %s --stats --runid %s --db %s' % (sys.argv[0], options.runid, options.db) - if not success: - sys.exit(1) - - -def get_testcases(cursor, runid, result=None): - sql = 'select test, testcase from testcase where runid=?' - args = (runid, ) - if result is not None: - sql += ' and result=?' - args += (result, ) - return ['.'.join(x) for x in cursor.execute(sql, args).fetchall()] - - -def get_failed_testcases(cursor, runid): - sql = 'select test, testcase, result from testcase where runid=?' - args = (runid, ) - sql += ' and result!="PASSED" and result!="TIMEOUT"' - names = [] - errors = {} - for test, testcase, result in cursor.execute(sql, args).fetchall(): - name = '%s.%s' % (test, testcase) - names.append(name) - errors[name] = result - return names, errors - - -_warning_re = re.compile('\w*warning', re.I) - - -def get_warnings(output): - """ - >>> get_warnings('hello DeprecationWarning warning: bla DeprecationWarning') - ['DeprecationWarning', 'warning', 'DeprecationWarning'] - """ - if len(output) <= OUTPUT_LIMIT: - return _warning_re.findall(output) - else: - return _warning_re.findall(output[:OUTPUT_LIMIT]) + ['AbridgedOutputWarning'] +def remove_options(lst): + return [x for x in lst if x and not x.startswith('-')] -def get_exceptions(output): - """ - >>> get_exceptions('''test$ python -c "1/0" - ... Traceback (most recent call last): - ... File "", line 1, in - ... ZeroDivisionError: integer division or modulo by zero''') - ['ZeroDivisionError'] - """ - errors = [] - readtb = False - for line in output.split('\n'): - if 'Traceback (most recent call last):' in line: - readtb = True - else: - if readtb: - if line[:1] == ' ': - pass - else: - errors.append(line.split(':')[0]) - readtb = False - return errors - - -def get_warning_stats(output): - counter = {} - for warning in get_warnings(output): - counter.setdefault(warning, 0) - counter[warning] += 1 - items = counter.items() - items.sort(key=lambda (a, b): -b) +def load_list_from_file(filename): result = [] - for name, count in items: - if count == 1: - result.append(name) - else: - result.append('%s %ss' % (count, name)) + if filename: + for x in open(filename): + x = x.split('#', 1)[0].strip() + if x: + result.append(x) return result -def get_ignored_tracebacks(test): - if os.path.exists(test + '.py'): - data = open(test + '.py').read() - m = re.search('Ignore tracebacks: (.*)', data) - if m is not None: - return m.group(1).split() - return [] - - -def get_traceback_stats(output, test): - ignored = get_ignored_tracebacks(test) or ignore_tracebacks - counter = {} - traceback_count = output.lower().count('Traceback (most recent call last)') - ignored_list = [] - for error in get_exceptions(output): - if error in ignored: - ignored_list.append(error) - else: - counter.setdefault(error, 0) - counter[error] += 1 - traceback_count -= 1 - items = counter.items() - items.sort(key=lambda (a, b): -b) - if traceback_count > 0: - items.append(('other traceback', traceback_count)) - result = [] - for name, count in items: - if count == 1: - result.append('1 %s' % name) - else: - result.append('%s %ss' % (count, name)) - return result, ignored_list +def full(args=None): + tests = [] + for setenv, ignore in [('GEVENT_RESOLVER=thread', None), + ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8', 'tests_that_dont_use_resolver.txt')]: + setenv = dict(x.split('=') for x in setenv.split()) + for cmd, options in discover(args, ignore=ignore): + my_setenv = options.get('setenv', {}) + my_setenv.update(setenv) + options['setenv'] = my_setenv + tests.append((cmd, options)) -def get_info(output, test): - output = output[:OUTPUT_LIMIT] - traceback_stats, ignored_list = get_traceback_stats(output, test) - warning_stats = get_warning_stats(output) - result = traceback_stats + warning_stats - skipped = not warning_stats and not traceback_stats and ignored_list in [['test_support.TestSkipped'], ['test.test_support.TestSkipped']] - return ', '.join(result), skipped - - -def print_stats(options): - db = sqlite3.connect(options.db) - cursor = db.cursor() - if options.runid is None: - options.runid = cursor.execute('select runid from test order by started_at desc limit 1').fetchall()[0][0] - print 'Using the latest runid: %s' % options.runid - total = len(get_testcases(cursor, options.runid)) - failed, errors = get_failed_testcases(cursor, options.runid) - timedout = get_testcases(cursor, options.runid, 'TIMEOUT') - for test, output, retcode in cursor.execute('select test, output, retcode from test where runid=?', (options.runid, )): - info, skipped = get_info(output or '', test) - if info: - print '%s: %s' % (test, info) - if retcode == 'TIMEOUT': - for testcase in timedout: - if testcase.startswith(test + '.'): - break - else: - timedout.append(test) - total += 1 - elif retcode != 0: - for testcase in failed: - if testcase.startswith(test + '.'): - break - else: - if not skipped: - failed.append(test) - total += 1 - if failed: - failed.sort() - print 'FAILURES: ' - for testcase in failed: - error = errors.get(testcase) - if error: - error = repr(error)[1:-1][:100] - print ' - %s: %s' % (testcase, error) - else: - print ' - %s' % (testcase, ) - if timedout: - print 'TIMEOUTS: ' - print ' - ' + '\n - '.join(timedout) - print '%s testcases passed; %s failed; %s timed out' % (total, len(failed), len(timedout)) - if failed or timedout: - return True - return False + if sys.version_info[:2] == (2, 7) and os.environ.get('EXTRA'): + tests.append(([sys.executable, '-u', 'xtest_pep8.py'], None)) + + return tests def main(): import optparse parser = optparse.OptionParser() - parser.add_option('-v', '--verbose', default=0, action='count') - parser.add_option('-q', '--quiet', default=0, action='count') - parser.add_option('--verbosity', default=0, type='int', help=optparse.SUPPRESS_HELP) - parser.add_option('--db', default='testresults.sqlite3') - parser.add_option('--no-db', dest='db', action='store_false') - parser.add_option('--runid') - parser.add_option('--record', default=False, action='store_true') - parser.add_option('--no-capture', dest='capture', default=True, action='store_false') - parser.add_option('--stats', default=False, action='store_true') - parser.add_option('--timeout', default=DEFAULT_TIMEOUT, type=float, metavar='SECONDS') - + parser.add_option('--ignore') + parser.add_option('--discover', action='store_true') + parser.add_option('--full', action='store_true') + parser.add_option('--expected') + parser.add_option('--failfast', action='store_true') options, args = parser.parse_args() - options.verbosity += options.verbose - options.quiet - - if options.db: - if sqlite3: - options.db = os.path.abspath(options.db) - print 'Using the database: %s' % options.db - else: - sys.stderr.write('Cannot access the database %r: no sqlite3 module found.\n' % (options.db, )) - options.db = False - - if options.db: - db = sqlite3.connect(options.db) - db.execute('create table if not exists test (id integer primary key autoincrement, runid text)') - db.execute('create table if not exists testcase (id integer primary key autoincrement, runid text)') - db.commit() - - if options.stats: - print_stats(options) + options.expected = load_list_from_file(options.expected) + if options.full: + assert options.ignore is None, '--ignore and --full are not compatible' + tests = full(args) else: - if not options.runid: - try: - import uuid - options.runid = str(uuid.uuid4()) - except ImportError: - import random - options.runid = str(random.random())[2:] - print 'Generated runid: %s' % (options.runid, ) - if options.record: - run_tests(options, args) - else: - spawn_subprocesses(options, args) + tests = discover(args, options.ignore) + if options.discover: + for cmd, options in tests: + print util.getname(cmd, env=options.get('env'), setenv=options.get('setenv')) + print '%s tests found.' % len(tests) + else: + run_many(tests, expected=options.expected, failfast=options.failfast) if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__select.py python-gevent-1.0/greentest/test__select.py --- python-gevent-0.13.7/greentest/test__select.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__select.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,4 +1,6 @@ -from gevent import select +import sys +import os +from gevent import select, socket import greentest @@ -8,13 +10,33 @@ select.select([], [], [], timeout) +if sys.platform != 'win32': + + class TestSelectRead(greentest.GenericWaitTestCase): + + def wait(self, timeout): + r, w = os.pipe() + try: + select.select([r], [], [], timeout) + finally: + os.close(r) + os.close(w) + + class TestSelectTypes(greentest.TestCase): def test_int(self): - select.select([1], [], [], 0.001) + sock = socket.socket() + select.select([int(sock.fileno())], [], [], 0.001) - def test_long(self): - select.select([1L], [], [], 0.001) + try: + long + except NameError: + pass + else: + def test_long(self): + sock = socket.socket() + select.select([long(sock.fileno())], [], [], 0.001) def test_string(self): self.switch_expected = False diff -Nru python-gevent-0.13.7/greentest/test__semaphore.py python-gevent-1.0/greentest/test__semaphore.py --- python-gevent-0.13.7/greentest/test__semaphore.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__semaphore.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,5 +1,6 @@ import greentest -from gevent.coros import Semaphore +import gevent +from gevent.lock import Semaphore class TestTimeoutAcquire(greentest.TestCase): @@ -10,6 +11,16 @@ result = s.acquire(timeout=0.01) assert result is False, repr(result) + def test_release_twice(self): + s = Semaphore() + result = [] + s.rawlink(lambda s: result.append('a')) + s.release() + s.rawlink(lambda s: result.append('b')) + s.release() + gevent.sleep(0.001) + self.assertEqual(result, ['a', 'b']) + if __name__ == '__main__': greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__server_http.py python-gevent-1.0/greentest/test__server_http.py --- python-gevent-0.13.7/greentest/test__server_http.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__server_http.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -import unittest -import gevent -from gevent import http -import test__server -from test__server import * - -internal_error_start = 'HTTP/1.0 500 Internal Server Error\n'.replace('\n', '\r\n') -internal_error_end = '\n\nInternal Server Error'.replace('\n', '\r\n') - -internal_error503 = '''HTTP/1.0 503 Service Unavailable -Connection: close -Content-type: text/plain -Content-length: 31 - -Service Temporarily Unavailable'''.replace('\n', '\r\n') - - -class SimpleHTTPServer(http.HTTPServer): - - def handle(self, request): - if request.uri == '/ping': - request.send_reply(200, "OK", "PONG") - elif request.uri == '/short': - gevent.sleep(0.1) - request.send_reply(200, "OK", 'hello') - elif request.uri == '/long': - gevent.sleep(10) - request.send_reply(200, "OK", 'hello') - else: - request.send_reply(404, "gevent.http", "") - - -class Settings: - ServerClass = http.HTTPServer - ServerSubClass = SimpleHTTPServer - restartable = False - close_socket_detected = False - - @staticmethod - def assert500(self): - conn = self.makefile() - conn.write('GET / HTTP/1.0\r\n\r\n') - result = conn.read() - assert result.startswith(internal_error_start), (result, internal_error_start) - assert result.endswith(internal_error_end), (result, internal_error_end) - - assertAcceptedConnectionError = assert500 - - @staticmethod - def assert503(self): - conn = self.makefile() - conn.write('GET / HTTP/1.0\r\n\r\n') - result = conn.read() - assert result == internal_error503, (result, internal_error503) - - assertPoolFull = assert503 - - -test__server.Settings = Settings - - -if __name__ == '__main__': - unittest.main() diff -Nru python-gevent-0.13.7/greentest/test__server.py python-gevent-1.0/greentest/test__server.py --- python-gevent-0.13.7/greentest/test__server.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__server.py 2013-11-26 16:25:45.000000000 +0000 @@ -3,6 +3,7 @@ import gevent from gevent.server import StreamServer import errno +import sys import os @@ -16,7 +17,7 @@ try: method, path, rest = request_line.split(' ', 3) except Exception: - print 'Failed to parse request line: %r' % (request_line, ) + print ('Failed to parse request line: %r' % (request_line, )) raise if path == '/ping': client_socket.sendall('HTTP/1.0 200 OK\r\n\r\nPONG') @@ -51,8 +52,9 @@ # attempt to send anything reset the connection try: self.send_request() - except socket.error, ex: - if ex[0] != errno.ECONNRESET: + except socket.error: + ex = sys.exc_info()[1] + if ex.args[0] != errno.ECONNRESET: raise @staticmethod @@ -62,7 +64,7 @@ class TestCase(greentest.TestCase): - __timeout__ = 10 + __timeout__ = 5 def cleanup(self): if getattr(self, 'server', None) is not None: @@ -76,7 +78,8 @@ return sock def makefile(self, timeout=0.1, bufsize=1): - sock = socket.create_connection((self.server.server_host, self.server.server_port)) + sock = socket.socket() + sock.connect((self.server.server_host, self.server.server_port)) fobj = sock.makefile(bufsize=bufsize) fobj._sock.settimeout(timeout) return fobj @@ -91,8 +94,9 @@ try: conn = self.makefile() raise AssertionError('Connection was not refused: %r' % (conn._sock, )) - except socket.error, ex: - if ex[0] not in (errno.ECONNREFUSED, errno.EADDRNOTAVAIL): + except socket.error: + ex = sys.exc_info()[1] + if ex.args[0] not in (errno.ECONNREFUSED, errno.EADDRNOTAVAIL): raise def assert500(self): @@ -140,9 +144,9 @@ def report_netstat(self, msg): return - print msg + print (msg) os.system('sudo netstat -anp | grep %s' % os.getpid()) - print '^^^^^' + print ('^^^^^') def init_server(self): self.server = self.ServerSubClass(('127.0.0.1', 0)) @@ -155,12 +159,11 @@ def _test_invalid_callback(self): try: - self.hook_stderr() + self.expect_one_error() self.server = self.ServerClass(('127.0.0.1', 0), lambda: None) self.server.start() self.assert500() - self.assert_stderr_traceback('TypeError') - self.assert_stderr(self.invalid_callback_message) + self.assert_error(TypeError) finally: self.server.stop() @@ -175,8 +178,6 @@ class TestDefaultSpawn(TestCase): - invalid_callback_message = ': ignoring test_error_in_spawn \\(sleeping \d.\d+ seconds\\)\n$') - self.assert_stderr('<.*?>: Failed to handle...') + self.assert_error(ExpectedError, error) return if Settings.restartable: assert not self.server.started @@ -297,8 +299,6 @@ class TestRawSpawn(TestDefaultSpawn): - invalid_callback_message = 'Failed active_event...' - def get_spawn(self): return gevent.spawn_raw @@ -323,10 +323,10 @@ gevent.sleep(0.1) self.assertRequestSucceeded() + test_pool_full.error_fatal = False -class TestNoneSpawn(TestCase): - invalid_callback_message = '<.*?>: Failed to handle' +class TestNoneSpawn(TestCase): def get_spawn(self): return None @@ -339,23 +339,23 @@ gevent.sleep(0) self.server = Settings.ServerClass(('127.0.0.1', 0), sleep, spawn=None) self.server.start() - self.hook_stderr() + self.expect_one_error() self.assert500() - self.assert_mainloop_assertion(self.invalid_callback_message) + self.assert_error(AssertionError, 'Impossible to call blocking function in the event loop callback') class ExpectedError(Exception): pass -class TestSSLSocketNotAllowed(TestCase): +if hasattr(socket, 'ssl'): - switch_expected = False + class TestSSLSocketNotAllowed(TestCase): - def get_spawn(self): - return gevent.spawn + switch_expected = False - if hasattr(socket, 'ssl'): + def get_spawn(self): + return gevent.spawn def test(self): from gevent.socket import ssl, socket @@ -365,6 +365,7 @@ listener = ssl(listener) self.assertRaises(TypeError, self.ServerSubClass, listener) + # test non-socket.error exception in accept call: fatal # test error in spawn(): non-fatal # test error in spawned handler: non-fatal diff -Nru python-gevent-0.13.7/greentest/test__server_pywsgi.py python-gevent-1.0/greentest/test__server_pywsgi.py --- python-gevent-0.13.7/greentest/test__server_pywsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__server_pywsgi.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,12 +1,9 @@ -import unittest +import greentest import gevent from gevent import pywsgi import test__server from test__server import * from test__server import Settings as server_Settings -from test__server_http import Settings as http_Settings - -import gevent.wsgi; gevent.wsgi.WSGIServer.__init__ = None def application(self, environ, start_response): @@ -33,10 +30,40 @@ application = application -class Settings(http_Settings): +internal_error_start = 'HTTP/1.1 500 Internal Server Error\n'.replace('\n', '\r\n') +internal_error_end = '\n\nInternal Server Error'.replace('\n', '\r\n') + +internal_error503 = '''HTTP/1.1 503 Service Unavailable +Connection: close +Content-type: text/plain +Content-length: 31 + +Service Temporarily Unavailable'''.replace('\n', '\r\n') + + +class Settings: ServerClass = pywsgi.WSGIServer ServerSubClass = SimpleWSGIServer close_socket_detected = True + restartable = False + close_socket_detected = False + + @staticmethod + def assert500(self): + conn = self.makefile() + conn.write('GET / HTTP/1.0\r\n\r\n') + result = conn.read() + assert result.startswith(internal_error_start), (result, internal_error_start) + assert result.endswith(internal_error_end), (result, internal_error_end) + + assertAcceptedConnectionError = assert500 + + @staticmethod + def assert503(self): + conn = self.makefile() + conn.write('GET / HTTP/1.0\r\n\r\n') + result = conn.read() + assert result == internal_error503, (result, internal_error503) @staticmethod def assertPoolFull(self): @@ -51,14 +78,7 @@ test__server.Settings = Settings -msg = '<.*?>: Failed to handle...' - -TestNoneSpawn.invalid_callback_message = msg -TestRawSpawn.invalid_callback_message = msg -TestPoolSpawn.invalid_callback_message = msg -TestDefaultSpawn.invalid_callback_message = msg - del TestNoneSpawn if __name__ == '__main__': - unittest.main() + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__server_wsgi.py python-gevent-1.0/greentest/test__server_wsgi.py --- python-gevent-0.13.7/greentest/test__server_wsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__server_wsgi.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -import unittest -import gevent -from gevent import wsgi -import test__server -from test__server import * -from test__server_http import Settings as http_Settings - -import gevent.pywsgi; gevent.pywsgi.WSGIServer.__init__ = None - - -def application(self, environ, start_response): - if environ['PATH_INFO'] == '/ping': - start_response("200 OK", []) - return ["PONG"] - elif environ['PATH_INFO'] == '/short': - gevent.sleep(0.1) - start_response("200 after 0.1 seconds", []) - return ["hello"] - elif environ['PATH_INFO'] == '/long': - gevent.sleep(10) - start_response("200 after 10 seconds", []) - return ["hello"] - else: - start_response("404 wsgi WTF?", []) - return [] - - -class SimpleWSGIServer(wsgi.WSGIServer): - application = application - - -class Settings(http_Settings): - ServerClass = wsgi.WSGIServer - ServerSubClass = SimpleWSGIServer - - -test__server.Settings = Settings - -msg = '<.*?>: Failed to handle...' - -TestNoneSpawn.invalid_callback_message = msg -TestRawSpawn.invalid_callback_message = msg -TestPoolSpawn.invalid_callback_message = msg -TestDefaultSpawn.invalid_callback_message = msg - -if __name__ == '__main__': - unittest.main() diff -Nru python-gevent-0.13.7/greentest/test__signal.py python-gevent-1.0/greentest/test__signal.py --- python-gevent-0.13.7/greentest/test__signal.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__signal.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,49 @@ +import signal +import greentest +import gevent +import sys + + +class Expected(Exception): + pass + + +def raise_Expected(): + raise Expected('TestSignal') + + +if hasattr(signal, 'SIGALRM'): + + class TestSignal(greentest.TestCase): + + error_fatal = False + __timeout__ = 5 + + def test(self): + sig = gevent.signal(signal.SIGALRM, raise_Expected) + assert sig.ref is False, repr(sig.ref) + sig.ref = True + assert sig.ref is True + sig.ref = False + try: + signal.alarm(1) + try: + gevent.sleep(2) + raise AssertionError('must raise Expected') + except Expected: + ex = sys.exc_info()[1] + assert str(ex) == 'TestSignal', ex + # also let's check that alarm is persistent + signal.alarm(1) + try: + gevent.sleep(2) + raise AssertionError('must raise Expected') + except Expected: + ex = sys.exc_info()[1] + assert str(ex) == 'TestSignal', ex + finally: + sig.cancel() + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__sleep0.py python-gevent-1.0/greentest/test__sleep0.py --- python-gevent-0.13.7/greentest/test__sleep0.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__sleep0.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,11 @@ +from __future__ import with_statement +import gevent +from util import alarm + + +alarm(1) + + +with gevent.Timeout(0.01, False): + while True: + gevent.sleep(0) diff -Nru python-gevent-0.13.7/greentest/test__socket_close.py python-gevent-1.0/greentest/test__socket_close.py --- python-gevent-0.13.7/greentest/test__socket_close.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_close.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,30 +1,52 @@ import gevent from gevent import socket +from gevent import server import greentest # XXX also test: send, sendall, recvfrom, recvfrom_into, sendto +def readall(socket, address): + while socket.recv(1024): + pass + + class Test(greentest.TestCase): + error_fatal = False + + def setUp(self): + self.server = server.StreamServer(('', 0), readall) + self.server.start() + + def tearDown(self): + self.server.stop() + def test_recv_closed(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect(('www.google.com', 80)) + sock.connect(('127.0.0.1', self.server.server_port)) receiver = gevent.spawn(sock.recv, 25) - gevent.sleep(0.001) - sock.close() - receiver.join(timeout=0.001) - assert receiver.ready(), receiver - self.assertEqual(receiver.value, '') + try: + gevent.sleep(0.001) + sock.close() + receiver.join(timeout=0.1) + assert receiver.ready(), receiver + self.assertEqual(receiver.value, None) + assert isinstance(receiver.exception, socket.error) + self.assertEqual(receiver.exception.errno, socket.EBADF) + finally: + receiver.kill() def test_recv_twice(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect(('www.google.com', 80)) + sock.connect(('127.0.0.1', self.server.server_port)) receiver = gevent.spawn(sock.recv, 25) - gevent.sleep(0.001) - self.assertRaises(AssertionError, sock.recv, 25) - self.assertRaises(AssertionError, sock.recv, 25) - receiver.kill() + try: + gevent.sleep(0.001) + self.assertRaises(AssertionError, sock.recv, 25) + self.assertRaises(AssertionError, sock.recv, 25) + finally: + receiver.kill() if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__socket_dns6.py python-gevent-1.0/greentest/test__socket_dns6.py --- python-gevent-0.13.7/greentest/test__socket_dns6.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_dns6.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +from __future__ import with_statement +import greentest +import socket +from test__socket_dns import TestCase, add + + +class Test6(TestCase): + + # host that only has AAAA record + host = 'aaaa.test-ipv6.com' + + def test_empty(self): + self._test('getaddrinfo', self.host, 'http') + + def test_inet(self): + self._test('getaddrinfo', self.host, None, socket.AF_INET) + + def test_inet6(self): + self._test('getaddrinfo', self.host, None, socket.AF_INET6) + + def test_unspec(self): + self._test('getaddrinfo', self.host, None, socket.AF_UNSPEC) + + +class Test6_google(Test6): + host = 'ipv6.google.com' + + +class Test6_ds(Test6): + # host that has both A and AAAA records + host = 'ds.test-ipv6.com' + + +add(Test6, Test6.host) +add(Test6_google, Test6_google.host) +add(Test6_ds, Test6_ds.host) + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__socket_dns.py python-gevent-1.0/greentest/test__socket_dns.py --- python-gevent-0.13.7/greentest/test__socket_dns.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_dns.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,203 +1,466 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +from __future__ import with_statement import sys import re import greentest -import socket as real_socket -from gevent.socket import * +import socket +from time import time +import gevent +import gevent.socket as gevent_socket +from util import log -ACCEPTED_GAIERROR_MISMATCH = { - "gaierror(-5, 'No address associated with hostname')": - ("DNSError(3, 'name does not exist')", "DNSError(66, 'unknown')"), -} - -assert gaierror is real_socket.gaierror -assert error is real_socket.error - -VERBOSE = '-v' in sys.argv -IGNORE_ERRORS = '--ignore' in sys.argv -DEBUG = '-d' in sys.argv -for arg in ['--ignore', '-d']: +resolver = gevent.get_hub().resolver +log('Resolver: %s', resolver) + +if getattr(resolver, 'pool', None) is not None: + resolver.pool.size = 1 + + +assert gevent_socket.gaierror is socket.gaierror +assert gevent_socket.error is socket.error + +DEBUG = False + + +def _run(function, *args): try: - sys.argv.remove(arg) - except ValueError: - pass + result = function(*args) + assert not isinstance(result, BaseException), repr(result) + return result + except Exception: + return sys.exc_info()[1] + + +def format_call(function, args): + args = repr(args) + if args.endswith(',)'): + args = args[:-2] + ')' + try: + module = function.__module__.replace('gevent.socket', 'gevent').replace('_socket', 'stdlib') + name = function.__name__ + return '%s:%s%s' % (module, name, args) + except AttributeError: + return function + args + + +def log_fresult(result, seconds): + if isinstance(result, Exception): + msg = ' -=> raised %r' % (result, ) + else: + msg = ' -=> returned %r' % (result, ) + time = ' %.2fms' % (seconds * 1000.0, ) + space = 80 - len(msg) - len(time) + if space > 0: + space = ' ' * space + else: + space = '' + log(msg + space + time) + + +def run(function, *args): + if DEBUG: + log(format_call(function, args)) + delta = time() + result = _run(function, *args) + delta = time() - delta + if DEBUG: + log_fresult(result, delta) + return result, delta + + +def log_call(result, time, function, *args): + log(format_call(function, args)) + log_fresult(result, time) + + +google_host_re = re.compile('^arn[a-z0-9-]+.1e100.net$') + + +def compare_ipv6(a, b): + """ + >>> compare_ipv6('2a00:1450:400f:801::1010', '2a00:1450:400f:800::1011') + True + >>> compare_ipv6('2a00:1450:400f:801::1010', '2aXX:1450:400f:900::1011') + False + >>> compare_ipv6('2a00:1450:4016:800::1013', '2a00:1450:4008:c01::93') + True + """ + if a.count(':') == 5 and b.count(':') == 5: + # QQQ not actually sure if this is right thing to do + return a.rsplit(':')[:2] == b.rsplit(':')[:2] + if google_host_re.match(a) and google_host_re.match(b): + return True + return a == b + + +def contains_5tuples(lst): + for item in lst: + if not (isinstance(item, tuple) and len(item) == 5): + return False + return True + + +def relaxed_is_equal(a, b): + """ + >>> relaxed_is_equal([(10, 1, 6, '', ('2a00:1450:400f:801::1010', 80, 0, 0))], [(10, 1, 6, '', ('2a00:1450:400f:800::1011', 80, 0, 0))]) + True + >>> relaxed_is_equal([1, '2'], (1, '2')) + False + >>> relaxed_is_equal([1, '2'], [1, '2']) + True + """ + if type(a) is not type(b): + return False + if isinstance(a, basestring): + return compare_ipv6(a, b) + if hasattr(a, '__iter__'): + if len(a) != len(b): + return False + if contains_5tuples(a) and contains_5tuples(b): + # getaddrinfo results + a = sorted(a) + b = sorted(b) + return all(relaxed_is_equal(x, y) for (x, y) in zip(a, b)) + return a == b + + +def add(klass, hostname, name=None): + + call = callable(hostname) + + if name is None: + if call: + name = hostname.__name__ + else: + name = re.sub('[^\w]+', '_', repr(hostname)) + assert name, repr(hostname) + + def test1(self): + x = hostname() if call else hostname + self._test('getaddrinfo', x, 'http') + test1.__name__ = 'test_%s_getaddrinfo' % name + setattr(klass, test1.__name__, test1) + + def test2(self): + x = hostname() if call else hostname + ipaddr = self._test('gethostbyname', x) + if not isinstance(ipaddr, Exception): + self._test('gethostbyaddr', ipaddr) + test2.__name__ = 'test_%s_gethostbyname' % name + setattr(klass, test2.__name__, test2) + + def test3(self): + x = hostname() if call else hostname + self._test('gethostbyname_ex', x) + test3.__name__ = 'test_%s_gethostbyname_ex' % name + setattr(klass, test3.__name__, test3) + + def test4(self): + x = hostname() if call else hostname + self._test('gethostbyaddr', x) + test4.__name__ = 'test_%s_gethostbyaddr' % name + setattr(klass, test4.__name__, test4) + + def test5(self): + x = hostname() if call else hostname + self._test('getnameinfo', (x, 80), 0) + test5.__name__ = 'test_%s_getnameinfo' % name + setattr(klass, test5.__name__, test5) class TestCase(greentest.TestCase): + __timeout__ = 30 + switch_expected = None - if IGNORE_ERRORS: - def assertEqual(self, a, b): - if a != b: - print 'ERROR: %r != %r' % (a, b) - - def _test(self, hostname, check_ip=None): - self._test_gethostbyname(hostname, check_ip=check_ip) - self._test_getaddrinfo(hostname) + def should_log_results(self, result1, result2): + if isinstance(result1, BaseException) and isinstance(result2, BaseException): + return type(result1) is not type(result2) + return repr(result1) != repr(result2) + + def _test(self, func, *args): + gevent_func = getattr(gevent_socket, func) + real_func = getattr(socket, func) + real_result, time_real = run(real_func, *args) + gevent_result, time_gevent = run(gevent_func, *args) + if not DEBUG and self.should_log_results(real_result, gevent_result): + log('') + log_call(real_result, time_real, real_func, *args) + log_call(gevent_result, time_gevent, gevent_func, *args) + self.assertEqualResults(real_result, gevent_result, func, args) + + if time_gevent > time_real + 0.01 and time_gevent > 0.02: + msg = 'gevent:%s%s took %dms versus %dms stdlib' % (func, args, time_gevent * 1000.0, time_real * 1000.0) + + if time_gevent > time_real + 1: + word = 'VERY' + else: + word = 'quite' + + log('\nWARNING: %s slow: %s', word, msg) + + return gevent_result + + def assertEqualResults(self, real_result, gevent_result, func, args): + errors = [socket.gaierror, socket.herror, TypeError] + if type(real_result) in errors and type(gevent_result) in errors: + if type(real_result) is not type(gevent_result): + log('WARNING: error type mismatch: %r (gevent) != %r (stdlib)', gevent_result, real_result) + return + real_result_repr = repr(real_result) + gevent_result_repr = repr(gevent_result) + if real_result_repr == gevent_result_repr: + return + if relaxed_is_equal(gevent_result, real_result): + return + raise AssertionError('%r != %r\n %s' % (gevent_result, real_result, format_call(func, args))) - def _test_gethostbyname(self, hostname, check_ip=None): - try: - if VERBOSE: - print 'real_socket.gethostbyname(%r)' % (hostname, ) - real_ip = real_socket.gethostbyname(hostname) - except Exception, ex: - if DEBUG: - raise - real_ip = ex - try: - if VERBOSE: - print 'gevent.socket.gethostbyname(%r)' % (hostname, ) - ip = gethostbyname(hostname) - except Exception, ex: - if DEBUG: - raise - ip = ex - if self.equal(real_ip, ip): - return ip - self.assertEqual(real_ip, ip) - if check_ip is not None: - self.assertEqual(check_ip, ip) - return ip - - PORTS = [80, 0, 53, 'http'] - getaddrinfo_args = [(), - (AF_UNSPEC, ), - (AF_UNSPEC, SOCK_STREAM, 0, 0), - (AF_INET, SOCK_STREAM, ), - (AF_UNSPEC, SOCK_DGRAM, ), - (AF_INET, SOCK_RAW, ), - (AF_UNSPEC, SOCK_STREAM, 6), - (AF_INET, SOCK_DGRAM, 17)] - - def _test_getaddrinfo(self, hostname): - for port in self.PORTS: - for args in self.getaddrinfo_args: - if VERBOSE: - print - print 'real_socket.getaddrinfo(%r, %r, %r)' % (hostname, port, args) - try: - real_ip = real_socket.getaddrinfo(hostname, port, *args) - if VERBOSE: - print ' returned %r' % (real_ip, ) - except Exception, ex: - if DEBUG: - raise - real_ip = ex - if VERBOSE: - print 'gevent.socket.getaddrinfo(%r, %r, %r)' % (hostname, port, args) - try: - ip = getaddrinfo(hostname, port, *args) - if VERBOSE: - print ' returned %r' % (ip, ) - except Exception, ex: - if DEBUG: - raise - ip = ex - if not self.equal(real_ip, ip): - args_str = ', '.join(repr(x) for x in (hostname, port) + args) - print 'WARNING: getaddrinfo(%s):\n %r (stdlib)\n != %r (gevent)' % (args_str, real_ip, ip) - # QQQ switch_expected becomes useless when a bunch of unrelated tests are merged - # into a single one like above. Generate individual test cases instead? - - def equal(self, a, b): - if a == b: - return True - if isinstance(a, Exception) and isinstance(b, Exception): - if repr(a) == repr(b): - return True - if repr(b) in ACCEPTED_GAIERROR_MISMATCH.get(repr(a), (repr(b), )): - return True - def checkEqual(self, a, b): - if a == b: - return - print 'WARNING: %s.%s:\n %r\n != %r' % (self.__class__.__name__, self.testname, a, b) +class TestTypeError(TestCase): + pass +add(TestTypeError, None) +add(TestTypeError, 25) -def get_test(ip, host): - def test(self): - self._test(host, check_ip=ip) - test.__name__ = 'test_' + re.sub('[^\w]', '_', host + '__' + ip) +class TestHostname(TestCase): + pass - return test +add(TestHostname, socket.gethostname) -class TestLocal(TestCase): +class TestLocalhost(TestCase): + # certain tests in test_patched_socket.py only work if getaddrinfo('localhost') does not switch + # (e.g. NetworkConnectionAttributesTest.testSourceAddress) + pass + #switch_expected = False +add(TestLocalhost, 'localhost') +add(TestLocalhost, 'ip6-localhost') + + +class TestNonexistent(TestCase): + pass + +add(TestNonexistent, 'nonexistentxxxyyy') + + +class Test1234(TestCase): + pass + +add(Test1234, '1.2.3.4') + + +class Test127001(TestCase): + pass + +add(Test127001, '127.0.0.1') + + +class TestBroadcast(TestCase): switch_expected = False - def test_hostname(self): - hostname = real_socket.gethostname() - self._test(hostname) - def test_localhost(self): - self._test('localhost') +add(TestBroadcast, '') - def test_127_0_0_1(self): - self._test('127.0.0.1') - def test_1_2_3_4(self): - self._test('1.2.3.4') +class TestEtcHosts(TestCase): + pass - def SKIP_test_notexistent(self): - # not really interesting because the original gethostbyname() is called for everything without dots - # disabled because it takes too much time on windows for some reason - self._test('notexistent') +try: + etc_hosts = open('/etc/hosts').read() +except IOError: + etc_hosts = '' - def test_None(self): - self._test(None) +for ip, host in re.findall(r'^\s*(\d+\.\d+\.\d+\.\d+)\s+([^\s]+)', etc_hosts, re.M)[:10]: + add(TestEtcHosts, host) + add(TestEtcHosts, ip) + del host, ip - def test_25(self): - self._test(25) - try: - etc_hosts = open('/etc/hosts').read() - except IOError: - etc_hosts = '' +class TestGeventOrg(TestCase): + pass + +add(TestGeventOrg, 'gevent.org') + + +class TestFamily(TestCase): + + @classmethod + def getresult(cls): + if not hasattr(cls, '_result'): + cls._result = getattr(socket, 'getaddrinfo')('gevent.org', None) + return cls._result + + def assert_error(self, error, function, *args): + try: + result = function(*args) + raise AssertionError('%s: Expected to raise %s, instead returned %r' % (function, error, result)) + except Exception, ex: + if isinstance(error, basestring): + repr_error = error + else: + repr_error = repr(error) + if type(ex) is not type(error): + raise + if repr(ex) == repr_error: + return + raise + + def test_inet(self): + self.assertEqual(gevent_socket.getaddrinfo('gevent.org', None, socket.AF_INET), self.getresult()) - for ip, host in re.findall(r'^\s*(\d+\.\d+\.\d+\.\d+)\s+([^\s]+)', etc_hosts, re.M)[:10]: - func = get_test(ip, host) - print 'Adding %s' % func.__name__ - locals()[func.__name__] = func - del func + def test_unspec(self): + self.assertEqual(gevent_socket.getaddrinfo('gevent.org', None, socket.AF_UNSPEC), self.getresult()) + def test_badvalue(self): + self._test('getaddrinfo', 'gevent.org', None, 255) + self._test('getaddrinfo', 'gevent.org', None, 255000) + self._test('getaddrinfo', 'gevent.org', None, -1) -class TestRemote(TestCase): + def test_badtype(self): + self._test('getaddrinfo', 'gevent.org', 'x') - switch_expected = True - def test_www_python_org(self): - self._test('www.python.org') +class Test_getaddrinfo(TestCase): + + def _test_getaddrinfo(self, *args): + self._test('getaddrinfo', *args) + + def test_80(self): + self._test_getaddrinfo('gevent.org', 80) + + def test_int_string(self): + self._test_getaddrinfo('gevent.org', '80') + + def test_0(self): + self._test_getaddrinfo('gevent.org', 0) + + def test_http(self): + self._test_getaddrinfo('gevent.org', 'http') def test_notexistent_tld(self): - self._test('myhost.mytld') + self._test_getaddrinfo('myhost.mytld', 53) def test_notexistent_dot_com(self): - self._test('sdfsdfgu5e66098032453245wfdggd.com') + self._test_getaddrinfo('sdfsdfgu5e66098032453245wfdggd.com', 80) + + def test1(self): + return self._test_getaddrinfo('gevent.org', 52, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, 0) + + def test2(self): + return self._test_getaddrinfo('gevent.org', 53, socket.AF_INET, socket.SOCK_DGRAM, 17) + + def test3(self): + return self._test_getaddrinfo('google.com', 'http', socket.AF_INET6) class TestInternational(TestCase): + pass - def test(self): - self._test(u'президент.рф') +add(TestInternational, u'президент.рф', 'russian') +add(TestInternational, u'президент.рф'.encode('idna'), 'idna') -class TestIPv6(TestCase): +class TestInterrupted_gethostbyname(greentest.GenericWaitTestCase): - def test(self): - #self.PORTS = ['http'] - #self.getaddrinfo_args = [(), (AF_UNSPEC, ), (AF_INET, ), (AF_INET6, )] - self._test('aaaa.test-ipv6.com') + def wait(self, timeout): + with gevent.Timeout(timeout, False): + for index in xrange(1000000): + try: + gevent_socket.gethostbyname('www.x%s.com' % index) + except socket.error: + pass + raise AssertionError('Timeout was not raised') + + def cleanup(self): + gevent.get_hub().threadpool.join() + + +# class TestInterrupted_getaddrinfo(greentest.GenericWaitTestCase): +# +# def wait(self, timeout): +# with gevent.Timeout(timeout, False): +# for index in range(1000): +# try: +# gevent_socket.getaddrinfo('www.a%s.com' % index, 'http') +# except socket.gaierror: +# pass + + +class TestBadName(TestCase): + pass + +add(TestBadName, 'xxxxxxxxxxxx') + + +class TestBadIP(TestCase): + pass + +add(TestBadIP, '1.2.3.400') -class TestBadPort(TestCase): +class Test_getnameinfo_127001(TestCase): def test(self): - self.PORTS = ['xxxxxx'] - self._test('www.google.com') + assert gevent_socket.getnameinfo is not socket.getnameinfo + self._test('getnameinfo', ('127.0.0.1', 80), 0) + + def test_DGRAM(self): + self._test('getnameinfo', ('127.0.0.1', 779), 0) + self._test('getnameinfo', ('127.0.0.1', 779), socket.NI_DGRAM) + + def test_NOFQDN(self): + # I get ('localhost', 'www') with _socket but ('localhost.localdomain', 'www') with gevent.socket + self._test('getnameinfo', ('127.0.0.1', 80), socket.NI_NOFQDN) + + def test_NAMEREQD(self): + self._test('getnameinfo', ('127.0.0.1', 80), socket.NI_NAMEREQD) + + +class Test_getnameinfo_geventorg(TestCase): + + def test_NUMERICHOST(self): + self._test('getnameinfo', ('gevent.org', 80), 0) + self._test('getnameinfo', ('gevent.org', 80), socket.NI_NUMERICHOST) + + def test_NUMERICSERV(self): + self._test('getnameinfo', ('gevent.org', 80), socket.NI_NUMERICSERV) + + def test_domain1(self): + self._test('getnameinfo', ('gevent.org', 80), 0) + + def test_domain2(self): + self._test('getnameinfo', ('www.gevent.org', 80), 0) + + def test_port_zero(self): + self._test('getnameinfo', ('www.gevent.org', 0), 0) + + +class Test_getnameinfo_fail(TestCase): + + def test_port_string(self): + self._test('getnameinfo', ('www.gevent.org', 'http'), 0) + + def test_bad_flags(self): + self._test('getnameinfo', ('127.0.0.1', 80), 55555555) + + +class TestInvalidPort(TestCase): + + def test1(self): + self._test('getnameinfo', ('www.gevent.org', -1), 0) + + def test2(self): + self._test('getnameinfo', ('www.gevent.org', None), 0) + + def test3(self): + self._test('getnameinfo', ('www.gevent.org', 'x'), 0) + + def test4(self): + self._test('getnameinfo', ('www.gevent.org', 65536), 0) if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test__socket_errors.py python-gevent-1.0/greentest/test__socket_errors.py --- python-gevent-0.13.7/greentest/test__socket_errors.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_errors.py 2013-11-26 16:25:45.000000000 +0000 @@ -19,6 +19,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +import sys import greentest from gevent.socket import socket, error @@ -30,12 +31,15 @@ class TestSocketErrors(greentest.TestCase): + __timeout__ = 5 + def test_connection_refused(self): s = socket() try: s.connect(('127.0.0.1', 81)) - except error, ex: - assert ex[0] == ECONNREFUSED, repr(ex) + except error: + ex = sys.exc_info()[1] + assert ex.args[0] == ECONNREFUSED, repr(ex) assert 'refused' in str(ex).lower(), str(ex) diff -Nru python-gevent-0.13.7/greentest/test__socket_ex.py python-gevent-1.0/greentest/test__socket_ex.py --- python-gevent-0.13.7/greentest/test__socket_ex.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_ex.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,33 @@ +import greentest +from gevent import socket + + +class TestClosedSocket(greentest.TestCase): + + switch_expected = False + + def test(self): + sock = socket.socket() + sock.close() + try: + sock.send('a', timeout=1) + except socket.error, ex: + if ex[0] != 9: + raise + + +class TestRef(greentest.TestCase): + + switch_expected = False + + def test(self): + sock = socket.socket() + assert sock.ref is True, sock.ref + sock.ref = False + assert sock.ref is False, sock.ref + assert sock._read_event.ref is False, sock.ref + assert sock._write_event.ref is False, sock.ref + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__socket.py python-gevent-1.0/greentest/test__socket.py --- python-gevent-0.13.7/greentest/test__socket.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,158 +1,186 @@ +from gevent import monkey; monkey.patch_all() +import sys import os -import gevent -from gevent import socket -import greentest +import array +import socket +import traceback import time +import greentest +from functools import wraps + +# we use threading on purpose so that we can test both regular and gevent sockets with the same code +from threading import Thread as _Thread + + +def wrap_error(func): + + @wraps(func) + def wrapper(*args, **kwargs): + try: + return func(*args, **kwargs) + except: + traceback.print_exc() + os._exit(2) + + return wrapper + + +class Thread(_Thread): + + def __init__(self, **kwargs): + target = kwargs.pop('target') + target = wrap_error(target) + _Thread.__init__(self, target=target, **kwargs) + self.start() class TestTCP(greentest.TestCase): + __timeout__ = None TIMEOUT_ERROR = socket.timeout + long_data = ", ".join([str(x) for x in range(20000)]) def setUp(self): greentest.TestCase.setUp(self) - self.listener = socket.tcp_listener(('127.0.0.1', 0)) + listener = socket.socket() + greentest.bind_and_listen(listener, ('127.0.0.1', 0)) + self.listener = listener + self.port = listener.getsockname()[1] - def tearDown(self): + def cleanup(self): del self.listener - greentest.TestCase.tearDown(self) def create_connection(self): - return socket.create_connection(('127.0.0.1', self.listener.getsockname()[1])) + sock = socket.socket() + sock.connect(('127.0.0.1', self.port)) + return sock + + def _test_sendall(self, data): + + read_data = [] + + def accept_and_read(): + try: + read_data.append(self.listener.accept()[0].makefile().read()) + except: + traceback.print_exc() + os._exit(1) + + server = Thread(target=accept_and_read) + client = self.create_connection() + client.sendall(data) + client.close() + server.join() + assert read_data[0] == self.long_data, read_data + + def test_sendall_str(self): + self._test_sendall(self.long_data) + + def test_sendall_unicode(self): + self._test_sendall(unicode(self.long_data)) + + def test_sendall_array(self): + data = array.array("B", self.long_data) + self._test_sendall(data) def test_fullduplex(self): + N = 100000 + def server(): (client, addr) = self.listener.accept() # start reading, then, while reading, start writing. the reader should not hang forever - N = 100000 # must be a big enough number so that sendall calls trampoline - sender = gevent.spawn_link_exception(client.sendall, 't' * N) - result = client.recv(1000) - assert result == 'hello world', result - sender.join(0.2) - sender.kill() - if client.__class__.__name__ == 'SSLObject': - # if sslold.SSLObject is not closed then the other end will receive sslerror: (8, 'Unexpected EOF') - # Not sure if it must be fixed but I don't want to waste time on that since - # the preferred way to do ssl now is via gevent.ssl which works OK without explicit close - client.close() - #print '%s: client' % getcurrent() + def sendall(): + client.sendall('t' * N) - server_proc = gevent.spawn_link_exception(server) + sender = Thread(target=sendall) + result = client.recv(1000) + self.assertEqual(result, 'hello world') + sender.join() + + server_thread = Thread(target=server) client = self.create_connection() - client_reader = gevent.spawn_link_exception(client.makefile().read) - gevent.sleep(0.001) + client_reader = Thread(target=client.makefile().read, args=(N, )) + time.sleep(0.1) client.send('hello world') + time.sleep(0.1) # close() used to hang client.close() # this tests "full duplex" bug; - server_proc.get() + server_thread.join() - client_reader.get() + client_reader.join() def test_recv_timeout(self): - acceptor = gevent.spawn_link_exception(self.listener.accept) - try: - client = self.create_connection() - client.settimeout(0.1) - start = time.time() - try: - data = client.recv(1024) - except self.TIMEOUT_ERROR: - assert 0.1 - 0.01 <= time.time() - start <= 0.1 + 0.1, (time.time() - start) - else: - raise AssertionError('%s should have been raised, instead recv returned %r' % (self.TIMEOUT_ERROR, data, )) - finally: - acceptor.get() - - def test_sendall_timeout(self): - acceptor = gevent.spawn_link_exception(self.listener.accept) - try: + client_sock = [] + acceptor = Thread(target=lambda: client_sock.append(self.listener.accept())) + client = self.create_connection() + client.settimeout(1) + start = time.time() + self.assertRaises(self.TIMEOUT_ERROR, client.recv, 1024) + took = time.time() - start + assert 1 - 0.1 <= took <= 1 + 0.1, (time.time() - start) + acceptor.join() + + # On Windows send() accepts whatever is thrown at it + if sys.platform != 'win32': + + def test_sendall_timeout(self): + client_sock = [] + acceptor = Thread(target=lambda: client_sock.append(self.listener.accept())) client = self.create_connection() + time.sleep(0.1) + assert client_sock client.settimeout(0.1) + data_sent = 'h' * 1000000 start = time.time() - send_succeed = False - data_sent = 'h' * 100000 - try: - client.sendall(data_sent) - except self.TIMEOUT_ERROR: - assert 0.1 - 0.01 <= time.time() - start <= 0.1 + 0.1, (time.time() - start) - else: - assert time.time() - start <= 0.1 + 0.01, (time.time() - start) - send_succeed = True - finally: - conn, addr = acceptor.get() - if send_succeed: - client.close() - data_read = conn.makefile().read() - self.assertEqual(len(data_sent), len(data_read)) - self.assertEqual(data_sent, data_read) - print '%s: WARNING: read the data instead of failing with timeout' % self.__class__.__name__ + self.assertRaises(self.TIMEOUT_ERROR, client.sendall, data_sent) + took = time.time() - start + assert 0.1 - 0.01 <= took <= 0.1 + 0.1, took + acceptor.join() def test_makefile(self): + def accept_once(): conn, addr = self.listener.accept() fd = conn.makefile() - conn.close() fd.write('hello\n') fd.close() - acceptor = gevent.spawn(accept_once) - try: - client = self.create_connection() - fd = client.makefile() - client.close() - assert fd.readline() == 'hello\n' - assert fd.read() == '' - fd.close() - finally: - acceptor.get() - - -if hasattr(socket, 'ssl'): - - class TestSSL(TestTCP): - - certfile = os.path.join(os.path.dirname(__file__), 'test_server.crt') - privfile = os.path.join(os.path.dirname(__file__), 'test_server.key') - TIMEOUT_ERROR = socket.sslerror - - def setUp(self): - TestTCP.setUp(self) - self.listener = ssl_listener(('127.0.0.1', 0), self.privfile, self.certfile) + acceptor = Thread(target=accept_once) + client = self.create_connection() + fd = client.makefile() + client.close() + assert fd.readline() == 'hello\n' + assert fd.read() == '' + fd.close() + acceptor.join() - def create_connection(self): - return socket.ssl(socket.create_connection(('127.0.0.1', self.listener.getsockname()[1]))) - def ssl_listener(address, private_key, certificate): - import _socket - r = _socket.socket() - sock = socket.ssl(r, private_key, certificate) - socket.bind_and_listen(sock, address) - return sock +def get_port(): + tempsock = socket.socket() + tempsock.bind(('', 0)) + port = tempsock.getsockname()[1] + tempsock.close() + return port class TestCreateConnection(greentest.TestCase): + __timeout__ = 5 + def test(self): - tempsock1 = socket.socket() - tempsock1.bind(('', 0)) - source_port = tempsock1.getsockname()[1] - tempsock2 = socket.socket() - tempsock2.bind(('', 0)) - tempsock2.getsockname()[1] - tempsock1.close() - del tempsock1 - tempsock2.close() - del tempsock2 try: - socket.create_connection(('localhost', 4), timeout=30, source_address=('', source_port)) - except socket.error, ex: - if 'connection refused' not in str(ex).lower(): + socket.create_connection(('localhost', get_port()), timeout=30, source_address=('', get_port())) + except socket.error: + ex = sys.exc_info()[1] + if 'refused' not in str(ex).lower(): raise + else: + raise AssertionError('create_connection did not raise socket.error as expected') if __name__ == '__main__': diff -Nru python-gevent-0.13.7/greentest/test_socketserver.py python-gevent-1.0/greentest/test_socketserver.py --- python-gevent-0.13.7/greentest/test_socketserver.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_socketserver.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,247 +0,0 @@ -# Test suite for SocketServer.py -# converted to unittest (Denis) -from gevent import monkey -monkey.patch_all() - -import test_support -from test_support import (verbose, verify, TESTFN, TestSkipped, - reap_children) -test_support.requires('network') - -from SocketServer import * -import socket -import errno -import select -import time -import threading -import sys -import os -import unittest - -NREQ = 3 -DELAY = 0.05 - -class MyMixinHandler: - def handle(self): - time.sleep(DELAY) - line = self.rfile.readline() - time.sleep(DELAY) - self.wfile.write(line) - -class MyStreamHandler(MyMixinHandler, StreamRequestHandler): - pass - -class MyDatagramHandler(MyMixinHandler, DatagramRequestHandler): - pass - -class MyMixinServer: - def serve_a_few(self): - for i in range(NREQ): - self.handle_request() - def handle_error(self, request, client_address): - self.close_request(request) - self.server_close() - raise - -teststring = "hello world\n" - -def receive(sock, n, timeout=5): - r, w, x = select.select([sock], [], [], timeout) - if sock in r: - return sock.recv(n) - else: - raise RuntimeError, "timed out on %r" % (sock,) - -def testdgram(proto, addr): - s = socket.socket(proto, socket.SOCK_DGRAM) - s.sendto(teststring, addr) - buf = data = receive(s, 100) - while data and '\n' not in buf: - data = receive(s, 100) - buf += data - verify(buf == teststring) - s.close() - -def teststream(proto, addr): - s = socket.socket(proto, socket.SOCK_STREAM) - s.connect(addr) - s.sendall(teststring) - buf = data = receive(s, 100) - while data and '\n' not in buf: - data = receive(s, 100) - buf += data - verify(buf == teststring) - s.close() - -class ServerThread(threading.Thread): - def __init__(self, addr, svrcls, hdlrcls): - threading.Thread.__init__(self) - self.__addr = addr - self.__svrcls = svrcls - self.__hdlrcls = hdlrcls - def run(self): - class svrcls(MyMixinServer, self.__svrcls): - pass - if verbose: print "thread: creating server" - svr = svrcls(self.__addr, self.__hdlrcls) - # pull the address out of the server in case it changed - # this can happen if another process is using the port - addr = svr.server_address - if addr: - self.__addr = addr - if sys.version_info[:2] >= (2, 5): - if self.__addr != svr.socket.getsockname(): - raise RuntimeError('server_address was %s, expected %s' % - (self.__addr, svr.socket.getsockname())) - if verbose: print "thread: serving three times" - svr.serve_a_few() - if verbose: print "thread: done" - -seed = 0 -def pickport(): - global seed - seed += 1 - return 10000 + (os.getpid() % 1000)*10 + seed - -host = "localhost" -testfiles = [] -def pickaddr(proto): - if proto == socket.AF_INET: - return (host, pickport()) - else: - fn = TESTFN + str(pickport()) - if os.name == 'os2': - # AF_UNIX socket names on OS/2 require a specific prefix - # which can't include a drive letter and must also use - # backslashes as directory separators - if fn[1] == ':': - fn = fn[2:] - if fn[0] in (os.sep, os.altsep): - fn = fn[1:] - fn = os.path.join('\socket', fn) - if os.sep == '/': - fn = fn.replace(os.sep, os.altsep) - else: - fn = fn.replace(os.altsep, os.sep) - testfiles.append(fn) - return fn - -def cleanup(): - for fn in testfiles: - try: - os.remove(fn) - except os.error: - pass - testfiles[:] = [] - -def testloop(proto, servers, hdlrcls, testfunc): - for svrcls in servers: - addr = pickaddr(proto) - if verbose: - print "ADDR =", addr - print "CLASS =", svrcls - t = ServerThread(addr, svrcls, hdlrcls) - if verbose: print "server created" - t.start() - if verbose: print "server running" - for i in range(NREQ): - time.sleep(DELAY) - if verbose: print "test client", i - testfunc(proto, addr) - if verbose: print "waiting for server" - t.join() - if verbose: print "done" - -class ForgivingTCPServer(TCPServer): - # prevent errors if another process is using the port we want - def server_bind(self): - host, default_port = self.server_address - # this code shamelessly stolen from test.test_support - # the ports were changed to protect the innocent - import sys - for port in [default_port, 3434, 8798, 23833]: - try: - self.server_address = host, port - TCPServer.server_bind(self) - break - except socket.error, (err, msg): - if err != errno.EADDRINUSE: - raise - print >>sys.__stderr__, \ - ' WARNING: failed to listen on port %d, trying another' % port - -tcpservers = [ForgivingTCPServer, ThreadingTCPServer] -if hasattr(os, 'fork') and os.name not in ('os2',): - tcpservers.append(ForkingTCPServer) -udpservers = [UDPServer, ThreadingUDPServer] - -if hasattr(os, 'fork') and os.name not in ('os2',): - udpservers.append(ForkingUDPServer) - -if not hasattr(socket, 'AF_UNIX'): - streamservers = [] - dgramservers = [] -else: - class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass - streamservers = [UnixStreamServer, ThreadingUnixStreamServer] - if hasattr(os, 'fork') and os.name not in ('os2',): - streamservers.append(ForkingUnixStreamServer) - class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass - dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer] - if hasattr(os, 'fork') and os.name not in ('os2',): - dgramservers.append(ForkingUnixDatagramServer) - -def sloppy_cleanup(): - # See http://python.org/sf/1540386 - # We need to reap children here otherwise a child from one server - # can be left running for the next server and cause a test failure. - time.sleep(DELAY) - reap_children() - -def testall(): - testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream) - sloppy_cleanup() - testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram) - if hasattr(socket, 'AF_UNIX'): - sloppy_cleanup() - testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream) - # Alas, on Linux (at least) recvfrom() doesn't return a meaningful - # client address so this cannot work: - ##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram) - -class Test(unittest.TestCase): - - def tearDown(self): - sloppy_cleanup() - - for tcpserver in tcpservers: - n = tcpserver.__name__ - exec """def test_%s(self): testloop(socket.AF_INET, [%s], MyStreamHandler, teststream)""" % (n,n) - - for udpserver in udpservers: - n = udpserver.__name__ - exec """def test_%s(self): testloop(socket.AF_INET, [%s], MyDatagramHandler, testdgram)""" % (n,n) - - if hasattr(socket, 'AF_UNIX'): - for streamserver in streamservers: - n = streamserver.__name__ - exec """def test_%s(self): testloop(socket.AF_UNIX, [%s], MyStreamHandler, teststream)""" % (n,n) - - -def testall(): - test_support.run_unittest(Test) - -def test_main(): - import imp - if imp.lock_held(): - # If the import lock is held, the threads will hang. - raise TestSkipped("can't run when import lock is held") - - try: - testall() - finally: - cleanup() - reap_children() - -if __name__ == "__main__": - test_main() diff -Nru python-gevent-0.13.7/greentest/test__socket_ssl.py python-gevent-1.0/greentest/test__socket_ssl.py --- python-gevent-0.13.7/greentest/test__socket_ssl.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_ssl.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,15 +1,20 @@ #!/usr/bin/python from gevent import monkey; monkey.patch_all() import sys -import unittest -import httplib +import greentest +try: + import httplib +except ImportError: + from http import client as httplib import socket if not hasattr(socket, 'ssl'): sys.exit(0) -class AmazonHTTPSTests(unittest.TestCase): +class AmazonHTTPSTests(greentest.TestCase): + + __timeout__ = 30 def test_amazon_response(self): conn = httplib.HTTPSConnection('sdb.amazonaws.com') @@ -26,4 +31,4 @@ if __name__ == "__main__": - unittest.main() + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__socket_timeout.py python-gevent-1.0/greentest/test__socket_timeout.py --- python-gevent-0.13.7/greentest/test__socket_timeout.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__socket_timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,38 +1,44 @@ +import sys import gevent from gevent import socket -import unittest +import greentest -class Test(unittest.TestCase): +class Test(greentest.TestCase): - def setUp(self): + def start(self): self.server = socket.socket() self.server.bind(('127.0.0.1', 0)) self.server.listen(1) self.server_port = self.server.getsockname()[1] self.acceptor = gevent.spawn(self.server.accept) - def tearDown(self): + def stop(self): self.server.close() self.acceptor.kill() del self.acceptor del self.server def test(self): - sock = socket.socket() - sock.connect(('127.0.0.1', self.server_port)) + self.start() try: - sock.settimeout(0.1) + sock = socket.socket() + sock.connect(('127.0.0.1', self.server_port)) try: - result = sock.recv(1024) - raise AssertionError('Expected timeout to be raised, instead recv() returned %r' % (result, )) - except socket.error, ex: - self.assertEqual(ex.args, ('timed out',)) - self.assertEqual(str(ex), 'timed out') - self.assertEqual(ex[0], 'timed out') + sock.settimeout(0.1) + try: + result = sock.recv(1024) + raise AssertionError('Expected timeout to be raised, instead recv() returned %r' % (result, )) + except socket.error: + ex = sys.exc_info()[1] + self.assertEqual(ex.args, ('timed out',)) + self.assertEqual(str(ex), 'timed out') + self.assertEqual(ex[0], 'timed out') + finally: + sock.close() finally: - sock.close() + self.stop() if __name__ == '__main__': - unittest.main() + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__ssl.py python-gevent-1.0/greentest/test__ssl.py --- python-gevent-0.13.7/greentest/test__ssl.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__ssl.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,37 @@ +from gevent import monkey; monkey.patch_all() +import os +import socket +import greentest +from test__socket import TestTCP +import ssl + + +class TestSSL(TestTCP): + + certfile = os.path.join(os.path.dirname(__file__), 'test_server.crt') + privfile = os.path.join(os.path.dirname(__file__), 'test_server.key') + TIMEOUT_ERROR = socket.sslerror + + def setUp(self): + greentest.TestCase.setUp(self) + self.listener, r = ssl_listener(('127.0.0.1', 0), self.privfile, self.certfile) + self.port = r.getsockname()[1] + + def create_connection(self): + return ssl.wrap_socket(super(TestSSL, self).create_connection()) + + def test_sendall_timeout(self): + pass + +del TestTCP + + +def ssl_listener(address, private_key, certificate): + r = socket.socket() + greentest.bind_and_listen(r, address) + sock = ssl.wrap_socket(r, private_key, certificate) + return sock, r + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_ssl.py python-gevent-1.0/greentest/test_ssl.py --- python-gevent-0.13.7/greentest/test_ssl.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_ssl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1303 +0,0 @@ -# Test the support for SSL and sockets -from gevent import monkey; monkey.patch_all() - -import sys -import unittest -import test_support -import asyncore -import socket -import select -import gc -import os -import errno -import pprint -import urllib, urlparse -import traceback -import weakref - -from BaseHTTPServer import HTTPServer -from SimpleHTTPServer import SimpleHTTPRequestHandler - -try: - bytearray -except NameError: - bytearray = None - -try: - memoryview -except NameError: - memoryview = None - -# Optionally test SSL support, if we have it in the tested platform -skip_expected = False -try: - from gevent import ssl -except ImportError: - skip_expected = True - -HOST = 'localhost' -CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert.pem") -SVN_PYTHON_ORG_ROOT_CERT = os.path.join(os.path.dirname(__file__) or os.curdir, "https_svn_python_org_root.pem") - - -def handle_error(prefix): - exc_format = ' '.join(traceback.format_exception(*sys.exc_info())) - if test_support.verbose: - sys.stdout.write(prefix + exc_format) - - -class BasicTests(unittest.TestCase): - - def test_sslwrap_simple(self): - # A crude test for the legacy API - try: - ssl.sslwrap_simple(socket.socket(socket.AF_INET)) - except IOError, e: - if e[0] == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that - pass - else: - raise - try: - ssl.sslwrap_simple(socket.socket(socket.AF_INET)._sock) - except IOError, e: - if e[0] == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that - pass - else: - raise - - def test_constants(self): - ssl.PROTOCOL_SSLv2 - ssl.PROTOCOL_SSLv23 - ssl.PROTOCOL_SSLv3 - ssl.PROTOCOL_TLSv1 - ssl.CERT_NONE - ssl.CERT_OPTIONAL - ssl.CERT_REQUIRED - - def test_random(self): - v = ssl.RAND_status() - if test_support.verbose: - sys.stdout.write("\n RAND_status is %d (%s)\n" - % (v, (v and "sufficient randomness") or - "insufficient randomness")) - try: - ssl.RAND_egd(1) - except TypeError: - pass - else: - print "didn't raise TypeError" - ssl.RAND_add("this is a random string", 75.0) - - def test_parse_cert(self): - # note that this uses an 'unofficial' function in _ssl.c, - # provided solely for this test, to exercise the certificate - # parsing code - p = ssl._ssl._test_decode_cert(CERTFILE, False) - if test_support.verbose: - sys.stdout.write("\n" + pprint.pformat(p) + "\n") - - def test_DER_to_PEM(self): - pem = open(SVN_PYTHON_ORG_ROOT_CERT, 'r').read() - d1 = ssl.PEM_cert_to_DER_cert(pem) - p2 = ssl.DER_cert_to_PEM_cert(d1) - d2 = ssl.PEM_cert_to_DER_cert(p2) - if (d1 != d2): - raise test_support.TestFailed("PEM-to-DER or DER-to-PEM translation failed") - - def _test_openssl_version(self): - n = ssl.OPENSSL_VERSION_NUMBER - t = ssl.OPENSSL_VERSION_INFO - s = ssl.OPENSSL_VERSION - self.assertIsInstance(n, (int, long)) - self.assertIsInstance(t, tuple) - self.assertIsInstance(s, str) - # Some sanity checks follow - # >= 0.9 - self.assertGreaterEqual(n, 0x900000) - # < 2.0 - self.assertLess(n, 0x20000000) - major, minor, fix, patch, status = t - self.assertGreaterEqual(major, 0) - self.assertLess(major, 2) - self.assertGreaterEqual(minor, 0) - self.assertLess(minor, 256) - self.assertGreaterEqual(fix, 0) - self.assertLess(fix, 256) - self.assertGreaterEqual(patch, 0) - self.assertLessEqual(patch, 26) - self.assertGreaterEqual(status, 0) - self.assertLessEqual(status, 15) - # Version string as returned by OpenSSL, the format might change - self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)), - (s, t)) - - def test_openssl_version(self): - try: - self._test_openssl_version() - except AttributeError: - if sys.version_info[:2] >= (2, 7): - raise - - def _test_ciphers(self): - remote = ("svn.python.org", 443) - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="ALL") - s.connect(remote) - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT") - s.connect(remote) - # Error checking occurs when connecting, because the SSL context - # isn't created before. - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") - try: - s.connect(remote) - except ssl.SSLError, ex: - if "No cipher can be selected" not in str(ex): - raise - - def test_ciphers(self): - try: - self._test_ciphers() - except TypeError, ex: - if 'sslwrap() takes at most 7 arguments (8 given)' in str(ex) and sys.version_info[:2] <= (2, 6): - pass - else: - raise - - def test_refcycle(self): - # Issue #7943: an SSL object doesn't create reference cycles with - # itself. - s = socket.socket(socket.AF_INET) - ss = ssl.wrap_socket(s) - wr = weakref.ref(ss) - del ss - self.assertEqual(wr(), None) - - -class NetworkedTests(unittest.TestCase): - - def test_connect(self): - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE) - s.connect(("svn.python.org", 443)) - c = s.getpeercert() - if c: - raise test_support.TestFailed("Peer cert %s shouldn't be here!") - s.close() - - # this should fail because we have no verification certs - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_REQUIRED) - try: - try: - s.connect(("svn.python.org", 443)) - except ssl.SSLError: - pass - finally: - s.close() - - # this should succeed because we specify the root cert - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_REQUIRED, - ca_certs=SVN_PYTHON_ORG_ROOT_CERT) - try: - s.connect(("svn.python.org", 443)) - finally: - s.close() - - #@unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows") - def test_makefile_close(self): - # Issue #5238: creating a file-like object with makefile() shouldn't - # delay closing the underlying "real socket" (here tested with its - # file descriptor, hence skipping the test under Windows). - ss = ssl.wrap_socket(socket.socket(socket.AF_INET)) - ss.connect(("svn.python.org", 443)) - fd = ss.fileno() - f = ss.makefile() - f.close() - # The fd is still open - os.read(fd, 0) - # Closing the SSL socket should close the fd too - ss.close() - gc.collect() - try: - os.read(fd, 0) - except OSError, ex: - if ex[0] != errno.EBADF: - raise - - def test_non_blocking_handshake(self): - s = socket.socket(socket.AF_INET) - s.connect(("svn.python.org", 443)) - s.setblocking(False) - s = ssl.wrap_socket(s, - cert_reqs=ssl.CERT_NONE, - do_handshake_on_connect=False) - count = 0 - while True: - try: - count += 1 - s.do_handshake() - break - except ssl.SSLError, err: - if err.args[0] == ssl.SSL_ERROR_WANT_READ: - select.select([s], [], []) - elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: - select.select([], [s], []) - else: - raise - s.close() - if test_support.verbose: - sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) - - def test_get_server_certificate(self): - pem = ssl.get_server_certificate(("svn.python.org", 443)) - if not pem: - raise test_support.TestFailed("No server certificate on svn.python.org:443!") - - try: - pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=CERTFILE) - except ssl.SSLError: - #should fail - pass - else: - raise test_support.TestFailed("Got server certificate %s for svn.python.org!" % pem) - - pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=SVN_PYTHON_ORG_ROOT_CERT) - if not pem: - raise test_support.TestFailed("No server certificate on svn.python.org:443!") - if test_support.verbose: - sys.stdout.write("\nVerified certificate for svn.python.org:443 is\n%s\n" % pem) - - def test_algorithms(self): - # Issue #8484: all algorithms should be available when verifying a - # certificate. - # SHA256 was added in OpenSSL 0.9.8 - if not hasattr(ssl, 'OPENSSL_VERSION_INFO'): - return - if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15): - self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION) - # NOTE: https://sha256.tbs-internet.com is another possible test host - remote = ("sha2.hboeck.de", 443) - sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem") - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_REQUIRED, - ca_certs=sha256_cert,) - try: - s.connect(remote) - if test_support.verbose: - sys.stdout.write("\nCipher with %r is %r\n" % - (remote, s.cipher())) - sys.stdout.write("Certificate is:\n%s\n" % - pprint.pformat(s.getpeercert())) - finally: - s.close() - - -try: - import threading -except ImportError: - _have_threads = False -else: - if not hasattr(threading.Thread, 'daemon'): - threading.Thread.daemon = property(threading.Thread.isDaemon, threading.Thread.setDaemon) - - _have_threads = True - - class ThreadedEchoServer(threading.Thread): - - class ConnectionHandler(threading.Thread): - - """A mildly complicated class, because we want it to work both - with and without the SSL wrapper around the socket connection, so - that we can test the STARTTLS functionality.""" - - def __init__(self, server, connsock): - self.server = server - self.running = False - self.sock = connsock - self.sock.setblocking(1) - self.sslconn = None - threading.Thread.__init__(self) - self.daemon = True - - def show_conn_details(self): - if self.server.certreqs == ssl.CERT_REQUIRED: - cert = self.sslconn.getpeercert() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") - cert_binary = self.sslconn.getpeercert(True) - if test_support.verbose and self.server.chatty: - sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") - cipher = self.sslconn.cipher() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") - - def wrap_conn(self): - try: - self.sslconn = ssl.wrap_socket(self.sock, server_side=True, - certfile=self.server.certificate, - ssl_version=self.server.protocol, - ca_certs=self.server.cacerts, - cert_reqs=self.server.certreqs, - ciphers=self.server.ciphers) - except ssl.SSLError: - # XXX Various errors can have happened here, for example - # a mismatching protocol version, an invalid certificate, - # or a low-level bug. This should be made more discriminating. - if self.server.chatty: - handle_error("\n server: bad connection attempt from " + - str(self.sock.getpeername()) + ":\n") - self.close() - self.running = False - self.server.stop() - return False - else: - return True - - def read(self): - if self.sslconn: - return self.sslconn.read() - else: - return self.sock.recv(1024) - - def write(self, bytes): - if self.sslconn: - return self.sslconn.write(bytes) - else: - return self.sock.send(bytes) - - def close(self): - if self.sslconn: - self.sslconn.close() - else: - self.sock._sock.close() - - def run(self): - self.running = True - if not self.server.starttls_server: - if isinstance(self.sock, ssl.SSLSocket): - self.sslconn = self.sock - elif not self.wrap_conn(): - return - self.show_conn_details() - while self.running: - try: - msg = self.read() - if not msg: - # eof, so quit this handler - self.running = False - self.close() - elif msg.strip() == 'over': - if test_support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: client closed connection\n") - self.close() - return - elif self.server.starttls_server and msg.strip() == 'STARTTLS': - if test_support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: read STARTTLS from client, sending OK...\n") - self.write("OK\n") - if not self.wrap_conn(): - return - elif self.server.starttls_server and self.sslconn and msg.strip() == 'ENDTLS': - if test_support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: read ENDTLS from client, sending OK...\n") - self.write("OK\n") - self.sslconn.unwrap() - self.sslconn = None - if test_support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: connection is now unencrypted...\n") - else: - if (test_support.verbose and - self.server.connectionchatty): - ctype = (self.sslconn and "encrypted") or "unencrypted" - sys.stdout.write(" server: read %s (%s), sending back %s (%s)...\n" - % (repr(msg), ctype, repr(msg.lower()), ctype)) - self.write(msg.lower()) - except ssl.SSLError: - if self.server.chatty: - handle_error("Test server failure:\n") - self.close() - self.running = False - # normally, we'd just stop here, but for the test - # harness, we want to stop the server - self.server.stop() - - def __init__(self, certificate, ssl_version=None, - certreqs=None, cacerts=None, - chatty=True, connectionchatty=False, starttls_server=False, - wrap_accepting_socket=False, ciphers=None): - - if ssl_version is None: - ssl_version = ssl.PROTOCOL_TLSv1 - if certreqs is None: - certreqs = ssl.CERT_NONE - self.certificate = certificate - self.protocol = ssl_version - self.certreqs = certreqs - self.cacerts = cacerts - self.ciphers = ciphers - self.chatty = chatty - self.connectionchatty = connectionchatty - self.starttls_server = starttls_server - self.sock = socket.socket() - self.flag = None - if wrap_accepting_socket: - self.sock = ssl.wrap_socket(self.sock, server_side=True, - certfile=self.certificate, - cert_reqs = self.certreqs, - ca_certs = self.cacerts, - ssl_version = self.protocol, - ciphers = self.ciphers) - if test_support.verbose and self.chatty: - sys.stdout.write(' server: wrapped server socket as %s\n' % str(self.sock)) - self.port = test_support.bind_port(self.sock) - self.active = False - threading.Thread.__init__(self) - self.daemon = False - - def start(self, flag=None): - self.flag = flag - threading.Thread.start(self) - - def run(self): - self.sock.settimeout(0.05) - self.sock.listen(5) - self.active = True - if self.flag: - # signal an event - self.flag.set() - while self.active: - try: - newconn, connaddr = self.sock.accept() - if test_support.verbose and self.chatty: - sys.stdout.write(' server: new connection from ' - + str(connaddr) + '\n') - handler = self.ConnectionHandler(self, newconn) - handler.start() - except socket.timeout: - pass - except KeyboardInterrupt: - self.stop() - self.sock.close() - - def stop(self): - self.active = False - - class AsyncoreEchoServer(threading.Thread): - - class EchoServer(asyncore.dispatcher): - - class ConnectionHandler(asyncore.dispatcher_with_send): - - def __init__(self, conn, certfile): - asyncore.dispatcher_with_send.__init__(self, conn) - self.socket = ssl.wrap_socket(conn, server_side=True, - certfile=certfile, - do_handshake_on_connect=False) - self._ssl_accepting = True - - def readable(self): - if isinstance(self.socket, ssl.SSLSocket): - while self.socket.pending() > 0: - self.handle_read_event() - return True - - def _do_ssl_handshake(self): - try: - self.socket.do_handshake() - except ssl.SSLError, err: - if err.args[0] in (ssl.SSL_ERROR_WANT_READ, - ssl.SSL_ERROR_WANT_WRITE): - return - elif err.args[0] == ssl.SSL_ERROR_EOF: - return self.handle_close() - raise - except socket.error, err: - if err.args[0] == errno.ECONNABORTED: - return self.handle_close() - else: - self._ssl_accepting = False - - def handle_read(self): - if self._ssl_accepting: - self._do_ssl_handshake() - else: - data = self.recv(1024) - if data and data.strip() != 'over': - self.send(data.lower()) - - def handle_close(self): - self.close() - if test_support.verbose: - sys.stdout.write(" server: closed connection %s\n" % self.socket) - - def handle_error(self): - raise - - def __init__(self, certfile): - self.certfile = certfile - asyncore.dispatcher.__init__(self) - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = test_support.bind_port(self.socket) - self.listen(5) - - def handle_accept(self): - sock_obj, addr = self.accept() - if test_support.verbose: - sys.stdout.write(" server: new connection from %s:%s\n" %addr) - self.ConnectionHandler(sock_obj, self.certfile) - - def handle_error(self): - raise - - def __init__(self, certfile): - self.flag = None - self.active = False - self.server = self.EchoServer(certfile) - self.port = self.server.port - threading.Thread.__init__(self) - self.daemon = True - - def __str__(self): - return "<%s %s>" % (self.__class__.__name__, self.server) - - def start(self, flag=None): - self.flag = flag - threading.Thread.start(self) - - def run(self): - self.active = True - if self.flag: - self.flag.set() - while self.active: - asyncore.loop(0.05) - - def stop(self): - self.active = False - self.server.close() - - class SocketServerHTTPSServer(threading.Thread): - - class HTTPSServer(HTTPServer): - - def __init__(self, server_address, RequestHandlerClass, certfile): - HTTPServer.__init__(self, server_address, RequestHandlerClass) - # we assume the certfile contains both private key and certificate - self.certfile = certfile - self.allow_reuse_address = True - - def __str__(self): - return ('<%s %s:%s>' % - (self.__class__.__name__, - self.server_name, - self.server_port)) - - def get_request(self): - # override this to wrap socket with SSL - sock, addr = self.socket.accept() - sslconn = ssl.wrap_socket(sock, server_side=True, - certfile=self.certfile) - return sslconn, addr - - # for Python 2.5 and older: - - def serve_forever(self, poll_interval): - try: - return HTTPServer.serve_forever(self, poll_interval) - except TypeError: - for _ in xrange(100): - self.handle_request() - - def shutdown(self): - self.server_close() - - - class RootedHTTPRequestHandler(SimpleHTTPRequestHandler): - # need to override translate_path to get a known root, - # instead of using os.curdir, since the test could be - # run from anywhere - - server_version = "TestHTTPS/1.0" - - root = None - - def translate_path(self, path): - """Translate a /-separated PATH to the local filename syntax. - - Components that mean special things to the local file system - (e.g. drive or directory names) are ignored. (XXX They should - probably be diagnosed.) - - """ - # abandon query parameters - path = urlparse.urlparse(path)[2] - path = os.path.normpath(urllib.unquote(path)) - words = path.split('/') - words = filter(None, words) - path = self.root - for word in words: - drive, word = os.path.splitdrive(word) - head, word = os.path.split(word) - if word in self.root: continue - path = os.path.join(path, word) - return path - - def log_message(self, format, *args): - - # we override this to suppress logging unless "verbose" - - if test_support.verbose: - sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" % - (self.server.server_address, - self.server.server_port, - self.request.cipher(), - self.log_date_time_string(), - format%args)) - - - def __init__(self, certfile): - self.flag = None - self.RootedHTTPRequestHandler.root = os.path.split(CERTFILE)[0] - self.server = self.HTTPSServer( - (HOST, 0), self.RootedHTTPRequestHandler, certfile) - self.port = self.server.server_port - threading.Thread.__init__(self) - self.daemon = True - - def __str__(self): - return "<%s %s>" % (self.__class__.__name__, self.server) - - def start(self, flag=None): - self.flag = flag - threading.Thread.start(self) - - def run(self): - if self.flag: - self.flag.set() - self.server.serve_forever(0.05) - - def stop(self): - self.server.shutdown() - - - def bad_cert_test(certfile): - """ - Launch a server with CERT_REQUIRED, and check that trying to - connect to it with the given client certificate fails. - """ - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_REQUIRED, - cacerts=CERTFILE, chatty=False) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - try: - try: - s = ssl.wrap_socket(socket.socket(), - certfile=certfile, - ssl_version=ssl.PROTOCOL_TLSv1) - s.connect((HOST, server.port)) - except ssl.SSLError, x: - if test_support.verbose: - sys.stdout.write("\nSSLError is %s\n" % x[1]) - except socket.error, x: - if test_support.verbose: - sys.stdout.write("\nsocket.error is %s\n" % x[1]) - else: - raise AssertionError("Use of invalid cert should have failed!") - finally: - server.stop() - server.join() - - def server_params_test(certfile, protocol, certreqs, cacertsfile, - client_certfile, client_protocol=None, indata="FOO\n", - ciphers=None, chatty=True, connectionchatty=False, - wrap_accepting_socket=False): - """ - Launch a server, connect a client to it and try various reads - and writes. - """ - server = ThreadedEchoServer(certfile, - certreqs=certreqs, - ssl_version=protocol, - cacerts=cacertsfile, - ciphers=ciphers, - chatty=chatty, - connectionchatty=connectionchatty, - wrap_accepting_socket=wrap_accepting_socket) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - if client_protocol is None: - client_protocol = protocol - try: - s = ssl.wrap_socket(socket.socket(), - certfile=client_certfile, - ca_certs=cacertsfile, - ciphers=ciphers, - cert_reqs=certreqs, - ssl_version=client_protocol) - s.connect((HOST, server.port)) - args = [indata] - if sys.version_info[:2] >= (2, 7): - # bytearray fails on Python2.6 - args.append(bytearray(indata)) - if memoryview is not None: - args.append(memoryview(indata)) - for arg in args: - if connectionchatty: - if test_support.verbose: - sys.stdout.write( - " client: sending %s...\n" % (repr(arg))) - s.write(arg) - outdata = s.read() - if connectionchatty: - if test_support.verbose: - sys.stdout.write(" client: read %s\n" % repr(outdata)) - if outdata != indata.lower(): - raise AssertionError( - "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" - % (outdata[:min(len(outdata),20)], len(outdata), - indata[:min(len(indata),20)].lower(), len(indata))) - s.write("over\n") - if connectionchatty: - if test_support.verbose: - sys.stdout.write(" client: closing connection.\n") - s.close() - finally: - server.stop() - server.join() - - def try_protocol_combo(server_protocol, - client_protocol, - expect_success, - certsreqs=None): - if certsreqs is None: - certsreqs = ssl.CERT_NONE - certtype = { - ssl.CERT_NONE: "CERT_NONE", - ssl.CERT_OPTIONAL: "CERT_OPTIONAL", - ssl.CERT_REQUIRED: "CERT_REQUIRED", - }[certsreqs] - if test_support.verbose: - formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n" - sys.stdout.write(formatstr % - (ssl.get_protocol_name(client_protocol), - ssl.get_protocol_name(server_protocol), - certtype)) - try: - # NOTE: we must enable "ALL" ciphers, otherwise an SSLv23 client - # will send an SSLv3 hello (rather than SSLv2) starting from - # OpenSSL 1.0.0 (see issue #8322). - if sys.version_info >= (2, 7): - ciphers = 'ALL' - else: - ciphers = None - server_params_test(CERTFILE, server_protocol, certsreqs, - CERTFILE, CERTFILE, client_protocol, - ciphers=ciphers, chatty=False) - # Protocol mismatch can result in either an SSLError, or a - # "Connection reset by peer" error. - except ssl.SSLError: - if expect_success: - raise - except socket.error, e: - if expect_success or e[0] != errno.ECONNRESET: - raise - else: - if not expect_success: - raise AssertionError( - "Client protocol %s succeeded with server protocol %s!" - % (ssl.get_protocol_name(client_protocol), - ssl.get_protocol_name(server_protocol))) - - - class ThreadedTests(unittest.TestCase): - - def test_rude_shutdown(self): - """A brutal shutdown of an SSL server should raise an IOError - in the client when attempting handshake. - """ - listener_ready = threading.Event() - listener_gone = threading.Event() - - s = socket.socket() - port = test_support.bind_port(s, HOST) - - # `listener` runs in a thread. It sits in an accept() until - # the main thread connects. Then it rudely closes the socket, - # and sets Event `listener_gone` to let the main thread know - # the socket is gone. - def listener(): - s.listen(5) - listener_ready.set() - s.accept() - s.close() - listener_gone.set() - - def connector(): - listener_ready.wait() - c = socket.socket() - c.connect((HOST, port)) - listener_gone.wait() - try: - ssl_sock = ssl.wrap_socket(c) - except IOError: - pass - except ssl.SSLError: - # in pypi/ssl package (used on Python 2.5 and 2.4), ssl.SSLError is not a subclass of IOError - # so we accepting it here as well - if sys.version_info >= (2, 6): - raise - else: - raise test_support.TestFailed( - 'connecting to closed SSL socket should have failed') - - t = threading.Thread(target=listener) - t.start() - try: - connector() - finally: - t.join() - - def test_echo(self): - """Basic test of an SSL client connecting to a server""" - if test_support.verbose: - sys.stdout.write("\n") - server_params_test(CERTFILE, ssl.PROTOCOL_TLSv1, ssl.CERT_NONE, - CERTFILE, CERTFILE, ssl.PROTOCOL_TLSv1, - chatty=True, connectionchatty=True) - - def test_getpeercert(self): - if test_support.verbose: - sys.stdout.write("\n") - s2 = socket.socket() - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_SSLv23, - cacerts=CERTFILE, - chatty=False) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - try: - s = ssl.wrap_socket(socket.socket(), - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_REQUIRED, - ssl_version=ssl.PROTOCOL_SSLv23) - s.connect((HOST, server.port)) - cert = s.getpeercert() - self.assertTrue(cert, "Can't get peer certificate.") - cipher = s.cipher() - if test_support.verbose: - sys.stdout.write(pprint.pformat(cert) + '\n') - sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') - if 'subject' not in cert: - raise test_support.TestFailed( - "No subject field in certificate: %s." % - pprint.pformat(cert)) - if ((('organizationName', 'Python Software Foundation'),) - not in cert['subject']): - raise test_support.TestFailed( - "Missing or invalid 'organizationName' field in certificate subject; " - "should be 'Python Software Foundation'.") - s.close() - finally: - server.stop() - server.join() - - def test_empty_cert(self): - """Connecting with an empty cert file""" - bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, - "nullcert.pem")) - def test_malformed_cert(self): - """Connecting with a badly formatted certificate (syntax error)""" - bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, - "badcert.pem")) - def test_nonexisting_cert(self): - """Connecting with a non-existing cert file""" - bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, - "wrongcert.pem")) - def test_malformed_key(self): - """Connecting with a badly formatted key (syntax error)""" - bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir, - "badkey.pem")) - - def test_protocol_sslv2(self): - """Connecting to an SSLv2 server with various client options""" - if test_support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, True) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) - - def test_protocol_sslv23(self): - """Connecting to an SSLv23 server with various client options""" - if test_support.verbose: - sys.stdout.write("\n") - try: - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) - except (ssl.SSLError, socket.error), x: - # this fails on some older versions of OpenSSL (0.9.7l, for instance) - if test_support.verbose: - sys.stdout.write( - " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" - % str(x)) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True) - - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) - - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) - - def test_protocol_sslv3(self): - """Connecting to an SSLv3 server with various client options""" - if test_support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) - - def test_protocol_tlsv1(self): - """Connecting to a TLSv1 server with various client options""" - if test_support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False) - - def test_starttls(self): - """Switching from clear text to encrypted and back again.""" - msgs = ("msg 1", "MSG 2", "STARTTLS", "MSG 3", "msg 4", "ENDTLS", "msg 5", "msg 6") - - server = ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_TLSv1, - starttls_server=True, - chatty=True, - connectionchatty=True) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - wrapped = False - try: - s = socket.socket() - s.setblocking(1) - s.connect((HOST, server.port)) - if test_support.verbose: - sys.stdout.write("\n") - for indata in msgs: - if test_support.verbose: - sys.stdout.write( - " client: sending %s...\n" % repr(indata)) - if wrapped: - conn.write(indata) - outdata = conn.read() - else: - s.send(indata) - outdata = s.recv(1024) - if (indata == "STARTTLS" and - outdata.strip().lower().startswith("ok")): - # STARTTLS ok, switch to secure mode - if test_support.verbose: - sys.stdout.write( - " client: read %s from server, starting TLS...\n" - % repr(outdata)) - conn = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) - wrapped = True - elif (indata == "ENDTLS" and - outdata.strip().lower().startswith("ok")): - # ENDTLS ok, switch back to clear text - if test_support.verbose: - sys.stdout.write( - " client: read %s from server, ending TLS...\n" - % repr(outdata)) - s = conn.unwrap() - wrapped = False - else: - if test_support.verbose: - sys.stdout.write( - " client: read %s from server\n" % repr(outdata)) - if test_support.verbose: - sys.stdout.write(" client: closing connection.\n") - if wrapped: - conn.write("over\n") - else: - s.send("over\n") - s.close() - finally: - server.stop() - server.join() - - def test_socketserver(self): - """Using a SocketServer to create and manage SSL connections.""" - server = SocketServerHTTPSServer(CERTFILE) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - try: - if test_support.verbose: - sys.stdout.write('\n') - d1 = open(CERTFILE, 'rb').read() - d2 = '' - # now fetch the same data from the HTTPS server - url = 'https://127.0.0.1:%d/%s' % ( - server.port, os.path.split(CERTFILE)[1]) - f = urllib.urlopen(url) - dlen = f.info().getheader("content-length") - if dlen and (int(dlen) > 0): - d2 = f.read(int(dlen)) - if test_support.verbose: - sys.stdout.write( - " client: read %d bytes from remote server '%s'\n" - % (len(d2), server)) - f.close() - self.assertEqual(d1, d2) - finally: - server.stop() - server.join() - - def test_wrapped_accept(self): - """Check the accept() method on SSL sockets.""" - if test_support.verbose: - sys.stdout.write("\n") - server_params_test(CERTFILE, ssl.PROTOCOL_SSLv23, ssl.CERT_REQUIRED, - CERTFILE, CERTFILE, ssl.PROTOCOL_SSLv23, - chatty=True, connectionchatty=True, - wrap_accepting_socket=True) - - def test_asyncore_server(self): - """Check the example asyncore integration.""" - indata = "TEST MESSAGE of mixed case\n" - - if test_support.verbose: - sys.stdout.write("\n") - server = AsyncoreEchoServer(CERTFILE) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - try: - s = ssl.wrap_socket(socket.socket()) - s.connect(('127.0.0.1', server.port)) - if test_support.verbose: - sys.stdout.write( - " client: sending %s...\n" % (repr(indata))) - s.write(indata) - outdata = s.read() - if test_support.verbose: - sys.stdout.write(" client: read %s\n" % repr(outdata)) - if outdata != indata.lower(): - raise test_support.TestFailed( - "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" - % (outdata[:min(len(outdata),20)], len(outdata), - indata[:min(len(indata),20)].lower(), len(indata))) - s.write("over\n") - if test_support.verbose: - sys.stdout.write(" client: closing connection.\n") - s.close() - finally: - server.stop() - # wait for server thread to end - server.join() - - def test_recv_send(self): - """Test recv(), send() and friends.""" - if test_support.verbose: - sys.stdout.write("\n") - - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, - cacerts=CERTFILE, - chatty=True, - connectionchatty=False) - flag = threading.Event() - server.start(flag) - # wait for it to start - flag.wait() - # try to connect - s = ssl.wrap_socket(socket.socket(), - server_side=False, - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) - s.connect((HOST, server.port)) - try: - # helper methods for standardising recv* method signatures - def _recv_into(): - b = bytearray("\0"*100) - count = s.recv_into(b) - return b[:count] - - def _recvfrom_into(): - b = bytearray("\0"*100) - count, addr = s.recvfrom_into(b) - return b[:count] - - # (name, method, whether to expect success, *args) - send_methods = [ - ('send', s.send, True, []), - ('sendto', s.sendto, False, ["some.address"]), - ('sendall', s.sendall, True, []), - ] - recv_methods = [ - ('recv', s.recv, True, []), - ('recvfrom', s.recvfrom, False, ["some.address"]), - ('recv_into', _recv_into, True, []), - ('recvfrom_into', _recvfrom_into, False, []), - ] - if bytearray is None: - recv_methods = recv_methods[:-2] - data_prefix = u"PREFIX_" - - for meth_name, send_meth, expect_success, args in send_methods: - indata = data_prefix + meth_name - try: - send_meth(indata.encode('ASCII', 'strict'), *args) - outdata = s.read() - outdata = outdata.decode('ASCII', 'strict') - if outdata != indata.lower(): - raise test_support.TestFailed( - "While sending with <<%s>> bad data " - "<<%r>> (%d) received; " - "expected <<%r>> (%d)\n" % ( - meth_name, outdata[:20], len(outdata), - indata[:20], len(indata) - ) - ) - except ValueError, e: - if expect_success: - raise test_support.TestFailed( - "Failed to send with method <<%s>>; " - "expected to succeed.\n" % (meth_name,) - ) - if not str(e).startswith(meth_name): - raise test_support.TestFailed( - "Method <<%s>> failed with unexpected " - "exception message: %s\n" % ( - meth_name, e - ) - ) - - for meth_name, recv_meth, expect_success, args in recv_methods: - indata = data_prefix + meth_name - try: - s.send(indata.encode('ASCII', 'strict')) - outdata = recv_meth(*args) - outdata = outdata.decode('ASCII', 'strict') - if outdata != indata.lower(): - raise test_support.TestFailed( - "While receiving with <<%s>> bad data " - "<<%r>> (%d) received; " - "expected <<%r>> (%d)\n" % ( - meth_name, outdata[:20], len(outdata), - indata[:20], len(indata) - ) - ) - except ValueError, e: - if expect_success: - raise test_support.TestFailed( - "Failed to receive with method <<%s>>; " - "expected to succeed.\n" % (meth_name,) - ) - if not str(e).startswith(meth_name): - raise test_support.TestFailed( - "Method <<%s>> failed with unexpected " - "exception message: %s\n" % ( - meth_name, e - ) - ) - # consume data - s.read() - - s.write("over\n".encode("ASCII", "strict")) - s.close() - finally: - server.stop() - server.join() - - def test_handshake_timeout(self): - # Issue #5103: SSL handshake must respect the socket timeout - server = socket.socket(socket.AF_INET) - host = "127.0.0.1" - port = test_support.bind_port(server) - started = threading.Event() - finish = False - - def serve(): - server.listen(5) - started.set() - conns = [] - while not finish: - r, w, e = select.select([server], [], [], 0.1) - if server in r: - # Let the socket hang around rather than having - # it closed by garbage collection. - conns.append(server.accept()[0]) - - t = threading.Thread(target=serve) - t.start() - started.wait() - - try: - try: - c = socket.socket(socket.AF_INET) - c.settimeout(0.2) - c.connect((host, port)) - # Will attempt handshake and time out - try: - ssl.wrap_socket(c) - except ssl.SSLError, ex: - if 'timed out' not in str(ex): - raise - finally: - c.close() - try: - c = socket.socket(socket.AF_INET) - c.settimeout(0.2) - c = ssl.wrap_socket(c) - # Will attempt handshake and time out - try: - c.connect((host, port)) - except ssl.SSLError, ex: - if 'timed out' not in str(ex): - raise - finally: - c.close() - finally: - finish = True - t.join() - server.close() - - -if __name__ == "__main__": - unittest.main() diff -Nru python-gevent-0.13.7/greentest/tests_that_dont_use_resolver.txt python-gevent-1.0/greentest/tests_that_dont_use_resolver.txt --- python-gevent-0.13.7/greentest/tests_that_dont_use_resolver.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/tests_that_dont_use_resolver.txt 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,78 @@ +test__all__.py +#uses socket test__api.py +test__api_timeout.py +test__ares_host_result.py +test_ares_timeout.py # explicitly uses ares resolver +# uses socket test__backdoor.py +test_close_backend_fd.py +test__core_async.py +test__core_callback.py +test__core_loop_run.py +test__core.py +test__core_stat.py +test__core_timer.py +test__core_watcher.py +test__destroy.py +# uses socket test__doctests.py +test__environ.py +test__event.py +# uses socket test__example_echoserver.py +# uses socket test__example_portforwarder.py +# uses socket test___example_servers.py +# uses bunch of things test__examples.py +# uses socket test__example_udp_client.py +# uses socket test__example_udp_server.py +test__exc_info.py +#test__execmodules.py +test__fileobject.py +# uses socket test__greenio.py +test__GreenletExit.py +test__greenlet.py +test__greenletset.py +# uses socket test__greenness.py +test_hub_join.py +test_hub_join_timeout.py +# uses socket test__hub.py +test_issue112.py +test__joinall.py +test__local.py +test__loop_callback.py +test__memleak.py +# uses lots of things test___monkey_patching.py +test__monkey.py +test__order.py +test__os.py +test__pool.py +# uses socket test__pywsgi.py +test__queue.py +test_queue.py +# uses socket test__refcount.py +test__select.py +test__semaphore.py +# uses socket test__server.py +# test__server_pywsgi.py +test__signal.py +# uses socket test__socket_close.py +# test__socket_dns6.py +# test__socket_dns.py +# test__socket_errors.py +# test__socket.py +# test__socket_ssl.py +# test__socket_timeout.py +test__subprocess_interrupted.py +test__subprocess.py +test__systemerror.py +test_threading_2.py +test__threading_patched_local.py +test__threading_vs_settrace.py +test__threadpool.py +test__timeout.py + +# monkey patched standard tests: +test_queue.py +test_select.py +test_signal.py +test_subprocess.py +test_threading_local.py +test_threading.py +test_thread.py diff -Nru python-gevent-0.13.7/greentest/test__subprocess_interrupted.py python-gevent-1.0/greentest/test__subprocess_interrupted.py --- python-gevent-0.13.7/greentest/test__subprocess_interrupted.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__subprocess_interrupted.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,17 @@ +import sys + + +if 'runtestcase' in sys.argv[1:]: + import gevent + import gevent.subprocess + gevent.spawn(sys.exit, 'bye') + gevent.subprocess.Popen('python -c "1/0"'.split()) + gevent.sleep(1) +else: + import subprocess + for _ in xrange(5): + out, err = subprocess.Popen([sys.executable, __file__, 'runtestcase'], stderr=subprocess.PIPE).communicate() + if 'refs' in err: + assert err.startswith('bye'), repr(err) + else: + assert err.strip() == 'bye', repr(err) diff -Nru python-gevent-0.13.7/greentest/test__subprocess_poll.py python-gevent-1.0/greentest/test__subprocess_poll.py --- python-gevent-0.13.7/greentest/test__subprocess_poll.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__subprocess_poll.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,9 @@ +import sys +from gevent.subprocess import Popen +from util import alarm + +alarm(1) + +popen = Popen([sys.executable, '-c', 'pass']) +while popen.poll() is None: + pass diff -Nru python-gevent-0.13.7/greentest/test__subprocess.py python-gevent-1.0/greentest/test__subprocess.py --- python-gevent-0.13.7/greentest/test__subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__subprocess.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,151 @@ +# mostly tests from test_subprocess.py that used to have problems +import sys +import os +import errno +import greentest +import gevent +from gevent import subprocess +import time + + +if subprocess.mswindows: + SETBINARY = 'import msvcrt; msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY);' +else: + SETBINARY = '' + + +class Test(greentest.TestCase): + + def test_exit(self): + popen = subprocess.Popen([sys.executable, '-c', 'import sys; sys.exit(10)']) + self.assertEqual(popen.wait(), 10) + + def test_wait(self): + popen = subprocess.Popen([sys.executable, '-c', 'import sys; sys.exit(11)']) + gevent.wait([popen]) + self.assertEqual(popen.poll(), 11) + + def test_child_exception(self): + try: + subprocess.Popen(['*']).wait() + except OSError, ex: + assert ex.errno == 2, ex + else: + raise AssertionError('Expected OSError: [Errno 2] No such file or directory') + + def test_leak(self): + num_before = greentest.get_number_open_files() + p = subprocess.Popen([sys.executable, "-c", "print()"], + stdout=subprocess.PIPE) + p.wait() + del p + num_after = greentest.get_number_open_files() + self.assertEqual(num_before, num_after) + + def test_communicate(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + 'sys.stderr.write("pineapple");' + 'sys.stdout.write(sys.stdin.read())'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate("banana") + self.assertEqual(stdout, "banana") + if sys.executable.endswith('-dbg'): + assert stderr.startswith('pineapple') + else: + self.assertEqual(stderr, "pineapple") + + def test_universal1(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, + universal_newlines=1) + try: + stdout = p.stdout.read() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + finally: + p.stdout.close() + + def test_universal2(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + + 'sys.stdout.write("line1\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line2\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.flush();' + 'sys.stdout.write("line4\\r\\nline5");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline6");'], + stdout=subprocess.PIPE, + universal_newlines=1) + try: + stdout = p.stdout.read() + if hasattr(file, 'newlines'): + # Interpreter with universal newline support + self.assertEqual(stdout, + "line1\nline2\nline3\nline4\nline5\nline6") + else: + # Interpreter without universal newline support + self.assertEqual(stdout, + "line1\nline2\rline3\r\nline4\r\nline5\nline6") + finally: + p.stdout.close() + + if sys.platform != 'win32': + + def test_nonblock_removed(self): + # see issue #134 + r, w = os.pipe() + p = subprocess.Popen(['grep', 'text'], stdin=subprocess.FileObject(r)) + try: + os.close(w) + time.sleep(0.1) + self.assertEqual(p.poll(), None) + finally: + if p.poll() is None: + p.kill() + + def test_issue148(self): + for i in range(7): + try: + p1 = subprocess.Popen('this_name_must_not_exist') + except OSError: + ex = sys.exc_info()[1] + if ex.errno != errno.ENOENT: + raise + else: + raise AssertionError('must fail with ENOENT') + + def test_check_output_keyword_error(self): + try: + subprocess.check_output([sys.executable, '-c', 'import sys; sys.exit(44)']) + except subprocess.CalledProcessError, e: + self.assertEqual(e.returncode, 44) + else: + raise AssertionError('must fail with CalledProcessError') + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_support.py python-gevent-1.0/greentest/test_support.py --- python-gevent-0.13.7/greentest/test_support.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_support.py 2013-11-26 16:25:45.000000000 +0000 @@ -172,12 +172,12 @@ if port == 0: port = sock.getsockname()[1] return port - except socket.error, (err, msg): - if err != errno.EADDRINUSE: + except socket.error: + if sys.exc_info()[1].args[0] != errno.EADDRINUSE: raise print >>sys.__stderr__, \ ' WARNING: failed to listen on port %d, trying another' % port - raise TestFailed, 'unable to find port to listen on' + raise TestFailed('unable to find port to listen on') FUZZ = 1e-6 @@ -248,10 +248,9 @@ except UnicodeEncodeError: pass else: - print \ - 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ - 'Unicode filename tests may not be effective' \ - % TESTFN_UNICODE_UNENCODEABLE + sys.stderr.write('WARNING: The filename %r CAN be encoded by the filesystem. ' + 'Unicode filename tests may not be effective' + % TESTFN_UNICODE_UNENCODEABLE) # Make sure we can write to TESTFN, try in /tmp if we can't fp = None @@ -307,7 +306,7 @@ """ if not (a == b): - raise TestFailed, "%r == %r" % (a, b) + raise TestFailed("%r == %r" % (a, b)) def sortdict(dict): "Like repr(dict), but in sorted order." @@ -323,7 +322,7 @@ except SyntaxError: pass else: - print 'Missing SyntaxError: "%s"' % statement + print ('Missing SyntaxError: "%s"' % statement) def open_urlresource(url): import urllib, urlparse @@ -390,7 +389,10 @@ class _Dummy: def __getslice__(self, i, j): return j -MAX_Py_ssize_t = _Dummy()[:] +try: + MAX_Py_ssize_t = _Dummy()[:] +except TypeError: + MAX_Py_ssize_t = sys.maxsize def set_memlimit(limit): import re @@ -542,7 +544,7 @@ finally: sys.stdout = save_stdout if verbose: - print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t) + print ('doctest (%s) ... %d tests with zero failures' % (module.__name__, t)) return f, t #======================================================================= @@ -559,13 +561,13 @@ _MAX_COUNT = 10 count = 0 while len(threading._active) != num_active and count < _MAX_COUNT: - print threading._active + print (threading._active) count += 1 time.sleep(0.1) count = 0 while len(threading._limbo) != num_limbo and count < _MAX_COUNT: - print threading._limbo + print (threading._limbo) count += 1 time.sleep(0.1) diff -Nru python-gevent-0.13.7/greentest/test__systemerror.py python-gevent-1.0/greentest/test__systemerror.py --- python-gevent-0.13.7/greentest/test__systemerror.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__systemerror.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,77 @@ +import sys +import greentest +import gevent +from gevent.hub import get_hub + + +def raise_(ex): + raise ex + + +MSG = 'should be re-raised and caught' + + +class Test(greentest.TestCase): + + error_fatal = False + + def test_sys_exit(self): + self.start(sys.exit, MSG) + + try: + gevent.sleep(0.001) + except SystemExit: + ex = sys.exc_info()[1] + assert str(ex) == MSG, repr(str(ex)) + else: + raise AssertionError('must raise SystemExit') + + def test_keyboard_interrupt(self): + self.start(raise_, KeyboardInterrupt) + + try: + gevent.sleep(0.001) + except KeyboardInterrupt: + pass + else: + raise AssertionError('must raise KeyboardInterrupt') + + def test_system_error(self): + self.start(raise_, SystemError(MSG)) + + try: + gevent.sleep(0.001) + except SystemError: + ex = sys.exc_info()[1] + assert str(ex) == MSG, repr(str(ex)) + else: + raise AssertionError('must raise SystemError') + + def test_exception(self): + self.start(raise_, Exception('regular exception must not kill the program')) + gevent.sleep(0.001) + + +class TestCallback(Test): + + def tearDown(self): + assert not self.x.pending, self.x + + def start(self, *args): + self.x = get_hub().loop.run_callback(*args) + + +class TestSpawn(Test): + + def tearDown(self): + gevent.sleep(0.0001) + assert self.x.dead, self.x + + def start(self, *args): + self.x = gevent.spawn(*args) + + +del Test + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_threading_2.py python-gevent-1.0/greentest/test_threading_2.py --- python-gevent-0.13.7/greentest/test_threading_2.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_threading_2.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,9 +1,9 @@ # testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading from __future__ import with_statement -setup = '''from gevent import monkey; monkey.patch_all() +setup_ = '''from gevent import monkey; monkey.patch_all() from gevent.event import Event -from gevent.coros import RLock, Semaphore, BoundedSemaphore +from gevent.lock import RLock, Semaphore, BoundedSemaphore from gevent.thread import allocate_lock as Lock import threading threading.Event = Event @@ -23,11 +23,11 @@ threading._Condition.notify_all = threading._Condition.notifyAll ''' -exec setup +exec setup_ -setup_3 = '\n'.join(' %s' % line for line in setup.split('\n')) -setup_4 = '\n'.join(' %s' % line for line in setup.split('\n')) -setup_5 = '\n'.join(' %s' % line for line in setup.split('\n')) +setup_3 = '\n'.join(' %s' % line for line in setup_.split('\n')) +setup_4 = '\n'.join(' %s' % line for line in setup_.split('\n')) +setup_5 = '\n'.join(' %s' % line for line in setup_.split('\n')) import test.test_support @@ -44,16 +44,22 @@ import lock_tests # A trivial mutable counter. + + class Counter(object): def __init__(self): self.value = 0 + def inc(self): self.value += 1 + def dec(self): self.value -= 1 + def get(self): return self.value + class TestThread(threading.Thread): def __init__(self, name, testcase, sema, mutex, nrunning): threading.Thread.__init__(self, name=name) @@ -86,6 +92,7 @@ print '%s is finished. %d tasks are running' % ( self.name, self.nrunning.get()) + class ThreadTests(unittest.TestCase): # Create a bunch of threads, let each do some work, wait until all are @@ -103,7 +110,7 @@ threads = [] for i in range(NUMTASKS): - t = TestThread(""%i, self, sema, mutex, numrunning) + t = TestThread("" % i, self, sema, mutex, numrunning) threads.append(t) if hasattr(t, 'ident'): self.failUnlessEqual(t.ident, None) @@ -127,6 +134,7 @@ def test_ident_of_no_threading_threads(self): # The ident still must work for the main thread and dummy threads. self.assertFalse(threading.currentThread().ident is None) + def f(): ident.append(threading.currentThread().ident) done.set() @@ -181,6 +189,7 @@ self.assert_(isinstance(threading._active[tid], threading._DummyThread)) del threading._active[tid] + # in gevent, we actually clean up threading._active, but it's not happended there yet # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) # exposed at the Python level. This test relies on ctypes to get at it. @@ -220,7 +229,7 @@ worker_saw_exception.set() t = Worker() - t.daemon = True # so if this fails, we don't hang Python at shutdown + t.daemon = True # so if this fails, we don't hang Python at shutdown t.start() if verbose: print " started worker thread" @@ -241,7 +250,7 @@ if verbose: print " attempting to raise asynch exception in worker" result = set_async_exc(ctypes.c_long(t.id), exception) - self.assertEqual(result, 1) # one thread state modified + self.assertEqual(result, 1) # one thread state modified if verbose: print " waiting for worker to say it caught the exception" worker_saw_exception.wait(timeout=10) @@ -309,35 +318,6 @@ """ % setup_4]) self.assertEqual(rc, 42) - def test_finalize_with_trace(self): - # Issue1733757 - # Avoid a deadlock when sys.settrace steps into threading._shutdown - import subprocess - rc = subprocess.call([sys.executable, "-c", """if 1: -%s - import sys, threading - - # A deadlock-killer, to prevent the - # testsuite to hang forever - def killer(): - import os, time - time.sleep(2) - print 'program blocked; aborting' - os._exit(2) - t = threading.Thread(target=killer) - t.daemon = True - t.start() - - # This is the trace function - def func(frame, event, arg): - threading.current_thread() - return func - - sys.settrace(func) - """ % setup_3]) - self.failIf(rc == 2, "interpreted was blocked") - self.failUnless(rc == 0, "Unexpected error") - if sys.version_info[:2] > (2, 5): def test_join_nondaemon_on_shutdown(self): # Issue 1722344 @@ -393,7 +373,7 @@ self.should_raise = should_raise self.thread = threading.Thread(target=self._run, args=(self,), - kwargs={'yet_another':self}) + kwargs={'yet_another': self}) self.thread.start() def _run(self, other_ref, yet_another): @@ -450,7 +430,6 @@ """ self._run_and_join(script) - def test_2_join_in_forked_process(self): # Like the test above, but from a forked interpreter import os @@ -512,7 +491,7 @@ def test_joining_current_thread(self): current_thread = threading.current_thread() - self.assertRaises(RuntimeError, current_thread.join); + self.assertRaises(RuntimeError, current_thread.join) def test_joining_inactive_thread(self): thread = threading.Thread() @@ -527,27 +506,33 @@ class LockTests(lock_tests.LockTests): locktype = staticmethod(threading.Lock) + class RLockTests(lock_tests.RLockTests): locktype = staticmethod(threading.RLock) + class EventTests(lock_tests.EventTests): eventtype = staticmethod(threading.Event) + class ConditionAsRLockTests(lock_tests.RLockTests): # An Condition uses an RLock by default and exports its API. locktype = staticmethod(threading.Condition) + class ConditionTests(lock_tests.ConditionTests): condtype = staticmethod(threading.Condition) + class SemaphoreTests(lock_tests.SemaphoreTests): semtype = staticmethod(threading.Semaphore) + class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests): semtype = staticmethod(threading.BoundedSemaphore) -def test_main(): +def main(): test.test_support.run_unittest(LockTests, RLockTests, EventTests, ConditionAsRLockTests, ConditionTests, SemaphoreTests, BoundedSemaphoreTests, @@ -557,4 +542,4 @@ ) if __name__ == "__main__": - test_main() + main() diff -Nru python-gevent-0.13.7/greentest/test_threading_local.py python-gevent-1.0/greentest/test_threading_local.py --- python-gevent-0.13.7/greentest/test_threading_local.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_threading_local.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -# this is http://svn.python.org/view/python/trunk/Lib/test/test_threading_local.py?view=markup&pathrev=78336 -# although we do have test_patched_local.py, it does not have all the tests that this file has -from gevent import monkey; monkey.patch_all() -import unittest -from doctest import DocTestSuite -from test import test_support -import threading -import weakref -import gc - -class Weak(object): - pass - -def target(local, weaklist): - weak = Weak() - local.weak = weak - weaklist.append(weakref.ref(weak)) - -class ThreadingLocalTest(unittest.TestCase): - - def test_local_refs(self): - self._local_refs(20) - self._local_refs(50) - self._local_refs(100) - - def _local_refs(self, n): - local = threading.local() - weaklist = [] - for i in range(n): - t = threading.Thread(target=target, args=(local, weaklist)) - t.start() - t.join() - del t - - gc.collect() - self.assertEqual(len(weaklist), n) - - # XXX threading.local keeps the local of the last stopped thread alive. - deadlist = [weak for weak in weaklist if weak() is None] - self.assertEqual(len(deadlist), n-1) - - # Assignment to the same thread local frees it sometimes (!) - local.someothervar = None - gc.collect() - deadlist = [weak for weak in weaklist if weak() is None] - #self.assertIn(len(deadlist), (n-1, n), (n, len(deadlist))) - assert len(deadlist) in (n-1, n), (n, len(deadlist)) - - def test_derived(self): - # Issue 3088: if there is a threads switch inside the __init__ - # of a threading.local derived class, the per-thread dictionary - # is created but not correctly set on the object. - # The first member set may be bogus. - import time - class Local(threading.local): - def __init__(self): - time.sleep(0.01) - local = Local() - - def f(i): - local.x = i - # Simply check that the variable is correctly set - self.assertEqual(local.x, i) - - threads= [] - for i in range(10): - t = threading.Thread(target=f, args=(i,)) - t.start() - threads.append(t) - - for t in threads: - t.join() - - def test_derived_cycle_dealloc(self): - # http://bugs.python.org/issue6990 - class Local(threading.local): - pass - locals = None - passed = [False] - e1 = threading.Event() - e2 = threading.Event() - - def f(): - # 1) Involve Local in a cycle - cycle = [Local()] - cycle.append(cycle) - cycle[0].foo = 'bar' - - # 2) GC the cycle (triggers threadmodule.c::local_clear - # before local_dealloc) - del cycle - gc.collect() - e1.set() - e2.wait() - - # 4) New Locals should be empty - passed[0] = all(not hasattr(local, 'foo') for local in locals) - - t = threading.Thread(target=f) - t.start() - e1.wait() - - # 3) New Locals should recycle the original's address. Creating - # them in the thread overwrites the thread state and avoids the - # bug - locals = [Local() for i in range(10)] - e2.set() - t.join() - - self.assertTrue(passed[0]) - - def test_arguments(self): - # Issue 1522237 - from thread import _local as local - from _threading_local import local as py_local - - assert local is py_local - assert local is threading.local - - class MyLocal(local): - def __init__(self, *args, **kwargs): - pass - - MyLocal(a=1) - MyLocal(1) - self.assertRaises(TypeError, local, a=1) - self.assertRaises(TypeError, local, 1) - - -try: - all -except NameError: - def all(iter): - for x in iter: - if not x: - return False - return True - - -if __name__ == '__main__': - unittest.main() diff -Nru python-gevent-0.13.7/greentest/test__threading.py python-gevent-1.0/greentest/test__threading.py --- python-gevent-0.13.7/greentest/test__threading.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__threading.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,29 @@ +from gevent import monkey; monkey.patch_all() +import gevent.hub + +# check that the locks initialized by 'threading' did not init the hub +assert gevent.hub._get_hub() is None, 'monkey.patch_all() should not init hub' + +import gevent +import greentest +import threading + + +def helper(): + threading.currentThread() + gevent.sleep(0.2) + + +class Test(greentest.TestCase): + + def test(self): + before = len(threading._active) + g = gevent.spawn(helper) + gevent.sleep(0.1) + self.assertEqual(len(threading._active), before + 1) + g.join() + self.assertEqual(len(threading._active), before) + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test__threading_vs_settrace.py python-gevent-1.0/greentest/test__threading_vs_settrace.py --- python-gevent-0.13.7/greentest/test__threading_vs_settrace.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__threading_vs_settrace.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,84 @@ +from __future__ import with_statement + +import sys +import subprocess +import unittest +import gevent.thread + +script = """ +from gevent import monkey +monkey.patch_all() +import sys, os, threading, time + + +# A deadlock-killer, to prevent the +# testsuite to hang forever +def killer(): + time.sleep(0.1) + sys.stdout.write('..program blocked; aborting!') + sys.stdout.flush() + os._exit(2) +t = threading.Thread(target=killer) +t.daemon = True +t.start() + + +def trace(frame, event, arg): + if threading is not None: + threading.currentThread() + return trace + + +def doit(): + sys.stdout.write("..thread started..") + + +def test1(): + t = threading.Thread(target=doit) + t.start() + t.join() + sys.settrace(None) + +sys.settrace(trace) +if len(sys.argv) > 1: + test1() + +sys.stdout.write("..finishing..") +""" + + +class ThreadTrace(unittest.TestCase): + def test_untraceable_lock(self): + if hasattr(sys, 'gettrace'): + old = sys.gettrace() + else: + old = None + lst = [] + try: + def trace(frame, ev, arg): + lst.append((frame.f_code.co_filename, frame.f_lineno, ev)) + print "TRACE: %s:%s %s" % lst[-1] + return trace + + with gevent.thread.allocate_lock(): + sys.settrace(trace) + finally: + sys.settrace(old) + + self.failUnless(lst == [], "trace not empty") + + def run_script(self, more_args=[]): + rc = subprocess.call([sys.executable, "-c", script] + more_args) + self.failIf(rc == 2, "interpreter was blocked") + self.failUnless(rc == 0, "Unexpected error") + + def test_finalize_with_trace(self): + self.run_script() + + def test_bootstrap_inner_with_trace(self): + self.run_script(["1"]) + + +if __name__ == "__main__": + import test.test_support + test.test_support.run_unittest(ThreadTrace) diff -Nru python-gevent-0.13.7/greentest/test__threadpool.py python-gevent-1.0/greentest/test__threadpool.py --- python-gevent-0.13.7/greentest/test__threadpool.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/test__threadpool.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,362 @@ +from __future__ import with_statement +import sys +from time import time, sleep +import random +import weakref +import greentest +from gevent.threadpool import ThreadPool +import gevent +import six + + +class TestCase(greentest.TestCase): + + def cleanup(self): + pool = getattr(self, 'pool', None) + if pool is not None: + pool.kill() + del self.pool + + +class PoolBasicTests(TestCase): + + def test_execute_async(self): + self.pool = pool = ThreadPool(2) + r = [] + first = pool.spawn(r.append, 1) + first.get() + self.assertEqual(r, [1]) + gevent.sleep(0) + + pool.apply_async(r.append, (2, )) + self.assertEqual(r, [1]) + + pool.apply_async(r.append, (3, )) + self.assertEqual(r, [1]) + + pool.apply_async(r.append, (4, )) + self.assertEqual(r, [1]) + gevent.sleep(0.01) + self.assertEqual(sorted(r), [1, 2, 3, 4]) + + def test_apply(self): + self.pool = pool = ThreadPool(1) + result = pool.apply(lambda a: ('foo', a), (1, )) + self.assertEqual(result, ('foo', 1)) + + def test_init_valueerror(self): + self.switch_expected = False + self.assertRaises(ValueError, ThreadPool, -1) + self.pool = None + +# +# tests from standard library test/test_multiprocessing.py + + +class TimingWrapper(object): + + def __init__(self, func): + self.func = func + self.elapsed = None + + def __call__(self, *args, **kwds): + t = time() + try: + return self.func(*args, **kwds) + finally: + self.elapsed = time() - t + + +def sqr(x, wait=0.0): + sleep(wait) + return x * x + + +def sqr_random_sleep(x): + sleep(random.random() * 0.1) + return x * x + + +TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.082, 0.035, 0.14 + + +class TestPool(TestCase): + __timeout__ = 5 + size = 1 + + def setUp(self): + greentest.TestCase.setUp(self) + self.pool = ThreadPool(self.size) + + def test_apply(self): + papply = self.pool.apply + self.assertEqual(papply(sqr, (5,)), sqr(5)) + self.assertEqual(papply(sqr, (), {'x': 3}), sqr(x=3)) + + def test_map(self): + pmap = self.pool.map + self.assertEqual(pmap(sqr, range(10)), list(map(sqr, range(10)))) + self.assertEqual(pmap(sqr, range(100)), list(map(sqr, range(100)))) + + def test_async(self): + res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) + get = TimingWrapper(res.get) + self.assertEqual(get(), 49) + self.assertAlmostEqual(get.elapsed, TIMEOUT1, 1) + + def test_async_callback(self): + result = [] + res = self.pool.apply_async(sqr, (7, TIMEOUT1,), callback=lambda x: result.append(x)) + get = TimingWrapper(res.get) + self.assertEqual(get(), 49) + self.assertAlmostEqual(get.elapsed, TIMEOUT1, 1) + gevent.sleep(0) # let's the callback run + assert result == [49], result + + def test_async_timeout(self): + res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) + get = TimingWrapper(res.get) + self.assertRaises(gevent.Timeout, get, timeout=TIMEOUT2) + self.assertAlmostEqual(get.elapsed, TIMEOUT2, 1) + self.pool.join() + + def test_imap(self): + it = self.pool.imap(sqr, range(10)) + self.assertEqual(list(it), list(map(sqr, range(10)))) + + it = self.pool.imap(sqr, range(10)) + for i in range(10): + self.assertEqual(six.advance_iterator(it), i * i) + self.assertRaises(StopIteration, lambda: six.advance_iterator(it)) + + it = self.pool.imap(sqr, range(1000)) + for i in range(1000): + self.assertEqual(six.advance_iterator(it), i * i) + self.assertRaises(StopIteration, lambda: six.advance_iterator(it)) + + def test_imap_random(self): + it = self.pool.imap(sqr_random_sleep, range(10)) + self.assertEqual(list(it), list(map(sqr, range(10)))) + + def test_imap_unordered(self): + it = self.pool.imap_unordered(sqr, range(1000)) + self.assertEqual(sorted(it), list(map(sqr, range(1000)))) + + it = self.pool.imap_unordered(sqr, range(1000)) + self.assertEqual(sorted(it), list(map(sqr, range(1000)))) + + def test_imap_unordered_random(self): + it = self.pool.imap_unordered(sqr_random_sleep, range(10)) + self.assertEqual(sorted(it), list(map(sqr, range(10)))) + + def test_terminate(self): + result = self.pool.map_async(sleep, [0.1] * ((self.size or 10) * 2)) + gevent.sleep(0.1) + kill = TimingWrapper(self.pool.kill) + kill() + assert kill.elapsed < 0.5, kill.elapsed + result.join() + + def sleep(self, x): + sleep(float(x) / 10.) + return str(x) + + def test_imap_unordered_sleep(self): + # testing that imap_unordered returns items in competion order + result = list(self.pool.imap_unordered(self.sleep, [10, 1, 2])) + if self.pool.size == 1: + expected = ['10', '1', '2'] + else: + expected = ['1', '2', '10'] + self.assertEqual(result, expected) + + +class TestPool2(TestPool): + size = 2 + + +class TestPool3(TestPool): + size = 3 + + +class TestPool10(TestPool): + size = 10 + __timeout__ = 5 + + +# class TestJoinSleep(greentest.GenericGetTestCase): +# +# def wait(self, timeout): +# pool = ThreadPool(1) +# pool.spawn(gevent.sleep, 10) +# pool.join(timeout=timeout) +# +# +# class TestJoinSleep_raise_error(greentest.GenericWaitTestCase): +# +# def wait(self, timeout): +# pool = ThreadPool(1) +# g = pool.spawn(gevent.sleep, 10) +# pool.join(timeout=timeout, raise_error=True) + + +class TestJoinEmpty(TestCase): + switch_expected = False + + def test(self): + self.pool = ThreadPool(1) + self.pool.join() + + +class TestSpawn(TestCase): + switch_expected = True + + def test(self): + self.pool = pool = ThreadPool(1) + self.assertEqual(len(pool), 0) + log = [] + sleep_n_log = lambda item, seconds: [sleep(seconds), log.append(item)] + pool.spawn(sleep_n_log, 'a', 0.1) + self.assertEqual(len(pool), 1) + pool.spawn(sleep_n_log, 'b', 0.1) + # even though the pool is of size 1, it can contain 2 items + # since we allow +1 for better throughput + self.assertEqual(len(pool), 2) + gevent.sleep(0.15) + self.assertEqual(log, ['a']) + self.assertEqual(len(pool), 1) + gevent.sleep(0.15) + self.assertEqual(log, ['a', 'b']) + self.assertEqual(len(pool), 0) + + +def error_iter(): + yield 1 + yield 2 + raise greentest.ExpectedException + + +class TestErrorInIterator(TestCase): + + error_fatal = False + + def test(self): + self.pool = ThreadPool(3) + self.assertRaises(greentest.ExpectedException, self.pool.map, lambda x: None, error_iter()) + gevent.sleep(0.001) + + def test_unordered(self): + self.pool = ThreadPool(3) + + def unordered(): + return list(self.pool.imap_unordered(lambda x: None, error_iter())) + + self.assertRaises(greentest.ExpectedException, unordered) + gevent.sleep(0.001) + + +class TestMaxsize(TestCase): + + def test_inc(self): + self.pool = ThreadPool(0) + done = [] + gevent.spawn(self.pool.spawn, done.append, 1) + gevent.spawn_later(0.0001, self.pool.spawn, done.append, 2) + gevent.sleep(0.01) + self.assertEqual(done, []) + self.pool.maxsize = 1 + gevent.sleep(0.01) + self.assertEqual(done, [1, 2]) + + def test_setzero(self): + pool = self.pool = ThreadPool(3) + pool.spawn(sleep, 0.1) + pool.spawn(sleep, 0.2) + pool.spawn(sleep, 0.3) + gevent.sleep(0.2) + self.assertEqual(pool.size, 3) + pool.maxsize = 0 + gevent.sleep(0.2) + self.assertEqual(pool.size, 0) + + +class TestSize(TestCase): + + def test(self): + pool = self.pool = ThreadPool(2) + self.assertEqual(pool.size, 0) + pool.size = 1 + self.assertEqual(pool.size, 1) + pool.size = 2 + self.assertEqual(pool.size, 2) + pool.size = 1 + self.assertEqual(pool.size, 1) + + def set_neg(): + pool.size = -1 + + self.assertRaises(ValueError, set_neg) + + def set_too_big(): + pool.size = 3 + + self.assertRaises(ValueError, set_too_big) + pool.size = 0 + self.assertEqual(pool.size, 0) + pool.size = 2 + self.assertEqual(pool.size, 2) + + +class TestRef(TestCase): + + def test(self): + pool = self.pool = ThreadPool(2) + + refs = [] + obj = SomeClass() + obj.refs = refs + func = obj.func + del obj + + with greentest.disabled_gc(): + # we do this: + # result = func(Object(), kwarg1=Object()) + # but in a thread pool and see that arguments', result's and func's references are not leaked + result = pool.apply(func, (Object(), ), {'kwarg1': Object()}) + assert isinstance(result, Object), repr(result) + gevent.sleep(0.1) # XXX should not be needed + + refs.append(weakref.ref(func)) + del func, result + for index, r in enumerate(refs): + assert r() is None, (index, r(), sys.getrefcount(r()), refs) + assert len(refs) == 4, refs + + +class Object(object): + pass + + +class SomeClass(object): + + def func(self, arg1, kwarg1=None): + result = Object() + self.refs.extend([weakref.ref(x) for x in [arg1, kwarg1, result]]) + return result + + +def func(): + pass + + +class TestRefCount(TestCase): + + def test(self): + pool = ThreadPool(1) + pool.spawn(func) + gevent.sleep(0) + pool.kill() + + +if __name__ == '__main__': + greentest.main() diff -Nru python-gevent-0.13.7/greentest/test_thread.py python-gevent-1.0/greentest/test_thread.py --- python-gevent-0.13.7/greentest/test_thread.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test_thread.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -# Very rudimentary test of thread module - -# Create a bunch of threads, let each do some work, wait until all are done - -from gevent import monkey -monkey.patch_all() - -from test_support import verbose -import random -import thread -import time - -mutex = thread.allocate_lock() -rmutex = thread.allocate_lock() # for calls to random -running = 0 -done = thread.allocate_lock() -done.acquire() - -numtasks = 10 - -def task(ident): - global running - rmutex.acquire() - delay = random.random() * numtasks * 0.02 - rmutex.release() - if verbose: - print 'task', ident, 'will run for', round(delay, 2), 'sec' - time.sleep(delay) - if verbose: - print 'task', ident, 'done' - mutex.acquire() - running = running - 1 - if running == 0: - done.release() - mutex.release() - -next_ident = 0 -def newtask(): - global next_ident, running - mutex.acquire() - next_ident = next_ident + 1 - if verbose: - print 'creating task', next_ident - thread.start_new_thread(task, (next_ident,)) - running = running + 1 - mutex.release() - -for i in range(numtasks): - newtask() - -print 'waiting for all tasks to complete' -done.acquire() -print 'all tasks done' - -class barrier: - def __init__(self, n): - self.n = n - self.waiting = 0 - self.checkin = thread.allocate_lock() - self.checkout = thread.allocate_lock() - self.checkout.acquire() - - def enter(self): - checkin, checkout = self.checkin, self.checkout - - checkin.acquire() - self.waiting = self.waiting + 1 - if self.waiting == self.n: - self.waiting = self.n - 1 - checkout.release() - return - checkin.release() - - checkout.acquire() - self.waiting = self.waiting - 1 - if self.waiting == 0: - checkin.release() - return - checkout.release() - -numtrips = 3 -def task2(ident): - global running - for i in range(numtrips): - if ident == 0: - # give it a good chance to enter the next - # barrier before the others are all out - # of the current one - delay = 0.001 - else: - rmutex.acquire() - delay = random.random() * numtasks * 0.02 - rmutex.release() - if verbose: - print 'task', ident, 'will run for', round(delay, 2), 'sec' - time.sleep(delay) - if verbose: - print 'task', ident, 'entering barrier', i - bar.enter() - if verbose: - print 'task', ident, 'leaving barrier', i - mutex.acquire() - running -= 1 - # Must release mutex before releasing done, else the main thread can - # exit and set mutex to None as part of global teardown; then - # mutex.release() raises AttributeError. - finished = running == 0 - mutex.release() - if finished: - done.release() - -print '\n*** Barrier Test ***' -if done.acquire(0): - raise ValueError, "'done' should have remained acquired" -bar = barrier(numtasks) -running = numtasks -for i in range(numtasks): - thread.start_new_thread(task2, (i,)) -done.acquire() -print 'all tasks done' - -if hasattr(thread, 'stack_size'): - # not all platforms support changing thread stack size - print '\n*** Changing thread stack size ***' - if thread.stack_size() != 0: - raise ValueError, "initial stack_size not 0" - - thread.stack_size(0) - if thread.stack_size() != 0: - raise ValueError, "stack_size not reset to default" - - from os import name as os_name - if os_name in ("nt", "os2", "posix"): - - tss_supported = 1 - try: - thread.stack_size(4096) - except ValueError: - print 'caught expected ValueError setting stack_size(4096)' - except thread.error: - tss_supported = 0 - print 'platform does not support changing thread stack size' - - if tss_supported: - failed = lambda s, e: s != e - fail_msg = "stack_size(%d) failed - should succeed" - for tss in (262144, 0x100000, 0): - thread.stack_size(tss) - if failed(thread.stack_size(), tss): - raise ValueError, fail_msg % tss - print 'successfully set stack_size(%d)' % tss - - for tss in (262144, 0x100000): - print 'trying stack_size = %d' % tss - next_ident = 0 - for i in range(numtasks): - newtask() - - print 'waiting for all tasks to complete' - done.acquire() - print 'all tasks done' - - # reset stack size to default - thread.stack_size(0) diff -Nru python-gevent-0.13.7/greentest/test__timeout.py python-gevent-1.0/greentest/test__timeout.py --- python-gevent-0.13.7/greentest/test__timeout.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__timeout.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,5 +1,6 @@ import greentest import gevent +import sys from gevent.hub import get_hub DELAY = 0.01 @@ -11,14 +12,16 @@ def test_direct_raise_class(self): try: raise gevent.Timeout - except gevent.Timeout, t: + except gevent.Timeout: + t = sys.exc_info()[1] assert not t.pending, repr(t) def test_direct_raise_instance(self): timeout = gevent.Timeout() try: raise timeout - except gevent.Timeout, t: + except gevent.Timeout: + t = sys.exc_info()[1] assert timeout is t, (timeout, t) assert not t.pending, repr(t) @@ -29,7 +32,8 @@ try: get_hub().switch() raise AssertionError('Must raise Timeout') - except gevent.Timeout, ex: + except gevent.Timeout: + ex = sys.exc_info()[1] if ex is not timeout: raise diff -Nru python-gevent-0.13.7/greentest/test__wsgi.py python-gevent-1.0/greentest/test__wsgi.py --- python-gevent-0.13.7/greentest/test__wsgi.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/test__wsgi.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -import gevent -from gevent import wsgi -import test__pywsgi -from test__pywsgi import * - -del TestHttps -test__pywsgi.server_implements_chunked = False -test__pywsgi.server_implements_pipeline = False -test__pywsgi.server_implements_100continue = False -TestCase.get_wsgi_module = lambda *args: wsgi - - -if __name__ == '__main__': - greentest.main() diff -Nru python-gevent-0.13.7/greentest/update_patched_tests.py python-gevent-1.0/greentest/update_patched_tests.py --- python-gevent-0.13.7/greentest/update_patched_tests.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/update_patched_tests.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -import os -import glob - -for filename in glob.glob('test_patched_*.py'): - cmd = 'cp patched_test.py %s' % filename - print cmd - os.system(cmd) diff -Nru python-gevent-0.13.7/greentest/util.py python-gevent-1.0/greentest/util.py --- python-gevent-0.13.7/greentest/util.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/util.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,406 @@ +from __future__ import with_statement +import sys +import os +import re +import traceback +import unittest +import threading +import time +from datetime import timedelta +from gevent import subprocess, sleep, spawn_later + + +SLEEP = 0.1 +runtimelog = [] +MIN_RUNTIME = 1.0 +BUFFER_OUTPUT = False + + +class Popen(subprocess.Popen): + + def __enter__(self): + return self + + def __exit__(self, *args): + kill(self) + + +def log(message, *args): + try: + if args: + string = message % args + else: + string = message + except Exception: + traceback.print_exc() + try: + string = '%r %% %r\n\n' % (message, args) + except Exception: + pass + try: + sys.stderr.write(string) + except Exception: + traceback.print_exc() + else: + sys.stderr.write(string + '\n') + + +def killpg(pid): + if not hasattr(os, 'killpg'): + return + try: + return os.killpg(pid, 9) + except OSError, ex: + if ex.errno != 3: + log('killpg(%r, 9) failed: %s: %s', pid, type(ex).__name__, ex) + except Exception, ex: + log('killpg(%r, 9) failed: %s: %s', pid, type(ex).__name__, ex) + + +def kill_processtree(pid): + ignore_msg = 'ERROR: The process "%s" not found.' % pid + err = subprocess.Popen('taskkill /F /PID %s /T' % pid, stderr=subprocess.PIPE).communicate()[1] + if err and err.strip() not in [ignore_msg, '']: + log('%r', err) + + +def _kill(popen): + if hasattr(popen, 'kill'): + try: + popen.kill() + except OSError, ex: + if ex.errno == 3: # No such process + return + if ex.errno == 13: # Permission denied (translated from windows error 5: "Access is denied") + return + raise + else: + try: + os.kill(popen.pid, 9) + except EnvironmentError: + pass + + +def kill(popen): + try: + if getattr(popen, 'setpgrp_enabled', None): + killpg(popen.pid) + elif sys.platform.startswith('win'): + kill_processtree(popen.pid) + except Exception: + traceback.print_exc() + try: + _kill(popen) + except Exception: + traceback.print_exc() + try: + popen.wait() + except Exception: + traceback.print_exc() + + +def getname(command, env=None, setenv=None): + result = [] + + env = (env or os.environ).copy() + env.update(setenv or {}) + + for key, value in sorted(env.items()): + if key.startswith('GEVENT_') or key.startswith('GEVENTARES_'): + result.append('%s=%s' % (key, value)) + + if isinstance(command, basestring): + result.append(command) + else: + result.extend(command) + + return ' '.join(result) + + +def start(command, **kwargs): + timeout = kwargs.pop('timeout', None) + preexec_fn = None + if not os.environ.get('DO_NOT_SETPGRP'): + preexec_fn = getattr(os, 'setpgrp', None) + env = kwargs.pop('env', None) + setenv = kwargs.pop('setenv', None) or {} + name = getname(command, env=env, setenv=setenv) + if preexec_fn is not None: + setenv['DO_NOT_SETPGRP'] = '1' + if setenv: + if env: + env = env.copy() + else: + env = os.environ.copy() + env.update(setenv) + + log('+ %s', name) + popen = Popen(command, preexec_fn=preexec_fn, env=env, **kwargs) + popen.name = name + popen.setpgrp_enabled = preexec_fn is not None + if timeout is not None: + popen._killer = spawn_later(timeout, kill, popen) + popen._killer._start_event.ref = False # XXX add 'ref' property to greenlet + else: + popen._killer = None + return popen + + +class RunResult(object): + + def __init__(self, code, output=None, name=None): + self.code = code + self.output = output + self.name = name + + def __nonzero__(self): + return bool(self.code) + + def __int__(self): + return self.code + + +def run(command, **kwargs): + buffer_output = kwargs.pop('buffer_output', BUFFER_OUTPUT) + if buffer_output: + assert 'stdout' not in kwargs and 'stderr' not in kwargs, kwargs + kwargs['stderr'] = subprocess.STDOUT + kwargs['stdout'] = subprocess.PIPE + popen = start(command, **kwargs) + name = popen.name + try: + time_start = time.time() + out, err = popen.communicate() + took = time.time() - time_start + if popen.poll() is None: + result = 'TIMEOUT' + else: + result = popen.poll() + finally: + if popen._killer is not None: + popen._killer.kill(block=False) + kill(popen) + assert not err + if out: + out = out.strip() + if out: + out = ' ' + out.replace('\n', '\n ') + out = out.rstrip() + out += '\n' + log('| %s\n%s', name, out) + if result: + log('! %s [code %s] [took %.1fs]', name, result, took) + else: + log('- %s [took %.1fs]', name, took) + if took >= MIN_RUNTIME: + runtimelog.append((-took, name)) + return RunResult(result, out, name) + + +def parse_command(parts): + if isinstance(parts, basestring): + parts = parts.split() + environ = [] + if parts[0] == '-': + del parts[0] + elif parts[0] == '*': + del parts[0] + environ = None + elif '=' in parts[0]: + while parts[0].count('='): + environ.append(parts[0]) + del parts[0] + exe = parts[0] + del parts[0] + if exe == '*': + exe = None + else: + assert exe + assert not exe.startswith('-'), repr(exe) + return environ, exe, parts + + +def parse_line(line): + """ + >>> parse_line("* - /usr/bin/python -u test.py") + (None, [], '/usr/bin/python', ['-u', 'test.py']) + + >>> parse_line("win32 * C:\\Python27\\python.exe -u -m monkey_test --Event test_subprocess.py") + ('win32', None, 'C:\\\\Python27\\\\python.exe', ['-u', '-m', 'monkey_test', '--Event', 'test_subprocess.py']) + + >>> parse_line("* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns.py") + (None, ['GEVENTARES_SERVERS=8.8.8.8', 'GEVENT_RESOLVER=ares'], None, ['-u', 'test__socket_dns.py']) + """ + parts = line.split() + if len(parts) < 4: + raise ValueError('Expected "platform environ executable arguments", got %r' % line) + platform = parts[0] + if platform == '*': + platform = None + return (platform, ) + parse_command(parts[1:]) + + +def match_word(pattern, word): + if isinstance(pattern, str) and isinstance(word, str) and '(' in pattern or '*' in pattern or '?' in pattern or '[' in pattern: + return re.match(pattern, word) + return pattern == word + + +def match_environ(expected_environ, actual_environ): + """ + >>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8', + ... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread') + True + >>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.7', + ... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread') + False + >>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=', + ... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread') + False + """ + if expected_environ is None: + return True + if isinstance(expected_environ, basestring): + expected_environ = expected_environ.split() + if isinstance(actual_environ, basestring): + actual_environ = actual_environ.split() + expected_environ = dict(x.split('=') for x in expected_environ) + actual_environ = dict(x.split('=') for x in actual_environ) + for key, expected_value in expected_environ.items(): + value = actual_environ.pop(key, None) + if value is not None and value != expected_value: + return False + return True + + +def match_line(line, command): + expected_platform, expected_environ, expected_exe, expected_arguments = parse_line(line) + if expected_platform is not None and expected_platform != sys.platform: + return + environ, exe, arguments = parse_command(command) + if not match_environ(expected_environ, environ): + return + if expected_exe is not None and not match_word(expected_exe, exe): + return + return expected_arguments == arguments + + +def matches(expected, command): + """ + >>> matches(["* * C:\Python27\python.exe -u -m monkey_test --Event test_threading.py"], "C:\Python27\python.exe -u -m monkey_test --Event test_threading.py") + True + >>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'], "/usr/bin/python2.5-dbg -u -m monkey_test --Event test_urllib2net.py") + True + >>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'], "/usr/bin/python2.5 -u -m monkey_test --Event test_urllib2net.py") + True + >>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'], "/usr/bin/python2.6 -u -m monkey_test --Event test_urllib2net.py") + False + >>> matches(['* GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 python -u test__subprocess.py'], + ... "GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread python -u test__subprocess.py") + True + """ + for line in expected: + if match_line(line, command): + return True + return False + + +def format_seconds(seconds): + if seconds < 20: + return '%.1fs' % seconds + seconds = str(timedelta(seconds=round(seconds))) + if seconds.startswith('0:'): + seconds = seconds[2:] + return seconds + + +def report(total, failed, exit=True, took=None, expected=None): + if runtimelog: + log('\nLongest-running tests:') + runtimelog.sort() + length = len('%.1f' % -runtimelog[0][0]) + frmt = '%' + str(length) + '.1f seconds: %s' + for delta, name in runtimelog[:5]: + log(frmt, -delta, name) + if took: + took = ' in %s' % format_seconds(took) + else: + took = '' + + failed_expected = [] + failed_unexpected = [] + + if failed: + log('\n%s/%s tests failed%s', len(failed), total, took) + expected = set(expected or []) + for name in failed: + if matches(expected, name): + failed_expected.append(name) + else: + failed_unexpected.append(name) + + if failed_expected: + log('\n%s/%s expected failures', len(failed_expected), total) + for name in failed_expected: + log(' - %s', name) + + if failed_unexpected: + log('\n%s/%s unexpected failures', len(failed_unexpected), total) + for name in failed_unexpected: + log(' - %s', name) + else: + log('\n%s tests passed%s', total, took) + if exit: + if failed_unexpected: + sys.exit(min(100, len(failed_unexpected))) + if total <= 0: + sys.exit('No tests found.') + + +class TestServer(unittest.TestCase): + cwd = '../examples/' + args = [] + before_delay = 1 + after_delay = 0.5 + + def test(self): + with start([sys.executable, '-u', self.server] + self.args, cwd=self.cwd) as popen: + self.popen = popen + self.before() + self._run_all_tests() + self.after() + + def before(self): + if self.before_delay is not None: + sleep(self.before_delay) + assert self.popen.poll() is None, '%s died with code %s' % (self.server, self.popen.poll(), ) + + def after(self): + if self.after_delay is not None: + sleep(self.after_delay) + assert self.popen.poll() is None, '%s died with code %s' % (self.server, self.popen.poll(), ) + + def _run_all_tests(self): + ran = False + for method in sorted(dir(self)): + if method.startswith('_test'): + function = getattr(self, method) + if callable(function): + function() + ran = True + assert ran + + +class alarm(threading.Thread): + # can't use signal.alarm because of Windows + + def __init__(self, timeout): + threading.Thread.__init__(self) + self.setDaemon(True) + self.timeout = timeout + self.start() + + def run(self): + time.sleep(self.timeout) + sys.stderr.write('Timeout.\n') + os._exit(5) diff -Nru python-gevent-0.13.7/greentest/xtest__benchmarks.py python-gevent-1.0/greentest/xtest__benchmarks.py --- python-gevent-0.13.7/greentest/xtest__benchmarks.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/xtest__benchmarks.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,65 @@ +# testrunner timeout: 300 +import sys +import glob +import subprocess +import time + + +TIMEOUT = 30 + + +def kill(popen): + if popen.poll() is not None: + return + try: + popen.kill() + except OSError, ex: + if ex.errno == 3: # No such process + return + if ex.errno == 13: # Permission denied (translated from windows error 5: "Access is denied") + return + raise + + +def wait(popen): + end = time.time() + TIMEOUT + while popen.poll() is None: + if time.time() > end: + kill(popen) + popen.wait() + return 'TIMEOUT' + time.sleep(0.1) + return popen.poll() + + +def system(command): + popen = subprocess.Popen(command, shell=False) + try: + return wait(popen) + finally: + kill(popen) + + +modules = set() + +for path in glob.glob('bench_*.py'): + modules.add(path) + +if __name__ == '__main__': + assert modules + + errors = [] + + for path in modules: + sys.stderr.write(path + '\n') + sys.stdout.flush() + command = [sys.executable, '-u', path, 'all'] + res = system(command) + if res: + error = '%r failed with %s' % (' '.join(command), res) + sys.stderr.write(error + '\n') + errors.append(error) + sys.stderr.write('-----\n\n') + + if errors: + sys.exit('\n'.join(errors)) diff -Nru python-gevent-0.13.7/greentest/xtest__issue91.py python-gevent-1.0/greentest/xtest__issue91.py --- python-gevent-0.13.7/greentest/xtest__issue91.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/xtest__issue91.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,17 @@ +from gevent.select import select +from gevent.server import StreamServer +from gevent import socket + + +def handler(socket, address): + while True: + if not socket.recv(1000): + break + + +server = StreamServer(('127.0.0.1', 0), handler) +server.start() + +s = socket.create_connection(('127.0.0.1', server.server_port)) +while True: + select([], [s.fileno()] * 10, []) diff -Nru python-gevent-0.13.7/greentest/xtest_pep8.py python-gevent-1.0/greentest/xtest_pep8.py --- python-gevent-0.13.7/greentest/xtest_pep8.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/xtest_pep8.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,75 +1,29 @@ import sys import os -import unittest -import glob -import re -from os.path import abspath, dirname, join, basename - -# this regex matches filenames of the standard tests (with one underscore) -stdtest_re = re.compile('^(test_[^_].+|lock_tests)\.py$') - -script = 'pep8' - -try: - index = sys.argv.index('--script') -except ValueError: - pass -else: - script = sys.argv[index + 1] - del sys.argv[index:index + 2] -# E501 line too long (80 character limit that we don't follow) -command = script + ' --repeat --statistics --ignore E501 %s | grep -v E501' +sys.stderr.write('pep8 --version: ') +if os.system('pep8 --version'): + sys.exit('ERROR: pep8 script not found') -if os.system('pep8 --version'): - sys.stderr.write('Please install pep8 script\n') - sys.exit(0) +if not os.path.exists('gevent') and not os.path.exists('setup.py'): + os.chdir('..') -def system(*args): - command = ' '.join(args) - popen_result = os.popen(command) - result = popen_result.read() - if result: - sys.stderr.write(result) - raise AssertionError('"%s" failed' % str(command)[:100]) - - -class Test(unittest.TestCase): - - def test_gevent(self): - import gevent - # E221 multiple spaces before operator - system(command % abspath(dirname(gevent.__file__)), '| grep -v E221') - - def test_tests(self): - # E702 multiple statements on one line (from gevent import monkey; monkey.patch_all()) - files = glob.glob(join(abspath(dirname(__file__)), '*.py')) - # filter out standard tests of form test_xxx.py (one underscore) - files = [filename for filename in files if stdtest_re.match(basename(filename)) is None] - system(command % (' '.join(files)), '| grep -v E702') - - # we keep the standard tests as close to the originals as possible, so don't test them - def X_test_std_tests(self): - # E702 multiple statements on one line (from gevent import monkey; monkey.patch_all()) - files = glob.glob(join(abspath(dirname(__file__)), '*.py')) - # only count standard tests of form test_xxx.py (one underscore) - files = [filename for filename in files if stdtest_re.match(basename(filename)) is not None] - system(command % (' '.join(files)), '| grep -v E702') - - def test_examples(self): - # E702 multiple statements on one line (from gevent import monkey; monkey.patch_all()) - # E202 whitespace before '(' - system(command % join(dirname(abspath(dirname(__file__))), 'examples'), '| grep -v E702 | grep -v E202') - - def test_doc(self): - system(command % join(dirname(abspath(dirname(__file__))), 'doc')) +commands = [ + 'pep8 --show-source --max-line-length=160 gevent/ setup.py', + 'pep8 --show-source --max-line-length=160 --ignore E702 examples/*.py', + 'pep8 --show-source --max-line-length=160 --ignore E702,E128 examples/webchat', + 'pep8 --show-source --max-line-length=160 doc/', + "pep8 --max-line-length=200 --exclude 'test_support.py,test_queue.py,lock_tests.py,patched_tests_setup.py,test_threading_2.py' --ignore E702 greentest/*.py", + 'pep8 --show-source --max-line-length=160 --ignore E203,E128,E124,E201 greentest/patched_tests_setup.py'] - def test_setup(self): - system(command % join(dirname(abspath(dirname(__file__))), 'setup.py')) +failures = 0 +for command in commands: + sys.stderr.write('+ %s\n' % command) + if os.system(command): + failures += 1 -if __name__ == '__main__': - unittest.main() +sys.exit(failures) diff -Nru python-gevent-0.13.7/greentest/xtest__server_close.py python-gevent-1.0/greentest/xtest__server_close.py --- python-gevent-0.13.7/greentest/xtest__server_close.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/greentest/xtest__server_close.py 2013-11-26 16:25:45.000000000 +0000 @@ -2,6 +2,7 @@ from gevent import socket import gevent import errno +import sys import os from test__server import SimpleStreamServer @@ -19,8 +20,9 @@ try: conn = self.makefile() raise AssertionError('Connection was not refused: %r' % (conn._sock, )) - except socket.error, ex: - if ex[0] != errno.ECONNREFUSED: + except socket.error: + ex = sys.exc_info()[1] + if ex.args[0] != errno.ECONNREFUSED: raise def assertRequestSucceeded(self): diff -Nru python-gevent-0.13.7/greentest/xtest_signal.py python-gevent-1.0/greentest/xtest_signal.py --- python-gevent-0.13.7/greentest/xtest_signal.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/xtest_signal.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,77 @@ +"""This is the extract from test_signal.py that runs forever until it fails. + +It reproduces the bug where SIGCHLD either not delivered or somehow lost and thus +if libev does not poll waitpid() periodically, popen.wait() blocks forever. + +The patch that fixes it: https://bitbucket.org/denis/gevent/changeset/adb8b5ac698c +Comment out the lines in ev.c that start the timer if you want to see for yourself. + +Reproduced on my machine (Linux 3.0.0-16-generic) with backend epoll and select. + +With signalfd enabled (GEVENT_BACKEND=signalfd) it seems to work. +""" +import gevent +from contextlib import closing +import gc +import pickle +from gevent import select +from gevent import subprocess +import traceback +import sys +import os + +gc.disable() + +MAX_DURATION = 10 + + +def run_test(): + child = subprocess.Popen(['/bin/true']) + child.wait() # << this is where it blocks + + +def test_main(): + # This function spawns a child process to insulate the main + # test-running process from all the signals. It then + # communicates with that child process over a pipe and + # re-raises information about any exceptions the child + # throws. The real work happens in self.run_test(). + os_done_r, os_done_w = os.pipe() + with closing(os.fdopen(os_done_r)) as done_r, closing(os.fdopen(os_done_w, 'w')) as done_w: + child = gevent.fork() + if not child: + # In the child process; run the test and report results + # through the pipe. + try: + done_r.close() + # Have to close done_w again here because + # exit_subprocess() will skip the enclosing with block. + with closing(done_w): + try: + run_test() + except: + pickle.dump(traceback.format_exc(), done_w) + else: + pickle.dump(None, done_w) + except: + print 'Uh oh, raised from pickle.' + traceback.print_exc() + finally: + os._exit(0) + + done_w.close() + # Block for up to MAX_DURATION seconds for the test to finish. + r, w, x = select.select([done_r], [], [], MAX_DURATION) + if done_r in r: + tb = pickle.load(done_r) + assert not tb, tb + else: + os.kill(child, 9) + assert False, 'Test deadlocked after %d seconds.' % MAX_DURATION + + +if __name__ == "__main__": + print gevent.get_hub() + while True: + test_main() + sys.stderr.write('.') diff -Nru python-gevent-0.13.7/greentest/xtest_stdlib.py python-gevent-1.0/greentest/xtest_stdlib.py --- python-gevent-0.13.7/greentest/xtest_stdlib.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/greentest/xtest_stdlib.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,5 @@ +import sys +import os + +if os.system("ack 'from test import (?!test_support)|from test\.(?!test_support)' 2.5 2.6 2.7") != 256: + sys.exit('FAILED: Some tests in stdlib were not updated to not reference "test".') diff -Nru python-gevent-0.13.7/known_failures.txt python-gevent-1.0/known_failures.txt --- python-gevent-0.13.7/known_failures.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/known_failures.txt 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,30 @@ +# This is a list of known failures (=bugs). + +# format: platform environ executable arguments +# A star ("*") can be used instead of platform, environ or executable (means "any"). + +* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns.py +* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns6.py + +# currently gevent.core.stat watcher does not implement 'prev' and 'attr' attributes on Windows +win32 * C:\Python27\python.exe -u test__core_stat.py + +# other Windows-related issues (need investigating) +win32 * C:\Python27\python.exe -u -m monkey_test test_threading.py +win32 * C:\Python27\python.exe -u -m monkey_test --Event test_threading.py +win32 * C:\Python27\python.exe -u -m monkey_test test_subprocess.py +win32 * C:\Python27\python.exe -u -m monkey_test --Event test_subprocess.py + +# these need investigating: +* * .*/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py +* * .*/python2.5(-dbg)? -u -m monkey_test test_urllib2net.py +* * .*/python2.5(-dbg)? -u test__threading_vs_settrace.py +* * .*/python2.5(-dbg)? -u test__example_portforwarder.py +* * .*/python2.5(-dbg)? -u test__socket_close.py + +# bunch of SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed +# seems to be Python/OpenSSL problem, not gevent's +* * * -u -m monkey_test --Event test_ssl.py +* * * -u -m monkey_test test_ssl.py + +* * /usr/bin/python2.[567]-dbg -u test__backdoor.py diff -Nru python-gevent-0.13.7/libev/Changes python-gevent-1.0/libev/Changes --- python-gevent-0.13.7/libev/Changes 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/Changes 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,464 @@ +Revision history for libev, a high-performance and full-featured event loop. + +TODO: ev_loop_wakeup +TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone) +TODO: faq, process a thing in each iteration +TODO: dbeugging tips, ev_verify, ev_init twice +TODO: ev_break for immediate exit (EVBREAK_NOW?) +TODO: ev_feed_child_event + +TODO: document the special problem of signals around fork. +TODO: store pid for each signal +TODO: document file descriptor usage per loop + - destroying a non-default loop would stop the global waitpid + watcher (Denis Bilenko). + - queueing pending watchers of higher priority from a watcher now invokes + them in a timely fashion (reported by Denis Bilenko). + - add throw() to all libev functions that cannot throw exceptions, for + further code size decrease when compiling for C++. + - add throw () to callbacks that must not throw exceptions (allocator, + syserr, loop acquire/release, periodic reschedule cbs). + - fix event_base_loop return code, add event_get_callback, event_base_new, + event_base_get_method calls to improve libevent 1.x emulation and add + some libevent 2.x functionality (based on a patch by Jeff Davey). + - add more memory fences to fix a bug reported by Jeff Davey. Better + be overfenced than underprotected. + - ev_run now returns a boolean status (true meaning watchers are + still active). + - ev_once: undef EV_ERROR in ev_kqueue.c, to avoid clashing with + libev's EV_ERROR (reported by 191919). + - (ecb) add memory fence support for xlC (Darin McBride). + - (ecb) add memory fence support for gcc-mips (Anton Kirilov). + - (ecb) add memory fence support for gcc-alpha (Christian Weisgerber). + - work around some kernels losing file descriptors by leaking + the kqueue descriptor in the child. + - include sys/syscall.h instead of plain syscall.h. + - check for io watcher loops in ev_verify, check for the most + common reported usage bug in ev_io_start. + - chose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET. + - always use WSASend/WSARecv directly on windows, hoping that this + works in all cases (unlike read/write/send/recv...). + - try to detect signals around a fork faster (test program by + Denis Bilenko). + - work around recent glibc versions that leak memory in realloc. + - rename ev::embed::set to ev::embed::set_embed to avoid clashing + the watcher base set (loop) method. + - rewrite the async/signal pipe logic to always keep a valid fd, which + simplifies (and hopefuly correctifies :) the race checking + on fork, at the cost of one extra fd. + +4.11 Sat Feb 4 19:52:39 CET 2012 + - INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as + was documented already, but not implemented in the repeating case. + - new compiletime symbols: EV_NO_SMP and EV_NO_THREADS. + - fix a race where the workaround against the epoll fork bugs + caused signals to not be handled anymore. + - correct backend_fudge for most backends, and implement a windows + specific workaround to avoid looping because we call both + select and Sleep, both with different time resolutions. + - document range and guarantees of ev_sleep. + - document reasonable ranges for periodics interval and offset. + - rename backend_fudge to backend_mintime to avoid future confusion :) + - change the default periodic reschedule function to hopefully be more + exact and correct even in corner cases or in the far future. + - do not rely on -lm anymore: use it when available but use our + own floor () if it is missing. This should make it easier to embed, + as no external libraries are required. + - strategically import macros from libecb and mark rarely-used functions + as cache-cold (saving almost 2k code size on typical amd64 setups). + - add Symbols.ev and Symbols.event files, that were missing. + - fix backend_mintime value for epoll (was 1/1024, is 1/1000 now). + - fix #3 "be smart about timeouts" to not "deadlock" when + timeout == now, also improve the section overall. + - avoid "AVOIDING FINISHING BEFORE RETURNING" idiom. + - support new EV_API_STATIC mode to make all libev symbols + static. + - supply default CFLAGS of -g -O3 with gcc when original CFLAGS + were empty. + +4.04 Wed Feb 16 09:01:51 CET 2011 + - fix two problems in the native win32 backend, where reuse of fd's + with different underlying handles caused handles not to be removed + or added to the select set (analyzed and tested by Bert Belder). + - do no rely on ceil() in ev_e?poll.c. + - backport libev to HP-UX versions before 11 v3. + - configure did not detect nanosleep and clock_gettime properly when + they are available in the libc (as opposed to -lrt). + +4.03 Tue Jan 11 14:37:25 CET 2011 + - officially support polling files with all backends. + - support files, /dev/zero etc. the same way as select in the epoll + backend, by generating events on our own. + - ports backend: work around solaris bug 6874410 and many related ones + (EINTR, maybe more), with no performance loss (note that the solaris + bug report is actually wrong, reality is far more bizarre and broken + than that). + - define EV_READ/EV_WRITE as macros in event.h, as some programs use + #ifdef to test for them. + - new (experimental) function: ev_feed_signal. + - new (to become default) EVFLAG_NOSIGMASK flag. + - new EVBACKEND_MASK symbol. + - updated COMMON IDIOMS SECTION. + +4.01 Fri Nov 5 21:51:29 CET 2010 + - automake fucked it up, apparently, --add-missing -f is not quite enough + to make it update its files, so 4.00 didn't install ev++.h and + event.h on make install. grrr. + - ev_loop(count|depth) didn't return anything (Robin Haberkorn). + - change EV_UNDEF to 0xffffffff to silence some overzealous compilers. + - use "(libev) " prefix for all libev error messages now. + +4.00 Mon Oct 25 12:32:12 CEST 2010 + - "PORTING FROM LIBEV 3.X TO 4.X" (in ev.pod) is recommended reading. + - ev_embed_stop did not correctly stop the watcher (very good + testcase by Vladimir Timofeev). + - ev_run will now always update the current loop time - it erroneously + didn't when idle watchers were active, causing timers not to fire. + - fix a bug where a timeout of zero caused the timer not to fire + in the libevent emulation (testcase by Péter Szabó). + - applied win32 fixes by Michael Lenaghan (also James Mansion). + - replace EV_MINIMAL by EV_FEATURES. + - prefer EPOLL_CTL_ADD over EPOLL_CTL_MOD in some more cases, as it + seems the former is *much* faster than the latter. + - linux kernel version detection (for inotify bug workarounds) + did not work properly. + - reduce the number of spurious wake-ups with the ports backend. + - remove dependency on sys/queue.h on freebsd (patch by Vanilla Hsu). + - do async init within ev_async_start, not ev_async_set, which avoids + an API quirk where the set function must be called in the C++ API + even when there is nothing to set. + - add (undocumented) EV_ENABLE when adding events with kqueue, + this might help with OS X, which seems to need it despite documenting + not to need it (helpfully pointed out by Tilghman Lesher). + - do not use poll by default on freebsd, it's broken (what isn't + on freebsd...). + - allow to embed epoll on kernels >= 2.6.32. + - configure now prepends -O3, not appends it, so one can still + override it. + - ev.pod: greatly expanded the portability section, added a porting + section, a description of watcher states and made lots of minor fixes. + - disable poll backend on AIX, the poll header spams the namespace + and it's not worth working around dead platforms (reported + and analyzed by Aivars Kalvans). + - improve header file compatibility of the standalone eventfd code + in an obscure case. + - implement EV_AVOID_STDIO option. + - do not use sscanf to parse linux version number (smaller, faster, + no sscanf dependency). + - new EV_CHILD_ENABLE and EV_SIGNAL_ENABLE configurable settings. + - update libev.m4 HAVE_CLOCK_SYSCALL test for newer glibcs. + - add section on accept() problems to the manpage. + - rename EV_TIMEOUT to EV_TIMER. + - rename ev_loop_count/depth/verify/loop/unloop. + - remove ev_default_destroy and ev_default_fork. + - switch to two-digit minor version. + - work around an apparent gentoo compiler bug. + - define _DARWIN_UNLIMITED_SELECT. just so. + - use enum instead of #define for most constants. + - improve compatibility to older C++ compilers. + - (experimental) ev_run/ev_default_loop/ev_break/ev_loop_new have now + default arguments when compiled as C++. + - enable automake dependency tracking. + - ev_loop_new no longer leaks memory when loop creation failed. + - new ev_cleanup watcher type. + +3.9 Thu Dec 31 07:59:59 CET 2009 + - signalfd is no longer used by default and has to be requested + explicitly - this means that easy to catch bugs become hard to + catch race conditions, but the users have spoken. + - point out the unspecified signal mask in the documentation, and + that this is a race condition regardless of EV_SIGNALFD. + - backport inotify code to C89. + - inotify file descriptors could leak into child processes. + - ev_stat watchers could keep an erroneous extra ref on the loop, + preventing exit when unregistering all watchers (testcases + provided by ry@tinyclouds.org). + - implement EV_WIN32_HANDLE_TO_FD and EV_WIN32_CLOSE_FD configuration + symbols to make it easier for apps to do their own fd management. + - support EV_IDLE_ENABLE being disabled in ev++.h + (patch by Didier Spezia). + - take advantage of inotify_init1, if available, to set cloexec/nonblock + on fd creation, to avoid races. + - the signal handling pipe wasn't always initialised under windows + (analysed by lekma). + - changed minimum glibc requirement from glibc 2.9 to 2.7, for + signalfd. + - add missing string.h include (Denis F. Latypoff). + - only replace ev_stat.prev when we detect an actual difference, + so prev is (almost) always different to attr. this might + have caused the problems with 04_stat.t. + - add ev::timer->remaining () method to C++ API. + +3.8 Sun Aug 9 14:30:45 CEST 2009 + - incompatible change: do not necessarily reset signal handler + to SIG_DFL when a sighandler is stopped. + - ev_default_destroy did not properly free or zero some members, + potentially causing crashes and memory corruption on repeated + ev_default_destroy/ev_default_loop calls. + - take advantage of signalfd on GNU/Linux systems. + - document that the signal mask might be in an unspecified + state when using libev's signal handling. + - take advantage of some GNU/Linux calls to set cloexec/nonblock + on fd creation, to avoid race conditions. + +3.7 Fri Jul 17 16:36:32 CEST 2009 + - ev_unloop and ev_loop wrongly used a global variable to exit loops, + instead of using a per-loop variable (bug caught by accident...). + - the ev_set_io_collect_interval interpretation has changed. + - add new functionality: ev_set_userdata, ev_userdata, + ev_set_invoke_pending_cb, ev_set_loop_release_cb, + ev_invoke_pending, ev_pending_count, together with a long example + about thread locking. + - add ev_timer_remaining (as requested by Denis F. Latypoff). + - add ev_loop_depth. + - calling ev_unloop in fork/prepare watchers will no longer poll + for new events. + - Denis F. Latypoff corrected many typos in example code snippets. + - honor autoconf detection of EV_USE_CLOCK_SYSCALL, also double- + check that the syscall number is available before trying to + use it (reported by ry@tinyclouds). + - use GetSystemTimeAsFileTime instead of _timeb on windows, for + slightly higher accuracy. + - properly declare ev_loop_verify and ev_now_update even when + !EV_MULTIPLICITY. + - do not compile in any priority code when EV_MAXPRI == EV_MINPRI. + - support EV_MINIMAL==2 for a reduced API. + - actually 0-initialise struct sigaction when installing signals. + - add section on hibernate and stopped processes to ev_timer docs. + +3.6 Tue Apr 28 02:49:30 CEST 2009 + - multiple timers becoming ready within an event loop iteration + will be invoked in the "correct" order now. + - do not leave the event loop early just because we have no active + watchers, fixing a problem when embedding a kqueue loop + that has active kernel events but no registered watchers + (reported by blacksand blacksand). + - correctly zero the idx values for arrays, so destroying and + reinitialising the default loop actually works (patch by + Malek Hadj-Ali). + - implement ev_suspend and ev_resume. + - new EV_CUSTOM revents flag for use by applications. + - add documentation section about priorities. + - add a glossary to the dcoumentation. + - extend the ev_fork description slightly. + - optimize a jump out of call_pending. + +3.53 Sun Feb 15 02:38:20 CET 2009 + - fix a bug in event pipe creation on win32 that would cause a + failed assertion on event loop creation (patch by Malek Hadj-Ali). + - probe for CLOCK_REALTIME support at runtime as well and fall + back to gettimeofday if there is an error, to support older + operating systems with newer header files/libraries. + - prefer gettimeofday over clock_gettime with USE_CLOCK_SYSCALL + (default most everywhere), otherwise not. + +3.52 Wed Jan 7 21:43:02 CET 2009 + - fix compilation of select backend in fd_set mode when NFDBITS is + missing (to get it to compile on QNX, reported by Rodrigo Campos). + - better select-nfds handling when select backend is in fd_set mode. + - diagnose fd_set overruns when select backend is in fd_set mode. + - due to a thinko, instead of disabling everything but + select on the borked OS X platform, everything but select was + allowed (reported by Emanuele Giaquinta). + - actually verify that local and remote port are matching in + libev's socketpair emulation, which makes denial-of-service + attacks harder (but not impossible - it's windows). Make sure + it even works under vista, which thinks that getpeer/sockname + should return fantasy port numbers. + - include "libev" in all assertion messages for potentially + clearer diagnostics. + - event_get_version (libevent compatibility) returned + a useless string instead of the expected version string + (patch by W.C.A. Wijngaards). + +3.51 Wed Dec 24 23:00:11 CET 2008 + - fix a bug where an inotify watcher was added twice, causing + freezes on hash collisions (reported and analysed by Graham Leggett). + - new config symbol, EV_USE_CLOCK_SYSCALL, to make libev use + a direct syscall - slower, but no dependency on librt et al. + - assume negative return values != -1 signals success of port_getn + (http://cvs.epicsol.org/cgi/viewcvs.cgi/epic5/source/newio.c?rev=1.52) + (no known failure reports, but it doesn't hurt). + - fork detection in ev_embed now stops and restarts the watcher + automatically. + - EXPERIMENTAL: default the method to operator () in ev++.h, + to make it nicer to use functors (requested by Benedek László). + - fixed const object callbacks in ev++.h. + - replaced loop_ref argument of watcher.set (loop) by a direct + ev_loop * in ev++.h, to avoid clashes with functor patch. + - do not try to watch the empty string via inotify. + - inotify watchers could be leaked under certain circumstances. + - OS X 10.5 is actually even more broken than earlier versions, + so fall back to select on that piece of garbage. + - fixed some weirdness in the ev_embed documentation. + +3.49 Wed Nov 19 11:26:53 CET 2008 + - ev_stat watchers will now use inotify as a mere hint on + kernels <2.6.25, or if the filesystem is not in the + "known to be good" list. + - better mingw32 compatibility (it's not as borked as native win32) + (analysed by Roger Pack). + - include stdio.h in the example program, as too many people are + confused by the weird C language otherwise. I guess the next thing + I get told is that the "..." ellipses in the examples don't compile + with their C compiler. + +3.48 Thu Oct 30 09:02:37 CET 2008 + - further optimise away the EPOLL_CTL_ADD/MOD combo in the epoll + backend by assuming the kernel event mask hasn't changed if + ADD fails with EEXIST. + - work around spurious event notification bugs in epoll by using + a 32-bit generation counter. recreate kernel state if we receive + spurious notifications or unwanted events. this is very costly, + but I didn't come up with this horrible design. + - use memset to initialise most arrays now and do away with the + init functions. + - expand time-out strategies into a "Be smart about timeouts" section. + - drop the "struct" from all ev_watcher declarations in the + documentation and did other clarifications (yeah, it was a mistake + to have a struct AND a function called ev_loop). + - fix a bug where ev_default would not initialise the default + loop again after it was destroyed with ev_default_destroy. + - rename syserr to ev_syserr to avoid name clashes when embedding, + do similar changes for event.c. + +3.45 Tue Oct 21 21:59:26 CEST 2008 + - disable inotify usage on linux <2.6.25, as it is broken + (reported by Yoann Vandoorselaere). + - ev_stat erroneously would try to add inotify watchers + even when inotify wasn't available (this should only + have a performance impact). + - ev_once now passes both timeout and io to the callback if both + occur concurrently, instead of giving timeouts precedence. + - disable EV_USE_INOTIFY when sys/inotify.h is too old. + +3.44 Mon Sep 29 05:18:39 CEST 2008 + - embed watchers now automatically invoke ev_loop_fork on the + embedded loop when the parent loop forks. + - new function: ev_now_update (loop). + - verify_watcher was not marked static. + - improve the "associating..." manpage section. + - documentation tweaks here and there. + +3.43 Sun Jul 6 05:34:41 CEST 2008 + - include more include files on windows to get struct _stati64 + (reported by Chris Hulbert, but doesn't quite fix his issue). + - add missing #include in ev.c on windows (reported by + Matt Tolton). + +3.42 Tue Jun 17 12:12:07 CEST 2008 + - work around yet another windows bug: FD_SET actually adds fd's + multiple times to the fd_*SET*, despite official MSN docs claiming + otherwise. Reported and well-analysed by Matt Tolton. + - define NFDBITS to 0 when EV_SELECT_IS_WINSOCKET to make it compile + (reported any analysed by Chris Hulbert). + - fix a bug in ev_ebadf (this function is only used to catch + programming errors in the libev user). reported by Matt Tolton. + - fix a bug in fd_intern on win32 (could lead to compile errors + under some circumstances, but would work correctly if it compiles). + reported by Matt Tolton. + - (try to) work around missing lstat on windows. + - pass in the write fd set as except fd set under windows. windows + is so uncontrollably lame that it requires this. this means that + switching off oobinline is not supported (but tcp/ip doesn't + have oob, so that would be stupid anyways. + - use posix module symbol to auto-detect monotonic clock presence + and some other default values. + +3.41 Fri May 23 18:42:54 CEST 2008 + - work around an obscure bug in winsocket select: if you + provide only empty fd sets then select returns WSAEINVAL. how sucky. + - improve timer scheduling stability and reduce use of time_epsilon. + - use 1-based 2-heap for EV_MINIMAL, simplifies code, reduces + codesize and makes for better cache-efficiency. + - use 3-based 4-heap for !EV_MINIMAL. this makes better use + of cpu cache lines and gives better growth behaviour than + 2-based heaps. + - cache timestamp within heap for !EV_MINIMAL, to avoid random + memory accesses. + - document/add EV_USE_4HEAP and EV_HEAP_CACHE_AT. + - fix a potential aliasing issue in ev_timer_again. + - add/document ev_periodic_at, retract direct access to ->at. + - improve ev_stat docs. + - add portability requirements section. + - fix manpage headers etc. + - normalise WSA error codes to lower range on windows. + - add consistency check code that can be called automatically + or on demand to check for internal structures (ev_loop_verify). + +3.31 Wed Apr 16 20:45:04 CEST 2008 + - added last minute fix for ev_poll.c by Brandon Black. + +3.3 Wed Apr 16 19:04:10 CEST 2008 + - event_base_loopexit should return 0 on success + (W.C.A. Wijngaards). + - added linux eventfd support. + - try to autodetect epoll and inotify support + by libc header version if not using autoconf. + - new symbols: EV_DEFAULT_UC and EV_DEFAULT_UC_. + - declare functions defined in ev.h as inline if + C99 or gcc are available. + - enable inlining with gcc versions 2 and 3. + - work around broken poll implementations potentially + not clearing revents field in ev_poll (Brandon Black) + (no such systems are known at this time). + - work around a bug in realloc on openbsd and darwin, + also makes the erroneous valgrind complaints + go away (noted by various people). + - fix ev_async_pending, add c++ wrapper for ev_async + (based on patch sent by Johannes Deisenhofer). + - add sensible set method to ev::embed. + - made integer constants type int in ev.h. + +3.2 Wed Apr 2 17:11:19 CEST 2008 + - fix a 64 bit overflow issue in the select backend, + by using fd_mask instead of int for the mask. + - rename internal sighandler to avoid clash with very old perls. + - entering ev_loop will not clear the ONESHOT or NONBLOCKING + flags of any outer loops anymore. + - add ev_async_pending. + +3.1 Thu Mar 13 13:45:22 CET 2008 + - implement ev_async watchers. + - only initialise signal pipe on demand. + - make use of sig_atomic_t configurable. + - improved documentation. + +3.0 Mon Jan 28 13:14:47 CET 2008 + - API/ABI bump to version 3.0. + - ev++.h includes "ev.h" by default now, not . + - slightly improved documentation. + - speed up signal detection after a fork. + - only optionally return trace status changed in ev_child + watchers. + - experimental (and undocumented) loop wrappers for ev++.h. + +2.01 Tue Dec 25 08:04:41 CET 2007 + - separate Changes file. + - fix ev_path_set => ev_stat_set typo. + - remove event_compat.h from the libev tarball. + - change how include files are found. + - doc updates. + - update licenses, explicitly allow for GPL relicensing. + +2.0 Sat Dec 22 17:47:03 CET 2007 + - new ev_sleep, ev_set_(io|timeout)_collect_interval. + - removed epoll from embeddable fd set. + - fix embed watchers. + - renamed ev_embed.loop to other. + - added exported Symbol tables. + - undefine member wrapper macros at the end of ev.c. + - respect EV_H in ev++.h. + +1.86 Tue Dec 18 02:36:57 CET 2007 + - fix memleak on loop destroy (not relevant for perl). + +1.85 Fri Dec 14 20:32:40 CET 2007 + - fix some aliasing issues w.r.t. timers and periodics + (not relevant for perl). + +(for historic versions refer to EV/Changes, found in the Perl interface) + +0.1 Wed Oct 31 21:31:48 CET 2007 + - original version; hacked together in <24h. + diff -Nru python-gevent-0.13.7/libev/config.guess python-gevent-1.0/libev/config.guess --- python-gevent-0.13.7/libev/config.guess 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/config.guess 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1526 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru python-gevent-0.13.7/libev/config.h.in python-gevent-1.0/libev/config.h.in --- python-gevent-0.13.7/libev/config.h.in 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/config.h.in 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,125 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 to use the syscall interface for clock_gettime */ +#undef HAVE_CLOCK_SYSCALL + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `epoll_ctl' function. */ +#undef HAVE_EPOLL_CTL + +/* Define to 1 if you have the `eventfd' function. */ +#undef HAVE_EVENTFD + +/* Define to 1 if the floor function is available */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `inotify_init' function. */ +#undef HAVE_INOTIFY_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + +/* Define to 1 if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `nanosleep' function. */ +#undef HAVE_NANOSLEEP + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the `port_create' function. */ +#undef HAVE_PORT_CREATE + +/* Define to 1 if you have the header file. */ +#undef HAVE_PORT_H + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the `signalfd' function. */ +#undef HAVE_SIGNALFD + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff -Nru python-gevent-0.13.7/libev/config.sub python-gevent-1.0/libev/config.sub --- python-gevent-0.13.7/libev/config.sub 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/config.sub 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,1658 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-16' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru python-gevent-0.13.7/libev/configure python-gevent-1.0/libev/configure --- python-gevent-0.13.7/libev/configure 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/configure 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,13056 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="ev_epoll.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +AR +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +enable_libtool_lock +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +am__api_version='1.11' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=libev + VERSION=4.11 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + ac_config_headers="$ac_config_headers config.h" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +if test -z "$orig_CFLAGS"; then + if test x$GCC = xyes; then + CFLAGS="-g -O3" + fi +fi + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.6b' +macro_revision='1.3017' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:4501: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:4504: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:4507: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 5713 "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7238: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7242: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7577: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7581: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7682: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7686: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7737: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7741: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(void) {} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10121 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10217 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + +for ac_header in sys/inotify.h sys/epoll.h sys/event.h port.h poll.h sys/select.h sys/eventfd.h sys/signalfd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in inotify_init epoll_ctl kqueue port_create poll select eventfd signalfd +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in clock_gettime +do : + ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME 1 +_ACEOF + +else + + if test $(uname) = Linux; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime syscall" >&5 +$as_echo_n "checking for clock_gettime syscall... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +struct timespec ts; int status = syscall (SYS_clock_gettime, CLOCK_REALTIME, &ts) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_have_clock_syscall=1 + +$as_echo "#define HAVE_CLOCK_SYSCALL 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test -z "$LIBEV_M4_AVOID_LIBRT" && test -z "$ac_have_clock_syscall"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRT 1 +_ACEOF + + LIBS="-lrt $LIBS" + +fi + + unset ac_cv_func_clock_gettime + for ac_func in clock_gettime +do : + ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME 1 +_ACEOF + +fi +done + + fi + +fi +done + + +for ac_func in nanosleep +do : + ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" +if test "x$ac_cv_func_nanosleep" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NANOSLEEP 1 +_ACEOF + +else + + if test -z "$LIBEV_M4_AVOID_LIBRT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nanosleep in -lrt" >&5 +$as_echo_n "checking for nanosleep in -lrt... " >&6; } +if test "${ac_cv_lib_rt_nanosleep+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char nanosleep (); +int +main () +{ +return nanosleep (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_nanosleep=yes +else + ac_cv_lib_rt_nanosleep=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_nanosleep" >&5 +$as_echo "$ac_cv_lib_rt_nanosleep" >&6; } +if test "x$ac_cv_lib_rt_nanosleep" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRT 1 +_ACEOF + + LIBS="-lrt $LIBS" + +fi + + unset ac_cv_func_nanosleep + for ac_func in nanosleep +do : + ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" +if test "x$ac_cv_func_nanosleep" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NANOSLEEP 1 +_ACEOF + +fi +done + + fi + +fi +done + + +if test -z "$LIBEV_M4_AVOID_LIBM"; then + LIBM=m +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing floor" >&5 +$as_echo_n "checking for library containing floor... " >&6; } +if test "${ac_cv_search_floor+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char floor (); +int +main () +{ +return floor (); + ; + return 0; +} +_ACEOF +for ac_lib in '' $LIBM; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_floor=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_floor+set}" = set; then : + break +fi +done +if test "${ac_cv_search_floor+set}" = set; then : + +else + ac_cv_search_floor=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_floor" >&5 +$as_echo "$ac_cv_search_floor" >&6; } +ac_res=$ac_cv_search_floor +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_FLOOR 1" >>confdefs.h + +fi + + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff -Nru python-gevent-0.13.7/libev/ev.c python-gevent-1.0/libev/ev.c --- python-gevent-0.13.7/libev/ev.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,4571 @@ +/* + * libev event processing core, watcher management + * + * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +/* this big block deduces configuration from config.h */ +#ifndef EV_STANDALONE +# ifdef EV_CONFIG_H +# include EV_CONFIG_H +# else +# include "config.h" +# endif + +#if HAVE_FLOOR +# ifndef EV_USE_FLOOR +# define EV_USE_FLOOR 1 +# endif +#endif + +# if HAVE_CLOCK_SYSCALL +# ifndef EV_USE_CLOCK_SYSCALL +# define EV_USE_CLOCK_SYSCALL 1 +# ifndef EV_USE_REALTIME +# define EV_USE_REALTIME 0 +# endif +# ifndef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 1 +# endif +# endif +# elif !defined EV_USE_CLOCK_SYSCALL +# define EV_USE_CLOCK_SYSCALL 0 +# endif + +# if HAVE_CLOCK_GETTIME +# ifndef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 1 +# endif +# ifndef EV_USE_REALTIME +# define EV_USE_REALTIME 0 +# endif +# else +# ifndef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 0 +# endif +# ifndef EV_USE_REALTIME +# define EV_USE_REALTIME 0 +# endif +# endif + +# if HAVE_NANOSLEEP +# ifndef EV_USE_NANOSLEEP +# define EV_USE_NANOSLEEP EV_FEATURE_OS +# endif +# else +# undef EV_USE_NANOSLEEP +# define EV_USE_NANOSLEEP 0 +# endif + +# if HAVE_SELECT && HAVE_SYS_SELECT_H +# ifndef EV_USE_SELECT +# define EV_USE_SELECT EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_SELECT +# define EV_USE_SELECT 0 +# endif + +# if HAVE_POLL && HAVE_POLL_H +# ifndef EV_USE_POLL +# define EV_USE_POLL EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_POLL +# define EV_USE_POLL 0 +# endif + +# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H +# ifndef EV_USE_EPOLL +# define EV_USE_EPOLL EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_EPOLL +# define EV_USE_EPOLL 0 +# endif + +# if HAVE_KQUEUE && HAVE_SYS_EVENT_H +# ifndef EV_USE_KQUEUE +# define EV_USE_KQUEUE EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_KQUEUE +# define EV_USE_KQUEUE 0 +# endif + +# if HAVE_PORT_H && HAVE_PORT_CREATE +# ifndef EV_USE_PORT +# define EV_USE_PORT EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_PORT +# define EV_USE_PORT 0 +# endif + +# if HAVE_INOTIFY_INIT && HAVE_SYS_INOTIFY_H +# ifndef EV_USE_INOTIFY +# define EV_USE_INOTIFY EV_FEATURE_OS +# endif +# else +# undef EV_USE_INOTIFY +# define EV_USE_INOTIFY 0 +# endif + +# if HAVE_SIGNALFD && HAVE_SYS_SIGNALFD_H +# ifndef EV_USE_SIGNALFD +# define EV_USE_SIGNALFD EV_FEATURE_OS +# endif +# else +# undef EV_USE_SIGNALFD +# define EV_USE_SIGNALFD 0 +# endif + +# if HAVE_EVENTFD +# ifndef EV_USE_EVENTFD +# define EV_USE_EVENTFD EV_FEATURE_OS +# endif +# else +# undef EV_USE_EVENTFD +# define EV_USE_EVENTFD 0 +# endif + +#endif + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#ifdef EV_H +# include EV_H +#else +# include "ev.h" +#endif + +#if EV_NO_THREADS +# undef EV_NO_SMP +# define EV_NO_SMP 1 +# undef ECB_NO_THREADS +# define ECB_NO_THREADS 1 +#endif +#if EV_NO_SMP +# undef EV_NO_SMP +# define ECB_NO_SMP 1 +#endif + +#ifndef _WIN32 +# include +# include +# include +#else +# include +# define WIN32_LEAN_AND_MEAN +# include +# include +# ifndef EV_SELECT_IS_WINSOCKET +# define EV_SELECT_IS_WINSOCKET 1 +# endif +# undef EV_AVOID_STDIO +#endif + +/* OS X, in its infinite idiocy, actually HARDCODES + * a limit of 1024 into their select. Where people have brains, + * OS X engineers apparently have a vacuum. Or maybe they were + * ordered to have a vacuum, or they do anything for money. + * This might help. Or not. + */ +#define _DARWIN_UNLIMITED_SELECT 1 + +/* this block tries to deduce configuration from header-defined symbols and defaults */ + +/* try to deduce the maximum number of signals on this platform */ +#if defined EV_NSIG +/* use what's provided */ +#elif defined NSIG +# define EV_NSIG (NSIG) +#elif defined _NSIG +# define EV_NSIG (_NSIG) +#elif defined SIGMAX +# define EV_NSIG (SIGMAX+1) +#elif defined SIG_MAX +# define EV_NSIG (SIG_MAX+1) +#elif defined _SIG_MAX +# define EV_NSIG (_SIG_MAX+1) +#elif defined MAXSIG +# define EV_NSIG (MAXSIG+1) +#elif defined MAX_SIG +# define EV_NSIG (MAX_SIG+1) +#elif defined SIGARRAYSIZE +# define EV_NSIG (SIGARRAYSIZE) /* Assume ary[SIGARRAYSIZE] */ +#elif defined _sys_nsig +# define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ +#else +# error "unable to find value for NSIG, please report" +/* to make it compile regardless, just remove the above line, */ +/* but consider reporting it, too! :) */ +# define EV_NSIG 65 +#endif + +#ifndef EV_USE_FLOOR +# define EV_USE_FLOOR 0 +#endif + +#ifndef EV_USE_CLOCK_SYSCALL +# if __linux && __GLIBC__ >= 2 +# define EV_USE_CLOCK_SYSCALL EV_FEATURE_OS +# else +# define EV_USE_CLOCK_SYSCALL 0 +# endif +#endif + +#ifndef EV_USE_MONOTONIC +# if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0 +# define EV_USE_MONOTONIC EV_FEATURE_OS +# else +# define EV_USE_MONOTONIC 0 +# endif +#endif + +#ifndef EV_USE_REALTIME +# define EV_USE_REALTIME !EV_USE_CLOCK_SYSCALL +#endif + +#ifndef EV_USE_NANOSLEEP +# if _POSIX_C_SOURCE >= 199309L +# define EV_USE_NANOSLEEP EV_FEATURE_OS +# else +# define EV_USE_NANOSLEEP 0 +# endif +#endif + +#ifndef EV_USE_SELECT +# define EV_USE_SELECT EV_FEATURE_BACKENDS +#endif + +#ifndef EV_USE_POLL +# ifdef _WIN32 +# define EV_USE_POLL 0 +# else +# define EV_USE_POLL EV_FEATURE_BACKENDS +# endif +#endif + +#ifndef EV_USE_EPOLL +# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4)) +# define EV_USE_EPOLL EV_FEATURE_BACKENDS +# else +# define EV_USE_EPOLL 0 +# endif +#endif + +#ifndef EV_USE_KQUEUE +# define EV_USE_KQUEUE 0 +#endif + +#ifndef EV_USE_PORT +# define EV_USE_PORT 0 +#endif + +#ifndef EV_USE_INOTIFY +# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4)) +# define EV_USE_INOTIFY EV_FEATURE_OS +# else +# define EV_USE_INOTIFY 0 +# endif +#endif + +#ifndef EV_PID_HASHSIZE +# define EV_PID_HASHSIZE EV_FEATURE_DATA ? 16 : 1 +#endif + +#ifndef EV_INOTIFY_HASHSIZE +# define EV_INOTIFY_HASHSIZE EV_FEATURE_DATA ? 16 : 1 +#endif + +#ifndef EV_USE_EVENTFD +# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) +# define EV_USE_EVENTFD EV_FEATURE_OS +# else +# define EV_USE_EVENTFD 0 +# endif +#endif + +#ifndef EV_USE_SIGNALFD +# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) +# define EV_USE_SIGNALFD EV_FEATURE_OS +# else +# define EV_USE_SIGNALFD 0 +# endif +#endif + +#if 0 /* debugging */ +# define EV_VERIFY 3 +# define EV_USE_4HEAP 1 +# define EV_HEAP_CACHE_AT 1 +#endif + +#ifndef EV_VERIFY +# define EV_VERIFY (EV_FEATURE_API ? 1 : 0) +#endif + +#ifndef EV_USE_4HEAP +# define EV_USE_4HEAP EV_FEATURE_DATA +#endif + +#ifndef EV_HEAP_CACHE_AT +# define EV_HEAP_CACHE_AT EV_FEATURE_DATA +#endif + +/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ +/* which makes programs even slower. might work on other unices, too. */ +#if EV_USE_CLOCK_SYSCALL +# include +# ifdef SYS_clock_gettime +# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts)) +# undef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 1 +# else +# undef EV_USE_CLOCK_SYSCALL +# define EV_USE_CLOCK_SYSCALL 0 +# endif +#endif + +/* this block fixes any misconfiguration where we know we run into trouble otherwise */ + +#ifdef _AIX +/* AIX has a completely broken poll.h header */ +# undef EV_USE_POLL +# define EV_USE_POLL 0 +#endif + +#ifndef CLOCK_MONOTONIC +# undef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 0 +#endif + +#ifndef CLOCK_REALTIME +# undef EV_USE_REALTIME +# define EV_USE_REALTIME 0 +#endif + +#if !EV_STAT_ENABLE +# undef EV_USE_INOTIFY +# define EV_USE_INOTIFY 0 +#endif + +#if !EV_USE_NANOSLEEP +/* hp-ux has it in sys/time.h, which we unconditionally include above */ +# if !defined _WIN32 && !defined __hpux +# include +# endif +#endif + +#if EV_USE_INOTIFY +# include +# include +/* some very old inotify.h headers don't have IN_DONT_FOLLOW */ +# ifndef IN_DONT_FOLLOW +# undef EV_USE_INOTIFY +# define EV_USE_INOTIFY 0 +# endif +#endif + +#if EV_USE_EVENTFD +/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ +# include +# ifndef EFD_NONBLOCK +# define EFD_NONBLOCK O_NONBLOCK +# endif +# ifndef EFD_CLOEXEC +# ifdef O_CLOEXEC +# define EFD_CLOEXEC O_CLOEXEC +# else +# define EFD_CLOEXEC 02000000 +# endif +# endif +EV_CPP(extern "C") int (eventfd) (unsigned int initval, int flags); +#endif + +#if EV_USE_SIGNALFD +/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ +# include +# ifndef SFD_NONBLOCK +# define SFD_NONBLOCK O_NONBLOCK +# endif +# ifndef SFD_CLOEXEC +# ifdef O_CLOEXEC +# define SFD_CLOEXEC O_CLOEXEC +# else +# define SFD_CLOEXEC 02000000 +# endif +# endif +EV_CPP (extern "C") int signalfd (int fd, const sigset_t *mask, int flags); + +struct signalfd_siginfo +{ + uint32_t ssi_signo; + char pad[128 - sizeof (uint32_t)]; +}; +#endif + +/**/ + +#if EV_VERIFY >= 3 +# define EV_FREQUENT_CHECK ev_verify (EV_A) +#else +# define EV_FREQUENT_CHECK do { } while (0) +#endif + +/* + * This is used to work around floating point rounding problems. + * This value is good at least till the year 4000. + */ +#define MIN_INTERVAL 0.0001220703125 /* 1/2**13, good till 4000 */ +/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */ + +#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */ +#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */ + +#define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0) +#define EV_TS_SET(ts,t) do { ts.tv_sec = (long)t; ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); } while (0) + +/* the following is ecb.h embedded into libev - use update_ev_c to update from an external copy */ +/* ECB.H BEGIN */ +/* + * libecb - http://software.schmorp.de/pkg/libecb + * + * Copyright (©) 2009-2012 Marc Alexander Lehmann + * Copyright (©) 2011 Emanuele Giaquinta + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ECB_H +#define ECB_H + +/* 16 bits major, 16 bits minor */ +#define ECB_VERSION 0x00010001 + +#ifdef _WIN32 + typedef signed char int8_t; + typedef unsigned char uint8_t; + typedef signed short int16_t; + typedef unsigned short uint16_t; + typedef signed int int32_t; + typedef unsigned int uint32_t; + #if __GNUC__ + typedef signed long long int64_t; + typedef unsigned long long uint64_t; + #else /* _MSC_VER || __BORLANDC__ */ + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #endif + #ifdef _WIN64 + #define ECB_PTRSIZE 8 + typedef uint64_t uintptr_t; + typedef int64_t intptr_t; + #else + #define ECB_PTRSIZE 4 + typedef uint32_t uintptr_t; + typedef int32_t intptr_t; + #endif + typedef intptr_t ptrdiff_t; +#else + #include + #if UINTMAX_MAX > 0xffffffffU + #define ECB_PTRSIZE 8 + #else + #define ECB_PTRSIZE 4 + #endif +#endif + +/* many compilers define _GNUC_ to some versions but then only implement + * what their idiot authors think are the "more important" extensions, + * causing enormous grief in return for some better fake benchmark numbers. + * or so. + * we try to detect these and simply assume they are not gcc - if they have + * an issue with that they should have done it right in the first place. + */ +#ifndef ECB_GCC_VERSION + #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__ + #define ECB_GCC_VERSION(major,minor) 0 + #else + #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) + #endif +#endif + +#define ECB_C (__STDC__+0) /* this assumes that __STDC__ is either empty or a number */ +#define ECB_C99 (__STDC_VERSION__ >= 199901L) +#define ECB_C11 (__STDC_VERSION__ >= 201112L) +#define ECB_CPP (__cplusplus+0) +#define ECB_CPP11 (__cplusplus >= 201103L) + +/*****************************************************************************/ + +/* ECB_NO_THREADS - ecb is not used by multiple threads, ever */ +/* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */ + +#if ECB_NO_THREADS + #define ECB_NO_SMP 1 +#endif + +#if ECB_NO_SMP + #define ECB_MEMORY_FENCE do { } while (0) +#endif + +#ifndef ECB_MEMORY_FENCE + #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 + #if __i386 || __i386__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") + #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") + #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") + #elif __amd64 || __amd64__ || __x86_64 || __x86_64__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") + #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") + #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") + #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") + #elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ \ + || defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6ZK__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory") + #elif defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ \ + || defined __ARM_ARCH_7M__ || defined __ARM_ARCH_7R__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") + #elif __sparc || __sparc__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory") + #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") + #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") + #elif defined __s390__ || defined __s390x__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") + #elif defined __mips__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") + #elif defined __alpha__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mb" : : : "memory") + #elif defined __hppa__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("" : : : "memory") + #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") + #elif defined __ia64__ + #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mf" : : : "memory") + #endif + #endif +#endif + +#ifndef ECB_MEMORY_FENCE + #if ECB_GCC_VERSION(4,7) + /* see comment below (stdatomic.h) about the C11 memory model. */ + #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST) + #elif defined __clang && __has_feature (cxx_atomic) + /* see comment below (stdatomic.h) about the C11 memory model. */ + #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST) + #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__ + #define ECB_MEMORY_FENCE __sync_synchronize () + #elif _MSC_VER >= 1400 /* VC++ 2005 */ + #pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier) + #define ECB_MEMORY_FENCE _ReadWriteBarrier () + #define ECB_MEMORY_FENCE_ACQUIRE _ReadWriteBarrier () /* according to msdn, _ReadBarrier is not a load fence */ + #define ECB_MEMORY_FENCE_RELEASE _WriteBarrier () + #elif defined _WIN32 + #include + #define ECB_MEMORY_FENCE MemoryBarrier () /* actually just xchg on x86... scary */ + #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 + #include + #define ECB_MEMORY_FENCE __machine_rw_barrier () + #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier () + #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier () + #elif __xlC__ + #define ECB_MEMORY_FENCE __sync () + #endif +#endif + +#ifndef ECB_MEMORY_FENCE + #if ECB_C11 && !defined __STDC_NO_ATOMICS__ + /* we assume that these memory fences work on all variables/all memory accesses, */ + /* not just C11 atomics and atomic accesses */ + #include + /* Unfortunately, neither gcc 4.7 nor clang 3.1 generate any instructions for */ + /* any fence other than seq_cst, which isn't very efficient for us. */ + /* Why that is, we don't know - either the C11 memory model is quite useless */ + /* for most usages, or gcc and clang have a bug */ + /* I *currently* lean towards the latter, and inefficiently implement */ + /* all three of ecb's fences as a seq_cst fence */ + #define ECB_MEMORY_FENCE atomic_thread_fence (memory_order_seq_cst) + #endif +#endif + +#ifndef ECB_MEMORY_FENCE + #if !ECB_AVOID_PTHREADS + /* + * if you get undefined symbol references to pthread_mutex_lock, + * or failure to find pthread.h, then you should implement + * the ECB_MEMORY_FENCE operations for your cpu/compiler + * OR provide pthread.h and link against the posix thread library + * of your system. + */ + #include + #define ECB_NEEDS_PTHREADS 1 + #define ECB_MEMORY_FENCE_NEEDS_PTHREADS 1 + + static pthread_mutex_t ecb_mf_lock = PTHREAD_MUTEX_INITIALIZER; + #define ECB_MEMORY_FENCE do { pthread_mutex_lock (&ecb_mf_lock); pthread_mutex_unlock (&ecb_mf_lock); } while (0) + #endif +#endif + +#if !defined ECB_MEMORY_FENCE_ACQUIRE && defined ECB_MEMORY_FENCE + #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE +#endif + +#if !defined ECB_MEMORY_FENCE_RELEASE && defined ECB_MEMORY_FENCE + #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE +#endif + +/*****************************************************************************/ + +#if __cplusplus + #define ecb_inline static inline +#elif ECB_GCC_VERSION(2,5) + #define ecb_inline static __inline__ +#elif ECB_C99 + #define ecb_inline static inline +#else + #define ecb_inline static +#endif + +#if ECB_GCC_VERSION(3,3) + #define ecb_restrict __restrict__ +#elif ECB_C99 + #define ecb_restrict restrict +#else + #define ecb_restrict +#endif + +typedef int ecb_bool; + +#define ECB_CONCAT_(a, b) a ## b +#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) +#define ECB_STRINGIFY_(a) # a +#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) + +#define ecb_function_ ecb_inline + +#if ECB_GCC_VERSION(3,1) + #define ecb_attribute(attrlist) __attribute__(attrlist) + #define ecb_is_constant(expr) __builtin_constant_p (expr) + #define ecb_expect(expr,value) __builtin_expect ((expr),(value)) + #define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality) +#else + #define ecb_attribute(attrlist) + #define ecb_is_constant(expr) 0 + #define ecb_expect(expr,value) (expr) + #define ecb_prefetch(addr,rw,locality) +#endif + +/* no emulation for ecb_decltype */ +#if ECB_GCC_VERSION(4,5) + #define ecb_decltype(x) __decltype(x) +#elif ECB_GCC_VERSION(3,0) + #define ecb_decltype(x) __typeof(x) +#endif + +#define ecb_noinline ecb_attribute ((__noinline__)) +#define ecb_unused ecb_attribute ((__unused__)) +#define ecb_const ecb_attribute ((__const__)) +#define ecb_pure ecb_attribute ((__pure__)) + +#if ECB_C11 + #define ecb_noreturn _Noreturn +#else + #define ecb_noreturn ecb_attribute ((__noreturn__)) +#endif + +#if ECB_GCC_VERSION(4,3) + #define ecb_artificial ecb_attribute ((__artificial__)) + #define ecb_hot ecb_attribute ((__hot__)) + #define ecb_cold ecb_attribute ((__cold__)) +#else + #define ecb_artificial + #define ecb_hot + #define ecb_cold +#endif + +/* put around conditional expressions if you are very sure that the */ +/* expression is mostly true or mostly false. note that these return */ +/* booleans, not the expression. */ +#define ecb_expect_false(expr) ecb_expect (!!(expr), 0) +#define ecb_expect_true(expr) ecb_expect (!!(expr), 1) +/* for compatibility to the rest of the world */ +#define ecb_likely(expr) ecb_expect_true (expr) +#define ecb_unlikely(expr) ecb_expect_false (expr) + +/* count trailing zero bits and count # of one bits */ +#if ECB_GCC_VERSION(3,4) + /* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */ + #define ecb_ld32(x) (__builtin_clz (x) ^ 31) + #define ecb_ld64(x) (__builtin_clzll (x) ^ 63) + #define ecb_ctz32(x) __builtin_ctz (x) + #define ecb_ctz64(x) __builtin_ctzll (x) + #define ecb_popcount32(x) __builtin_popcount (x) + /* no popcountll */ +#else + ecb_function_ int ecb_ctz32 (uint32_t x) ecb_const; + ecb_function_ int + ecb_ctz32 (uint32_t x) + { + int r = 0; + + x &= ~x + 1; /* this isolates the lowest bit */ + +#if ECB_branchless_on_i386 + r += !!(x & 0xaaaaaaaa) << 0; + r += !!(x & 0xcccccccc) << 1; + r += !!(x & 0xf0f0f0f0) << 2; + r += !!(x & 0xff00ff00) << 3; + r += !!(x & 0xffff0000) << 4; +#else + if (x & 0xaaaaaaaa) r += 1; + if (x & 0xcccccccc) r += 2; + if (x & 0xf0f0f0f0) r += 4; + if (x & 0xff00ff00) r += 8; + if (x & 0xffff0000) r += 16; +#endif + + return r; + } + + ecb_function_ int ecb_ctz64 (uint64_t x) ecb_const; + ecb_function_ int + ecb_ctz64 (uint64_t x) + { + int shift = x & 0xffffffffU ? 0 : 32; + return ecb_ctz32 (x >> shift) + shift; + } + + ecb_function_ int ecb_popcount32 (uint32_t x) ecb_const; + ecb_function_ int + ecb_popcount32 (uint32_t x) + { + x -= (x >> 1) & 0x55555555; + x = ((x >> 2) & 0x33333333) + (x & 0x33333333); + x = ((x >> 4) + x) & 0x0f0f0f0f; + x *= 0x01010101; + + return x >> 24; + } + + ecb_function_ int ecb_ld32 (uint32_t x) ecb_const; + ecb_function_ int ecb_ld32 (uint32_t x) + { + int r = 0; + + if (x >> 16) { x >>= 16; r += 16; } + if (x >> 8) { x >>= 8; r += 8; } + if (x >> 4) { x >>= 4; r += 4; } + if (x >> 2) { x >>= 2; r += 2; } + if (x >> 1) { r += 1; } + + return r; + } + + ecb_function_ int ecb_ld64 (uint64_t x) ecb_const; + ecb_function_ int ecb_ld64 (uint64_t x) + { + int r = 0; + + if (x >> 32) { x >>= 32; r += 32; } + + return r + ecb_ld32 (x); + } +#endif + +ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) ecb_const; +ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); } +ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) ecb_const; +ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); } + +ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) ecb_const; +ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) +{ + return ( (x * 0x0802U & 0x22110U) + | (x * 0x8020U & 0x88440U)) * 0x10101U >> 16; +} + +ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) ecb_const; +ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) +{ + x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1); + x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2); + x = ((x >> 4) & 0x0f0f) | ((x & 0x0f0f) << 4); + x = ( x >> 8 ) | ( x << 8); + + return x; +} + +ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) ecb_const; +ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) +{ + x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1); + x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2); + x = ((x >> 4) & 0x0f0f0f0f) | ((x & 0x0f0f0f0f) << 4); + x = ((x >> 8) & 0x00ff00ff) | ((x & 0x00ff00ff) << 8); + x = ( x >> 16 ) | ( x << 16); + + return x; +} + +/* popcount64 is only available on 64 bit cpus as gcc builtin */ +/* so for this version we are lazy */ +ecb_function_ int ecb_popcount64 (uint64_t x) ecb_const; +ecb_function_ int +ecb_popcount64 (uint64_t x) +{ + return ecb_popcount32 (x) + ecb_popcount32 (x >> 32); +} + +ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) ecb_const; +ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) ecb_const; +ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) ecb_const; +ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) ecb_const; +ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const; +ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const; +ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) ecb_const; +ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) ecb_const; + +ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); } +ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); } +ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); } +ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); } +ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); } +ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); } +ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); } +ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); } + +#if ECB_GCC_VERSION(4,3) + #define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16) + #define ecb_bswap32(x) __builtin_bswap32 (x) + #define ecb_bswap64(x) __builtin_bswap64 (x) +#else + ecb_function_ uint16_t ecb_bswap16 (uint16_t x) ecb_const; + ecb_function_ uint16_t + ecb_bswap16 (uint16_t x) + { + return ecb_rotl16 (x, 8); + } + + ecb_function_ uint32_t ecb_bswap32 (uint32_t x) ecb_const; + ecb_function_ uint32_t + ecb_bswap32 (uint32_t x) + { + return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16); + } + + ecb_function_ uint64_t ecb_bswap64 (uint64_t x) ecb_const; + ecb_function_ uint64_t + ecb_bswap64 (uint64_t x) + { + return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32); + } +#endif + +#if ECB_GCC_VERSION(4,5) + #define ecb_unreachable() __builtin_unreachable () +#else + /* this seems to work fine, but gcc always emits a warning for it :/ */ + ecb_inline void ecb_unreachable (void) ecb_noreturn; + ecb_inline void ecb_unreachable (void) { } +#endif + +/* try to tell the compiler that some condition is definitely true */ +#define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) + +ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; +ecb_inline unsigned char +ecb_byteorder_helper (void) +{ + const uint32_t u = 0x11223344; + return *(unsigned char *)&u; +} + +ecb_inline ecb_bool ecb_big_endian (void) ecb_const; +ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } +ecb_inline ecb_bool ecb_little_endian (void) ecb_const; +ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } + +#if ECB_GCC_VERSION(3,0) || ECB_C99 + #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) +#else + #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n))) +#endif + +#if __cplusplus + template + static inline T ecb_div_rd (T val, T div) + { + return val < 0 ? - ((-val + div - 1) / div) : (val ) / div; + } + template + static inline T ecb_div_ru (T val, T div) + { + return val < 0 ? - ((-val ) / div) : (val + div - 1) / div; + } +#else + #define ecb_div_rd(val,div) ((val) < 0 ? - ((-(val) + (div) - 1) / (div)) : ((val) ) / (div)) + #define ecb_div_ru(val,div) ((val) < 0 ? - ((-(val) ) / (div)) : ((val) + (div) - 1) / (div)) +#endif + +#if ecb_cplusplus_does_not_suck + /* does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm) */ + template + static inline int ecb_array_length (const T (&arr)[N]) + { + return N; + } +#else + #define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) +#endif + +#endif + +/* ECB.H END */ + +#if ECB_MEMORY_FENCE_NEEDS_PTHREADS +/* if your architecture doesn't need memory fences, e.g. because it is + * single-cpu/core, or if you use libev in a project that doesn't use libev + * from multiple threads, then you can define ECB_AVOID_PTHREADS when compiling + * libev, in which cases the memory fences become nops. + * alternatively, you can remove this #error and link against libpthread, + * which will then provide the memory fences. + */ +# error "memory fences not defined for your architecture, please report" +#endif + +#ifndef ECB_MEMORY_FENCE +# define ECB_MEMORY_FENCE do { } while (0) +# define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE +# define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE +#endif + +#define expect_false(cond) ecb_expect_false (cond) +#define expect_true(cond) ecb_expect_true (cond) +#define noinline ecb_noinline + +#define inline_size ecb_inline + +#if EV_FEATURE_CODE +# define inline_speed ecb_inline +#else +# define inline_speed static noinline +#endif + +#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) + +#if EV_MINPRI == EV_MAXPRI +# define ABSPRI(w) (((W)w), 0) +#else +# define ABSPRI(w) (((W)w)->priority - EV_MINPRI) +#endif + +#define EMPTY /* required for microsofts broken pseudo-c compiler */ +#define EMPTY2(a,b) /* used to suppress some warnings */ + +typedef ev_watcher *W; +typedef ev_watcher_list *WL; +typedef ev_watcher_time *WT; + +#define ev_active(w) ((W)(w))->active +#define ev_at(w) ((WT)(w))->at + +#if EV_USE_REALTIME +/* sig_atomic_t is used to avoid per-thread variables or locking but still */ +/* giving it a reasonably high chance of working on typical architectures */ +static EV_ATOMIC_T have_realtime; /* did clock_gettime (CLOCK_REALTIME) work? */ +#endif + +#if EV_USE_MONOTONIC +static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ +#endif + +#ifndef EV_FD_TO_WIN32_HANDLE +# define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd) +#endif +#ifndef EV_WIN32_HANDLE_TO_FD +# define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (handle, 0) +#endif +#ifndef EV_WIN32_CLOSE_FD +# define EV_WIN32_CLOSE_FD(fd) close (fd) +#endif + +#ifdef _WIN32 +# include "ev_win32.c" +#endif + +/*****************************************************************************/ + +/* define a suitable floor function (only used by periodics atm) */ + +#if EV_USE_FLOOR +# include +# define ev_floor(v) floor (v) +#else + +#include + +/* a floor() replacement function, should be independent of ev_tstamp type */ +static ev_tstamp noinline +ev_floor (ev_tstamp v) +{ + /* the choice of shift factor is not terribly important */ +#if FLT_RADIX != 2 /* assume FLT_RADIX == 10 */ + const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 10000000000000000000. : 1000000000.; +#else + const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 18446744073709551616. : 4294967296.; +#endif + + /* argument too large for an unsigned long? */ + if (expect_false (v >= shift)) + { + ev_tstamp f; + + if (v == v - 1.) + return v; /* very large number */ + + f = shift * ev_floor (v * (1. / shift)); + return f + ev_floor (v - f); + } + + /* special treatment for negative args? */ + if (expect_false (v < 0.)) + { + ev_tstamp f = -ev_floor (-v); + + return f - (f == v ? 0 : 1); + } + + /* fits into an unsigned long */ + return (unsigned long)v; +} + +#endif + +/*****************************************************************************/ + +#ifdef __linux +# include +#endif + +static unsigned int noinline ecb_cold +ev_linux_version (void) +{ +#ifdef __linux + unsigned int v = 0; + struct utsname buf; + int i; + char *p = buf.release; + + if (uname (&buf)) + return 0; + + for (i = 3+1; --i; ) + { + unsigned int c = 0; + + for (;;) + { + if (*p >= '0' && *p <= '9') + c = c * 10 + *p++ - '0'; + else + { + p += *p == '.'; + break; + } + } + + v = (v << 8) | c; + } + + return v; +#else + return 0; +#endif +} + +/*****************************************************************************/ + +#if EV_AVOID_STDIO +static void noinline ecb_cold +ev_printerr (const char *msg) +{ + write (STDERR_FILENO, msg, strlen (msg)); +} +#endif + +static void (*syserr_cb)(const char *msg) EV_THROW; + +void ecb_cold +ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW +{ + syserr_cb = cb; +} + +static void noinline ecb_cold +ev_syserr (const char *msg) +{ + if (!msg) + msg = "(libev) system error"; + + if (syserr_cb) + syserr_cb (msg); + else + { +#if EV_AVOID_STDIO + ev_printerr (msg); + ev_printerr (": "); + ev_printerr (strerror (errno)); + ev_printerr ("\n"); +#else + perror (msg); +#endif + abort (); + } +} + +static void * +ev_realloc_emul (void *ptr, long size) EV_THROW +{ + /* some systems, notably openbsd and darwin, fail to properly + * implement realloc (x, 0) (as required by both ansi c-89 and + * the single unix specification, so work around them here. + * recently, also (at least) fedora and debian started breaking it, + * despite documenting it otherwise. + */ + + if (size) + return realloc (ptr, size); + + free (ptr); + return 0; +} + +static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul; + +void ecb_cold +ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW +{ + alloc = cb; +} + +inline_speed void * +ev_realloc (void *ptr, long size) +{ + ptr = alloc (ptr, size); + + if (!ptr && size) + { +#if EV_AVOID_STDIO + ev_printerr ("(libev) memory allocation failed, aborting.\n"); +#else + fprintf (stderr, "(libev) cannot allocate %ld bytes, aborting.", size); +#endif + abort (); + } + + return ptr; +} + +#define ev_malloc(size) ev_realloc (0, (size)) +#define ev_free(ptr) ev_realloc ((ptr), 0) + +/*****************************************************************************/ + +/* set in reify when reification needed */ +#define EV_ANFD_REIFY 1 + +/* file descriptor info structure */ +typedef struct +{ + WL head; + unsigned char events; /* the events watched for */ + unsigned char reify; /* flag set when this ANFD needs reification (EV_ANFD_REIFY, EV__IOFDSET) */ + unsigned char emask; /* the epoll backend stores the actual kernel mask in here */ + unsigned char unused; +#if EV_USE_EPOLL + unsigned int egen; /* generation counter to counter epoll bugs */ +#endif +#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP + SOCKET handle; +#endif +#if EV_USE_IOCP + OVERLAPPED or, ow; +#endif +} ANFD; + +/* stores the pending event set for a given watcher */ +typedef struct +{ + W w; + int events; /* the pending event set for the given watcher */ +} ANPENDING; + +#if EV_USE_INOTIFY +/* hash table entry per inotify-id */ +typedef struct +{ + WL head; +} ANFS; +#endif + +/* Heap Entry */ +#if EV_HEAP_CACHE_AT + /* a heap element */ + typedef struct { + ev_tstamp at; + WT w; + } ANHE; + + #define ANHE_w(he) (he).w /* access watcher, read-write */ + #define ANHE_at(he) (he).at /* access cached at, read-only */ + #define ANHE_at_cache(he) (he).at = (he).w->at /* update at from watcher */ +#else + /* a heap element */ + typedef WT ANHE; + + #define ANHE_w(he) (he) + #define ANHE_at(he) (he)->at + #define ANHE_at_cache(he) +#endif + +#if EV_MULTIPLICITY + + struct ev_loop + { + ev_tstamp ev_rt_now; + #define ev_rt_now ((loop)->ev_rt_now) + #define VAR(name,decl) decl; + #include "ev_vars.h" + #undef VAR + }; + #include "ev_wrap.h" + + static struct ev_loop default_loop_struct; + EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */ + +#else + + EV_API_DECL ev_tstamp ev_rt_now = 0; /* needs to be initialised to make it a definition despite extern */ + #define VAR(name,decl) static decl; + #include "ev_vars.h" + #undef VAR + + static int ev_default_loop_ptr; + +#endif + +#if EV_FEATURE_API +# define EV_RELEASE_CB if (expect_false (release_cb)) release_cb (EV_A) +# define EV_ACQUIRE_CB if (expect_false (acquire_cb)) acquire_cb (EV_A) +# define EV_INVOKE_PENDING invoke_cb (EV_A) +#else +# define EV_RELEASE_CB (void)0 +# define EV_ACQUIRE_CB (void)0 +# define EV_INVOKE_PENDING ev_invoke_pending (EV_A) +#endif + +#define EVBREAK_RECURSE 0x80 + +/*****************************************************************************/ + +#ifndef EV_HAVE_EV_TIME +ev_tstamp +ev_time (void) EV_THROW +{ +#if EV_USE_REALTIME + if (expect_true (have_realtime)) + { + struct timespec ts; + clock_gettime (CLOCK_REALTIME, &ts); + return ts.tv_sec + ts.tv_nsec * 1e-9; + } +#endif + + struct timeval tv; + gettimeofday (&tv, 0); + return tv.tv_sec + tv.tv_usec * 1e-6; +} +#endif + +inline_size ev_tstamp +get_clock (void) +{ +#if EV_USE_MONOTONIC + if (expect_true (have_monotonic)) + { + struct timespec ts; + clock_gettime (CLOCK_MONOTONIC, &ts); + return ts.tv_sec + ts.tv_nsec * 1e-9; + } +#endif + + return ev_time (); +} + +#if EV_MULTIPLICITY +ev_tstamp +ev_now (EV_P) EV_THROW +{ + return ev_rt_now; +} +#endif + +void +ev_sleep (ev_tstamp delay) EV_THROW +{ + if (delay > 0.) + { +#if EV_USE_NANOSLEEP + struct timespec ts; + + EV_TS_SET (ts, delay); + nanosleep (&ts, 0); +#elif defined _WIN32 + Sleep ((unsigned long)(delay * 1e3)); +#else + struct timeval tv; + + /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ + /* something not guaranteed by newer posix versions, but guaranteed */ + /* by older ones */ + EV_TV_SET (tv, delay); + select (0, 0, 0, 0, &tv); +#endif + } +} + +/*****************************************************************************/ + +#define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */ + +/* find a suitable new size for the given array, */ +/* hopefully by rounding to a nice-to-malloc size */ +inline_size int +array_nextsize (int elem, int cur, int cnt) +{ + int ncur = cur + 1; + + do + ncur <<= 1; + while (cnt > ncur); + + /* if size is large, round to MALLOC_ROUND - 4 * longs to accommodate malloc overhead */ + if (elem * ncur > MALLOC_ROUND - sizeof (void *) * 4) + { + ncur *= elem; + ncur = (ncur + elem + (MALLOC_ROUND - 1) + sizeof (void *) * 4) & ~(MALLOC_ROUND - 1); + ncur = ncur - sizeof (void *) * 4; + ncur /= elem; + } + + return ncur; +} + +static void * noinline ecb_cold +array_realloc (int elem, void *base, int *cur, int cnt) +{ + *cur = array_nextsize (elem, *cur, cnt); + return ev_realloc (base, elem * *cur); +} + +#define array_init_zero(base,count) \ + memset ((void *)(base), 0, sizeof (*(base)) * (count)) + +#define array_needsize(type,base,cur,cnt,init) \ + if (expect_false ((cnt) > (cur))) \ + { \ + int ecb_unused ocur_ = (cur); \ + (base) = (type *)array_realloc \ + (sizeof (type), (base), &(cur), (cnt)); \ + init ((base) + (ocur_), (cur) - ocur_); \ + } + +#if 0 +#define array_slim(type,stem) \ + if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ + { \ + stem ## max = array_roundsize (stem ## cnt >> 1); \ + base = (type *)ev_realloc (base, sizeof (type) * (stem ## max));\ + fprintf (stderr, "slimmed down " # stem " to %d\n", stem ## max);/*D*/\ + } +#endif + +#define array_free(stem, idx) \ + ev_free (stem ## s idx); stem ## cnt idx = stem ## max idx = 0; stem ## s idx = 0 + +/*****************************************************************************/ + +/* dummy callback for pending events */ +static void noinline +pendingcb (EV_P_ ev_prepare *w, int revents) +{ +} + +void noinline +ev_feed_event (EV_P_ void *w, int revents) EV_THROW +{ + W w_ = (W)w; + int pri = ABSPRI (w_); + + if (expect_false (w_->pending)) + pendings [pri][w_->pending - 1].events |= revents; + else + { + w_->pending = ++pendingcnt [pri]; + array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2); + pendings [pri][w_->pending - 1].w = w_; + pendings [pri][w_->pending - 1].events = revents; + } + + pendingpri = NUMPRI - 1; +} + +inline_speed void +feed_reverse (EV_P_ W w) +{ + array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2); + rfeeds [rfeedcnt++] = w; +} + +inline_size void +feed_reverse_done (EV_P_ int revents) +{ + do + ev_feed_event (EV_A_ rfeeds [--rfeedcnt], revents); + while (rfeedcnt); +} + +inline_speed void +queue_events (EV_P_ W *events, int eventcnt, int type) +{ + int i; + + for (i = 0; i < eventcnt; ++i) + ev_feed_event (EV_A_ events [i], type); +} + +/*****************************************************************************/ + +inline_speed void +fd_event_nocheck (EV_P_ int fd, int revents) +{ + ANFD *anfd = anfds + fd; + ev_io *w; + + for (w = (ev_io *)anfd->head; w; w = (ev_io *)((WL)w)->next) + { + int ev = w->events & revents; + + if (ev) + ev_feed_event (EV_A_ (W)w, ev); + } +} + +/* do not submit kernel events for fds that have reify set */ +/* because that means they changed while we were polling for new events */ +inline_speed void +fd_event (EV_P_ int fd, int revents) +{ + ANFD *anfd = anfds + fd; + + if (expect_true (!anfd->reify)) + fd_event_nocheck (EV_A_ fd, revents); +} + +void +ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW +{ + if (fd >= 0 && fd < anfdmax) + fd_event_nocheck (EV_A_ fd, revents); +} + +/* make sure the external fd watch events are in-sync */ +/* with the kernel/libev internal state */ +inline_size void +fd_reify (EV_P) +{ + int i; + +#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP + for (i = 0; i < fdchangecnt; ++i) + { + int fd = fdchanges [i]; + ANFD *anfd = anfds + fd; + + if (anfd->reify & EV__IOFDSET && anfd->head) + { + SOCKET handle = EV_FD_TO_WIN32_HANDLE (fd); + + if (handle != anfd->handle) + { + unsigned long arg; + + assert (("libev: only socket fds supported in this configuration", ioctlsocket (handle, FIONREAD, &arg) == 0)); + + /* handle changed, but fd didn't - we need to do it in two steps */ + backend_modify (EV_A_ fd, anfd->events, 0); + anfd->events = 0; + anfd->handle = handle; + } + } + } +#endif + + for (i = 0; i < fdchangecnt; ++i) + { + int fd = fdchanges [i]; + ANFD *anfd = anfds + fd; + ev_io *w; + + unsigned char o_events = anfd->events; + unsigned char o_reify = anfd->reify; + + anfd->reify = 0; + + /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */ + { + anfd->events = 0; + + for (w = (ev_io *)anfd->head; w; w = (ev_io *)((WL)w)->next) + anfd->events |= (unsigned char)w->events; + + if (o_events != anfd->events) + o_reify = EV__IOFDSET; /* actually |= */ + } + + if (o_reify & EV__IOFDSET) + backend_modify (EV_A_ fd, o_events, anfd->events); + } + + fdchangecnt = 0; +} + +/* something about the given fd changed */ +inline_size void +fd_change (EV_P_ int fd, int flags) +{ + unsigned char reify = anfds [fd].reify; + anfds [fd].reify |= flags; + + if (expect_true (!reify)) + { + ++fdchangecnt; + array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2); + fdchanges [fdchangecnt - 1] = fd; + } +} + +/* the given fd is invalid/unusable, so make sure it doesn't hurt us anymore */ +inline_speed void ecb_cold +fd_kill (EV_P_ int fd) +{ + ev_io *w; + + while ((w = (ev_io *)anfds [fd].head)) + { + ev_io_stop (EV_A_ w); + ev_feed_event (EV_A_ (W)w, EV_ERROR | EV_READ | EV_WRITE); + } +} + +/* check whether the given fd is actually valid, for error recovery */ +inline_size int ecb_cold +fd_valid (int fd) +{ +#ifdef _WIN32 + return EV_FD_TO_WIN32_HANDLE (fd) != -1; +#else + return fcntl (fd, F_GETFD) != -1; +#endif +} + +/* called on EBADF to verify fds */ +static void noinline ecb_cold +fd_ebadf (EV_P) +{ + int fd; + + for (fd = 0; fd < anfdmax; ++fd) + if (anfds [fd].events) + if (!fd_valid (fd) && errno == EBADF) + fd_kill (EV_A_ fd); +} + +/* called on ENOMEM in select/poll to kill some fds and retry */ +static void noinline ecb_cold +fd_enomem (EV_P) +{ + int fd; + + for (fd = anfdmax; fd--; ) + if (anfds [fd].events) + { + fd_kill (EV_A_ fd); + break; + } +} + +/* usually called after fork if backend needs to re-arm all fds from scratch */ +static void noinline +fd_rearm_all (EV_P) +{ + int fd; + + for (fd = 0; fd < anfdmax; ++fd) + if (anfds [fd].events) + { + anfds [fd].events = 0; + anfds [fd].emask = 0; + fd_change (EV_A_ fd, EV__IOFDSET | EV_ANFD_REIFY); + } +} + +/* used to prepare libev internal fd's */ +/* this is not fork-safe */ +inline_speed void +fd_intern (int fd) +{ +#ifdef _WIN32 + unsigned long arg = 1; + ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg); +#else + fcntl (fd, F_SETFD, FD_CLOEXEC); + fcntl (fd, F_SETFL, O_NONBLOCK); +#endif +} + +/*****************************************************************************/ + +/* + * the heap functions want a real array index. array index 0 is guaranteed to not + * be in-use at any time. the first heap entry is at array [HEAP0]. DHEAP gives + * the branching factor of the d-tree. + */ + +/* + * at the moment we allow libev the luxury of two heaps, + * a small-code-size 2-heap one and a ~1.5kb larger 4-heap + * which is more cache-efficient. + * the difference is about 5% with 50000+ watchers. + */ +#if EV_USE_4HEAP + +#define DHEAP 4 +#define HEAP0 (DHEAP - 1) /* index of first element in heap */ +#define HPARENT(k) ((((k) - HEAP0 - 1) / DHEAP) + HEAP0) +#define UPHEAP_DONE(p,k) ((p) == (k)) + +/* away from the root */ +inline_speed void +downheap (ANHE *heap, int N, int k) +{ + ANHE he = heap [k]; + ANHE *E = heap + N + HEAP0; + + for (;;) + { + ev_tstamp minat; + ANHE *minpos; + ANHE *pos = heap + DHEAP * (k - HEAP0) + HEAP0 + 1; + + /* find minimum child */ + if (expect_true (pos + DHEAP - 1 < E)) + { + /* fast path */ (minpos = pos + 0), (minat = ANHE_at (*minpos)); + if ( ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos)); + if ( ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos)); + if ( ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos)); + } + else if (pos < E) + { + /* slow path */ (minpos = pos + 0), (minat = ANHE_at (*minpos)); + if (pos + 1 < E && ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos)); + if (pos + 2 < E && ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos)); + if (pos + 3 < E && ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos)); + } + else + break; + + if (ANHE_at (he) <= minat) + break; + + heap [k] = *minpos; + ev_active (ANHE_w (*minpos)) = k; + + k = minpos - heap; + } + + heap [k] = he; + ev_active (ANHE_w (he)) = k; +} + +#else /* 4HEAP */ + +#define HEAP0 1 +#define HPARENT(k) ((k) >> 1) +#define UPHEAP_DONE(p,k) (!(p)) + +/* away from the root */ +inline_speed void +downheap (ANHE *heap, int N, int k) +{ + ANHE he = heap [k]; + + for (;;) + { + int c = k << 1; + + if (c >= N + HEAP0) + break; + + c += c + 1 < N + HEAP0 && ANHE_at (heap [c]) > ANHE_at (heap [c + 1]) + ? 1 : 0; + + if (ANHE_at (he) <= ANHE_at (heap [c])) + break; + + heap [k] = heap [c]; + ev_active (ANHE_w (heap [k])) = k; + + k = c; + } + + heap [k] = he; + ev_active (ANHE_w (he)) = k; +} +#endif + +/* towards the root */ +inline_speed void +upheap (ANHE *heap, int k) +{ + ANHE he = heap [k]; + + for (;;) + { + int p = HPARENT (k); + + if (UPHEAP_DONE (p, k) || ANHE_at (heap [p]) <= ANHE_at (he)) + break; + + heap [k] = heap [p]; + ev_active (ANHE_w (heap [k])) = k; + k = p; + } + + heap [k] = he; + ev_active (ANHE_w (he)) = k; +} + +/* move an element suitably so it is in a correct place */ +inline_size void +adjustheap (ANHE *heap, int N, int k) +{ + if (k > HEAP0 && ANHE_at (heap [k]) <= ANHE_at (heap [HPARENT (k)])) + upheap (heap, k); + else + downheap (heap, N, k); +} + +/* rebuild the heap: this function is used only once and executed rarely */ +inline_size void +reheap (ANHE *heap, int N) +{ + int i; + + /* we don't use floyds algorithm, upheap is simpler and is more cache-efficient */ + /* also, this is easy to implement and correct for both 2-heaps and 4-heaps */ + for (i = 0; i < N; ++i) + upheap (heap, i + HEAP0); +} + +/*****************************************************************************/ + +/* associate signal watchers to a signal signal */ +typedef struct +{ + EV_ATOMIC_T pending; +#if EV_MULTIPLICITY + EV_P; +#endif + WL head; +} ANSIG; + +static ANSIG signals [EV_NSIG - 1]; + +/*****************************************************************************/ + +#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE + +static void noinline ecb_cold +evpipe_init (EV_P) +{ + if (!ev_is_active (&pipe_w)) + { + int fds [2]; + +# if EV_USE_EVENTFD + fds [0] = -1; + fds [1] = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC); + if (fds [1] < 0 && errno == EINVAL) + fds [1] = eventfd (0, 0); + + if (fds [1] < 0) +# endif + { + while (pipe (fds)) + ev_syserr ("(libev) error creating signal/async pipe"); + + fd_intern (fds [0]); + } + + fd_intern (fds [1]); + + evpipe [0] = fds [0]; + + if (evpipe [1] < 0) + evpipe [1] = fds [1]; /* first call, set write fd */ + else + { + /* on subsequent calls, do not change evpipe [1] */ + /* so that evpipe_write can always rely on its value. */ + /* this branch does not do anything sensible on windows, */ + /* so must not be executed on windows */ + + dup2 (fds [1], evpipe [1]); + close (fds [1]); + } + + ev_io_set (&pipe_w, evpipe [0] < 0 ? evpipe [1] : evpipe [0], EV_READ); + ev_io_start (EV_A_ &pipe_w); + ev_unref (EV_A); /* watcher should not keep loop alive */ + } +} + +inline_speed void +evpipe_write (EV_P_ EV_ATOMIC_T *flag) +{ + ECB_MEMORY_FENCE; /* push out the write before this function was called, acquire flag */ + + if (expect_true (*flag)) + return; + + *flag = 1; + ECB_MEMORY_FENCE_RELEASE; /* make sure flag is visible before the wakeup */ + + pipe_write_skipped = 1; + + ECB_MEMORY_FENCE; /* make sure pipe_write_skipped is visible before we check pipe_write_wanted */ + + if (pipe_write_wanted) + { + int old_errno; + + pipe_write_skipped = 0; + ECB_MEMORY_FENCE_RELEASE; + + old_errno = errno; /* save errno because write will clobber it */ + +#if EV_USE_EVENTFD + if (evpipe [0] < 0) + { + uint64_t counter = 1; + write (evpipe [1], &counter, sizeof (uint64_t)); + } + else +#endif + { +#ifdef _WIN32 + WSABUF buf; + DWORD sent; + buf.buf = &buf; + buf.len = 1; + WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0); +#else + write (evpipe [1], &(evpipe [1]), 1); +#endif + } + + errno = old_errno; + } +} + +/* called whenever the libev signal pipe */ +/* got some events (signal, async) */ +static void +pipecb (EV_P_ ev_io *iow, int revents) +{ + int i; + + if (revents & EV_READ) + { +#if EV_USE_EVENTFD + if (evpipe [0] < 0) + { + uint64_t counter; + read (evpipe [1], &counter, sizeof (uint64_t)); + } + else +#endif + { + char dummy[4]; +#ifdef _WIN32 + WSABUF buf; + DWORD recvd; + DWORD flags = 0; + buf.buf = dummy; + buf.len = sizeof (dummy); + WSARecv (EV_FD_TO_WIN32_HANDLE (evpipe [0]), &buf, 1, &recvd, &flags, 0, 0); +#else + read (evpipe [0], &dummy, sizeof (dummy)); +#endif + } + } + + pipe_write_skipped = 0; + + ECB_MEMORY_FENCE; /* push out skipped, acquire flags */ + +#if EV_SIGNAL_ENABLE + if (sig_pending) + { + sig_pending = 0; + + ECB_MEMORY_FENCE; + + for (i = EV_NSIG - 1; i--; ) + if (expect_false (signals [i].pending)) + ev_feed_signal_event (EV_A_ i + 1); + } +#endif + +#if EV_ASYNC_ENABLE + if (async_pending) + { + async_pending = 0; + + ECB_MEMORY_FENCE; + + for (i = asynccnt; i--; ) + if (asyncs [i]->sent) + { + asyncs [i]->sent = 0; + ECB_MEMORY_FENCE_RELEASE; + ev_feed_event (EV_A_ asyncs [i], EV_ASYNC); + } + } +#endif +} + +/*****************************************************************************/ + +void +ev_feed_signal (int signum) EV_THROW +{ +#if EV_MULTIPLICITY + EV_P = signals [signum - 1].loop; + + if (!EV_A) + return; +#endif + + signals [signum - 1].pending = 1; + evpipe_write (EV_A_ &sig_pending); +} + +static void +ev_sighandler (int signum) +{ +#ifdef _WIN32 + signal (signum, ev_sighandler); +#endif + + ev_feed_signal (signum); +} + +void noinline +ev_feed_signal_event (EV_P_ int signum) EV_THROW +{ + WL w; + + if (expect_false (signum <= 0 || signum >= EV_NSIG)) + return; + + --signum; + +#if EV_MULTIPLICITY + /* it is permissible to try to feed a signal to the wrong loop */ + /* or, likely more useful, feeding a signal nobody is waiting for */ + + if (expect_false (signals [signum].loop != EV_A)) + return; +#endif + + signals [signum].pending = 0; + ECB_MEMORY_FENCE_RELEASE; + + for (w = signals [signum].head; w; w = w->next) + ev_feed_event (EV_A_ (W)w, EV_SIGNAL); +} + +#if EV_USE_SIGNALFD +static void +sigfdcb (EV_P_ ev_io *iow, int revents) +{ + struct signalfd_siginfo si[2], *sip; /* these structs are big */ + + for (;;) + { + ssize_t res = read (sigfd, si, sizeof (si)); + + /* not ISO-C, as res might be -1, but works with SuS */ + for (sip = si; (char *)sip < (char *)si + res; ++sip) + ev_feed_signal_event (EV_A_ sip->ssi_signo); + + if (res < (ssize_t)sizeof (si)) + break; + } +} +#endif + +#endif + +/*****************************************************************************/ + +#if EV_CHILD_ENABLE +static WL childs [EV_PID_HASHSIZE]; + +static ev_signal childev; + +#ifndef WIFCONTINUED +# define WIFCONTINUED(status) 0 +#endif + +/* handle a single child status event */ +inline_speed void +child_reap (EV_P_ int chain, int pid, int status) +{ + ev_child *w; + int traced = WIFSTOPPED (status) || WIFCONTINUED (status); + + for (w = (ev_child *)childs [chain & ((EV_PID_HASHSIZE) - 1)]; w; w = (ev_child *)((WL)w)->next) + { + if ((w->pid == pid || !w->pid) + && (!traced || (w->flags & 1))) + { + ev_set_priority (w, EV_MAXPRI); /* need to do it *now*, this *must* be the same prio as the signal watcher itself */ + w->rpid = pid; + w->rstatus = status; + ev_feed_event (EV_A_ (W)w, EV_CHILD); + } + } +} + +#ifndef WCONTINUED +# define WCONTINUED 0 +#endif + +/* called on sigchld etc., calls waitpid */ +static void +childcb (EV_P_ ev_signal *sw, int revents) +{ + int pid, status; + + /* some systems define WCONTINUED but then fail to support it (linux 2.4) */ + if (0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED))) + if (!WCONTINUED + || errno != EINVAL + || 0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED))) + return; + + /* make sure we are called again until all children have been reaped */ + /* we need to do it this way so that the callback gets called before we continue */ + ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); + + child_reap (EV_A_ pid, pid, status); + if ((EV_PID_HASHSIZE) > 1) + child_reap (EV_A_ 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ +} + +#endif + +/*****************************************************************************/ + +#if EV_USE_IOCP +# include "ev_iocp.c" +#endif +#if EV_USE_PORT +# include "ev_port.c" +#endif +#if EV_USE_KQUEUE +# include "ev_kqueue.c" +#endif +#if EV_USE_EPOLL +# include "ev_epoll.c" +#endif +#if EV_USE_POLL +# include "ev_poll.c" +#endif +#if EV_USE_SELECT +# include "ev_select.c" +#endif + +int ecb_cold +ev_version_major (void) EV_THROW +{ + return EV_VERSION_MAJOR; +} + +int ecb_cold +ev_version_minor (void) EV_THROW +{ + return EV_VERSION_MINOR; +} + +/* return true if we are running with elevated privileges and should ignore env variables */ +int inline_size ecb_cold +enable_secure (void) +{ +#ifdef _WIN32 + return 0; +#else + return getuid () != geteuid () + || getgid () != getegid (); +#endif +} + +unsigned int ecb_cold +ev_supported_backends (void) EV_THROW +{ + unsigned int flags = 0; + + if (EV_USE_PORT ) flags |= EVBACKEND_PORT; + if (EV_USE_KQUEUE) flags |= EVBACKEND_KQUEUE; + if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL; + if (EV_USE_POLL ) flags |= EVBACKEND_POLL; + if (EV_USE_SELECT) flags |= EVBACKEND_SELECT; + + return flags; +} + +unsigned int ecb_cold +ev_recommended_backends (void) EV_THROW +{ + unsigned int flags = ev_supported_backends (); + +#ifndef __NetBSD__ + /* kqueue is borked on everything but netbsd apparently */ + /* it usually doesn't work correctly on anything but sockets and pipes */ + flags &= ~EVBACKEND_KQUEUE; +#endif +#ifdef __APPLE__ + /* only select works correctly on that "unix-certified" platform */ + flags &= ~EVBACKEND_KQUEUE; /* horribly broken, even for sockets */ + flags &= ~EVBACKEND_POLL; /* poll is based on kqueue from 10.5 onwards */ +#endif +#ifdef __FreeBSD__ + flags &= ~EVBACKEND_POLL; /* poll return value is unusable (http://forums.freebsd.org/archive/index.php/t-10270.html) */ +#endif + + return flags; +} + +unsigned int ecb_cold +ev_embeddable_backends (void) EV_THROW +{ + int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT; + + /* epoll embeddability broken on all linux versions up to at least 2.6.23 */ + if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */ + flags &= ~EVBACKEND_EPOLL; + + return flags; +} + +unsigned int +ev_backend (EV_P) EV_THROW +{ + return backend; +} + +#if EV_FEATURE_API +unsigned int +ev_iteration (EV_P) EV_THROW +{ + return loop_count; +} + +unsigned int +ev_depth (EV_P) EV_THROW +{ + return loop_depth; +} + +void +ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW +{ + io_blocktime = interval; +} + +void +ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW +{ + timeout_blocktime = interval; +} + +void +ev_set_userdata (EV_P_ void *data) EV_THROW +{ + userdata = data; +} + +void * +ev_userdata (EV_P) EV_THROW +{ + return userdata; +} + +void +ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)) EV_THROW +{ + invoke_cb = invoke_pending_cb; +} + +void +ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW +{ + release_cb = release; + acquire_cb = acquire; +} +#endif + +/* initialise a loop structure, must be zero-initialised */ +static void noinline ecb_cold +loop_init (EV_P_ unsigned int flags) EV_THROW +{ + if (!backend) + { + origflags = flags; + +#if EV_USE_REALTIME + if (!have_realtime) + { + struct timespec ts; + + if (!clock_gettime (CLOCK_REALTIME, &ts)) + have_realtime = 1; + } +#endif + +#if EV_USE_MONOTONIC + if (!have_monotonic) + { + struct timespec ts; + + if (!clock_gettime (CLOCK_MONOTONIC, &ts)) + have_monotonic = 1; + } +#endif + + /* pid check not overridable via env */ +#ifndef _WIN32 + if (flags & EVFLAG_FORKCHECK) + curpid = getpid (); +#endif + + if (!(flags & EVFLAG_NOENV) + && !enable_secure () + && getenv ("LIBEV_FLAGS")) + flags = atoi (getenv ("LIBEV_FLAGS")); + + ev_rt_now = ev_time (); + mn_now = get_clock (); + now_floor = mn_now; + rtmn_diff = ev_rt_now - mn_now; +#if EV_FEATURE_API + invoke_cb = ev_invoke_pending; +#endif + + io_blocktime = 0.; + timeout_blocktime = 0.; + backend = 0; + backend_fd = -1; + sig_pending = 0; +#if EV_ASYNC_ENABLE + async_pending = 0; +#endif + pipe_write_skipped = 0; + pipe_write_wanted = 0; + evpipe [0] = -1; + evpipe [1] = -1; +#if EV_USE_INOTIFY + fs_fd = flags & EVFLAG_NOINOTIFY ? -1 : -2; +#endif +#if EV_USE_SIGNALFD + sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1; +#endif + + if (!(flags & EVBACKEND_MASK)) + flags |= ev_recommended_backends (); + +#if EV_USE_IOCP + if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init (EV_A_ flags); +#endif +#if EV_USE_PORT + if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); +#endif +#if EV_USE_KQUEUE + if (!backend && (flags & EVBACKEND_KQUEUE)) backend = kqueue_init (EV_A_ flags); +#endif +#if EV_USE_EPOLL + if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init (EV_A_ flags); +#endif +#if EV_USE_POLL + if (!backend && (flags & EVBACKEND_POLL )) backend = poll_init (EV_A_ flags); +#endif +#if EV_USE_SELECT + if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags); +#endif + + ev_prepare_init (&pending_w, pendingcb); + +#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE + ev_init (&pipe_w, pipecb); + ev_set_priority (&pipe_w, EV_MAXPRI); +#endif + } +} + +/* free up a loop structure */ +void ecb_cold +ev_loop_destroy (EV_P) +{ + int i; + +#if EV_MULTIPLICITY + /* mimic free (0) */ + if (!EV_A) + return; +#endif + +#if EV_CLEANUP_ENABLE + /* queue cleanup watchers (and execute them) */ + if (expect_false (cleanupcnt)) + { + queue_events (EV_A_ (W *)cleanups, cleanupcnt, EV_CLEANUP); + EV_INVOKE_PENDING; + } +#endif + +#if EV_CHILD_ENABLE + if (ev_is_default_loop (EV_A) && ev_is_active (&childev)) + { + ev_ref (EV_A); /* child watcher */ + ev_signal_stop (EV_A_ &childev); + } +#endif + + if (ev_is_active (&pipe_w)) + { + /*ev_ref (EV_A);*/ + /*ev_io_stop (EV_A_ &pipe_w);*/ + + if (evpipe [0] >= 0) EV_WIN32_CLOSE_FD (evpipe [0]); + if (evpipe [1] >= 0) EV_WIN32_CLOSE_FD (evpipe [1]); + } + +#if EV_USE_SIGNALFD + if (ev_is_active (&sigfd_w)) + close (sigfd); +#endif + +#if EV_USE_INOTIFY + if (fs_fd >= 0) + close (fs_fd); +#endif + + if (backend_fd >= 0) + close (backend_fd); + +#if EV_USE_IOCP + if (backend == EVBACKEND_IOCP ) iocp_destroy (EV_A); +#endif +#if EV_USE_PORT + if (backend == EVBACKEND_PORT ) port_destroy (EV_A); +#endif +#if EV_USE_KQUEUE + if (backend == EVBACKEND_KQUEUE) kqueue_destroy (EV_A); +#endif +#if EV_USE_EPOLL + if (backend == EVBACKEND_EPOLL ) epoll_destroy (EV_A); +#endif +#if EV_USE_POLL + if (backend == EVBACKEND_POLL ) poll_destroy (EV_A); +#endif +#if EV_USE_SELECT + if (backend == EVBACKEND_SELECT) select_destroy (EV_A); +#endif + + for (i = NUMPRI; i--; ) + { + array_free (pending, [i]); +#if EV_IDLE_ENABLE + array_free (idle, [i]); +#endif + } + + ev_free (anfds); anfds = 0; anfdmax = 0; + + /* have to use the microsoft-never-gets-it-right macro */ + array_free (rfeed, EMPTY); + array_free (fdchange, EMPTY); + array_free (timer, EMPTY); +#if EV_PERIODIC_ENABLE + array_free (periodic, EMPTY); +#endif +#if EV_FORK_ENABLE + array_free (fork, EMPTY); +#endif +#if EV_CLEANUP_ENABLE + array_free (cleanup, EMPTY); +#endif + array_free (prepare, EMPTY); + array_free (check, EMPTY); +#if EV_ASYNC_ENABLE + array_free (async, EMPTY); +#endif + + backend = 0; + +#if EV_MULTIPLICITY + if (ev_is_default_loop (EV_A)) +#endif + ev_default_loop_ptr = 0; +#if EV_MULTIPLICITY + else + ev_free (EV_A); +#endif +} + +#if EV_USE_INOTIFY +inline_size void infy_fork (EV_P); +#endif + +inline_size void +loop_fork (EV_P) +{ +#if EV_USE_PORT + if (backend == EVBACKEND_PORT ) port_fork (EV_A); +#endif +#if EV_USE_KQUEUE + if (backend == EVBACKEND_KQUEUE) kqueue_fork (EV_A); +#endif +#if EV_USE_EPOLL + if (backend == EVBACKEND_EPOLL ) epoll_fork (EV_A); +#endif +#if EV_USE_INOTIFY + infy_fork (EV_A); +#endif + +#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE + if (ev_is_active (&pipe_w)) + { + /* pipe_write_wanted must be false now, so modifying fd vars should be safe */ + + ev_ref (EV_A); + ev_io_stop (EV_A_ &pipe_w); + + if (evpipe [0] >= 0) + EV_WIN32_CLOSE_FD (evpipe [0]); + + evpipe_init (EV_A); + /* iterate over everything, in case we missed something before */ + ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM); + } +#endif + + postfork = 0; +} + +#if EV_MULTIPLICITY + +struct ev_loop * ecb_cold +ev_loop_new (unsigned int flags) EV_THROW +{ + EV_P = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop)); + + memset (EV_A, 0, sizeof (struct ev_loop)); + loop_init (EV_A_ flags); + + if (ev_backend (EV_A)) + return EV_A; + + ev_free (EV_A); + return 0; +} + +#endif /* multiplicity */ + +#if EV_VERIFY +static void noinline ecb_cold +verify_watcher (EV_P_ W w) +{ + assert (("libev: watcher has invalid priority", ABSPRI (w) >= 0 && ABSPRI (w) < NUMPRI)); + + if (w->pending) + assert (("libev: pending watcher not on pending queue", pendings [ABSPRI (w)][w->pending - 1].w == w)); +} + +static void noinline ecb_cold +verify_heap (EV_P_ ANHE *heap, int N) +{ + int i; + + for (i = HEAP0; i < N + HEAP0; ++i) + { + assert (("libev: active index mismatch in heap", ev_active (ANHE_w (heap [i])) == i)); + assert (("libev: heap condition violated", i == HEAP0 || ANHE_at (heap [HPARENT (i)]) <= ANHE_at (heap [i]))); + assert (("libev: heap at cache mismatch", ANHE_at (heap [i]) == ev_at (ANHE_w (heap [i])))); + + verify_watcher (EV_A_ (W)ANHE_w (heap [i])); + } +} + +static void noinline ecb_cold +array_verify (EV_P_ W *ws, int cnt) +{ + while (cnt--) + { + assert (("libev: active index mismatch", ev_active (ws [cnt]) == cnt + 1)); + verify_watcher (EV_A_ ws [cnt]); + } +} +#endif + +#if EV_FEATURE_API +void ecb_cold +ev_verify (EV_P) EV_THROW +{ +#if EV_VERIFY + int i; + WL w, w2; + + assert (activecnt >= -1); + + assert (fdchangemax >= fdchangecnt); + for (i = 0; i < fdchangecnt; ++i) + assert (("libev: negative fd in fdchanges", fdchanges [i] >= 0)); + + assert (anfdmax >= 0); + for (i = 0; i < anfdmax; ++i) + { + int j = 0; + + for (w = w2 = anfds [i].head; w; w = w->next) + { + verify_watcher (EV_A_ (W)w); + + if (j++ & 1) + { + assert (("libev: io watcher list contains a loop", w != w2)); + w2 = w2->next; + } + + assert (("libev: inactive fd watcher on anfd list", ev_active (w) == 1)); + assert (("libev: fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i)); + } + } + + assert (timermax >= timercnt); + verify_heap (EV_A_ timers, timercnt); + +#if EV_PERIODIC_ENABLE + assert (periodicmax >= periodiccnt); + verify_heap (EV_A_ periodics, periodiccnt); +#endif + + for (i = NUMPRI; i--; ) + { + assert (pendingmax [i] >= pendingcnt [i]); +#if EV_IDLE_ENABLE + assert (idleall >= 0); + assert (idlemax [i] >= idlecnt [i]); + array_verify (EV_A_ (W *)idles [i], idlecnt [i]); +#endif + } + +#if EV_FORK_ENABLE + assert (forkmax >= forkcnt); + array_verify (EV_A_ (W *)forks, forkcnt); +#endif + +#if EV_CLEANUP_ENABLE + assert (cleanupmax >= cleanupcnt); + array_verify (EV_A_ (W *)cleanups, cleanupcnt); +#endif + +#if EV_ASYNC_ENABLE + assert (asyncmax >= asynccnt); + array_verify (EV_A_ (W *)asyncs, asynccnt); +#endif + +#if EV_PREPARE_ENABLE + assert (preparemax >= preparecnt); + array_verify (EV_A_ (W *)prepares, preparecnt); +#endif + +#if EV_CHECK_ENABLE + assert (checkmax >= checkcnt); + array_verify (EV_A_ (W *)checks, checkcnt); +#endif + +# if 0 +#if EV_CHILD_ENABLE + for (w = (ev_child *)childs [chain & ((EV_PID_HASHSIZE) - 1)]; w; w = (ev_child *)((WL)w)->next) + for (signum = EV_NSIG; signum--; ) if (signals [signum].pending) +#endif +# endif +#endif +} +#endif + +#if EV_MULTIPLICITY +struct ev_loop * ecb_cold +#else +int +#endif +ev_default_loop (unsigned int flags) EV_THROW +{ + if (!ev_default_loop_ptr) + { +#if EV_MULTIPLICITY + EV_P = ev_default_loop_ptr = &default_loop_struct; +#else + ev_default_loop_ptr = 1; +#endif + + loop_init (EV_A_ flags); + + if (ev_backend (EV_A)) + { +#if EV_CHILD_ENABLE + ev_signal_init (&childev, childcb, SIGCHLD); + ev_set_priority (&childev, EV_MAXPRI); + ev_signal_start (EV_A_ &childev); + ev_unref (EV_A); /* child watcher should not keep loop alive */ +#endif + } + else + ev_default_loop_ptr = 0; + } + + return ev_default_loop_ptr; +} + +void +ev_loop_fork (EV_P) EV_THROW +{ + postfork = 1; +} + +/*****************************************************************************/ + +void +ev_invoke (EV_P_ void *w, int revents) +{ + EV_CB_INVOKE ((W)w, revents); +} + +unsigned int +ev_pending_count (EV_P) EV_THROW +{ + int pri; + unsigned int count = 0; + + for (pri = NUMPRI; pri--; ) + count += pendingcnt [pri]; + + return count; +} + +void noinline +ev_invoke_pending (EV_P) +{ + pendingpri = NUMPRI; + + while (pendingpri) /* pendingpri possibly gets modified in the inner loop */ + { + --pendingpri; + + while (pendingcnt [pendingpri]) + { + ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri]; + + p->w->pending = 0; + EV_CB_INVOKE (p->w, p->events); + EV_FREQUENT_CHECK; + } + } +} + +#if EV_IDLE_ENABLE +/* make idle watchers pending. this handles the "call-idle */ +/* only when higher priorities are idle" logic */ +inline_size void +idle_reify (EV_P) +{ + if (expect_false (idleall)) + { + int pri; + + for (pri = NUMPRI; pri--; ) + { + if (pendingcnt [pri]) + break; + + if (idlecnt [pri]) + { + queue_events (EV_A_ (W *)idles [pri], idlecnt [pri], EV_IDLE); + break; + } + } + } +} +#endif + +/* make timers pending */ +inline_size void +timers_reify (EV_P) +{ + EV_FREQUENT_CHECK; + + if (timercnt && ANHE_at (timers [HEAP0]) < mn_now) + { + do + { + ev_timer *w = (ev_timer *)ANHE_w (timers [HEAP0]); + + /*assert (("libev: inactive timer on timer heap detected", ev_is_active (w)));*/ + + /* first reschedule or stop timer */ + if (w->repeat) + { + ev_at (w) += w->repeat; + if (ev_at (w) < mn_now) + ev_at (w) = mn_now; + + assert (("libev: negative ev_timer repeat value found while processing timers", w->repeat > 0.)); + + ANHE_at_cache (timers [HEAP0]); + downheap (timers, timercnt, HEAP0); + } + else + ev_timer_stop (EV_A_ w); /* nonrepeating: stop timer */ + + EV_FREQUENT_CHECK; + feed_reverse (EV_A_ (W)w); + } + while (timercnt && ANHE_at (timers [HEAP0]) < mn_now); + + feed_reverse_done (EV_A_ EV_TIMER); + } +} + +#if EV_PERIODIC_ENABLE + +static void noinline +periodic_recalc (EV_P_ ev_periodic *w) +{ + ev_tstamp interval = w->interval > MIN_INTERVAL ? w->interval : MIN_INTERVAL; + ev_tstamp at = w->offset + interval * ev_floor ((ev_rt_now - w->offset) / interval); + + /* the above almost always errs on the low side */ + while (at <= ev_rt_now) + { + ev_tstamp nat = at + w->interval; + + /* when resolution fails us, we use ev_rt_now */ + if (expect_false (nat == at)) + { + at = ev_rt_now; + break; + } + + at = nat; + } + + ev_at (w) = at; +} + +/* make periodics pending */ +inline_size void +periodics_reify (EV_P) +{ + EV_FREQUENT_CHECK; + + while (periodiccnt && ANHE_at (periodics [HEAP0]) < ev_rt_now) + { + do + { + ev_periodic *w = (ev_periodic *)ANHE_w (periodics [HEAP0]); + + /*assert (("libev: inactive timer on periodic heap detected", ev_is_active (w)));*/ + + /* first reschedule or stop timer */ + if (w->reschedule_cb) + { + ev_at (w) = w->reschedule_cb (w, ev_rt_now); + + assert (("libev: ev_periodic reschedule callback returned time in the past", ev_at (w) >= ev_rt_now)); + + ANHE_at_cache (periodics [HEAP0]); + downheap (periodics, periodiccnt, HEAP0); + } + else if (w->interval) + { + periodic_recalc (EV_A_ w); + ANHE_at_cache (periodics [HEAP0]); + downheap (periodics, periodiccnt, HEAP0); + } + else + ev_periodic_stop (EV_A_ w); /* nonrepeating: stop timer */ + + EV_FREQUENT_CHECK; + feed_reverse (EV_A_ (W)w); + } + while (periodiccnt && ANHE_at (periodics [HEAP0]) < ev_rt_now); + + feed_reverse_done (EV_A_ EV_PERIODIC); + } +} + +/* simply recalculate all periodics */ +/* TODO: maybe ensure that at least one event happens when jumping forward? */ +static void noinline ecb_cold +periodics_reschedule (EV_P) +{ + int i; + + /* adjust periodics after time jump */ + for (i = HEAP0; i < periodiccnt + HEAP0; ++i) + { + ev_periodic *w = (ev_periodic *)ANHE_w (periodics [i]); + + if (w->reschedule_cb) + ev_at (w) = w->reschedule_cb (w, ev_rt_now); + else if (w->interval) + periodic_recalc (EV_A_ w); + + ANHE_at_cache (periodics [i]); + } + + reheap (periodics, periodiccnt); +} +#endif + +/* adjust all timers by a given offset */ +static void noinline ecb_cold +timers_reschedule (EV_P_ ev_tstamp adjust) +{ + int i; + + for (i = 0; i < timercnt; ++i) + { + ANHE *he = timers + i + HEAP0; + ANHE_w (*he)->at += adjust; + ANHE_at_cache (*he); + } +} + +/* fetch new monotonic and realtime times from the kernel */ +/* also detect if there was a timejump, and act accordingly */ +inline_speed void +time_update (EV_P_ ev_tstamp max_block) +{ +#if EV_USE_MONOTONIC + if (expect_true (have_monotonic)) + { + int i; + ev_tstamp odiff = rtmn_diff; + + mn_now = get_clock (); + + /* only fetch the realtime clock every 0.5*MIN_TIMEJUMP seconds */ + /* interpolate in the meantime */ + if (expect_true (mn_now - now_floor < MIN_TIMEJUMP * .5)) + { + ev_rt_now = rtmn_diff + mn_now; + return; + } + + now_floor = mn_now; + ev_rt_now = ev_time (); + + /* loop a few times, before making important decisions. + * on the choice of "4": one iteration isn't enough, + * in case we get preempted during the calls to + * ev_time and get_clock. a second call is almost guaranteed + * to succeed in that case, though. and looping a few more times + * doesn't hurt either as we only do this on time-jumps or + * in the unlikely event of having been preempted here. + */ + for (i = 4; --i; ) + { + ev_tstamp diff; + rtmn_diff = ev_rt_now - mn_now; + + diff = odiff - rtmn_diff; + + if (expect_true ((diff < 0. ? -diff : diff) < MIN_TIMEJUMP)) + return; /* all is well */ + + ev_rt_now = ev_time (); + mn_now = get_clock (); + now_floor = mn_now; + } + + /* no timer adjustment, as the monotonic clock doesn't jump */ + /* timers_reschedule (EV_A_ rtmn_diff - odiff) */ +# if EV_PERIODIC_ENABLE + periodics_reschedule (EV_A); +# endif + } + else +#endif + { + ev_rt_now = ev_time (); + + if (expect_false (mn_now > ev_rt_now || ev_rt_now > mn_now + max_block + MIN_TIMEJUMP)) + { + /* adjust timers. this is easy, as the offset is the same for all of them */ + timers_reschedule (EV_A_ ev_rt_now - mn_now); +#if EV_PERIODIC_ENABLE + periodics_reschedule (EV_A); +#endif + } + + mn_now = ev_rt_now; + } +} + +int +ev_run (EV_P_ int flags) +{ +#if EV_FEATURE_API + ++loop_depth; +#endif + + assert (("libev: ev_loop recursion during release detected", loop_done != EVBREAK_RECURSE)); + + loop_done = EVBREAK_CANCEL; + + EV_INVOKE_PENDING; /* in case we recurse, ensure ordering stays nice and clean */ + + do + { +#if EV_VERIFY >= 2 + ev_verify (EV_A); +#endif + +#ifndef _WIN32 + if (expect_false (curpid)) /* penalise the forking check even more */ + if (expect_false (getpid () != curpid)) + { + curpid = getpid (); + postfork = 1; + } +#endif + +#if EV_FORK_ENABLE + /* we might have forked, so queue fork handlers */ + if (expect_false (postfork)) + if (forkcnt) + { + queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK); + EV_INVOKE_PENDING; + } +#endif + +#if EV_PREPARE_ENABLE + /* queue prepare watchers (and execute them) */ + if (expect_false (preparecnt)) + { + queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); + EV_INVOKE_PENDING; + } +#endif + + if (expect_false (loop_done)) + break; + + /* we might have forked, so reify kernel state if necessary */ + if (expect_false (postfork)) + loop_fork (EV_A); + + /* update fd-related kernel structures */ + fd_reify (EV_A); + + /* calculate blocking time */ + { + ev_tstamp waittime = 0.; + ev_tstamp sleeptime = 0.; + + /* remember old timestamp for io_blocktime calculation */ + ev_tstamp prev_mn_now = mn_now; + + /* update time to cancel out callback processing overhead */ + time_update (EV_A_ 1e100); + + /* from now on, we want a pipe-wake-up */ + pipe_write_wanted = 1; + + ECB_MEMORY_FENCE; /* make sure pipe_write_wanted is visible before we check for potential skips */ + + if (expect_true (!(flags & EVRUN_NOWAIT || idleall || !activecnt || pipe_write_skipped))) + { + waittime = MAX_BLOCKTIME; + + if (timercnt) + { + ev_tstamp to = ANHE_at (timers [HEAP0]) - mn_now; + if (waittime > to) waittime = to; + } + +#if EV_PERIODIC_ENABLE + if (periodiccnt) + { + ev_tstamp to = ANHE_at (periodics [HEAP0]) - ev_rt_now; + if (waittime > to) waittime = to; + } +#endif + + /* don't let timeouts decrease the waittime below timeout_blocktime */ + if (expect_false (waittime < timeout_blocktime)) + waittime = timeout_blocktime; + + /* at this point, we NEED to wait, so we have to ensure */ + /* to pass a minimum nonzero value to the backend */ + if (expect_false (waittime < backend_mintime)) + waittime = backend_mintime; + + /* extra check because io_blocktime is commonly 0 */ + if (expect_false (io_blocktime)) + { + sleeptime = io_blocktime - (mn_now - prev_mn_now); + + if (sleeptime > waittime - backend_mintime) + sleeptime = waittime - backend_mintime; + + if (expect_true (sleeptime > 0.)) + { + ev_sleep (sleeptime); + waittime -= sleeptime; + } + } + } + +#if EV_FEATURE_API + ++loop_count; +#endif + assert ((loop_done = EVBREAK_RECURSE, 1)); /* assert for side effect */ + backend_poll (EV_A_ waittime); + assert ((loop_done = EVBREAK_CANCEL, 1)); /* assert for side effect */ + + pipe_write_wanted = 0; /* just an optimisation, no fence needed */ + + ECB_MEMORY_FENCE_ACQUIRE; + if (pipe_write_skipped) + { + assert (("libev: pipe_w not active, but pipe not written", ev_is_active (&pipe_w))); + ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM); + } + + + /* update ev_rt_now, do magic */ + time_update (EV_A_ waittime + sleeptime); + } + + /* queue pending timers and reschedule them */ + timers_reify (EV_A); /* relative timers called last */ +#if EV_PERIODIC_ENABLE + periodics_reify (EV_A); /* absolute timers called first */ +#endif + +#if EV_IDLE_ENABLE + /* queue idle watchers unless other events are pending */ + idle_reify (EV_A); +#endif + +#if EV_CHECK_ENABLE + /* queue check watchers, to be executed first */ + if (expect_false (checkcnt)) + queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); +#endif + + EV_INVOKE_PENDING; + } + while (expect_true ( + activecnt + && !loop_done + && !(flags & (EVRUN_ONCE | EVRUN_NOWAIT)) + )); + + if (loop_done == EVBREAK_ONE) + loop_done = EVBREAK_CANCEL; + +#if EV_FEATURE_API + --loop_depth; +#endif + + return activecnt; +} + +void +ev_break (EV_P_ int how) EV_THROW +{ + loop_done = how; +} + +void +ev_ref (EV_P) EV_THROW +{ + ++activecnt; +} + +void +ev_unref (EV_P) EV_THROW +{ + --activecnt; +} + +void +ev_now_update (EV_P) EV_THROW +{ + time_update (EV_A_ 1e100); +} + +void +ev_suspend (EV_P) EV_THROW +{ + ev_now_update (EV_A); +} + +void +ev_resume (EV_P) EV_THROW +{ + ev_tstamp mn_prev = mn_now; + + ev_now_update (EV_A); + timers_reschedule (EV_A_ mn_now - mn_prev); +#if EV_PERIODIC_ENABLE + /* TODO: really do this? */ + periodics_reschedule (EV_A); +#endif +} + +/*****************************************************************************/ +/* singly-linked list management, used when the expected list length is short */ + +inline_size void +wlist_add (WL *head, WL elem) +{ + elem->next = *head; + *head = elem; +} + +inline_size void +wlist_del (WL *head, WL elem) +{ + while (*head) + { + if (expect_true (*head == elem)) + { + *head = elem->next; + break; + } + + head = &(*head)->next; + } +} + +/* internal, faster, version of ev_clear_pending */ +inline_speed void +clear_pending (EV_P_ W w) +{ + if (w->pending) + { + pendings [ABSPRI (w)][w->pending - 1].w = (W)&pending_w; + w->pending = 0; + } +} + +int +ev_clear_pending (EV_P_ void *w) EV_THROW +{ + W w_ = (W)w; + int pending = w_->pending; + + if (expect_true (pending)) + { + ANPENDING *p = pendings [ABSPRI (w_)] + pending - 1; + p->w = (W)&pending_w; + w_->pending = 0; + return p->events; + } + else + return 0; +} + +inline_size void +pri_adjust (EV_P_ W w) +{ + int pri = ev_priority (w); + pri = pri < EV_MINPRI ? EV_MINPRI : pri; + pri = pri > EV_MAXPRI ? EV_MAXPRI : pri; + ev_set_priority (w, pri); +} + +inline_speed void +ev_start (EV_P_ W w, int active) +{ + pri_adjust (EV_A_ w); + w->active = active; + ev_ref (EV_A); +} + +inline_size void +ev_stop (EV_P_ W w) +{ + ev_unref (EV_A); + w->active = 0; +} + +/*****************************************************************************/ + +void noinline +ev_io_start (EV_P_ ev_io *w) EV_THROW +{ + int fd = w->fd; + + if (expect_false (ev_is_active (w))) + return; + + assert (("libev: ev_io_start called with negative fd", fd >= 0)); + assert (("libev: ev_io_start called with illegal event mask", !(w->events & ~(EV__IOFDSET | EV_READ | EV_WRITE)))); + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, 1); + array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero); + wlist_add (&anfds[fd].head, (WL)w); + + /* common bug, apparently */ + assert (("libev: ev_io_start called with corrupted watcher", ((WL)w)->next != (WL)w)); + + fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); + w->events &= ~EV__IOFDSET; + + EV_FREQUENT_CHECK; +} + +void noinline +ev_io_stop (EV_P_ ev_io *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + assert (("libev: ev_io_stop called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); + + EV_FREQUENT_CHECK; + + wlist_del (&anfds[w->fd].head, (WL)w); + ev_stop (EV_A_ (W)w); + + fd_change (EV_A_ w->fd, EV_ANFD_REIFY); + + EV_FREQUENT_CHECK; +} + +void noinline +ev_timer_start (EV_P_ ev_timer *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + ev_at (w) += mn_now; + + assert (("libev: ev_timer_start called with negative timer repeat value", w->repeat >= 0.)); + + EV_FREQUENT_CHECK; + + ++timercnt; + ev_start (EV_A_ (W)w, timercnt + HEAP0 - 1); + array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2); + ANHE_w (timers [ev_active (w)]) = (WT)w; + ANHE_at_cache (timers [ev_active (w)]); + upheap (timers, ev_active (w)); + + EV_FREQUENT_CHECK; + + /*assert (("libev: internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/ +} + +void noinline +ev_timer_stop (EV_P_ ev_timer *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + assert (("libev: internal timer heap corruption", ANHE_w (timers [active]) == (WT)w)); + + --timercnt; + + if (expect_true (active < timercnt + HEAP0)) + { + timers [active] = timers [timercnt + HEAP0]; + adjustheap (timers, timercnt, active); + } + } + + ev_at (w) -= mn_now; + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} + +void noinline +ev_timer_again (EV_P_ ev_timer *w) EV_THROW +{ + EV_FREQUENT_CHECK; + + clear_pending (EV_A_ (W)w); + + if (ev_is_active (w)) + { + if (w->repeat) + { + ev_at (w) = mn_now + w->repeat; + ANHE_at_cache (timers [ev_active (w)]); + adjustheap (timers, timercnt, ev_active (w)); + } + else + ev_timer_stop (EV_A_ w); + } + else if (w->repeat) + { + ev_at (w) = w->repeat; + ev_timer_start (EV_A_ w); + } + + EV_FREQUENT_CHECK; +} + +ev_tstamp +ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW +{ + return ev_at (w) - (ev_is_active (w) ? mn_now : 0.); +} + +#if EV_PERIODIC_ENABLE +void noinline +ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + if (w->reschedule_cb) + ev_at (w) = w->reschedule_cb (w, ev_rt_now); + else if (w->interval) + { + assert (("libev: ev_periodic_start called with negative interval value", w->interval >= 0.)); + periodic_recalc (EV_A_ w); + } + else + ev_at (w) = w->offset; + + EV_FREQUENT_CHECK; + + ++periodiccnt; + ev_start (EV_A_ (W)w, periodiccnt + HEAP0 - 1); + array_needsize (ANHE, periodics, periodicmax, ev_active (w) + 1, EMPTY2); + ANHE_w (periodics [ev_active (w)]) = (WT)w; + ANHE_at_cache (periodics [ev_active (w)]); + upheap (periodics, ev_active (w)); + + EV_FREQUENT_CHECK; + + /*assert (("libev: internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/ +} + +void noinline +ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + assert (("libev: internal periodic heap corruption", ANHE_w (periodics [active]) == (WT)w)); + + --periodiccnt; + + if (expect_true (active < periodiccnt + HEAP0)) + { + periodics [active] = periodics [periodiccnt + HEAP0]; + adjustheap (periodics, periodiccnt, active); + } + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} + +void noinline +ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW +{ + /* TODO: use adjustheap and recalculation */ + ev_periodic_stop (EV_A_ w); + ev_periodic_start (EV_A_ w); +} +#endif + +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + +#if EV_SIGNAL_ENABLE + +void noinline +ev_signal_start (EV_P_ ev_signal *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG)); + +#if EV_MULTIPLICITY + assert (("libev: a signal must not be attached to two different loops", + !signals [w->signum - 1].loop || signals [w->signum - 1].loop == loop)); + + signals [w->signum - 1].loop = EV_A; +#endif + + EV_FREQUENT_CHECK; + +#if EV_USE_SIGNALFD + if (sigfd == -2) + { + sigfd = signalfd (-1, &sigfd_set, SFD_NONBLOCK | SFD_CLOEXEC); + if (sigfd < 0 && errno == EINVAL) + sigfd = signalfd (-1, &sigfd_set, 0); /* retry without flags */ + + if (sigfd >= 0) + { + fd_intern (sigfd); /* doing it twice will not hurt */ + + sigemptyset (&sigfd_set); + + ev_io_init (&sigfd_w, sigfdcb, sigfd, EV_READ); + ev_set_priority (&sigfd_w, EV_MAXPRI); + ev_io_start (EV_A_ &sigfd_w); + ev_unref (EV_A); /* signalfd watcher should not keep loop alive */ + } + } + + if (sigfd >= 0) + { + /* TODO: check .head */ + sigaddset (&sigfd_set, w->signum); + sigprocmask (SIG_BLOCK, &sigfd_set, 0); + + signalfd (sigfd, &sigfd_set, 0); + } +#endif + + ev_start (EV_A_ (W)w, 1); + wlist_add (&signals [w->signum - 1].head, (WL)w); + + if (!((WL)w)->next) +# if EV_USE_SIGNALFD + if (sigfd < 0) /*TODO*/ +# endif + { +# ifdef _WIN32 + evpipe_init (EV_A); + + signal (w->signum, ev_sighandler); +# else + struct sigaction sa; + + evpipe_init (EV_A); + + sa.sa_handler = ev_sighandler; + sigfillset (&sa.sa_mask); + sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */ + sigaction (w->signum, &sa, 0); + + if (origflags & EVFLAG_NOSIGMASK) + { + sigemptyset (&sa.sa_mask); + sigaddset (&sa.sa_mask, w->signum); + sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0); + } +#endif + } + + EV_FREQUENT_CHECK; +} + +void noinline +ev_signal_stop (EV_P_ ev_signal *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + wlist_del (&signals [w->signum - 1].head, (WL)w); + ev_stop (EV_A_ (W)w); + + if (!signals [w->signum - 1].head) + { +#if EV_MULTIPLICITY + signals [w->signum - 1].loop = 0; /* unattach from signal */ +#endif +#if EV_USE_SIGNALFD + if (sigfd >= 0) + { + sigset_t ss; + + sigemptyset (&ss); + sigaddset (&ss, w->signum); + sigdelset (&sigfd_set, w->signum); + + signalfd (sigfd, &sigfd_set, 0); + sigprocmask (SIG_UNBLOCK, &ss, 0); + } + else +#endif + signal (w->signum, SIG_DFL); + } + + EV_FREQUENT_CHECK; +} + +#endif + +#if EV_CHILD_ENABLE + +void +ev_child_start (EV_P_ ev_child *w) EV_THROW +{ +#if EV_MULTIPLICITY + assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr)); +#endif + if (expect_false (ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, 1); + wlist_add (&childs [w->pid & ((EV_PID_HASHSIZE) - 1)], (WL)w); + + EV_FREQUENT_CHECK; +} + +void +ev_child_stop (EV_P_ ev_child *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + wlist_del (&childs [w->pid & ((EV_PID_HASHSIZE) - 1)], (WL)w); + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} + +#endif + +#if EV_STAT_ENABLE + +# ifdef _WIN32 +# undef lstat +# define lstat(a,b) _stati64 (a,b) +# endif + +#define DEF_STAT_INTERVAL 5.0074891 +#define NFS_STAT_INTERVAL 30.1074891 /* for filesystems potentially failing inotify */ +#define MIN_STAT_INTERVAL 0.1074891 + +static void noinline stat_timer_cb (EV_P_ ev_timer *w_, int revents); + +#if EV_USE_INOTIFY + +/* the * 2 is to allow for alignment padding, which for some reason is >> 8 */ +# define EV_INOTIFY_BUFSIZE (sizeof (struct inotify_event) * 2 + NAME_MAX) + +static void noinline +infy_add (EV_P_ ev_stat *w) +{ + w->wd = inotify_add_watch (fs_fd, w->path, IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF | IN_MODIFY | IN_DONT_FOLLOW | IN_MASK_ADD); + + if (w->wd >= 0) + { + struct statfs sfs; + + /* now local changes will be tracked by inotify, but remote changes won't */ + /* unless the filesystem is known to be local, we therefore still poll */ + /* also do poll on <2.6.25, but with normal frequency */ + + if (!fs_2625) + w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL; + else if (!statfs (w->path, &sfs) + && (sfs.f_type == 0x1373 /* devfs */ + || sfs.f_type == 0xEF53 /* ext2/3 */ + || sfs.f_type == 0x3153464a /* jfs */ + || sfs.f_type == 0x52654973 /* reiser3 */ + || sfs.f_type == 0x01021994 /* tempfs */ + || sfs.f_type == 0x58465342 /* xfs */)) + w->timer.repeat = 0.; /* filesystem is local, kernel new enough */ + else + w->timer.repeat = w->interval ? w->interval : NFS_STAT_INTERVAL; /* remote, use reduced frequency */ + } + else + { + /* can't use inotify, continue to stat */ + w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL; + + /* if path is not there, monitor some parent directory for speedup hints */ + /* note that exceeding the hardcoded path limit is not a correctness issue, */ + /* but an efficiency issue only */ + if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) + { + char path [4096]; + strcpy (path, w->path); + + do + { + int mask = IN_MASK_ADD | IN_DELETE_SELF | IN_MOVE_SELF + | (errno == EACCES ? IN_ATTRIB : IN_CREATE | IN_MOVED_TO); + + char *pend = strrchr (path, '/'); + + if (!pend || pend == path) + break; + + *pend = 0; + w->wd = inotify_add_watch (fs_fd, path, mask); + } + while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); + } + } + + if (w->wd >= 0) + wlist_add (&fs_hash [w->wd & ((EV_INOTIFY_HASHSIZE) - 1)].head, (WL)w); + + /* now re-arm timer, if required */ + if (ev_is_active (&w->timer)) ev_ref (EV_A); + ev_timer_again (EV_A_ &w->timer); + if (ev_is_active (&w->timer)) ev_unref (EV_A); +} + +static void noinline +infy_del (EV_P_ ev_stat *w) +{ + int slot; + int wd = w->wd; + + if (wd < 0) + return; + + w->wd = -2; + slot = wd & ((EV_INOTIFY_HASHSIZE) - 1); + wlist_del (&fs_hash [slot].head, (WL)w); + + /* remove this watcher, if others are watching it, they will rearm */ + inotify_rm_watch (fs_fd, wd); +} + +static void noinline +infy_wd (EV_P_ int slot, int wd, struct inotify_event *ev) +{ + if (slot < 0) + /* overflow, need to check for all hash slots */ + for (slot = 0; slot < (EV_INOTIFY_HASHSIZE); ++slot) + infy_wd (EV_A_ slot, wd, ev); + else + { + WL w_; + + for (w_ = fs_hash [slot & ((EV_INOTIFY_HASHSIZE) - 1)].head; w_; ) + { + ev_stat *w = (ev_stat *)w_; + w_ = w_->next; /* lets us remove this watcher and all before it */ + + if (w->wd == wd || wd == -1) + { + if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF)) + { + wlist_del (&fs_hash [slot & ((EV_INOTIFY_HASHSIZE) - 1)].head, (WL)w); + w->wd = -1; + infy_add (EV_A_ w); /* re-add, no matter what */ + } + + stat_timer_cb (EV_A_ &w->timer, 0); + } + } + } +} + +static void +infy_cb (EV_P_ ev_io *w, int revents) +{ + char buf [EV_INOTIFY_BUFSIZE]; + int ofs; + int len = read (fs_fd, buf, sizeof (buf)); + + for (ofs = 0; ofs < len; ) + { + struct inotify_event *ev = (struct inotify_event *)(buf + ofs); + infy_wd (EV_A_ ev->wd, ev->wd, ev); + ofs += sizeof (struct inotify_event) + ev->len; + } +} + +inline_size void ecb_cold +ev_check_2625 (EV_P) +{ + /* kernels < 2.6.25 are borked + * http://www.ussg.indiana.edu/hypermail/linux/kernel/0711.3/1208.html + */ + if (ev_linux_version () < 0x020619) + return; + + fs_2625 = 1; +} + +inline_size int +infy_newfd (void) +{ +#if defined IN_CLOEXEC && defined IN_NONBLOCK + int fd = inotify_init1 (IN_CLOEXEC | IN_NONBLOCK); + if (fd >= 0) + return fd; +#endif + return inotify_init (); +} + +inline_size void +infy_init (EV_P) +{ + if (fs_fd != -2) + return; + + fs_fd = -1; + + ev_check_2625 (EV_A); + + fs_fd = infy_newfd (); + + if (fs_fd >= 0) + { + fd_intern (fs_fd); + ev_io_init (&fs_w, infy_cb, fs_fd, EV_READ); + ev_set_priority (&fs_w, EV_MAXPRI); + ev_io_start (EV_A_ &fs_w); + ev_unref (EV_A); + } +} + +inline_size void +infy_fork (EV_P) +{ + int slot; + + if (fs_fd < 0) + return; + + ev_ref (EV_A); + ev_io_stop (EV_A_ &fs_w); + close (fs_fd); + fs_fd = infy_newfd (); + + if (fs_fd >= 0) + { + fd_intern (fs_fd); + ev_io_set (&fs_w, fs_fd, EV_READ); + ev_io_start (EV_A_ &fs_w); + ev_unref (EV_A); + } + + for (slot = 0; slot < (EV_INOTIFY_HASHSIZE); ++slot) + { + WL w_ = fs_hash [slot].head; + fs_hash [slot].head = 0; + + while (w_) + { + ev_stat *w = (ev_stat *)w_; + w_ = w_->next; /* lets us add this watcher */ + + w->wd = -1; + + if (fs_fd >= 0) + infy_add (EV_A_ w); /* re-add, no matter what */ + else + { + w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL; + if (ev_is_active (&w->timer)) ev_ref (EV_A); + ev_timer_again (EV_A_ &w->timer); + if (ev_is_active (&w->timer)) ev_unref (EV_A); + } + } + } +} + +#endif + +#ifdef _WIN32 +# define EV_LSTAT(p,b) _stati64 (p, b) +#else +# define EV_LSTAT(p,b) lstat (p, b) +#endif + +void +ev_stat_stat (EV_P_ ev_stat *w) EV_THROW +{ + if (lstat (w->path, &w->attr) < 0) + w->attr.st_nlink = 0; + else if (!w->attr.st_nlink) + w->attr.st_nlink = 1; +} + +static void noinline +stat_timer_cb (EV_P_ ev_timer *w_, int revents) +{ + ev_stat *w = (ev_stat *)(((char *)w_) - offsetof (ev_stat, timer)); + + ev_statdata prev = w->attr; + ev_stat_stat (EV_A_ w); + + /* memcmp doesn't work on netbsd, they.... do stuff to their struct stat */ + if ( + prev.st_dev != w->attr.st_dev + || prev.st_ino != w->attr.st_ino + || prev.st_mode != w->attr.st_mode + || prev.st_nlink != w->attr.st_nlink + || prev.st_uid != w->attr.st_uid + || prev.st_gid != w->attr.st_gid + || prev.st_rdev != w->attr.st_rdev + || prev.st_size != w->attr.st_size + || prev.st_atime != w->attr.st_atime + || prev.st_mtime != w->attr.st_mtime + || prev.st_ctime != w->attr.st_ctime + ) { + /* we only update w->prev on actual differences */ + /* in case we test more often than invoke the callback, */ + /* to ensure that prev is always different to attr */ + w->prev = prev; + + #if EV_USE_INOTIFY + if (fs_fd >= 0) + { + infy_del (EV_A_ w); + infy_add (EV_A_ w); + ev_stat_stat (EV_A_ w); /* avoid race... */ + } + #endif + + ev_feed_event (EV_A_ w, EV_STAT); + } +} + +void +ev_stat_start (EV_P_ ev_stat *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + ev_stat_stat (EV_A_ w); + + if (w->interval < MIN_STAT_INTERVAL && w->interval) + w->interval = MIN_STAT_INTERVAL; + + ev_timer_init (&w->timer, stat_timer_cb, 0., w->interval ? w->interval : DEF_STAT_INTERVAL); + ev_set_priority (&w->timer, ev_priority (w)); + +#if EV_USE_INOTIFY + infy_init (EV_A); + + if (fs_fd >= 0) + infy_add (EV_A_ w); + else +#endif + { + ev_timer_again (EV_A_ &w->timer); + ev_unref (EV_A); + } + + ev_start (EV_A_ (W)w, 1); + + EV_FREQUENT_CHECK; +} + +void +ev_stat_stop (EV_P_ ev_stat *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + +#if EV_USE_INOTIFY + infy_del (EV_A_ w); +#endif + + if (ev_is_active (&w->timer)) + { + ev_ref (EV_A); + ev_timer_stop (EV_A_ &w->timer); + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_IDLE_ENABLE +void +ev_idle_start (EV_P_ ev_idle *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + pri_adjust (EV_A_ (W)w); + + EV_FREQUENT_CHECK; + + { + int active = ++idlecnt [ABSPRI (w)]; + + ++idleall; + ev_start (EV_A_ (W)w, active); + + array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2); + idles [ABSPRI (w)][active - 1] = w; + } + + EV_FREQUENT_CHECK; +} + +void +ev_idle_stop (EV_P_ ev_idle *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + idles [ABSPRI (w)][active - 1] = idles [ABSPRI (w)][--idlecnt [ABSPRI (w)]]; + ev_active (idles [ABSPRI (w)][active - 1]) = active; + + ev_stop (EV_A_ (W)w); + --idleall; + } + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_PREPARE_ENABLE +void +ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, ++preparecnt); + array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2); + prepares [preparecnt - 1] = w; + + EV_FREQUENT_CHECK; +} + +void +ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + prepares [active - 1] = prepares [--preparecnt]; + ev_active (prepares [active - 1]) = active; + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_CHECK_ENABLE +void +ev_check_start (EV_P_ ev_check *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, ++checkcnt); + array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2); + checks [checkcnt - 1] = w; + + EV_FREQUENT_CHECK; +} + +void +ev_check_stop (EV_P_ ev_check *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + checks [active - 1] = checks [--checkcnt]; + ev_active (checks [active - 1]) = active; + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_EMBED_ENABLE +void noinline +ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW +{ + ev_run (w->other, EVRUN_NOWAIT); +} + +static void +embed_io_cb (EV_P_ ev_io *io, int revents) +{ + ev_embed *w = (ev_embed *)(((char *)io) - offsetof (ev_embed, io)); + + if (ev_cb (w)) + ev_feed_event (EV_A_ (W)w, EV_EMBED); + else + ev_run (w->other, EVRUN_NOWAIT); +} + +static void +embed_prepare_cb (EV_P_ ev_prepare *prepare, int revents) +{ + ev_embed *w = (ev_embed *)(((char *)prepare) - offsetof (ev_embed, prepare)); + + { + EV_P = w->other; + + while (fdchangecnt) + { + fd_reify (EV_A); + ev_run (EV_A_ EVRUN_NOWAIT); + } + } +} + +static void +embed_fork_cb (EV_P_ ev_fork *fork_w, int revents) +{ + ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork)); + + ev_embed_stop (EV_A_ w); + + { + EV_P = w->other; + + ev_loop_fork (EV_A); + ev_run (EV_A_ EVRUN_NOWAIT); + } + + ev_embed_start (EV_A_ w); +} + +#if 0 +static void +embed_idle_cb (EV_P_ ev_idle *idle, int revents) +{ + ev_idle_stop (EV_A_ idle); +} +#endif + +void +ev_embed_start (EV_P_ ev_embed *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + { + EV_P = w->other; + assert (("libev: loop to be embedded is not embeddable", backend & ev_embeddable_backends ())); + ev_io_init (&w->io, embed_io_cb, backend_fd, EV_READ); + } + + EV_FREQUENT_CHECK; + + ev_set_priority (&w->io, ev_priority (w)); + ev_io_start (EV_A_ &w->io); + + ev_prepare_init (&w->prepare, embed_prepare_cb); + ev_set_priority (&w->prepare, EV_MINPRI); + ev_prepare_start (EV_A_ &w->prepare); + + ev_fork_init (&w->fork, embed_fork_cb); + ev_fork_start (EV_A_ &w->fork); + + /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ + + ev_start (EV_A_ (W)w, 1); + + EV_FREQUENT_CHECK; +} + +void +ev_embed_stop (EV_P_ ev_embed *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_io_stop (EV_A_ &w->io); + ev_prepare_stop (EV_A_ &w->prepare); + ev_fork_stop (EV_A_ &w->fork); + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_FORK_ENABLE +void +ev_fork_start (EV_P_ ev_fork *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, ++forkcnt); + array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2); + forks [forkcnt - 1] = w; + + EV_FREQUENT_CHECK; +} + +void +ev_fork_stop (EV_P_ ev_fork *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + forks [active - 1] = forks [--forkcnt]; + ev_active (forks [active - 1]) = active; + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_CLEANUP_ENABLE +void +ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, ++cleanupcnt); + array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); + cleanups [cleanupcnt - 1] = w; + + /* cleanup watchers should never keep a refcount on the loop */ + ev_unref (EV_A); + EV_FREQUENT_CHECK; +} + +void +ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + ev_ref (EV_A); + + { + int active = ev_active (w); + + cleanups [active - 1] = cleanups [--cleanupcnt]; + ev_active (cleanups [active - 1]) = active; + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} +#endif + +#if EV_ASYNC_ENABLE +void +ev_async_start (EV_P_ ev_async *w) EV_THROW +{ + if (expect_false (ev_is_active (w))) + return; + + w->sent = 0; + + evpipe_init (EV_A); + + EV_FREQUENT_CHECK; + + ev_start (EV_A_ (W)w, ++asynccnt); + array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2); + asyncs [asynccnt - 1] = w; + + EV_FREQUENT_CHECK; +} + +void +ev_async_stop (EV_P_ ev_async *w) EV_THROW +{ + clear_pending (EV_A_ (W)w); + if (expect_false (!ev_is_active (w))) + return; + + EV_FREQUENT_CHECK; + + { + int active = ev_active (w); + + asyncs [active - 1] = asyncs [--asynccnt]; + ev_active (asyncs [active - 1]) = active; + } + + ev_stop (EV_A_ (W)w); + + EV_FREQUENT_CHECK; +} + +void +ev_async_send (EV_P_ ev_async *w) EV_THROW +{ + w->sent = 1; + evpipe_write (EV_A_ &async_pending); +} +#endif + +/*****************************************************************************/ + +struct ev_once +{ + ev_io io; + ev_timer to; + void (*cb)(int revents, void *arg); + void *arg; +}; + +static void +once_cb (EV_P_ struct ev_once *once, int revents) +{ + void (*cb)(int revents, void *arg) = once->cb; + void *arg = once->arg; + + ev_io_stop (EV_A_ &once->io); + ev_timer_stop (EV_A_ &once->to); + ev_free (once); + + cb (revents, arg); +} + +static void +once_cb_io (EV_P_ ev_io *w, int revents) +{ + struct ev_once *once = (struct ev_once *)(((char *)w) - offsetof (struct ev_once, io)); + + once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->to)); +} + +static void +once_cb_to (EV_P_ ev_timer *w, int revents) +{ + struct ev_once *once = (struct ev_once *)(((char *)w) - offsetof (struct ev_once, to)); + + once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->io)); +} + +void +ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW +{ + struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once)); + + if (expect_false (!once)) + { + cb (EV_ERROR | EV_READ | EV_WRITE | EV_TIMER, arg); + return; + } + + once->cb = cb; + once->arg = arg; + + ev_init (&once->io, once_cb_io); + if (fd >= 0) + { + ev_io_set (&once->io, fd, events); + ev_io_start (EV_A_ &once->io); + } + + ev_init (&once->to, once_cb_to); + if (timeout >= 0.) + { + ev_timer_set (&once->to, timeout, 0.); + ev_timer_start (EV_A_ &once->to); + } +} + +/*****************************************************************************/ + +#if EV_WALK_ENABLE +void ecb_cold +ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW +{ + int i, j; + ev_watcher_list *wl, *wn; + + if (types & (EV_IO | EV_EMBED)) + for (i = 0; i < anfdmax; ++i) + for (wl = anfds [i].head; wl; ) + { + wn = wl->next; + +#if EV_EMBED_ENABLE + if (ev_cb ((ev_io *)wl) == embed_io_cb) + { + if (types & EV_EMBED) + cb (EV_A_ EV_EMBED, ((char *)wl) - offsetof (struct ev_embed, io)); + } + else +#endif +#if EV_USE_INOTIFY + if (ev_cb ((ev_io *)wl) == infy_cb) + ; + else +#endif + if ((ev_io *)wl != &pipe_w) + if (types & EV_IO) + cb (EV_A_ EV_IO, wl); + + wl = wn; + } + + if (types & (EV_TIMER | EV_STAT)) + for (i = timercnt + HEAP0; i-- > HEAP0; ) +#if EV_STAT_ENABLE + /*TODO: timer is not always active*/ + if (ev_cb ((ev_timer *)ANHE_w (timers [i])) == stat_timer_cb) + { + if (types & EV_STAT) + cb (EV_A_ EV_STAT, ((char *)ANHE_w (timers [i])) - offsetof (struct ev_stat, timer)); + } + else +#endif + if (types & EV_TIMER) + cb (EV_A_ EV_TIMER, ANHE_w (timers [i])); + +#if EV_PERIODIC_ENABLE + if (types & EV_PERIODIC) + for (i = periodiccnt + HEAP0; i-- > HEAP0; ) + cb (EV_A_ EV_PERIODIC, ANHE_w (periodics [i])); +#endif + +#if EV_IDLE_ENABLE + if (types & EV_IDLE) + for (j = NUMPRI; j--; ) + for (i = idlecnt [j]; i--; ) + cb (EV_A_ EV_IDLE, idles [j][i]); +#endif + +#if EV_FORK_ENABLE + if (types & EV_FORK) + for (i = forkcnt; i--; ) + if (ev_cb (forks [i]) != embed_fork_cb) + cb (EV_A_ EV_FORK, forks [i]); +#endif + +#if EV_ASYNC_ENABLE + if (types & EV_ASYNC) + for (i = asynccnt; i--; ) + cb (EV_A_ EV_ASYNC, asyncs [i]); +#endif + +#if EV_PREPARE_ENABLE + if (types & EV_PREPARE) + for (i = preparecnt; i--; ) +# if EV_EMBED_ENABLE + if (ev_cb (prepares [i]) != embed_prepare_cb) +# endif + cb (EV_A_ EV_PREPARE, prepares [i]); +#endif + +#if EV_CHECK_ENABLE + if (types & EV_CHECK) + for (i = checkcnt; i--; ) + cb (EV_A_ EV_CHECK, checks [i]); +#endif + +#if EV_SIGNAL_ENABLE + if (types & EV_SIGNAL) + for (i = 0; i < EV_NSIG - 1; ++i) + for (wl = signals [i].head; wl; ) + { + wn = wl->next; + cb (EV_A_ EV_SIGNAL, wl); + wl = wn; + } +#endif + +#if EV_CHILD_ENABLE + if (types & EV_CHILD) + for (i = (EV_PID_HASHSIZE); i--; ) + for (wl = childs [i]; wl; ) + { + wn = wl->next; + cb (EV_A_ EV_CHILD, wl); + wl = wn; + } +#endif +/* EV_STAT 0x00001000 /* stat data changed */ +/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */ +} +#endif + +#if EV_MULTIPLICITY + #include "ev_wrap.h" +#endif + diff -Nru python-gevent-0.13.7/libev/ev_epoll.c python-gevent-1.0/libev/ev_epoll.c --- python-gevent-0.13.7/libev/ev_epoll.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_epoll.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,279 @@ +/* + * libev epoll fd activity backend + * + * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +/* + * general notes about epoll: + * + * a) epoll silently removes fds from the fd set. as nothing tells us + * that an fd has been removed otherwise, we have to continually + * "rearm" fds that we suspect *might* have changed (same + * problem with kqueue, but much less costly there). + * b) the fact that ADD != MOD creates a lot of extra syscalls due to a) + * and seems not to have any advantage. + * c) the inability to handle fork or file descriptors (think dup) + * limits the applicability over poll, so this is not a generic + * poll replacement. + * d) epoll doesn't work the same as select with many file descriptors + * (such as files). while not critical, no other advanced interface + * seems to share this (rather non-unixy) limitation. + * e) epoll claims to be embeddable, but in practise you never get + * a ready event for the epoll fd (broken: <=2.6.26, working: >=2.6.32). + * f) epoll_ctl returning EPERM means the fd is always ready. + * + * lots of "weird code" and complication handling in this file is due + * to these design problems with epoll, as we try very hard to avoid + * epoll_ctl syscalls for common usage patterns and handle the breakage + * ensuing from receiving events for closed and otherwise long gone + * file descriptors. + */ + +#include + +#define EV_EMASK_EPERM 0x80 + +static void +epoll_modify (EV_P_ int fd, int oev, int nev) +{ + struct epoll_event ev; + unsigned char oldmask; + + /* + * we handle EPOLL_CTL_DEL by ignoring it here + * on the assumption that the fd is gone anyways + * if that is wrong, we have to handle the spurious + * event in epoll_poll. + * if the fd is added again, we try to ADD it, and, if that + * fails, we assume it still has the same eventmask. + */ + if (!nev) + return; + + oldmask = anfds [fd].emask; + anfds [fd].emask = nev; + + /* store the generation counter in the upper 32 bits, the fd in the lower 32 bits */ + ev.data.u64 = (uint64_t)(uint32_t)fd + | ((uint64_t)(uint32_t)++anfds [fd].egen << 32); + ev.events = (nev & EV_READ ? EPOLLIN : 0) + | (nev & EV_WRITE ? EPOLLOUT : 0); + + if (expect_true (!epoll_ctl (backend_fd, oev && oldmask != nev ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, fd, &ev))) + return; + + if (expect_true (errno == ENOENT)) + { + /* if ENOENT then the fd went away, so try to do the right thing */ + if (!nev) + goto dec_egen; + + if (!epoll_ctl (backend_fd, EPOLL_CTL_ADD, fd, &ev)) + return; + } + else if (expect_true (errno == EEXIST)) + { + /* EEXIST means we ignored a previous DEL, but the fd is still active */ + /* if the kernel mask is the same as the new mask, we assume it hasn't changed */ + if (oldmask == nev) + goto dec_egen; + + if (!epoll_ctl (backend_fd, EPOLL_CTL_MOD, fd, &ev)) + return; + } + else if (expect_true (errno == EPERM)) + { + /* EPERM means the fd is always ready, but epoll is too snobbish */ + /* to handle it, unlike select or poll. */ + anfds [fd].emask = EV_EMASK_EPERM; + + /* add fd to epoll_eperms, if not already inside */ + if (!(oldmask & EV_EMASK_EPERM)) + { + array_needsize (int, epoll_eperms, epoll_epermmax, epoll_epermcnt + 1, EMPTY2); + epoll_eperms [epoll_epermcnt++] = fd; + } + + return; + } + + fd_kill (EV_A_ fd); + +dec_egen: + /* we didn't successfully call epoll_ctl, so decrement the generation counter again */ + --anfds [fd].egen; +} + +static void +epoll_poll (EV_P_ ev_tstamp timeout) +{ + int i; + int eventcnt; + + if (expect_false (epoll_epermcnt)) + timeout = 0.; + + /* epoll wait times cannot be larger than (LONG_MAX - 999UL) / HZ msecs, which is below */ + /* the default libev max wait time, however. */ + EV_RELEASE_CB; + eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax, timeout * 1e3); + EV_ACQUIRE_CB; + + if (expect_false (eventcnt < 0)) + { + if (errno != EINTR) + ev_syserr ("(libev) epoll_wait"); + + return; + } + + for (i = 0; i < eventcnt; ++i) + { + struct epoll_event *ev = epoll_events + i; + + int fd = (uint32_t)ev->data.u64; /* mask out the lower 32 bits */ + int want = anfds [fd].events; + int got = (ev->events & (EPOLLOUT | EPOLLERR | EPOLLHUP) ? EV_WRITE : 0) + | (ev->events & (EPOLLIN | EPOLLERR | EPOLLHUP) ? EV_READ : 0); + + /* + * check for spurious notification. + * this only finds spurious notifications on egen updates + * other spurious notifications will be found by epoll_ctl, below + * we assume that fd is always in range, as we never shrink the anfds array + */ + if (expect_false ((uint32_t)anfds [fd].egen != (uint32_t)(ev->data.u64 >> 32))) + { + /* recreate kernel state */ + postfork = 1; + continue; + } + + if (expect_false (got & ~want)) + { + anfds [fd].emask = want; + + /* + * we received an event but are not interested in it, try mod or del + * this often happens because we optimistically do not unregister fds + * when we are no longer interested in them, but also when we get spurious + * notifications for fds from another process. this is partially handled + * above with the gencounter check (== our fd is not the event fd), and + * partially here, when epoll_ctl returns an error (== a child has the fd + * but we closed it). + */ + ev->events = (want & EV_READ ? EPOLLIN : 0) + | (want & EV_WRITE ? EPOLLOUT : 0); + + /* pre-2.6.9 kernels require a non-null pointer with EPOLL_CTL_DEL, */ + /* which is fortunately easy to do for us. */ + if (epoll_ctl (backend_fd, want ? EPOLL_CTL_MOD : EPOLL_CTL_DEL, fd, ev)) + { + postfork = 1; /* an error occurred, recreate kernel state */ + continue; + } + } + + fd_event (EV_A_ fd, got); + } + + /* if the receive array was full, increase its size */ + if (expect_false (eventcnt == epoll_eventmax)) + { + ev_free (epoll_events); + epoll_eventmax = array_nextsize (sizeof (struct epoll_event), epoll_eventmax, epoll_eventmax + 1); + epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); + } + + /* now synthesize events for all fds where epoll fails, while select works... */ + for (i = epoll_epermcnt; i--; ) + { + int fd = epoll_eperms [i]; + unsigned char events = anfds [fd].events & (EV_READ | EV_WRITE); + + if (anfds [fd].emask & EV_EMASK_EPERM && events) + fd_event (EV_A_ fd, events); + else + epoll_eperms [i] = epoll_eperms [--epoll_epermcnt]; + } +} + +int inline_size +epoll_init (EV_P_ int flags) +{ +#ifdef EPOLL_CLOEXEC + backend_fd = epoll_create1 (EPOLL_CLOEXEC); + + if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS)) +#endif + backend_fd = epoll_create (256); + + if (backend_fd < 0) + return 0; + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); + + backend_mintime = 1e-3; /* epoll does sometimes return early, this is just to avoid the worst */ + backend_modify = epoll_modify; + backend_poll = epoll_poll; + + epoll_eventmax = 64; /* initial number of events receivable per poll */ + epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); + + return EVBACKEND_EPOLL; +} + +void inline_size +epoll_destroy (EV_P) +{ + ev_free (epoll_events); + array_free (epoll_eperm, EMPTY); +} + +void inline_size +epoll_fork (EV_P) +{ + close (backend_fd); + + while ((backend_fd = epoll_create (256)) < 0) + ev_syserr ("(libev) epoll_create"); + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); + + fd_rearm_all (EV_A); +} + diff -Nru python-gevent-0.13.7/libev/ev.h python-gevent-1.0/libev/ev.h --- python-gevent-0.13.7/libev/ev.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,845 @@ +/* + * libev native API header + * + * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef EV_H_ +#define EV_H_ + +#ifdef __cplusplus +# define EV_CPP(x) x +#else +# define EV_CPP(x) +#endif + +#define EV_THROW EV_CPP(throw()) + +EV_CPP(extern "C" {) + +/*****************************************************************************/ + +/* pre-4.0 compatibility */ +#ifndef EV_COMPAT3 +# define EV_COMPAT3 1 +#endif + +#ifndef EV_FEATURES +# if defined __OPTIMIZE_SIZE__ +# define EV_FEATURES 0x7c +# else +# define EV_FEATURES 0x7f +# endif +#endif + +#define EV_FEATURE_CODE ((EV_FEATURES) & 1) +#define EV_FEATURE_DATA ((EV_FEATURES) & 2) +#define EV_FEATURE_CONFIG ((EV_FEATURES) & 4) +#define EV_FEATURE_API ((EV_FEATURES) & 8) +#define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16) +#define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32) +#define EV_FEATURE_OS ((EV_FEATURES) & 64) + +/* these priorities are inclusive, higher priorities will be invoked earlier */ +#ifndef EV_MINPRI +# define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0) +#endif +#ifndef EV_MAXPRI +# define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0) +#endif + +#ifndef EV_MULTIPLICITY +# define EV_MULTIPLICITY EV_FEATURE_CONFIG +#endif + +#ifndef EV_PERIODIC_ENABLE +# define EV_PERIODIC_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_STAT_ENABLE +# define EV_STAT_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_PREPARE_ENABLE +# define EV_PREPARE_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_CHECK_ENABLE +# define EV_CHECK_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_IDLE_ENABLE +# define EV_IDLE_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_FORK_ENABLE +# define EV_FORK_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_CLEANUP_ENABLE +# define EV_CLEANUP_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_SIGNAL_ENABLE +# define EV_SIGNAL_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_CHILD_ENABLE +# ifdef _WIN32 +# define EV_CHILD_ENABLE 0 +# else +# define EV_CHILD_ENABLE EV_FEATURE_WATCHERS +#endif +#endif + +#ifndef EV_ASYNC_ENABLE +# define EV_ASYNC_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_EMBED_ENABLE +# define EV_EMBED_ENABLE EV_FEATURE_WATCHERS +#endif + +#ifndef EV_WALK_ENABLE +# define EV_WALK_ENABLE 0 /* not yet */ +#endif + +/*****************************************************************************/ + +#if EV_CHILD_ENABLE && !EV_SIGNAL_ENABLE +# undef EV_SIGNAL_ENABLE +# define EV_SIGNAL_ENABLE 1 +#endif + +/*****************************************************************************/ + +typedef double ev_tstamp; + +#ifndef EV_ATOMIC_T +# include +# define EV_ATOMIC_T sig_atomic_t volatile +#endif + +#if EV_STAT_ENABLE +# ifdef _WIN32 +# include +# include +# endif +# include +#endif + +/* support multiple event loops? */ +#if EV_MULTIPLICITY +struct ev_loop; +# define EV_P struct ev_loop *loop /* a loop as sole parameter in a declaration */ +# define EV_P_ EV_P, /* a loop as first of multiple parameters */ +# define EV_A loop /* a loop as sole argument to a function call */ +# define EV_A_ EV_A, /* a loop as first of multiple arguments */ +# define EV_DEFAULT_UC ev_default_loop_uc_ () /* the default loop, if initialised, as sole arg */ +# define EV_DEFAULT_UC_ EV_DEFAULT_UC, /* the default loop as first of multiple arguments */ +# define EV_DEFAULT ev_default_loop (0) /* the default loop as sole arg */ +# define EV_DEFAULT_ EV_DEFAULT, /* the default loop as first of multiple arguments */ +#else +# define EV_P void +# define EV_P_ +# define EV_A +# define EV_A_ +# define EV_DEFAULT +# define EV_DEFAULT_ +# define EV_DEFAULT_UC +# define EV_DEFAULT_UC_ +# undef EV_EMBED_ENABLE +#endif + +/* EV_INLINE is used for functions in header files */ +#if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3 +# define EV_INLINE static inline +#else +# define EV_INLINE static +#endif + +#ifdef EV_API_STATIC +# define EV_API_DECL static +#else +# define EV_API_DECL extern +#endif + +/* EV_PROTOTYPES can be used to switch of prototype declarations */ +#ifndef EV_PROTOTYPES +# define EV_PROTOTYPES 1 +#endif + +/*****************************************************************************/ + +#define EV_VERSION_MAJOR 4 +#define EV_VERSION_MINOR 11 + +/* eventmask, revents, events... */ +enum { + EV_UNDEF = 0xFFFFFFFF, /* guaranteed to be invalid */ + EV_NONE = 0x00, /* no events */ + EV_READ = 0x01, /* ev_io detected read will not block */ + EV_WRITE = 0x02, /* ev_io detected write will not block */ + EV__IOFDSET = 0x80, /* internal use only */ + EV_IO = EV_READ, /* alias for type-detection */ + EV_TIMER = 0x00000100, /* timer timed out */ +#if EV_COMPAT3 + EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */ +#endif + EV_PERIODIC = 0x00000200, /* periodic timer timed out */ + EV_SIGNAL = 0x00000400, /* signal was received */ + EV_CHILD = 0x00000800, /* child/pid had status change */ + EV_STAT = 0x00001000, /* stat data changed */ + EV_IDLE = 0x00002000, /* event loop is idling */ + EV_PREPARE = 0x00004000, /* event loop about to poll */ + EV_CHECK = 0x00008000, /* event loop finished poll */ + EV_EMBED = 0x00010000, /* embedded event loop needs sweep */ + EV_FORK = 0x00020000, /* event loop resumed in child */ + EV_CLEANUP = 0x00040000, /* event loop resumed in child */ + EV_ASYNC = 0x00080000, /* async intra-loop signal */ + EV_CUSTOM = 0x01000000, /* for use by user code */ + EV_ERROR = 0x80000000 /* sent when an error occurs */ +}; + +/* can be used to add custom fields to all watchers, while losing binary compatibility */ +#ifndef EV_COMMON +# define EV_COMMON void *data; +#endif + +#ifndef EV_CB_DECLARE +# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents); +#endif +#ifndef EV_CB_INVOKE +# define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents)) +#endif + +/* not official, do not use */ +#define EV_CB(type,name) void name (EV_P_ struct ev_ ## type *w, int revents) + +/* + * struct member types: + * private: you may look at them, but not change them, + * and they might not mean anything to you. + * ro: can be read anytime, but only changed when the watcher isn't active. + * rw: can be read and modified anytime, even when the watcher is active. + * + * some internal details that might be helpful for debugging: + * + * active is either 0, which means the watcher is not active, + * or the array index of the watcher (periodics, timers) + * or the array index + 1 (most other watchers) + * or simply 1 for watchers that aren't in some array. + * pending is either 0, in which case the watcher isn't, + * or the array index + 1 in the pendings array. + */ + +#if EV_MINPRI == EV_MAXPRI +# define EV_DECL_PRIORITY +#elif !defined (EV_DECL_PRIORITY) +# define EV_DECL_PRIORITY int priority; +#endif + +/* shared by all watchers */ +#define EV_WATCHER(type) \ + int active; /* private */ \ + int pending; /* private */ \ + EV_DECL_PRIORITY /* private */ \ + EV_COMMON /* rw */ \ + EV_CB_DECLARE (type) /* private */ + +#define EV_WATCHER_LIST(type) \ + EV_WATCHER (type) \ + struct ev_watcher_list *next; /* private */ + +#define EV_WATCHER_TIME(type) \ + EV_WATCHER (type) \ + ev_tstamp at; /* private */ + +/* base class, nothing to see here unless you subclass */ +typedef struct ev_watcher +{ + EV_WATCHER (ev_watcher) +} ev_watcher; + +/* base class, nothing to see here unless you subclass */ +typedef struct ev_watcher_list +{ + EV_WATCHER_LIST (ev_watcher_list) +} ev_watcher_list; + +/* base class, nothing to see here unless you subclass */ +typedef struct ev_watcher_time +{ + EV_WATCHER_TIME (ev_watcher_time) +} ev_watcher_time; + +/* invoked when fd is either EV_READable or EV_WRITEable */ +/* revent EV_READ, EV_WRITE */ +typedef struct ev_io +{ + EV_WATCHER_LIST (ev_io) + + int fd; /* ro */ + int events; /* ro */ +} ev_io; + +/* invoked after a specific time, repeatable (based on monotonic clock) */ +/* revent EV_TIMEOUT */ +typedef struct ev_timer +{ + EV_WATCHER_TIME (ev_timer) + + ev_tstamp repeat; /* rw */ +} ev_timer; + +/* invoked at some specific time, possibly repeating at regular intervals (based on UTC) */ +/* revent EV_PERIODIC */ +typedef struct ev_periodic +{ + EV_WATCHER_TIME (ev_periodic) + + ev_tstamp offset; /* rw */ + ev_tstamp interval; /* rw */ + ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) EV_THROW; /* rw */ +} ev_periodic; + +/* invoked when the given signal has been received */ +/* revent EV_SIGNAL */ +typedef struct ev_signal +{ + EV_WATCHER_LIST (ev_signal) + + int signum; /* ro */ +} ev_signal; + +/* invoked when sigchld is received and waitpid indicates the given pid */ +/* revent EV_CHILD */ +/* does not support priorities */ +typedef struct ev_child +{ + EV_WATCHER_LIST (ev_child) + + int flags; /* private */ + int pid; /* ro */ + int rpid; /* rw, holds the received pid */ + int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */ +} ev_child; + +#if EV_STAT_ENABLE +/* st_nlink = 0 means missing file or other error */ +# ifdef _WIN32 +typedef struct _stati64 ev_statdata; +# else +typedef struct stat ev_statdata; +# endif + +/* invoked each time the stat data changes for a given path */ +/* revent EV_STAT */ +typedef struct ev_stat +{ + EV_WATCHER_LIST (ev_stat) + + ev_timer timer; /* private */ + ev_tstamp interval; /* ro */ + const char *path; /* ro */ + ev_statdata prev; /* ro */ + ev_statdata attr; /* ro */ + + int wd; /* wd for inotify, fd for kqueue */ +} ev_stat; +#endif + +#if EV_IDLE_ENABLE +/* invoked when the nothing else needs to be done, keeps the process from blocking */ +/* revent EV_IDLE */ +typedef struct ev_idle +{ + EV_WATCHER (ev_idle) +} ev_idle; +#endif + +/* invoked for each run of the mainloop, just before the blocking call */ +/* you can still change events in any way you like */ +/* revent EV_PREPARE */ +typedef struct ev_prepare +{ + EV_WATCHER (ev_prepare) +} ev_prepare; + +/* invoked for each run of the mainloop, just after the blocking call */ +/* revent EV_CHECK */ +typedef struct ev_check +{ + EV_WATCHER (ev_check) +} ev_check; + +#if EV_FORK_ENABLE +/* the callback gets invoked before check in the child process when a fork was detected */ +/* revent EV_FORK */ +typedef struct ev_fork +{ + EV_WATCHER (ev_fork) +} ev_fork; +#endif + +#if EV_CLEANUP_ENABLE +/* is invoked just before the loop gets destroyed */ +/* revent EV_CLEANUP */ +typedef struct ev_cleanup +{ + EV_WATCHER (ev_cleanup) +} ev_cleanup; +#endif + +#if EV_EMBED_ENABLE +/* used to embed an event loop inside another */ +/* the callback gets invoked when the event loop has handled events, and can be 0 */ +typedef struct ev_embed +{ + EV_WATCHER (ev_embed) + + struct ev_loop *other; /* ro */ + ev_io io; /* private */ + ev_prepare prepare; /* private */ + ev_check check; /* unused */ + ev_timer timer; /* unused */ + ev_periodic periodic; /* unused */ + ev_idle idle; /* unused */ + ev_fork fork; /* private */ +#if EV_CLEANUP_ENABLE + ev_cleanup cleanup; /* unused */ +#endif +} ev_embed; +#endif + +#if EV_ASYNC_ENABLE +/* invoked when somebody calls ev_async_send on the watcher */ +/* revent EV_ASYNC */ +typedef struct ev_async +{ + EV_WATCHER (ev_async) + + EV_ATOMIC_T sent; /* private */ +} ev_async; + +# define ev_async_pending(w) (+(w)->sent) +#endif + +/* the presence of this union forces similar struct layout */ +union ev_any_watcher +{ + struct ev_watcher w; + struct ev_watcher_list wl; + + struct ev_io io; + struct ev_timer timer; + struct ev_periodic periodic; + struct ev_signal signal; + struct ev_child child; +#if EV_STAT_ENABLE + struct ev_stat stat; +#endif +#if EV_IDLE_ENABLE + struct ev_idle idle; +#endif + struct ev_prepare prepare; + struct ev_check check; +#if EV_FORK_ENABLE + struct ev_fork fork; +#endif +#if EV_CLEANUP_ENABLE + struct ev_cleanup cleanup; +#endif +#if EV_EMBED_ENABLE + struct ev_embed embed; +#endif +#if EV_ASYNC_ENABLE + struct ev_async async; +#endif +}; + +/* flag bits for ev_default_loop and ev_loop_new */ +enum { + /* the default */ + EVFLAG_AUTO = 0x00000000U, /* not quite a mask */ + /* flag bits */ + EVFLAG_NOENV = 0x01000000U, /* do NOT consult environment */ + EVFLAG_FORKCHECK = 0x02000000U, /* check for a fork in each iteration */ + /* debugging/feature disable */ + EVFLAG_NOINOTIFY = 0x00100000U, /* do not attempt to use inotify */ +#if EV_COMPAT3 + EVFLAG_NOSIGFD = 0, /* compatibility to pre-3.9 */ +#endif + EVFLAG_SIGNALFD = 0x00200000U, /* attempt to use signalfd */ + EVFLAG_NOSIGMASK = 0x00400000U /* avoid modifying the signal mask */ +}; + +/* method bits to be ored together */ +enum { + EVBACKEND_SELECT = 0x00000001U, /* about anywhere */ + EVBACKEND_POLL = 0x00000002U, /* !win */ + EVBACKEND_EPOLL = 0x00000004U, /* linux */ + EVBACKEND_KQUEUE = 0x00000008U, /* bsd */ + EVBACKEND_DEVPOLL = 0x00000010U, /* solaris 8 */ /* NYI */ + EVBACKEND_PORT = 0x00000020U, /* solaris 10 */ + EVBACKEND_ALL = 0x0000003FU, /* all known backends */ + EVBACKEND_MASK = 0x0000FFFFU /* all future backends */ +}; + +#if EV_PROTOTYPES +EV_API_DECL int ev_version_major (void) EV_THROW; +EV_API_DECL int ev_version_minor (void) EV_THROW; + +EV_API_DECL unsigned int ev_supported_backends (void) EV_THROW; +EV_API_DECL unsigned int ev_recommended_backends (void) EV_THROW; +EV_API_DECL unsigned int ev_embeddable_backends (void) EV_THROW; + +EV_API_DECL ev_tstamp ev_time (void) EV_THROW; +EV_API_DECL void ev_sleep (ev_tstamp delay) EV_THROW; /* sleep for a while */ + +/* Sets the allocation function to use, works like realloc. + * It is used to allocate and free memory. + * If it returns zero when memory needs to be allocated, the library might abort + * or take some potentially destructive action. + * The default is your system realloc function. + */ +EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW; + +/* set the callback function to call on a + * retryable syscall error + * (such as failed select, poll, epoll_wait) + */ +EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW; + +#if EV_MULTIPLICITY + +/* the default loop is the only one that handles signals and child watchers */ +/* you can call this as often as you like */ +EV_API_DECL struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW; + +#ifdef EV_API_STATIC +EV_API_DECL struct ev_loop *ev_default_loop_ptr; +#endif + +EV_INLINE struct ev_loop * +ev_default_loop_uc_ (void) EV_THROW +{ + extern struct ev_loop *ev_default_loop_ptr; + + return ev_default_loop_ptr; +} + +EV_INLINE int +ev_is_default_loop (EV_P) EV_THROW +{ + return EV_A == EV_DEFAULT_UC; +} + +/* create and destroy alternative loops that don't handle signals */ +EV_API_DECL struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)) EV_THROW; + +EV_API_DECL ev_tstamp ev_now (EV_P) EV_THROW; /* time w.r.t. timers and the eventloop, updated after each poll */ + +#else + +EV_API_DECL int ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW; /* returns true when successful */ + +EV_API_DECL ev_tstamp ev_rt_now; + +EV_INLINE ev_tstamp +ev_now (void) EV_THROW +{ + return ev_rt_now; +} + +/* looks weird, but ev_is_default_loop (EV_A) still works if this exists */ +EV_INLINE int +ev_is_default_loop (void) EV_THROW +{ + return 1; +} + +#endif /* multiplicity */ + +/* destroy event loops, also works for the default loop */ +EV_API_DECL void ev_loop_destroy (EV_P); + +/* this needs to be called after fork, to duplicate the loop */ +/* when you want to re-use it in the child */ +/* you can call it in either the parent or the child */ +/* you can actually call it at any time, anywhere :) */ +EV_API_DECL void ev_loop_fork (EV_P) EV_THROW; + +EV_API_DECL unsigned int ev_backend (EV_P) EV_THROW; /* backend in use by loop */ + +EV_API_DECL void ev_now_update (EV_P) EV_THROW; /* update event loop time */ + +#if EV_WALK_ENABLE +/* walk (almost) all watchers in the loop of a given type, invoking the */ +/* callback on every such watcher. The callback might stop the watcher, */ +/* but do nothing else with the loop */ +EV_API_DECL void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW; +#endif + +#endif /* prototypes */ + +/* ev_run flags values */ +enum { + EVRUN_NOWAIT = 1, /* do not block/wait */ + EVRUN_ONCE = 2 /* block *once* only */ +}; + +/* ev_break how values */ +enum { + EVBREAK_CANCEL = 0, /* undo unloop */ + EVBREAK_ONE = 1, /* unloop once */ + EVBREAK_ALL = 2 /* unloop all loops */ +}; + +#if EV_PROTOTYPES +EV_API_DECL int ev_run (EV_P_ int flags EV_CPP (= 0)); +EV_API_DECL void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)) EV_THROW; /* break out of the loop */ + +/* + * ref/unref can be used to add or remove a refcount on the mainloop. every watcher + * keeps one reference. if you have a long-running watcher you never unregister that + * should not keep ev_loop from running, unref() after starting, and ref() before stopping. + */ +EV_API_DECL void ev_ref (EV_P) EV_THROW; +EV_API_DECL void ev_unref (EV_P) EV_THROW; + +/* + * convenience function, wait for a single event, without registering an event watcher + * if timeout is < 0, do wait indefinitely + */ +EV_API_DECL void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW; + +# if EV_FEATURE_API +EV_API_DECL unsigned int ev_iteration (EV_P) EV_THROW; /* number of loop iterations */ +EV_API_DECL unsigned int ev_depth (EV_P) EV_THROW; /* #ev_loop enters - #ev_loop leaves */ +EV_API_DECL void ev_verify (EV_P) EV_THROW; /* abort if loop data corrupted */ + +EV_API_DECL void ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */ +EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */ + +/* advanced stuff for threading etc. support, see docs */ +EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW; +EV_API_DECL void *ev_userdata (EV_P) EV_THROW; +EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)) EV_THROW; +EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P) EV_THROW) EV_THROW; + +EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */ +EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */ + +/* + * stop/start the timer handling. + */ +EV_API_DECL void ev_suspend (EV_P) EV_THROW; +EV_API_DECL void ev_resume (EV_P) EV_THROW; +#endif + +#endif + +/* these may evaluate ev multiple times, and the other arguments at most once */ +/* either use ev_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */ +#define ev_init(ev,cb_) do { \ + ((ev_watcher *)(void *)(ev))->active = \ + ((ev_watcher *)(void *)(ev))->pending = 0; \ + ev_set_priority ((ev), 0); \ + ev_set_cb ((ev), cb_); \ +} while (0) + +#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_) | EV__IOFDSET; } while (0) +#define ev_timer_set(ev,after_,repeat_) do { ((ev_watcher_time *)(ev))->at = (after_); (ev)->repeat = (repeat_); } while (0) +#define ev_periodic_set(ev,ofs_,ival_,rcb_) do { (ev)->offset = (ofs_); (ev)->interval = (ival_); (ev)->reschedule_cb = (rcb_); } while (0) +#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0) +#define ev_child_set(ev,pid_,trace_) do { (ev)->pid = (pid_); (ev)->flags = !!(trace_); } while (0) +#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0) +#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */ +#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */ +#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */ +#define ev_embed_set(ev,other_) do { (ev)->other = (other_); } while (0) +#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */ +#define ev_cleanup_set(ev) /* nop, yes, this is a serious in-joke */ +#define ev_async_set(ev) /* nop, yes, this is a serious in-joke */ + +#define ev_io_init(ev,cb,fd,events) do { ev_init ((ev), (cb)); ev_io_set ((ev),(fd),(events)); } while (0) +#define ev_timer_init(ev,cb,after,repeat) do { ev_init ((ev), (cb)); ev_timer_set ((ev),(after),(repeat)); } while (0) +#define ev_periodic_init(ev,cb,ofs,ival,rcb) do { ev_init ((ev), (cb)); ev_periodic_set ((ev),(ofs),(ival),(rcb)); } while (0) +#define ev_signal_init(ev,cb,signum) do { ev_init ((ev), (cb)); ev_signal_set ((ev), (signum)); } while (0) +#define ev_child_init(ev,cb,pid,trace) do { ev_init ((ev), (cb)); ev_child_set ((ev),(pid),(trace)); } while (0) +#define ev_stat_init(ev,cb,path,interval) do { ev_init ((ev), (cb)); ev_stat_set ((ev),(path),(interval)); } while (0) +#define ev_idle_init(ev,cb) do { ev_init ((ev), (cb)); ev_idle_set ((ev)); } while (0) +#define ev_prepare_init(ev,cb) do { ev_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0) +#define ev_check_init(ev,cb) do { ev_init ((ev), (cb)); ev_check_set ((ev)); } while (0) +#define ev_embed_init(ev,cb,other) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(other)); } while (0) +#define ev_fork_init(ev,cb) do { ev_init ((ev), (cb)); ev_fork_set ((ev)); } while (0) +#define ev_cleanup_init(ev,cb) do { ev_init ((ev), (cb)); ev_cleanup_set ((ev)); } while (0) +#define ev_async_init(ev,cb) do { ev_init ((ev), (cb)); ev_async_set ((ev)); } while (0) + +#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */ +#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */ + +#define ev_cb(ev) (ev)->cb /* rw */ + +#if EV_MINPRI == EV_MAXPRI +# define ev_priority(ev) ((ev), EV_MINPRI) +# define ev_set_priority(ev,pri) ((ev), (pri)) +#else +# define ev_priority(ev) (+(((ev_watcher *)(void *)(ev))->priority)) +# define ev_set_priority(ev,pri) ( (ev_watcher *)(void *)(ev))->priority = (pri) +#endif + +#define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at) + +#ifndef ev_set_cb +# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_) +#endif + +/* stopping (enabling, adding) a watcher does nothing if it is already running */ +/* stopping (disabling, deleting) a watcher does nothing unless its already running */ +#if EV_PROTOTYPES + +/* feeds an event into a watcher as if the event actually occurred */ +/* accepts any ev_watcher type */ +EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_THROW; +EV_API_DECL void ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW; +#if EV_SIGNAL_ENABLE +EV_API_DECL void ev_feed_signal (int signum) EV_THROW; +EV_API_DECL void ev_feed_signal_event (EV_P_ int signum) EV_THROW; +#endif +EV_API_DECL void ev_invoke (EV_P_ void *w, int revents); +EV_API_DECL int ev_clear_pending (EV_P_ void *w) EV_THROW; + +EV_API_DECL void ev_io_start (EV_P_ ev_io *w) EV_THROW; +EV_API_DECL void ev_io_stop (EV_P_ ev_io *w) EV_THROW; + +EV_API_DECL void ev_timer_start (EV_P_ ev_timer *w) EV_THROW; +EV_API_DECL void ev_timer_stop (EV_P_ ev_timer *w) EV_THROW; +/* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */ +EV_API_DECL void ev_timer_again (EV_P_ ev_timer *w) EV_THROW; +/* return remaining time */ +EV_API_DECL ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW; + +#if EV_PERIODIC_ENABLE +EV_API_DECL void ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW; +EV_API_DECL void ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW; +EV_API_DECL void ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW; +#endif + +/* only supported in the default loop */ +#if EV_SIGNAL_ENABLE +EV_API_DECL void ev_signal_start (EV_P_ ev_signal *w) EV_THROW; +EV_API_DECL void ev_signal_stop (EV_P_ ev_signal *w) EV_THROW; +#endif + +/* only supported in the default loop */ +# if EV_CHILD_ENABLE +EV_API_DECL void ev_child_start (EV_P_ ev_child *w) EV_THROW; +EV_API_DECL void ev_child_stop (EV_P_ ev_child *w) EV_THROW; +# endif + +# if EV_STAT_ENABLE +EV_API_DECL void ev_stat_start (EV_P_ ev_stat *w) EV_THROW; +EV_API_DECL void ev_stat_stop (EV_P_ ev_stat *w) EV_THROW; +EV_API_DECL void ev_stat_stat (EV_P_ ev_stat *w) EV_THROW; +# endif + +# if EV_IDLE_ENABLE +EV_API_DECL void ev_idle_start (EV_P_ ev_idle *w) EV_THROW; +EV_API_DECL void ev_idle_stop (EV_P_ ev_idle *w) EV_THROW; +# endif + +#if EV_PREPARE_ENABLE +EV_API_DECL void ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW; +EV_API_DECL void ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW; +#endif + +#if EV_CHECK_ENABLE +EV_API_DECL void ev_check_start (EV_P_ ev_check *w) EV_THROW; +EV_API_DECL void ev_check_stop (EV_P_ ev_check *w) EV_THROW; +#endif + +# if EV_FORK_ENABLE +EV_API_DECL void ev_fork_start (EV_P_ ev_fork *w) EV_THROW; +EV_API_DECL void ev_fork_stop (EV_P_ ev_fork *w) EV_THROW; +# endif + +# if EV_CLEANUP_ENABLE +EV_API_DECL void ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW; +EV_API_DECL void ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW; +# endif + +# if EV_EMBED_ENABLE +/* only supported when loop to be embedded is in fact embeddable */ +EV_API_DECL void ev_embed_start (EV_P_ ev_embed *w) EV_THROW; +EV_API_DECL void ev_embed_stop (EV_P_ ev_embed *w) EV_THROW; +EV_API_DECL void ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW; +# endif + +# if EV_ASYNC_ENABLE +EV_API_DECL void ev_async_start (EV_P_ ev_async *w) EV_THROW; +EV_API_DECL void ev_async_stop (EV_P_ ev_async *w) EV_THROW; +EV_API_DECL void ev_async_send (EV_P_ ev_async *w) EV_THROW; +# endif + +#if EV_COMPAT3 + #define EVLOOP_NONBLOCK EVRUN_NOWAIT + #define EVLOOP_ONESHOT EVRUN_ONCE + #define EVUNLOOP_CANCEL EVBREAK_CANCEL + #define EVUNLOOP_ONE EVBREAK_ONE + #define EVUNLOOP_ALL EVBREAK_ALL + #if EV_PROTOTYPES + EV_INLINE void ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); } + EV_INLINE void ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); } + EV_INLINE void ev_default_destroy (void) { ev_loop_destroy (EV_DEFAULT); } + EV_INLINE void ev_default_fork (void) { ev_loop_fork (EV_DEFAULT); } + #if EV_FEATURE_API + EV_INLINE unsigned int ev_loop_count (EV_P) { return ev_iteration (EV_A); } + EV_INLINE unsigned int ev_loop_depth (EV_P) { return ev_depth (EV_A); } + EV_INLINE void ev_loop_verify (EV_P) { ev_verify (EV_A); } + #endif + #endif +#else + typedef struct ev_loop ev_loop; +#endif + +#endif + +EV_CPP(}) + +#endif + diff -Nru python-gevent-0.13.7/libev/ev_kqueue.c python-gevent-1.0/libev/ev_kqueue.c --- python-gevent-0.13.7/libev/ev_kqueue.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_kqueue.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,214 @@ +/* + * libev kqueue backend + * + * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include +#include +#include +#include +#include + +void inline_speed +kqueue_change (EV_P_ int fd, int filter, int flags, int fflags) +{ + ++kqueue_changecnt; + array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2); + + EV_SET (&kqueue_changes [kqueue_changecnt - 1], fd, filter, flags, fflags, 0, 0); +} + +/* OS X at least needs this */ +#ifndef EV_ENABLE +# define EV_ENABLE 0 +#endif +#ifndef NOTE_EOF +# define NOTE_EOF 0 +#endif + +static void +kqueue_modify (EV_P_ int fd, int oev, int nev) +{ + if (oev != nev) + { + if (oev & EV_READ) + kqueue_change (EV_A_ fd, EVFILT_READ , EV_DELETE, 0); + + if (oev & EV_WRITE) + kqueue_change (EV_A_ fd, EVFILT_WRITE, EV_DELETE, 0); + } + + /* to detect close/reopen reliably, we have to re-add */ + /* event requests even when oev == nev */ + + if (nev & EV_READ) + kqueue_change (EV_A_ fd, EVFILT_READ , EV_ADD | EV_ENABLE, NOTE_EOF); + + if (nev & EV_WRITE) + kqueue_change (EV_A_ fd, EVFILT_WRITE, EV_ADD | EV_ENABLE, NOTE_EOF); +} + +static void +kqueue_poll (EV_P_ ev_tstamp timeout) +{ + int res, i; + struct timespec ts; + + /* need to resize so there is enough space for errors */ + if (kqueue_changecnt > kqueue_eventmax) + { + ev_free (kqueue_events); + kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt); + kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); + } + + EV_RELEASE_CB; + EV_TS_SET (ts, timeout); + res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts); + EV_ACQUIRE_CB; + kqueue_changecnt = 0; + + if (expect_false (res < 0)) + { + if (errno != EINTR) + ev_syserr ("(libev) kevent"); + + return; + } + + for (i = 0; i < res; ++i) + { + int fd = kqueue_events [i].ident; + + if (expect_false (kqueue_events [i].flags & EV_ERROR)) + { + int err = kqueue_events [i].data; + + /* we are only interested in errors for fds that we are interested in :) */ + if (anfds [fd].events) + { + if (err == ENOENT) /* resubmit changes on ENOENT */ + kqueue_modify (EV_A_ fd, 0, anfds [fd].events); + else if (err == EBADF) /* on EBADF, we re-check the fd */ + { + if (fd_valid (fd)) + kqueue_modify (EV_A_ fd, 0, anfds [fd].events); + else + fd_kill (EV_A_ fd); + } + else /* on all other errors, we error out on the fd */ + fd_kill (EV_A_ fd); + } + } + else + fd_event ( + EV_A_ + fd, + kqueue_events [i].filter == EVFILT_READ ? EV_READ + : kqueue_events [i].filter == EVFILT_WRITE ? EV_WRITE + : 0 + ); + } + + if (expect_false (res == kqueue_eventmax)) + { + ev_free (kqueue_events); + kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_eventmax + 1); + kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); + } +} + +int inline_size +kqueue_init (EV_P_ int flags) +{ + /* initialize the kernel queue */ + kqueue_fd_pid = getpid (); + if ((backend_fd = kqueue ()) < 0) + return 0; + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ + + backend_mintime = 1e-9; /* apparently, they did the right thing in freebsd */ + backend_modify = kqueue_modify; + backend_poll = kqueue_poll; + + kqueue_eventmax = 64; /* initial number of events receivable per poll */ + kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); + + kqueue_changes = 0; + kqueue_changemax = 0; + kqueue_changecnt = 0; + + return EVBACKEND_KQUEUE; +} + +void inline_size +kqueue_destroy (EV_P) +{ + ev_free (kqueue_events); + ev_free (kqueue_changes); +} + +void inline_size +kqueue_fork (EV_P) +{ + /* some BSD kernels don't just destroy the kqueue itself, + * but also close the fd, which isn't documented, and + * impossible to support properly. + * we remember the pid of the kqueue call and only close + * the fd if the pid is still the same. + * this leaks fds on sane kernels, but BSD interfaces are + * notoriously buggy and rarely get fixed. + */ + pid_t newpid = getpid (); + + if (newpid == kqueue_fd_pid) + close (backend_fd); + + kqueue_fd_pid = newpid; + while ((backend_fd = kqueue ()) < 0) + ev_syserr ("(libev) kqueue"); + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); + + /* re-register interest in fds */ + fd_rearm_all (EV_A); +} + +/* sys/event.h defines EV_ERROR */ +#undef EV_ERROR + diff -Nru python-gevent-0.13.7/libev/ev_poll.c python-gevent-1.0/libev/ev_poll.c --- python-gevent-0.13.7/libev/ev_poll.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_poll.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,148 @@ +/* + * libev poll fd activity backend + * + * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include + +void inline_size +pollidx_init (int *base, int count) +{ + /* consider using memset (.., -1, ...), which is practically guaranteed + * to work on all systems implementing poll */ + while (count--) + *base++ = -1; +} + +static void +poll_modify (EV_P_ int fd, int oev, int nev) +{ + int idx; + + if (oev == nev) + return; + + array_needsize (int, pollidxs, pollidxmax, fd + 1, pollidx_init); + + idx = pollidxs [fd]; + + if (idx < 0) /* need to allocate a new pollfd */ + { + pollidxs [fd] = idx = pollcnt++; + array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2); + polls [idx].fd = fd; + } + + assert (polls [idx].fd == fd); + + if (nev) + polls [idx].events = + (nev & EV_READ ? POLLIN : 0) + | (nev & EV_WRITE ? POLLOUT : 0); + else /* remove pollfd */ + { + pollidxs [fd] = -1; + + if (expect_true (idx < --pollcnt)) + { + polls [idx] = polls [pollcnt]; + pollidxs [polls [idx].fd] = idx; + } + } +} + +static void +poll_poll (EV_P_ ev_tstamp timeout) +{ + struct pollfd *p; + int res; + + EV_RELEASE_CB; + res = poll (polls, pollcnt, timeout * 1e3); + EV_ACQUIRE_CB; + + if (expect_false (res < 0)) + { + if (errno == EBADF) + fd_ebadf (EV_A); + else if (errno == ENOMEM && !syserr_cb) + fd_enomem (EV_A); + else if (errno != EINTR) + ev_syserr ("(libev) poll"); + } + else + for (p = polls; res; ++p) + { + assert (("libev: poll() returned illegal result, broken BSD kernel?", p < polls + pollcnt)); + + if (expect_false (p->revents)) /* this expect is debatable */ + { + --res; + + if (expect_false (p->revents & POLLNVAL)) + fd_kill (EV_A_ p->fd); + else + fd_event ( + EV_A_ + p->fd, + (p->revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) + | (p->revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) + ); + } + } +} + +int inline_size +poll_init (EV_P_ int flags) +{ + backend_mintime = 1e-3; + backend_modify = poll_modify; + backend_poll = poll_poll; + + pollidxs = 0; pollidxmax = 0; + polls = 0; pollmax = 0; pollcnt = 0; + + return EVBACKEND_POLL; +} + +void inline_size +poll_destroy (EV_P) +{ + ev_free (pollidxs); + ev_free (polls); +} + diff -Nru python-gevent-0.13.7/libev/ev_port.c python-gevent-1.0/libev/ev_port.c --- python-gevent-0.13.7/libev/ev_port.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_port.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,185 @@ +/* + * libev solaris event port backend + * + * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +/* useful reading: + * + * http://bugs.opensolaris.org/view_bug.do?bug_id=6268715 (random results) + * http://bugs.opensolaris.org/view_bug.do?bug_id=6455223 (just totally broken) + * http://bugs.opensolaris.org/view_bug.do?bug_id=6873782 (manpage ETIME) + * http://bugs.opensolaris.org/view_bug.do?bug_id=6874410 (implementation ETIME) + * http://www.mail-archive.com/networking-discuss@opensolaris.org/msg11898.html ETIME vs. nget + * http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/event_port.c (libc) + * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/portfs/port.c#1325 (kernel) + */ + +#include +#include +#include +#include +#include +#include + +void inline_speed +port_associate_and_check (EV_P_ int fd, int ev) +{ + if (0 > + port_associate ( + backend_fd, PORT_SOURCE_FD, fd, + (ev & EV_READ ? POLLIN : 0) + | (ev & EV_WRITE ? POLLOUT : 0), + 0 + ) + ) + { + if (errno == EBADFD) + fd_kill (EV_A_ fd); + else + ev_syserr ("(libev) port_associate"); + } +} + +static void +port_modify (EV_P_ int fd, int oev, int nev) +{ + /* we need to reassociate no matter what, as closes are + * once more silently being discarded. + */ + if (!nev) + { + if (oev) + port_dissociate (backend_fd, PORT_SOURCE_FD, fd); + } + else + port_associate_and_check (EV_A_ fd, nev); +} + +static void +port_poll (EV_P_ ev_tstamp timeout) +{ + int res, i; + struct timespec ts; + uint_t nget = 1; + + /* we initialise this to something we will skip in the loop, as */ + /* port_getn can return with nget unchanged, but no indication */ + /* whether it was the original value or has been updated :/ */ + port_events [0].portev_source = 0; + + EV_RELEASE_CB; + EV_TS_SET (ts, timeout); + res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts); + EV_ACQUIRE_CB; + + /* port_getn may or may not set nget on error */ + /* so we rely on port_events [0].portev_source not being updated */ + if (res == -1 && errno != ETIME && errno != EINTR) + ev_syserr ("(libev) port_getn (see http://bugs.opensolaris.org/view_bug.do?bug_id=6268715, try LIBEV_FLAGS=3 env variable)"); + + for (i = 0; i < nget; ++i) + { + if (port_events [i].portev_source == PORT_SOURCE_FD) + { + int fd = port_events [i].portev_object; + + fd_event ( + EV_A_ + fd, + (port_events [i].portev_events & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) + | (port_events [i].portev_events & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) + ); + + fd_change (EV_A_ fd, EV__IOFDSET); + } + } + + if (expect_false (nget == port_eventmax)) + { + ev_free (port_events); + port_eventmax = array_nextsize (sizeof (port_event_t), port_eventmax, port_eventmax + 1); + port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); + } +} + +int inline_size +port_init (EV_P_ int flags) +{ + /* Initialize the kernel queue */ + if ((backend_fd = port_create ()) < 0) + return 0; + + assert (("libev: PORT_SOURCE_FD must not be zero", PORT_SOURCE_FD)); + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ + + /* if my reading of the opensolaris kernel sources are correct, then + * opensolaris does something very stupid: it checks if the time has already + * elapsed and doesn't round up if that is the case,m otherwise it DOES round + * up. Since we can't know what the case is, we need to guess by using a + * "large enough" timeout. Normally, 1e-9 would be correct. + */ + backend_mintime = 1e-3; /* needed to compensate for port_getn returning early */ + backend_modify = port_modify; + backend_poll = port_poll; + + port_eventmax = 64; /* initial number of events receivable per poll */ + port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); + + return EVBACKEND_PORT; +} + +void inline_size +port_destroy (EV_P) +{ + ev_free (port_events); +} + +void inline_size +port_fork (EV_P) +{ + close (backend_fd); + + while ((backend_fd = port_create ()) < 0) + ev_syserr ("(libev) port"); + + fcntl (backend_fd, F_SETFD, FD_CLOEXEC); + + /* re-register interest in fds */ + fd_rearm_all (EV_A); +} + diff -Nru python-gevent-0.13.7/libev/ev_select.c python-gevent-1.0/libev/ev_select.c --- python-gevent-0.13.7/libev/ev_select.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_select.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,314 @@ +/* + * libev select fd activity backend + * + * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef _WIN32 +/* for unix systems */ +# include +# ifndef __hpux +/* for REAL unix systems */ +# include +# endif +#endif + +#ifndef EV_SELECT_USE_FD_SET +# ifdef NFDBITS +# define EV_SELECT_USE_FD_SET 0 +# else +# define EV_SELECT_USE_FD_SET 1 +# endif +#endif + +#if EV_SELECT_IS_WINSOCKET +# undef EV_SELECT_USE_FD_SET +# define EV_SELECT_USE_FD_SET 1 +# undef NFDBITS +# define NFDBITS 0 +#endif + +#if !EV_SELECT_USE_FD_SET +# define NFDBYTES (NFDBITS / 8) +#endif + +#include + +static void +select_modify (EV_P_ int fd, int oev, int nev) +{ + if (oev == nev) + return; + + { +#if EV_SELECT_USE_FD_SET + + #if EV_SELECT_IS_WINSOCKET + SOCKET handle = anfds [fd].handle; + #else + int handle = fd; + #endif + + assert (("libev: fd >= FD_SETSIZE passed to fd_set-based select backend", fd < FD_SETSIZE)); + + /* FD_SET is broken on windows (it adds the fd to a set twice or more, + * which eventually leads to overflows). Need to call it only on changes. + */ + #if EV_SELECT_IS_WINSOCKET + if ((oev ^ nev) & EV_READ) + #endif + if (nev & EV_READ) + FD_SET (handle, (fd_set *)vec_ri); + else + FD_CLR (handle, (fd_set *)vec_ri); + + #if EV_SELECT_IS_WINSOCKET + if ((oev ^ nev) & EV_WRITE) + #endif + if (nev & EV_WRITE) + FD_SET (handle, (fd_set *)vec_wi); + else + FD_CLR (handle, (fd_set *)vec_wi); + +#else + + int word = fd / NFDBITS; + fd_mask mask = 1UL << (fd % NFDBITS); + + if (expect_false (vec_max <= word)) + { + int new_max = word + 1; + + vec_ri = ev_realloc (vec_ri, new_max * NFDBYTES); + vec_ro = ev_realloc (vec_ro, new_max * NFDBYTES); /* could free/malloc */ + vec_wi = ev_realloc (vec_wi, new_max * NFDBYTES); + vec_wo = ev_realloc (vec_wo, new_max * NFDBYTES); /* could free/malloc */ + #ifdef _WIN32 + vec_eo = ev_realloc (vec_eo, new_max * NFDBYTES); /* could free/malloc */ + #endif + + for (; vec_max < new_max; ++vec_max) + ((fd_mask *)vec_ri) [vec_max] = + ((fd_mask *)vec_wi) [vec_max] = 0; + } + + ((fd_mask *)vec_ri) [word] |= mask; + if (!(nev & EV_READ)) + ((fd_mask *)vec_ri) [word] &= ~mask; + + ((fd_mask *)vec_wi) [word] |= mask; + if (!(nev & EV_WRITE)) + ((fd_mask *)vec_wi) [word] &= ~mask; +#endif + } +} + +static void +select_poll (EV_P_ ev_tstamp timeout) +{ + struct timeval tv; + int res; + int fd_setsize; + + EV_RELEASE_CB; + EV_TV_SET (tv, timeout); + +#if EV_SELECT_USE_FD_SET + fd_setsize = sizeof (fd_set); +#else + fd_setsize = vec_max * NFDBYTES; +#endif + + memcpy (vec_ro, vec_ri, fd_setsize); + memcpy (vec_wo, vec_wi, fd_setsize); + +#ifdef _WIN32 + /* pass in the write set as except set. + * the idea behind this is to work around a windows bug that causes + * errors to be reported as an exception and not by setting + * the writable bit. this is so uncontrollably lame. + */ + memcpy (vec_eo, vec_wi, fd_setsize); + res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, (fd_set *)vec_eo, &tv); +#elif EV_SELECT_USE_FD_SET + fd_setsize = anfdmax < FD_SETSIZE ? anfdmax : FD_SETSIZE; + res = select (fd_setsize, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); +#else + res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); +#endif + EV_ACQUIRE_CB; + + if (expect_false (res < 0)) + { + #if EV_SELECT_IS_WINSOCKET + errno = WSAGetLastError (); + #endif + #ifdef WSABASEERR + /* on windows, select returns incompatible error codes, fix this */ + if (errno >= WSABASEERR && errno < WSABASEERR + 1000) + if (errno == WSAENOTSOCK) + errno = EBADF; + else + errno -= WSABASEERR; + #endif + + #ifdef _WIN32 + /* select on windows erroneously returns EINVAL when no fd sets have been + * provided (this is documented). what microsoft doesn't tell you that this bug + * exists even when the fd sets _are_ provided, so we have to check for this bug + * here and emulate by sleeping manually. + * we also get EINVAL when the timeout is invalid, but we ignore this case here + * and assume that EINVAL always means: you have to wait manually. + */ + if (errno == EINVAL) + { + if (timeout) + { + unsigned long ms = timeout * 1e3; + Sleep (ms ? ms : 1); + } + + return; + } + #endif + + if (errno == EBADF) + fd_ebadf (EV_A); + else if (errno == ENOMEM && !syserr_cb) + fd_enomem (EV_A); + else if (errno != EINTR) + ev_syserr ("(libev) select"); + + return; + } + +#if EV_SELECT_USE_FD_SET + + { + int fd; + + for (fd = 0; fd < anfdmax; ++fd) + if (anfds [fd].events) + { + int events = 0; + #if EV_SELECT_IS_WINSOCKET + SOCKET handle = anfds [fd].handle; + #else + int handle = fd; + #endif + + if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ; + if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE; + #ifdef _WIN32 + if (FD_ISSET (handle, (fd_set *)vec_eo)) events |= EV_WRITE; + #endif + + if (expect_true (events)) + fd_event (EV_A_ fd, events); + } + } + +#else + + { + int word, bit; + for (word = vec_max; word--; ) + { + fd_mask word_r = ((fd_mask *)vec_ro) [word]; + fd_mask word_w = ((fd_mask *)vec_wo) [word]; + #ifdef _WIN32 + word_w |= ((fd_mask *)vec_eo) [word]; + #endif + + if (word_r || word_w) + for (bit = NFDBITS; bit--; ) + { + fd_mask mask = 1UL << bit; + int events = 0; + + events |= word_r & mask ? EV_READ : 0; + events |= word_w & mask ? EV_WRITE : 0; + + if (expect_true (events)) + fd_event (EV_A_ word * NFDBITS + bit, events); + } + } + } + +#endif +} + +int inline_size +select_init (EV_P_ int flags) +{ + backend_mintime = 1e-6; + backend_modify = select_modify; + backend_poll = select_poll; + +#if EV_SELECT_USE_FD_SET + vec_ri = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_ri); + vec_ro = ev_malloc (sizeof (fd_set)); + vec_wi = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_wi); + vec_wo = ev_malloc (sizeof (fd_set)); + #ifdef _WIN32 + vec_eo = ev_malloc (sizeof (fd_set)); + #endif +#else + vec_max = 0; + vec_ri = 0; + vec_ro = 0; + vec_wi = 0; + vec_wo = 0; + #ifdef _WIN32 + vec_eo = 0; + #endif +#endif + + return EVBACKEND_SELECT; +} + +void inline_size +select_destroy (EV_P) +{ + ev_free (vec_ri); + ev_free (vec_ro); + ev_free (vec_wi); + ev_free (vec_wo); + #ifdef _WIN32 + ev_free (vec_eo); + #endif +} + diff -Nru python-gevent-0.13.7/libev/ev_vars.h python-gevent-1.0/libev/ev_vars.h --- python-gevent-0.13.7/libev/ev_vars.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_vars.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,203 @@ +/* + * loop member variable declarations + * + * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#define VARx(type,name) VAR(name, type name) + +VARx(ev_tstamp, now_floor) /* last time we refreshed rt_time */ +VARx(ev_tstamp, mn_now) /* monotonic clock "now" */ +VARx(ev_tstamp, rtmn_diff) /* difference realtime - monotonic time */ + +/* for reverse feeding of events */ +VARx(W *, rfeeds) +VARx(int, rfeedmax) +VARx(int, rfeedcnt) + +VAR (pendings, ANPENDING *pendings [NUMPRI]) +VAR (pendingmax, int pendingmax [NUMPRI]) +VAR (pendingcnt, int pendingcnt [NUMPRI]) +VARx(int, pendingpri) /* highest priority currently pending */ +VARx(ev_prepare, pending_w) /* dummy pending watcher */ + +VARx(ev_tstamp, io_blocktime) +VARx(ev_tstamp, timeout_blocktime) + +VARx(int, backend) +VARx(int, activecnt) /* total number of active events ("refcount") */ +VARx(EV_ATOMIC_T, loop_done) /* signal by ev_break */ + +VARx(int, backend_fd) +VARx(ev_tstamp, backend_mintime) /* assumed typical timer resolution */ +VAR (backend_modify, void (*backend_modify)(EV_P_ int fd, int oev, int nev)) +VAR (backend_poll , void (*backend_poll)(EV_P_ ev_tstamp timeout)) + +VARx(ANFD *, anfds) +VARx(int, anfdmax) + +VAR (evpipe, int evpipe [2]) +VARx(ev_io, pipe_w) +VARx(EV_ATOMIC_T, pipe_write_wanted) +VARx(EV_ATOMIC_T, pipe_write_skipped) + +#if !defined(_WIN32) || EV_GENWRAP +VARx(pid_t, curpid) +#endif + +VARx(char, postfork) /* true if we need to recreate kernel state after fork */ + +#if EV_USE_SELECT || EV_GENWRAP +VARx(void *, vec_ri) +VARx(void *, vec_ro) +VARx(void *, vec_wi) +VARx(void *, vec_wo) +#if defined(_WIN32) || EV_GENWRAP +VARx(void *, vec_eo) +#endif +VARx(int, vec_max) +#endif + +#if EV_USE_POLL || EV_GENWRAP +VARx(struct pollfd *, polls) +VARx(int, pollmax) +VARx(int, pollcnt) +VARx(int *, pollidxs) /* maps fds into structure indices */ +VARx(int, pollidxmax) +#endif + +#if EV_USE_EPOLL || EV_GENWRAP +VARx(struct epoll_event *, epoll_events) +VARx(int, epoll_eventmax) +VARx(int *, epoll_eperms) +VARx(int, epoll_epermcnt) +VARx(int, epoll_epermmax) +#endif + +#if EV_USE_KQUEUE || EV_GENWRAP +VARx(pid_t, kqueue_fd_pid) +VARx(struct kevent *, kqueue_changes) +VARx(int, kqueue_changemax) +VARx(int, kqueue_changecnt) +VARx(struct kevent *, kqueue_events) +VARx(int, kqueue_eventmax) +#endif + +#if EV_USE_PORT || EV_GENWRAP +VARx(struct port_event *, port_events) +VARx(int, port_eventmax) +#endif + +#if EV_USE_IOCP || EV_GENWRAP +VARx(HANDLE, iocp) +#endif + +VARx(int *, fdchanges) +VARx(int, fdchangemax) +VARx(int, fdchangecnt) + +VARx(ANHE *, timers) +VARx(int, timermax) +VARx(int, timercnt) + +#if EV_PERIODIC_ENABLE || EV_GENWRAP +VARx(ANHE *, periodics) +VARx(int, periodicmax) +VARx(int, periodiccnt) +#endif + +#if EV_IDLE_ENABLE || EV_GENWRAP +VAR (idles, ev_idle **idles [NUMPRI]) +VAR (idlemax, int idlemax [NUMPRI]) +VAR (idlecnt, int idlecnt [NUMPRI]) +#endif +VARx(int, idleall) /* total number */ + +VARx(struct ev_prepare **, prepares) +VARx(int, preparemax) +VARx(int, preparecnt) + +VARx(struct ev_check **, checks) +VARx(int, checkmax) +VARx(int, checkcnt) + +#if EV_FORK_ENABLE || EV_GENWRAP +VARx(struct ev_fork **, forks) +VARx(int, forkmax) +VARx(int, forkcnt) +#endif + +#if EV_CLEANUP_ENABLE || EV_GENWRAP +VARx(struct ev_cleanup **, cleanups) +VARx(int, cleanupmax) +VARx(int, cleanupcnt) +#endif + +#if EV_ASYNC_ENABLE || EV_GENWRAP +VARx(EV_ATOMIC_T, async_pending) +VARx(struct ev_async **, asyncs) +VARx(int, asyncmax) +VARx(int, asynccnt) +#endif + +#if EV_USE_INOTIFY || EV_GENWRAP +VARx(int, fs_fd) +VARx(ev_io, fs_w) +VARx(char, fs_2625) /* whether we are running in linux 2.6.25 or newer */ +VAR (fs_hash, ANFS fs_hash [EV_INOTIFY_HASHSIZE]) +#endif + +VARx(EV_ATOMIC_T, sig_pending) +#if EV_USE_SIGNALFD || EV_GENWRAP +VARx(int, sigfd) +VARx(ev_io, sigfd_w) +VARx(sigset_t, sigfd_set) +#endif + +VARx(unsigned int, origflags) /* original loop flags */ + +#if EV_FEATURE_API || EV_GENWRAP +VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */ +VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */ + +VARx(void *, userdata) +VAR (release_cb, void (*release_cb)(EV_P) EV_THROW) +VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_THROW) +VAR (invoke_cb , void (*invoke_cb) (EV_P)) +#endif + +#undef VARx + diff -Nru python-gevent-0.13.7/libev/ev_win32.c python-gevent-1.0/libev/ev_win32.c --- python-gevent-0.13.7/libev/ev_win32.c 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_win32.c 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,163 @@ +/* + * libev win32 compatibility cruft (_not_ a backend) + * + * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifdef _WIN32 + +/* timeb.h is actually xsi legacy functionality */ +#include + +/* note: the comment below could not be substantiated, but what would I care */ +/* MSDN says this is required to handle SIGFPE */ +/* my wild guess would be that using something floating-pointy is required */ +/* for the crt to do something about it */ +volatile double SIGFPE_REQ = 0.0f; + +static SOCKET +ev_tcp_socket (void) +{ +#if EV_USE_WSASOCKET + return WSASocket (AF_INET, SOCK_STREAM, 0, 0, 0, 0); +#else + return socket (AF_INET, SOCK_STREAM, 0); +#endif +} + +/* oh, the humanity! */ +static int +ev_pipe (int filedes [2]) +{ + struct sockaddr_in addr = { 0 }; + int addr_size = sizeof (addr); + struct sockaddr_in adr2; + int adr2_size = sizeof (adr2); + SOCKET listener; + SOCKET sock [2] = { -1, -1 }; + + if ((listener = ev_tcp_socket ()) == INVALID_SOCKET) + return -1; + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + addr.sin_port = 0; + + if (bind (listener, (struct sockaddr *)&addr, addr_size)) + goto fail; + + if (getsockname (listener, (struct sockaddr *)&addr, &addr_size)) + goto fail; + + if (listen (listener, 1)) + goto fail; + + if ((sock [0] = ev_tcp_socket ()) == INVALID_SOCKET) + goto fail; + + if (connect (sock [0], (struct sockaddr *)&addr, addr_size)) + goto fail; + + if ((sock [1] = accept (listener, 0, 0)) < 0) + goto fail; + + /* windows vista returns fantasy port numbers for sockets: + * example for two interconnected tcp sockets: + * + * (Socket::unpack_sockaddr_in getsockname $sock0)[0] == 53364 + * (Socket::unpack_sockaddr_in getpeername $sock0)[0] == 53363 + * (Socket::unpack_sockaddr_in getsockname $sock1)[0] == 53363 + * (Socket::unpack_sockaddr_in getpeername $sock1)[0] == 53365 + * + * wow! tridirectional sockets! + * + * this way of checking ports seems to work: + */ + if (getpeername (sock [0], (struct sockaddr *)&addr, &addr_size)) + goto fail; + + if (getsockname (sock [1], (struct sockaddr *)&adr2, &adr2_size)) + goto fail; + + errno = WSAEINVAL; + if (addr_size != adr2_size + || addr.sin_addr.s_addr != adr2.sin_addr.s_addr /* just to be sure, I mean, it's windows */ + || addr.sin_port != adr2.sin_port) + goto fail; + + closesocket (listener); + +#if EV_SELECT_IS_WINSOCKET + filedes [0] = EV_WIN32_HANDLE_TO_FD (sock [0]); + filedes [1] = EV_WIN32_HANDLE_TO_FD (sock [1]); +#else + /* when select isn't winsocket, we also expect socket, connect, accept etc. + * to work on fds */ + filedes [0] = sock [0]; + filedes [1] = sock [1]; +#endif + + return 0; + +fail: + closesocket (listener); + + if (sock [0] != INVALID_SOCKET) closesocket (sock [0]); + if (sock [1] != INVALID_SOCKET) closesocket (sock [1]); + + return -1; +} + +#undef pipe +#define pipe(filedes) ev_pipe (filedes) + +#define EV_HAVE_EV_TIME 1 +ev_tstamp +ev_time (void) +{ + FILETIME ft; + ULARGE_INTEGER ui; + + GetSystemTimeAsFileTime (&ft); + ui.u.LowPart = ft.dwLowDateTime; + ui.u.HighPart = ft.dwHighDateTime; + + /* msvc cannot convert ulonglong to double... yes, it is that sucky */ + return (LONGLONG)(ui.QuadPart - 116444736000000000) * 1e-7; +} + +#endif + diff -Nru python-gevent-0.13.7/libev/ev_wrap.h python-gevent-1.0/libev/ev_wrap.h --- python-gevent-0.13.7/libev/ev_wrap.h 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ev_wrap.h 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,202 @@ +/* DO NOT EDIT, automatically generated by update_ev_wrap */ +#ifndef EV_WRAP_H +#define EV_WRAP_H +#define acquire_cb ((loop)->acquire_cb) +#define activecnt ((loop)->activecnt) +#define anfdmax ((loop)->anfdmax) +#define anfds ((loop)->anfds) +#define async_pending ((loop)->async_pending) +#define asynccnt ((loop)->asynccnt) +#define asyncmax ((loop)->asyncmax) +#define asyncs ((loop)->asyncs) +#define backend ((loop)->backend) +#define backend_fd ((loop)->backend_fd) +#define backend_mintime ((loop)->backend_mintime) +#define backend_modify ((loop)->backend_modify) +#define backend_poll ((loop)->backend_poll) +#define checkcnt ((loop)->checkcnt) +#define checkmax ((loop)->checkmax) +#define checks ((loop)->checks) +#define cleanupcnt ((loop)->cleanupcnt) +#define cleanupmax ((loop)->cleanupmax) +#define cleanups ((loop)->cleanups) +#define curpid ((loop)->curpid) +#define epoll_epermcnt ((loop)->epoll_epermcnt) +#define epoll_epermmax ((loop)->epoll_epermmax) +#define epoll_eperms ((loop)->epoll_eperms) +#define epoll_eventmax ((loop)->epoll_eventmax) +#define epoll_events ((loop)->epoll_events) +#define evfd ((loop)->evfd) +#define evpipe ((loop)->evpipe) +#define fdchangecnt ((loop)->fdchangecnt) +#define fdchangemax ((loop)->fdchangemax) +#define fdchanges ((loop)->fdchanges) +#define forkcnt ((loop)->forkcnt) +#define forkmax ((loop)->forkmax) +#define forks ((loop)->forks) +#define fs_2625 ((loop)->fs_2625) +#define fs_fd ((loop)->fs_fd) +#define fs_hash ((loop)->fs_hash) +#define fs_w ((loop)->fs_w) +#define idleall ((loop)->idleall) +#define idlecnt ((loop)->idlecnt) +#define idlemax ((loop)->idlemax) +#define idles ((loop)->idles) +#define invoke_cb ((loop)->invoke_cb) +#define io_blocktime ((loop)->io_blocktime) +#define iocp ((loop)->iocp) +#define kqueue_changecnt ((loop)->kqueue_changecnt) +#define kqueue_changemax ((loop)->kqueue_changemax) +#define kqueue_changes ((loop)->kqueue_changes) +#define kqueue_eventmax ((loop)->kqueue_eventmax) +#define kqueue_events ((loop)->kqueue_events) +#define kqueue_fd_pid ((loop)->kqueue_fd_pid) +#define loop_count ((loop)->loop_count) +#define loop_depth ((loop)->loop_depth) +#define loop_done ((loop)->loop_done) +#define mn_now ((loop)->mn_now) +#define now_floor ((loop)->now_floor) +#define origflags ((loop)->origflags) +#define pending_w ((loop)->pending_w) +#define pendingcnt ((loop)->pendingcnt) +#define pendingmax ((loop)->pendingmax) +#define pendingpri ((loop)->pendingpri) +#define pendings ((loop)->pendings) +#define periodiccnt ((loop)->periodiccnt) +#define periodicmax ((loop)->periodicmax) +#define periodics ((loop)->periodics) +#define pipe_w ((loop)->pipe_w) +#define pipe_write_skipped ((loop)->pipe_write_skipped) +#define pipe_write_wanted ((loop)->pipe_write_wanted) +#define pollcnt ((loop)->pollcnt) +#define pollidxmax ((loop)->pollidxmax) +#define pollidxs ((loop)->pollidxs) +#define pollmax ((loop)->pollmax) +#define polls ((loop)->polls) +#define port_eventmax ((loop)->port_eventmax) +#define port_events ((loop)->port_events) +#define postfork ((loop)->postfork) +#define preparecnt ((loop)->preparecnt) +#define preparemax ((loop)->preparemax) +#define prepares ((loop)->prepares) +#define release_cb ((loop)->release_cb) +#define rfeedcnt ((loop)->rfeedcnt) +#define rfeedmax ((loop)->rfeedmax) +#define rfeeds ((loop)->rfeeds) +#define rtmn_diff ((loop)->rtmn_diff) +#define sig_pending ((loop)->sig_pending) +#define sigfd ((loop)->sigfd) +#define sigfd_set ((loop)->sigfd_set) +#define sigfd_w ((loop)->sigfd_w) +#define timeout_blocktime ((loop)->timeout_blocktime) +#define timercnt ((loop)->timercnt) +#define timermax ((loop)->timermax) +#define timers ((loop)->timers) +#define userdata ((loop)->userdata) +#define vec_eo ((loop)->vec_eo) +#define vec_max ((loop)->vec_max) +#define vec_ri ((loop)->vec_ri) +#define vec_ro ((loop)->vec_ro) +#define vec_wi ((loop)->vec_wi) +#define vec_wo ((loop)->vec_wo) +#else +#undef EV_WRAP_H +#undef acquire_cb +#undef activecnt +#undef anfdmax +#undef anfds +#undef async_pending +#undef asynccnt +#undef asyncmax +#undef asyncs +#undef backend +#undef backend_fd +#undef backend_mintime +#undef backend_modify +#undef backend_poll +#undef checkcnt +#undef checkmax +#undef checks +#undef cleanupcnt +#undef cleanupmax +#undef cleanups +#undef curpid +#undef epoll_epermcnt +#undef epoll_epermmax +#undef epoll_eperms +#undef epoll_eventmax +#undef epoll_events +#undef evfd +#undef evpipe +#undef fdchangecnt +#undef fdchangemax +#undef fdchanges +#undef forkcnt +#undef forkmax +#undef forks +#undef fs_2625 +#undef fs_fd +#undef fs_hash +#undef fs_w +#undef idleall +#undef idlecnt +#undef idlemax +#undef idles +#undef invoke_cb +#undef io_blocktime +#undef iocp +#undef kqueue_changecnt +#undef kqueue_changemax +#undef kqueue_changes +#undef kqueue_eventmax +#undef kqueue_events +#undef kqueue_fd_pid +#undef loop_count +#undef loop_depth +#undef loop_done +#undef mn_now +#undef now_floor +#undef origflags +#undef pending_w +#undef pendingcnt +#undef pendingmax +#undef pendingpri +#undef pendings +#undef periodiccnt +#undef periodicmax +#undef periodics +#undef pipe_w +#undef pipe_write_skipped +#undef pipe_write_wanted +#undef pollcnt +#undef pollidxmax +#undef pollidxs +#undef pollmax +#undef polls +#undef port_eventmax +#undef port_events +#undef postfork +#undef preparecnt +#undef preparemax +#undef prepares +#undef release_cb +#undef rfeedcnt +#undef rfeedmax +#undef rfeeds +#undef rtmn_diff +#undef sig_pending +#undef sigfd +#undef sigfd_set +#undef sigfd_w +#undef timeout_blocktime +#undef timercnt +#undef timermax +#undef timers +#undef userdata +#undef vec_eo +#undef vec_max +#undef vec_ri +#undef vec_ro +#undef vec_wi +#undef vec_wo +#endif diff -Nru python-gevent-0.13.7/libev/install-sh python-gevent-1.0/libev/install-sh --- python-gevent-0.13.7/libev/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/install-sh 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff -Nru python-gevent-0.13.7/libev/LICENSE python-gevent-1.0/libev/LICENSE --- python-gevent-0.13.7/libev/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/LICENSE 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,37 @@ +All files in libev are +Copyright (c)2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Alternatively, the contents of this package may be used under the terms +of the GNU General Public License ("GPL") version 2 or any later version, +in which case the provisions of the GPL are applicable instead of the +above. If you wish to allow the use of your version of this package only +under the terms of the GPL and not to allow others to use your version of +this file under the BSD license, indicate your decision by deleting the +provisions above and replace them with the notice and other provisions +required by the GPL in this and the other files of this package. If you do +not delete the provisions above, a recipient may use your version of this +file under either the BSD or the GPL. diff -Nru python-gevent-0.13.7/libev/ltmain.sh python-gevent-1.0/libev/ltmain.sh --- python-gevent-0.13.7/libev/ltmain.sh 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/ltmain.sh 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,8413 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6b +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.6b Debian-2.2.6b-2" +TIMESTAMP="" +package_revision=1.3017 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? value : ""))); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + + +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff -Nru python-gevent-0.13.7/libev/Makefile.in python-gevent-1.0/libev/Makefile.in --- python-gevent-0.13.7/libev/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/Makefile.in 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,774 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/configure config.guess \ + config.sub depcomp install-sh ltmain.sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/libev.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man3dir)" \ + "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libev_la_LIBADD = +am_libev_la_OBJECTS = ev.lo event.lo +libev_la_OBJECTS = $(am_libev_la_OBJECTS) +libev_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libev_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libev_la_SOURCES) +DIST_SOURCES = $(libev_la_SOURCES) +man3dir = $(mandir)/man3 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign +VERSION_INFO = 4:0:0 +EXTRA_DIST = LICENSE Changes libev.m4 autogen.sh \ + ev_vars.h ev_wrap.h \ + ev_epoll.c ev_select.c ev_poll.c ev_kqueue.c ev_port.c ev_win32.c \ + ev.3 ev.pod Symbols.ev Symbols.event + +man_MANS = ev.3 +include_HEADERS = ev.h ev++.h event.h +lib_LTLIBRARIES = libev.la +libev_la_SOURCES = ev.c event.c +libev_la_LDFLAGS = -version-info $(VERSION_INFO) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libev.la: $(libev_la_OBJECTS) $(libev_la_DEPENDENCIES) + $(libev_la_LINK) -rpath $(libdir) $(libev_la_OBJECTS) $(libev_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ev.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-man3: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" + @list=''; test -n "$(man3dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ + done; } + +uninstall-man3: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man3dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includedir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man3 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-man + +uninstall-man: uninstall-man3 + +.MAKE: all install-am install-strip + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags dist \ + dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-man3 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-man uninstall-man3 + + +ev.3: ev.pod + pod2man -n LIBEV -r "libev-$(VERSION)" -c "libev - high performance full featured event loop" -s3 <$< >$@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru python-gevent-0.13.7/libev/missing python-gevent-1.0/libev/missing --- python-gevent-0.13.7/libev/missing 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/missing 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff -Nru python-gevent-0.13.7/libev/README python-gevent-1.0/libev/README --- python-gevent-0.13.7/libev/README 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/libev/README 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,58 @@ +libev is a high-performance event loop/event model with lots of features. +(see benchmark at http://libev.schmorp.de/bench.html) + + +ABOUT + + Homepage: http://software.schmorp.de/pkg/libev + Mailinglist: libev@lists.schmorp.de + http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev + Library Documentation: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod + + Libev is modelled (very losely) after libevent and the Event perl + module, but is faster, scales better and is more correct, and also more + featureful. And also smaller. Yay. + + Some of the specialties of libev not commonly found elsewhere are: + + - extensive and detailed, readable documentation (not doxygen garbage). + - fully supports fork, can detect fork in various ways and automatically + re-arms kernel mechanisms that do not support fork. + - highly optimised select, poll, epoll, kqueue and event ports backends. + - filesystem object (path) watching (with optional linux inotify support). + - wallclock-based times (using absolute time, cron-like). + - relative timers/timeouts (handle time jumps). + - fast intra-thread communication between multiple + event loops (with optional fast linux eventfd backend). + - extremely easy to embed (fully documented, no dependencies, + autoconf supported but optional). + - very small codebase, no bloated library, simple code. + - fully extensible by being able to plug into the event loop, + integrate other event loops, integrate other event loop users. + - very little memory use (small watchers, small event loop data). + - optional C++ interface allowing method and function callbacks + at no extra memory or runtime overhead. + - optional Perl interface with similar characteristics (capable + of running Glib/Gtk2 on libev). + - support for other languages (multiple C++ interfaces, D, Ruby, + Python) available from third-parties. + + Examples of programs that embed libev: the EV perl module, node.js, + auditd, rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the + Deliantra MMORPG server (http://www.deliantra.net/), Rubinius (a + next-generation Ruby VM), the Ebb web server, the Rev event toolkit. + + +CONTRIBUTORS + + libev was written and designed by Marc Lehmann and Emanuele Giaquinta. + + The following people sent in patches or made other noteworthy + contributions to the design (for minor patches, see the Changes + file. If I forgot to include you, please shout at me, it was an + accident): + + W.C.A. Wijngaards + Christopher Layne + Chris Brody + diff -Nru python-gevent-0.13.7/LICENSE.pyevent python-gevent-1.0/LICENSE.pyevent --- python-gevent-0.13.7/LICENSE.pyevent 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/LICENSE.pyevent 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -Copyright (c) 2004 Dug Song -Copyright (c) 2003 Martin Murray -All rights reserved, all wrongs reversed. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The names of the authors and copyright holders may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -Nru python-gevent-0.13.7/Makefile.ext python-gevent-1.0/Makefile.ext --- python-gevent-0.13.7/Makefile.ext 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/Makefile.ext 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,37 @@ +# This file is renamed to "Makefile.ext" in release tarballs so that setup.py won't try to +# run it. If you want setup.py to run "make" automatically, rename it back to "Makefile". + +PYTHON ?= python +CYTHON ?= cython + +all: gevent/gevent.core.c gevent/gevent.ares.c gevent/gevent._semaphore.c gevent/gevent._util.c + +gevent/gevent.core.c: gevent/core.ppyx gevent/libev.pxd + $(PYTHON) util/cythonpp.py -o gevent.core.c gevent/core.ppyx + echo >> gevent.core.c + echo '#include "callbacks.c"' >> gevent.core.c + mv gevent.core.* gevent/ + +gevent/gevent.ares.c: gevent/ares.pyx gevent/*.pxd + $(CYTHON) -o gevent.ares.c gevent/ares.pyx + mv gevent.ares.* gevent/ + +gevent/gevent._semaphore.c: gevent/_semaphore.pyx + $(CYTHON) -o gevent._semaphore.c gevent/_semaphore.pyx + mv gevent._semaphore.* gevent/ + +gevent/gevent._util.c: gevent/_util.pyx + $(CYTHON) -o gevent._util.c gevent/_util.pyx + mv gevent._util.* gevent/ + +clean: + rm -f gevent.core.c gevent.core.h core.pyx gevent/gevent.core.c gevent/gevent.core.h gevent/core.pyx + rm -f gevent.ares.c gevent.ares.h gevent/gevent.ares.c gevent/gevent.ares.h + rm -f gevent._semaphore.c gevent._semaphore.h gevent/gevent._semaphore.c gevent/gevent._semaphore.h + rm -f gevent._util.c gevent._util.h gevent/gevent._util.c gevent/gevent._util.h + +doc: + cd doc && PYTHONPATH=.. make html + + +.PHONY: clean all doc diff -Nru python-gevent-0.13.7/MANIFEST.in python-gevent-1.0/MANIFEST.in --- python-gevent-0.13.7/MANIFEST.in 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/MANIFEST.in 2013-11-26 16:25:45.000000000 +0000 @@ -2,11 +2,14 @@ recursive-include examples * recursive-include gevent * recursive-include doc * +recursive-include libev * +recursive-include c-ares * +recursive-include util * include LICENSE -include LICENSE.pyevent include README.rst include TODO include changelog.rst include MANIFEST.in -include fetch_libevent.py include AUTHORS +include Makefile.ext +include known_failures.txt diff -Nru python-gevent-0.13.7/PKG-INFO python-gevent-1.0/PKG-INFO --- python-gevent-0.13.7/PKG-INFO 2012-04-11 22:26:26.000000000 +0000 +++ python-gevent-1.0/PKG-INFO 2013-11-26 16:26:19.000000000 +0000 @@ -1,7 +1,7 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: gevent -Version: 0.13.7 -Summary: Python network library that uses greenlet and libevent for easy and scalable concurrency +Version: 1.0 +Summary: Coroutine-based network library Home-page: http://www.gevent.org/ Author: Denis Bilenko Author-email: denis.bilenko@gmail.com @@ -9,27 +9,16 @@ Description: gevent_ ======= - .. attention:: - - New_ version of gevent uses libev_ and c-ares rather than libevent and includes all the dependencies in the release tarball. - - You can download the 1.0 beta release from `google code`_. Please give it a try. - - .. _libev: http://blog.gevent.org/2011/04/28/libev-and-libevent/ - .. _google code: http://code.google.com/p/gevent/downloads/ - .. _New: https://bitbucket.org/denis/gevent/src/tip/changelog.rst#cl-7 - - gevent_ is a Python networking library that uses greenlet_ to provide synchronous API on top of libevent_ event loop. + gevent_ is a coroutine-based Python networking library. Features include: - * Fast event loop based on libevent_. + * Fast event loop based on libev_. * Lightweight execution units based on greenlet_. * Familiar API that re-uses concepts from the Python standard library. - * Cooperative sockets with ssl support. - * DNS queries performed through libevent-dns. + * Cooperative sockets with SSL support. + * DNS queries performed through c-ares_ or a threadpool. * Ability to use standard library and 3rd party modules written for standard blocking sockets - * Fast WSGI server based on libevent-http. gevent_ is `inspired by eventlet`_ but features more consistent API, simpler implementation and better performance. Read why others `use gevent`_ and check out the list of the `open source projects based on gevent`_. @@ -39,7 +28,7 @@ get gevent ---------- - Install Python 2.4 or newer, greenlet and libevent. + Install Python 2.5 or newer and greenlet_ extension. Download the latest release from `Python Package Index`_ or clone `the repository`_. @@ -48,16 +37,39 @@ Post feedback and issues on the `bug tracker`_, `mailing list`_, blog_ and `twitter (@gevent)`_. + installing from github + ---------------------- + + To install latest release candidate: + + pip install cython git+git://github.com/surfly/gevent.git@1.0rc3#egg=gevent + + To install latest development version: + + pip install cython git+git://github.com/surfly/gevent.git#egg=gevent + + + running tests + ------------- + + python setup.py build + + cd greentest + + PYTHONPATH=.. python testrunner.py --expected ../known_failures.txt + + .. _gevent: http://www.gevent.org - .. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html - .. _libevent: http://monkey.org/~provos/libevent/ + .. _greenlet: http://pypi.python.org/pypi/greenlet + .. _libev: http://libev.schmorp.de/ + .. _c-ares: http://c-ares.haxx.se/ .. _inspired by eventlet: http://blog.gevent.org/2010/02/27/why-gevent/ .. _use gevent: http://groups.google.com/group/gevent/browse_thread/thread/4de9703e5dca8271 - .. _open source projects based on gevent: http://code.google.com/p/gevent/wiki/ProjectsUsingGevent + .. _open source projects based on gevent: https://github.com/surfly/gevent/wiki/Projects .. _Denis Bilenko: http://denisbilenko.com .. _Python Package Index: http://pypi.python.org/pypi/gevent - .. _the repository: http://bitbucket.org/denis/gevent - .. _bug tracker: http://code.google.com/p/gevent/issues/list + .. _the repository: https://github.com/surfly/gevent + .. _bug tracker: https://github.com/surfly/gevent/wiki/Projects .. _mailing list: http://groups.google.com/group/gevent .. _blog: http://blog.gevent.org .. _twitter (@gevent): http://twitter.com/gevent @@ -65,7 +77,6 @@ Platform: UNKNOWN Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.4 Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 diff -Nru python-gevent-0.13.7/README.rst python-gevent-1.0/README.rst --- python-gevent-0.13.7/README.rst 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/README.rst 2013-11-26 16:25:45.000000000 +0000 @@ -1,27 +1,16 @@ gevent_ ======= -.. attention:: - - New_ version of gevent uses libev_ and c-ares rather than libevent and includes all the dependencies in the release tarball. - - You can download the 1.0 beta release from `google code`_. Please give it a try. - -.. _libev: http://blog.gevent.org/2011/04/28/libev-and-libevent/ -.. _google code: http://code.google.com/p/gevent/downloads/ -.. _New: https://bitbucket.org/denis/gevent/src/tip/changelog.rst#cl-7 - -gevent_ is a Python networking library that uses greenlet_ to provide synchronous API on top of libevent_ event loop. +gevent_ is a coroutine-based Python networking library. Features include: -* Fast event loop based on libevent_. +* Fast event loop based on libev_. * Lightweight execution units based on greenlet_. * Familiar API that re-uses concepts from the Python standard library. -* Cooperative sockets with ssl support. -* DNS queries performed through libevent-dns. +* Cooperative sockets with SSL support. +* DNS queries performed through c-ares_ or a threadpool. * Ability to use standard library and 3rd party modules written for standard blocking sockets -* Fast WSGI server based on libevent-http. gevent_ is `inspired by eventlet`_ but features more consistent API, simpler implementation and better performance. Read why others `use gevent`_ and check out the list of the `open source projects based on gevent`_. @@ -31,7 +20,7 @@ get gevent ---------- -Install Python 2.4 or newer, greenlet and libevent. +Install Python 2.5 or newer and greenlet_ extension. Download the latest release from `Python Package Index`_ or clone `the repository`_. @@ -40,16 +29,39 @@ Post feedback and issues on the `bug tracker`_, `mailing list`_, blog_ and `twitter (@gevent)`_. +installing from github +---------------------- + +To install latest release candidate: + + pip install cython git+git://github.com/surfly/gevent.git@1.0rc3#egg=gevent + +To install latest development version: + + pip install cython git+git://github.com/surfly/gevent.git#egg=gevent + + +running tests +------------- + + python setup.py build + + cd greentest + + PYTHONPATH=.. python testrunner.py --expected ../known_failures.txt + + .. _gevent: http://www.gevent.org -.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html -.. _libevent: http://monkey.org/~provos/libevent/ +.. _greenlet: http://pypi.python.org/pypi/greenlet +.. _libev: http://libev.schmorp.de/ +.. _c-ares: http://c-ares.haxx.se/ .. _inspired by eventlet: http://blog.gevent.org/2010/02/27/why-gevent/ .. _use gevent: http://groups.google.com/group/gevent/browse_thread/thread/4de9703e5dca8271 -.. _open source projects based on gevent: http://code.google.com/p/gevent/wiki/ProjectsUsingGevent +.. _open source projects based on gevent: https://github.com/surfly/gevent/wiki/Projects .. _Denis Bilenko: http://denisbilenko.com .. _Python Package Index: http://pypi.python.org/pypi/gevent -.. _the repository: http://bitbucket.org/denis/gevent -.. _bug tracker: http://code.google.com/p/gevent/issues/list +.. _the repository: https://github.com/surfly/gevent +.. _bug tracker: https://github.com/surfly/gevent/wiki/Projects .. _mailing list: http://groups.google.com/group/gevent .. _blog: http://blog.gevent.org .. _twitter (@gevent): http://twitter.com/gevent diff -Nru python-gevent-0.13.7/setup.cfg python-gevent-1.0/setup.cfg --- python-gevent-0.13.7/setup.cfg 2012-04-11 22:26:27.000000000 +0000 +++ python-gevent-1.0/setup.cfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff -Nru python-gevent-0.13.7/setup.py python-gevent-1.0/setup.py --- python-gevent-0.13.7/setup.py 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/setup.py 2013-11-26 16:25:45.000000000 +0000 @@ -1,319 +1,305 @@ #!/usr/bin/env python -""" -gevent build & installation script ----------------------------------- - -If you have more than one libevent installed or it is installed in a -non-standard location, use the options to point to the right dirs: - - -IPATH add include PATH - -LPATH add library PATH - --libevent PATH use libevent from PATH - If configure and make have been run in PATH, this implies - -IPATH -IPATH/include -LPATH/.libs - Otherwise setup.py will run configure and make and link - statically with libevent. -""" - +"""gevent build & installation script""" import sys import os import re +import shutil import traceback -import glob -from os.path import join, isdir, abspath, basename, exists, dirname +from os.path import join, abspath, basename, dirname +from glob import glob try: from setuptools import Extension, setup except ImportError: from distutils.core import Extension, setup -from distutils.command import build_ext +from distutils.command.build_ext import build_ext +from distutils.command.sdist import sdist as _sdist +from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError +ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError) -__version__ = re.search("__version__\s*=\s*'(.*)'", open('gevent/__init__.py').read(), re.M).group(1) -assert __version__ +# XXX make all env variables that setup.py parses start with GEVENTSETUP_ -include_dirs = [] # specified by -I -library_dirs = [] # specified by -L -libevent_source_path = None # specified by --libevent -extra_compile_args = [] -sources = ['gevent/core.c'] -libraries = [] +__version__ = re.search("__version__\s*=\s*'(.*)'", open('gevent/__init__.py').read(), re.M).group(1) +assert __version__ -def run_cython(cython_command='cython'): - sources = glob.glob('gevent/*.pyx') + glob.glob('gevent/*.pxi') - if not sources: - if not os.path.exists('gevent/core.c'): - print >> sys.stderr, 'Could not find gevent/core.c' - if os.path.exists('gevent/core.c'): - core_c_mtime = os.stat('gevent/core.c').st_mtime - changed = [filename for filename in sources if (os.stat(filename).st_mtime - core_c_mtime) > 1] - if not changed: - return - print >> sys.stderr, 'Running %s (changed: %s)' % (cython_command, ', '.join(changed)) - else: - print >> sys.stderr, 'Running %s' % cython_command - cython_result = os.system('%s gevent/core.pyx' % cython_command) - if cython_result: - if os.system('%s -V 2> %s' % (cython_command, os.devnull)): - # there's no cython in the system - print >> sys.stderr, 'No cython found, cannot rebuild core.c' - return - sys.exit(1) +def parse_environ(key): + value = os.environ.get(key) + if not value: + return + value = value.lower().strip() + if value in ('1', 'true', 'on', 'yes'): + return True + elif value in ('0', 'false', 'off', 'no'): + return False + raise ValueError('Environment variable %r has invalid value %r. Please set it to 1, 0 or an empty string' % (key, value)) + + +def get_config_value(key, defkey, path): + value = parse_environ(key) + if value is None: + value = parse_environ(defkey) + if value is not None: + return value + return os.path.exists(path) -class my_build_ext(build_ext.build_ext): - user_options = (build_ext.build_ext.user_options - + [("cython=", None, "path to the cython executable")]) - def initialize_options(self): - build_ext.build_ext.initialize_options(self) - self.cython = "cython" +LIBEV_EMBED = get_config_value('LIBEV_EMBED', 'EMBED', 'libev') +CARES_EMBED = get_config_value('CARES_EMBED', 'EMBED', 'c-ares') - def build_extension(self, ext): - compile_libevent(self) - if self.cython: - run_cython(self.cython) - result = build_ext.build_ext.build_extension(self, ext) - # hack: create a symlink from build/../core.so to gevent/core.so - # to prevent "ImportError: cannot import name core" failures - try: - fullname = self.get_ext_fullname(ext.name) - modpath = fullname.split('.') - filename = self.get_ext_filename(ext.name) - filename = os.path.split(filename)[-1] - if not self.inplace: - filename = os.path.join(*modpath[:-1] + [filename]) - path_to_build_core_so = abspath(os.path.join(self.build_lib, filename)) - path_to_core_so = abspath(join('gevent', basename(path_to_build_core_so))) - if path_to_build_core_so != path_to_core_so: - try: - os.unlink(path_to_core_so) - except OSError: - pass - if hasattr(os, 'symlink'): - print 'Linking %s to %s' % (path_to_build_core_so, path_to_core_so) - os.symlink(path_to_build_core_so, path_to_core_so) - else: - print 'Copying %s to %s' % (path_to_build_core_so, path_to_core_so) - import shutil - shutil.copyfile(path_to_build_core_so, path_to_core_so) - except Exception: - traceback.print_exc() - return result - - -def mysystem(cmd): - err = os.system(cmd) - if err: - sys.exit("running %r failed" % cmd) +define_macros = [] +libraries = [] +libev_configure_command = ["/bin/sh", abspath('libev/configure'), '> configure-output.txt'] +ares_configure_command = ["/bin/sh", abspath('c-ares/configure'), 'CONFIG_COMMANDS= CONFIG_FILES= > configure-output.txt'] -def compile_libevent(build): - sdir = libevent_source_path - if not sdir: +if sys.platform == 'win32': + libraries += ['ws2_32'] + define_macros += [('FD_SETSIZE', '1024'), ('_WIN32', '1')] + + +def expand(*lst): + result = [] + for item in lst: + for name in sorted(glob(item)): + result.append(name) + return result + + +CORE = Extension(name='gevent.core', + sources=['gevent/gevent.core.c'], + include_dirs=['libev'] if LIBEV_EMBED else [], + libraries=libraries, + define_macros=define_macros, + depends=expand('gevent/callbacks.*', 'gevent/stathelper.c', 'gevent/libev*.h', 'libev/*.*')) +# QQQ libev can also use -lm, however it seems to be added implicitly + +ARES = Extension(name='gevent.ares', + sources=['gevent/gevent.ares.c'], + include_dirs=['c-ares'] if CARES_EMBED else [], + libraries=libraries, + define_macros=define_macros, + depends=expand('gevent/dnshelper.c', 'gevent/cares_*.*')) +ARES.optional = True + + +ext_modules = [CORE, + ARES, + Extension(name="gevent._semaphore", + sources=["gevent/gevent._semaphore.c"]), + Extension(name="gevent._util", + sources=["gevent/gevent._util.c"])] + + +def make_universal_header(filename, *defines): + defines = [('#define %s ' % define, define) for define in defines] + lines = open(filename, 'r').read().split('\n') + ifdef = 0 + f = open(filename, 'w') + for line in lines: + if line.startswith('#ifdef'): + ifdef += 1 + elif line.startswith('#endif'): + ifdef -= 1 + elif not ifdef: + for prefix, define in defines: + if line.startswith(prefix): + line = '#ifdef __LP64__\n#define %s 8\n#else\n#define %s 4\n#endif' % (define, define) + break + print >>f, line + f.close() + + +def _system(cmd): + cmd = ' '.join(cmd) + sys.stdout.write('Running %r in %s\n' % (cmd, os.getcwd())) + return os.system(cmd) + + +def configure_libev(bext, ext): + if sys.platform == "win32": + CORE.define_macros.append(('EV_STANDALONE', '1')) return - from distutils import sysconfig + bdir = os.path.join(bext.build_temp, 'libev') + ext.include_dirs.insert(0, bdir) - configure = os.path.abspath(os.path.join(sdir, "configure")) - addlibs = [] - bdir = os.path.join(build.build_temp, "libevent") if not os.path.isdir(bdir): os.makedirs(bdir) cwd = os.getcwd() os.chdir(bdir) try: - if "CC" not in os.environ: - cc = sysconfig.get_config_var("CC") - if cc: - os.environ["CC"] = cc - - archflags = sysconfig.get_config_var("ARCHFLAGS") - if archflags: - os.environ["AM_CFLAGS"] = archflags - - if not exists("./config.status"): - mysystem("%s --with-pic --disable-shared --disable-dependency-tracking" % configure) - if "bsd" in sys.platform: - mysystem("gmake") - else: - mysystem("make") - - for line in open("Makefile"): - if line.startswith("LIBS = "): - addlibs = [x[2:] for x in line[len("LIBS = "):].strip().split() if x.startswith("-l")] + if os.path.exists('config.h'): + return + rc = _system(libev_configure_command) + if rc == 0 and sys.platform == 'darwin': + make_universal_header('config.h', 'SIZEOF_LONG', 'SIZEOF_SIZE_T', 'SIZEOF_TIME_T') finally: os.chdir(cwd) - if build is None: - return - - if build.include_dirs is None: - build.include_dirs = [] - if build.library_dirs is None: - build.library_dirs = [] - # bdir is needed for event-config.h - build.include_dirs[:0] = [bdir, "%s/include" % bdir, sdir, "%s/include" % sdir] - build.library_dirs[:0] = ["%s/.libs" % bdir] - build.libraries.extend(addlibs) - cc = build.compiler - if sys.platform == "darwin": - # stupid apple: http://developer.apple.com/mac/library/qa/qa2006/qa1393.html - cc.linker_so += ['-Wl,-search_paths_first'] - cc.linker_exe += ['-Wl,-search_paths_first'] +def configure_ares(bext, ext): + bdir = os.path.join(bext.build_temp, 'c-ares') + ext.include_dirs.insert(0, bdir) - cc.set_include_dirs(build.include_dirs) - cc.set_library_dirs(build.library_dirs) - cc.set_libraries(build.libraries) + if not os.path.isdir(bdir): + os.makedirs(bdir) + if sys.platform == "win32": + shutil.copy("c-ares\\ares_build.h.dist", os.path.join(bdir, "ares_build.h")) + return -def check_dir(path, must_exist): - if not isdir(path): - msg = 'Not a directory: %s' % path - if must_exist: - sys.exit(msg) + cwd = os.getcwd() + os.chdir(bdir) + try: + if os.path.exists('ares_config.h') and os.path.exists('ares_build.h'): + return + rc = _system(ares_configure_command) + if rc == 0 and sys.platform == 'darwin': + make_universal_header('ares_build.h', 'CARES_SIZEOF_LONG') + make_universal_header('ares_config.h', 'SIZEOF_LONG', 'SIZEOF_SIZE_T', 'SIZEOF_TIME_T') + finally: + os.chdir(cwd) -def add_include_dir(path, must_exist=True): - if path not in include_dirs: - check_dir(path, must_exist) - include_dirs.append(path) +if LIBEV_EMBED: + CORE.define_macros += [('LIBEV_EMBED', '1'), + ('EV_COMMON', ''), # we don't use void* data + # libev watchers that we don't use currently: + ('EV_CHECK_ENABLE', '0'), + ('EV_CLEANUP_ENABLE', '0'), + ('EV_EMBED_ENABLE', '0'), + ("EV_PERIODIC_ENABLE", '0')] + CORE.configure = configure_libev + if sys.platform == "darwin": + os.environ["CFLAGS"] = ("%s %s" % (os.environ.get("CFLAGS", ""), "-U__llvm__")).lstrip() + if os.environ.get('GEVENTSETUP_EV_VERIFY') is not None: + CORE.define_macros.append(('EV_VERIFY', os.environ['GEVENTSETUP_EV_VERIFY'])) +else: + CORE.libraries.append('ev') -def add_library_dir(path, must_exist=True): - if path not in library_dirs: - check_dir(path, must_exist) - library_dirs.append(path) +if CARES_EMBED: + ARES.sources += expand('c-ares/*.c') + ARES.configure = configure_ares + if sys.platform == 'win32': + ARES.libraries += ['advapi32'] + ARES.define_macros += [('CARES_STATICLIB', '')] + else: + ARES.define_macros += [('HAVE_CONFIG_H', '')] + if sys.platform != 'darwin': + ARES.libraries += ['rt'] + ARES.define_macros += [('CARES_EMBED', '1')] +else: + ARES.libraries.append('cares') + ARES.define_macros += [('HAVE_NETDB_H', '')] -def enable_libevent_source_path(): - add_include_dir(join(libevent_source_path, 'include'), must_exist=False) - add_include_dir(libevent_source_path, must_exist=False) - add_library_dir(join(libevent_source_path, '.libs'), must_exist=False) - if sys.platform == 'win32': - add_include_dir(join(libevent_source_path, 'compat'), must_exist=False) - add_include_dir(join(libevent_source_path, 'WIN32-Code'), must_exist=False) +def make(done=[]): + if not done: + if os.path.exists('Makefile'): + if "PYTHON" not in os.environ: + os.environ["PYTHON"] = sys.executable + if os.system('make'): + sys.exit(1) + done.append(1) + + +class sdist(_sdist): + + def run(self): + renamed = False + if os.path.exists('Makefile'): + make() + os.rename('Makefile', 'Makefile.ext') + renamed = True + try: + return _sdist.run(self) + finally: + if renamed: + os.rename('Makefile.ext', 'Makefile') - global compile_libevent - compile_libevent = lambda *a: None +class my_build_ext(build_ext): + + def gevent_prepare(self, ext): + make() + configure = getattr(ext, 'configure', None) + if configure: + configure(self, ext) -# parse options: -I NAME / -INAME / -L NAME / -LNAME / --libevent DIR -# we're cutting out options from sys.path instead of using optparse -# so that these option can co-exists with distutils' options -i = 1 -while i < len(sys.argv): - arg = sys.argv[i] - if arg == '-I': - del sys.argv[i] - add_include_dir(sys.argv[i]) - elif arg.startswith('-I'): - add_include_dir(arg[2:]) - elif arg == '-L': - del sys.argv[i] - add_library_dir(sys.argv[i]) - elif arg.startswith('-L'): - add_library_dir(arg[2:]) - elif arg == '--libevent': - del sys.argv[i] - libevent_source_path = sys.argv[i] - else: - i += 1 - continue - del sys.argv[i] - -if libevent_source_path is None and os.path.isdir("libevent-src"): - libevent_source_path = "libevent-src" - print "using libevent sources in libevent-src" - -# sources used when building on windows; this includes sources of both libevent-1.4 -# and libevent-2 combined, but will filter out the files that do not exist -libevent_sources = '''buffer.c -bufferevent_async.c -bufferevent.c -bufferevent_filter.c -bufferevent_pair.c -bufferevent_ratelim.c -bufferevent_sock.c -buffer_iocp.c -evbuffer.c -evdns.c -event.c -event_iocp.c -event_tagging.c -evmap.c -evrpc.c -evthread.c -evthread_win32.c -evutil.c -evutil_rand.c -http.c -listener.c -log.c -signal.c -strlcpy.c -WIN32-Code/win32.c -win32select.c'''.split() + def build_extension(self, ext): + self.gevent_prepare(ext) + try: + result = build_ext.build_extension(self, ext) + except ext_errors: + if getattr(ext, 'optional', False): + raise BuildFailed + else: + raise + # hack: create a symlink from build/../core.so to gevent/core.so + # to prevent "ImportError: cannot import name core" failures + try: + fullname = self.get_ext_fullname(ext.name) + modpath = fullname.split('.') + filename = self.get_ext_filename(ext.name) + filename = os.path.split(filename)[-1] + if not self.inplace: + filename = os.path.join(*modpath[:-1] + [filename]) + path_to_build_core_so = os.path.join(self.build_lib, filename) + path_to_core_so = join('gevent', basename(path_to_build_core_so)) + link(path_to_build_core_so, path_to_core_so) + except Exception: + traceback.print_exc() + return result -if not sys.argv[1:] or '-h' in sys.argv or '--help' in ' '.join(sys.argv): - print __doc__ -else: - if sys.platform == 'win32': - if not libevent_source_path: - sys.exit('Please provide path to libevent source with --libevent DIR') - enable_libevent_source_path() - extra_compile_args += ['-DHAVE_CONFIG_H', '-DWIN32'] - libraries = ['wsock32', 'advapi32', 'ws2_32', 'shell32'] - include_dirs.extend([join(libevent_source_path, 'WIN32-Code'), - join(libevent_source_path, 'compat')]) - libevent_sources = [join(libevent_source_path, filename) for filename in libevent_sources] - libevent_sources = [filename for filename in libevent_sources if exists(filename)] - if not libevent_sources: - sys.exit('No libevent sources found in %s' % libevent_source_path) - for filename in libevent_sources: - sources.append(filename) - else: - libraries = ['event'] - if (libevent_source_path - and (exists(join(libevent_source_path, ".libs")) - or not exists(join(libevent_source_path, "configure")))): - enable_libevent_source_path() - -gevent_core = Extension(name='gevent.core', - sources=sources, - include_dirs=include_dirs, - library_dirs=library_dirs, - libraries=libraries, - extra_compile_args=extra_compile_args) +def link(source, dest): + source = abspath(source) + dest = abspath(dest) + if source == dest: + return + try: + os.unlink(dest) + except OSError: + pass + try: + os.symlink(source, dest) + sys.stdout.write('Linking %s to %s\n' % (source, dest)) + except (OSError, AttributeError): + sys.stdout.write('Copying %s to %s\n' % (source, dest)) + shutil.copyfile(source, dest) -def read(name): - return open(join(dirname(__file__), name)).read() +class BuildFailed(Exception): + pass -if __name__ == '__main__': - if sys.argv[1:] == ['cython']: - run_cython() - else: - setup( - name='gevent', - version=__version__, - description='Python network library that uses greenlet and libevent for easy and scalable concurrency', - long_description=read('README.rst'), - author='Denis Bilenko', - author_email='denis.bilenko@gmail.com', - url='http://www.gevent.org/', - packages=['gevent'], - ext_modules=[gevent_core], - cmdclass={'build_ext': my_build_ext}, - install_requires=['greenlet'], - classifiers=[ +def read(name, *args): + try: + return open(join(dirname(__file__), name)).read(*args) + except OSError: + return '' + + +def run_setup(ext_modules): + setup( + name='gevent', + version=__version__, + description='Coroutine-based network library', + long_description=read('README.rst'), + author='Denis Bilenko', + author_email='denis.bilenko@gmail.com', + url='http://www.gevent.org/', + packages=['gevent'], + ext_modules=ext_modules, + cmdclass=dict(build_ext=my_build_ext, sdist=sdist), + install_requires=['greenlet'], + classifiers=[ "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", @@ -324,3 +310,15 @@ "Topic :: Software Development :: Libraries :: Python Modules", "Intended Audience :: Developers", "Development Status :: 4 - Beta"]) + + +if __name__ == '__main__': + try: + run_setup(ext_modules) + except BuildFailed: + if ARES not in ext_modules: + raise + ext_modules.remove(ARES) + run_setup(ext_modules) + if ARES not in ext_modules: + sys.stderr.write('\nWARNING: The gevent.ares extension has been disabled.\n') diff -Nru python-gevent-0.13.7/TODO python-gevent-1.0/TODO --- python-gevent-0.13.7/TODO 2012-04-11 22:26:23.000000000 +0000 +++ python-gevent-1.0/TODO 2013-11-26 16:25:45.000000000 +0000 @@ -1 +1 @@ -The issue tracker is hosted at http://code.google.com/p/gevent/issues/list +The issue tracker is hosted at https://github.com/surfly/gevent/issues diff -Nru python-gevent-0.13.7/util/cythonpp.py python-gevent-1.0/util/cythonpp.py --- python-gevent-0.13.7/util/cythonpp.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/util/cythonpp.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,803 @@ +#!/usr/bin/python +# Copyright (C) 2011-2012 Denis Bilenko (http://denisbilenko.com) +import sys +import os +import re +import traceback +import datetime +import pipes +import difflib +from hashlib import md5 + +if sys.version_info >= (3, 0): + exec("def do_exec(co, loc): exec(co, loc)\n") +else: + exec("def do_exec(co, loc): exec co in loc\n") + +_ex = lambda: sys.exc_info()[1] + + +CYTHON = os.environ.get('CYTHON') or 'cython' +DEBUG = False +WRITE_OUTPUT = False + +# Parameter name in macros must match this regex: +param_name_re = re.compile('^[a-zA-Z_]\w*$') + +# First line of a definition of a new macro: +define_re = re.compile(r'^#define\s+([a-zA-Z_]\w*)(\((?:[^,)]+,)*[^,)]+\))?\s+(.*)$') + +# Conditional directive: +condition_re = re.compile(r'^#(ifdef\s+.+|if\s+.+|else\s*|endif\s*)$') + + +def match_condition(line): + line = line.strip() + if line.endswith(':'): + return None + return condition_re.match(line) + +newline_token = ' ' + + +def process_filename(filename, output_filename=None): + """Process the .ppyx file with preprocessor and compile it with cython. + + The algorithm is as following: + + 1) Identify all possible preprocessor conditions in *filename*. + 2) Run preprocess_filename(*filename*) for each of these conditions. + 3) Process the output of preprocessor with Cython (as many times as + there are different sources generated for different preprocessor + definitions. + 4) Merge the output of different Cython runs using preprocessor conditions + identified in (1). + """ + if output_filename is None: + output_filename = filename.rsplit('.', 1)[0] + '.c' + + pyx_filename = filename.rsplit('.', 1)[0] + '.pyx' + assert pyx_filename != filename + + timestamp = str(datetime.datetime.now().replace(microsecond=0)) + banner = 'Generated by cythonpp.py on %s' % timestamp + py_banner = '# %s\n' % banner + + preprocessed = {} + for configuration in get_configurations(filename): + preprocessed[configuration] = preprocess_filename(filename, Config(configuration)) + preprocessed[None] = preprocess_filename(filename, None) + + preprocessed = expand_to_match(preprocessed.items()) + reference_pyx = preprocessed.pop(None) + + sources = [] + + counter = 0 + for configuration, lines in sorted(preprocessed.items()): + counter += 1 + value = ''.join(lines) + sourcehash = md5(value.encode("utf-8")).hexdigest() + comment = format_tag(set(configuration)) + atomic_write(pyx_filename, py_banner + value) + if WRITE_OUTPUT: + atomic_write(pyx_filename + '.%s' % counter, '# %s (%s)\n%s' % (banner, comment, value)) + output = run_cython(pyx_filename, sourcehash, output_filename, banner, comment) + if WRITE_OUTPUT: + atomic_write(output_filename + '.%s' % counter, output) + sources.append(attach_tags(output, configuration)) + + sys.stderr.write('Generating %s ' % output_filename) + result = generate_merged(output_filename, sources) + atomic_write(output_filename, result) + sys.stderr.write('%s bytes\n' % len(result)) + + if filename != pyx_filename: + log('Saving %s', pyx_filename) + atomic_write(pyx_filename, py_banner + ''.join(reference_pyx)) + + +def generate_merged(output_filename, sources): + result = [] + for line in produce_preprocessor(merge(sources)): + result.append(line.replace(newline_token, '\n')) + return ''.join(result) + + +def preprocess_filename(filename, config): + """Process given .ppyx file with preprocessor. + + This does the following + 1) Resolves "#if"s and "#ifdef"s using config + 2) Expands macro definitions (#define) + """ + linecount = 0 + current_name = None + definitions = {} + result = [] + including_section = [] + for line in open(filename): + linecount += 1 + rstripped = line.rstrip() + stripped = rstripped.lstrip() + try: + if current_name is not None: + name = current_name + value = rstripped + if value.endswith('\\'): + value = value[:-1].rstrip() + else: + current_name = None + definitions[name]['lines'].append(value) + else: + if not including_section or including_section[-1]: + m = define_re.match(stripped) + else: + m = None + if m is not None: + name, params, value = m.groups() + value = value.strip() + if value.endswith('\\'): + value = value[:-1].rstrip() + current_name = name + definitions[name] = {'lines': [value]} + if params is None: + dbg('Adding definition for %r', name) + else: + definitions[name]['params'] = parse_parameter_names(params) + dbg('Adding definition for %r: %s', name, definitions[name]['params']) + else: + m = match_condition(stripped) + if m is not None and config is not None: + if stripped == '#else': + if not including_section: + raise SyntaxError('unexpected "#else"') + if including_section[-1]: + including_section.pop() + including_section.append(False) + else: + including_section.pop() + including_section.append(True) + elif stripped == '#endif': + if not including_section: + raise SyntaxError('unexpected "#endif"') + including_section.pop() + else: + including_section.append(config.is_condition_true(stripped)) + else: + if including_section and not including_section[-1]: + pass # skip this line because last "#if" was false + else: + if stripped.startswith('#'): + # leave comments as is + result.append(Str_sourceline(line, linecount - 1)) + else: + lines = expand_definitions(line, definitions).split('\n') + if lines and not lines[-1]: + del lines[-1] + lines = [x + '\n' for x in lines] + lines = [Str_sourceline(x, linecount - 1) for x in lines] + result.extend(lines) + except BaseException: + ex = _ex() + log('%s:%s: %s', filename, linecount, ex) + if type(ex) is SyntaxError: + sys.exit(1) + else: + raise + return result + + +def merge(sources): + r"""Merge different sources into a single one. Each line of the result + is a subclass of string that maintains the information for each configuration + it should appear in the result. + + >>> src1 = attach_tags('hello\nworld\n', set([('defined(hello)', True), ('defined(world)', True)])) + >>> src2 = attach_tags('goodbye\nworld\n', set([('defined(hello)', False), ('defined(world)', True)])) + >>> src3 = attach_tags('hello\neveryone\n', set([('defined(hello)', True), ('defined(world)', False)])) + >>> src4 = attach_tags('goodbye\neveryone\n', set([('defined(hello)', False), ('defined(world)', False)])) + >>> from pprint import pprint + >>> pprint(merge([src1, src2, src3, src4])) + [Str('hello\n', [set([('defined(hello)', True)])]), + Str('goodbye\n', [set([('defined(hello)', False)])]), + Str('world\n', [set([('defined(world)', True)])]), + Str('everyone\n', [set([('defined(world)', False)])])] + """ + if len(sources) <= 1: + return [Str(str(x), simplify_tags(x.tags)) for x in sources[0]] + return merge([list(_merge(sources[0], sources[1]))] + sources[2:]) + + +def _merge(a, b): + for tag, i1, i2, j1, j2 in difflib.SequenceMatcher(None, a, b).get_opcodes(): + if tag == 'equal': + for line_a, line_b in zip(a[i1:i2], b[j1:j2]): + tags = getattr(line_a, 'tags', []) + getattr(line_b, 'tags', []) + yield Str(line_a, tags) + else: + for line in a[i1:i2]: + yield line + for line in b[j1:j2]: + yield line + + +def expand_to_match(items): + """Insert empty lines so that all sources has matching line numbers for the same code""" + cfg2newlines = {} # maps configuration -> list + for configuration, lines in items: + cfg2newlines[configuration] = [] + + maxguard = 2 ** 30 + while True: + minimalsourceline = maxguard + for configuration, lines in items: + if lines: + minimalsourceline = min(minimalsourceline, lines[0].sourceline) + if minimalsourceline == maxguard: + break + + for configuration, lines in items: + if lines and lines[0].sourceline <= minimalsourceline: + cfg2newlines[configuration].append(lines[0]) + del lines[0] + + number_of_lines = max(len(x) for x in cfg2newlines.values()) + + for newlines in cfg2newlines.values(): + add = (number_of_lines - len(newlines)) + newlines.extend(['\n'] * add) + + return cfg2newlines + + +def produce_preprocessor(iterable): + + current_line = [0] + + def wrap(line, log=True): + current_line[0] += 1 + dbg('%5d: %s', current_line[0], repr(str(line))[1:-1]) + return line + + state = None + for line in iterable: + key = line.tags or None + + if key == state: + yield wrap(line, key) + else: + if exact_reverse(key, state): + yield wrap('#else /* %s */\n' % format_tags(state)) + else: + if state: + yield wrap('#endif /* %s */\n' % format_tags(state)) + if key: + yield wrap('#if %s\n' % format_tags(key)) + yield wrap(line, key) + state = key + if state: + yield wrap('#endif /* %s */\n' % format_tags(state)) + + +def exact_reverse(tags1, tags2): + if not tags1: + return + if not tags2: + return + if not isinstance(tags1, list): + raise TypeError(repr(tags1)) + if not isinstance(tags2, list): + raise TypeError(repr(tags2)) + if len(tags1) == 1 and len(tags2) == 1: + tag1 = tags1[0] + tag2 = tags2[0] + assert isinstance(tag1, set), tag1 + assert isinstance(tag2, set), tag2 + if len(tag1) == 1 and len(tag2) == 1: + tag1 = list(tag1)[0] + tag2 = list(tag2)[0] + if tag1[0] == tag2[0]: + return sorted([tag1[1], tag2[1]]) == [False, True] + + +def format_cond(cond): + if isinstance(cond, tuple) and len(cond) == 2 and isinstance(cond[-1], bool): + pass + else: + raise TypeError(repr(cond)) + if cond[1]: + return cond[0] + else: + return '!' + cond[0] + + +def format_tag(tag): + if not isinstance(tag, set): + raise TypeError(repr(tag)) + return ' && '.join([format_cond(x) for x in sorted(tag)]) + + +def format_tags(tags): + if not isinstance(tags, list): + raise TypeError(repr(tags)) + return ' || '.join('(%s)' % format_tag(x) for x in tags) + + +def attach_tags(text, tags): + result = [x for x in text.split('\n')] + if result and not result[-1]: + del result[-1] + return [Str(x + '\n', set(tags)) for x in result] + + +def is_tags_type(tags): + if not isinstance(tags, list): + return False + for tag in tags: + if not isinstance(tag, set): + return False + for item in tag: + if isinstance(item, tuple) and len(item) == 2 and isinstance(item[1], bool) and isinstance(item[0], str): + pass + else: + raise TypeError('Invalid item: %r\n%s' % (item, tags)) + return True + + +class Str(str): + """This is a string subclass that has a set of tags attached to it. + + Used for merging the outputs. + """ + + def __new__(cls, string, tags): + if not isinstance(string, str): + raise TypeError('string must be str: %s' % (type(string), )) + if isinstance(tags, set): + tags = [tags] + if not is_tags_type(tags): + raise TypeError('tags must be a list of sets of 2-tuples: %r' % (tags, )) + self = str.__new__(cls, string) + self.tags = tags + return self + + def __repr__(self): + return '%s(%s, %r)' % (self.__class__.__name__, str.__repr__(self), self.tags) + + def __add__(self, other): + if not isinstance(other, str): + raise TypeError + return self.__class__(str.__add__(self, other), self.tags) + + def __radd__(self, other): + if not isinstance(other, str): + raise TypeError + return self.__class__(str.__add__(other, self), self.tags) + + methods = ['__getslice__', '__getitem__', '__mul__', '__rmod__', '__rmul__', + 'join', 'replace', 'upper', 'lower'] + + for method in methods: + do_exec('''def %s(self, *args): + return self.__class__(str.%s(self, *args), self.tags)''' % (method, method), locals()) + + +def simplify_tags(tags): + """ + >>> simplify_tags([set([('defined(world)', True), ('defined(hello)', True)]), + ... set([('defined(world)', False), ('defined(hello)', True)])]) + [set([('defined(hello)', True)])] + >>> simplify_tags([set([('defined(LIBEV_EMBED)', True), ('defined(_WIN32)', True)]), set([('defined(LIBEV_EMBED)', True), ('defined(_WIN32)', False)]), set([('defined(_WIN32)', False), ('defined(LIBEV_EMBED)', False)]), set([('defined(LIBEV_EMBED)', False), ('defined(_WIN32)', True)])]) + [] + """ + if not isinstance(tags, list): + raise TypeError + for x in tags: + if not x: + tags.remove(x) + return simplify_tags(tags) + for tag1, tag2 in combinations(tags, 2): + if tag1 == tag2: + tags.remove(tag1) + return simplify_tags(tags) + for item in tag1: + reverted_item = reverted(item) + if reverted_item in tag2: + tag1_copy = tag1.copy() + tag1_copy.remove(item) + tag2_copy = tag2.copy() + tag2_copy.remove(reverted_item) + if tag1_copy == tag2_copy: + tags.remove(tag1) + tags.remove(tag2) + tags.append(tag1_copy) + return simplify_tags(tags) + return tags + + +def reverted(item): + if not isinstance(item, tuple): + raise TypeError(repr(item)) + if len(item) != 2: + raise TypeError(repr(item)) + if item[-1] is True: + return (item[0], False) + elif item[-1] is False: + return (item[0], True) + raise ValueError(repr(item)) + + +def parse_parameter_names(x): + assert x.startswith('(') and x.endswith(')'), repr(x) + x = x[1:-1] + result = [] + for param in x.split(','): + param = param.strip() + if not param_name_re.match(param): + raise SyntaxError('Invalid parameter name: %r' % param) + result.append(param) + return result + + +def parse_parameter_values(x): + assert x.startswith('(') and x.endswith(')'), repr(x) + x = x[1:-1] + result = [] + for param in x.split(','): + result.append(param.strip()) + return result + + +def expand_definitions(code, definitions): + if not definitions: + return code + keys = list(definitions.keys()) + keys.sort(key=lambda x: (-len(x), x)) + keys = '|'.join(keys) + + # This regex defines a macro invocation + re_macro = re.compile(r'(^|##|[^\w])(%s)(\([^)]+\)|$|##|[^w])' % keys) + + def repl(m): + token = m.group(2) + definition = definitions[token] + + params = definition.get('params', []) + + if params: + arguments = m.group(3) + if arguments.startswith('(') and arguments.endswith(')'): + arguments = parse_parameter_values(arguments) + else: + arguments = None + if arguments and len(params) == len(arguments): + local_definitions = {} + dbg('Macro %r params=%r arguments=%r source=%r', token, params, arguments, m.groups()) + for key, value in zip(params, arguments): + dbg('Adding argument %r=%r', key, value) + local_definitions[key] = {'lines': [value]} + result = expand_definitions('\n'.join(definition['lines']), local_definitions) + else: + msg = 'Invalid number of arguments for macro %s: expected %s, got %s' + msg = msg % (token, len(params), len(arguments or [])) + raise SyntaxError(msg) + else: + result = '\n'.join(definition['lines']) + if m.group(3) != '##': + result += m.group(3) + if m.group(1) != '##': + result = m.group(1) + result + dbg('Replace %r with %r', m.group(0), result) + return result + + for _ in range(20000): + newcode, count = re_macro.subn(repl, code, count=1) + if code == newcode: + if count > 0: + raise SyntaxError('Infinite recursion') + return newcode + code = newcode + raise SyntaxError('Too many substitutions or internal error.') + + +class Str_sourceline(str): + + def __new__(cls, source, sourceline): + self = str.__new__(cls, source) + self.sourceline = sourceline + return self + + +def atomic_write(filename, data): + tmpname = filename + '.tmp.%s' % os.getpid() + f = open(tmpname, 'w') + f.write(data) + f.flush() + os.fsync(f.fileno()) + f.close() + if os.path.exists(filename): + os.unlink(filename) + os.rename(tmpname, filename) + dbg('Wrote %s bytes to %s', len(data), filename) + + +def run_cython(filename, sourcehash, output_filename, banner, comment, cache={}): + result = cache.get(sourcehash) + command = '%s -o %s %s' % (CYTHON, pipes.quote(output_filename), pipes.quote(filename)) + if result is not None: + log('Reusing %s # %s', command, comment) + return result + system(command, comment) + result = postprocess_cython_output(output_filename, banner) + cache[sourcehash] = result + return result + + +def system(command, comment): + log('Running %s # %s', command, comment) + result = os.system(command) + if result: + raise AssertionError('%r failed with code %s' % (command, result)) + + +def postprocess_cython_output(filename, banner): + # this does a few things: + # 1) converts multiline C-style (/**/) comments with a single line comment by + # replacing \n with newline_token + # 2) adds our header + # 3) remove timestamp in cython's header so that different timestamps do not + # confuse merger + result = ['/* %s */\n' % (banner)] + + input = open(filename) + firstline = input.readline() + + if firstline.strip().lower().startswith('/* generated by cython ') and firstline.strip().endswith('*/'): + line = firstline.strip().split(' on ', 1)[0] + result.append(line + ' */') + else: + result.append(firstline) + + in_comment = False + for line in input: + + if line.endswith('\n'): + line = line[:-1].rstrip() + '\n' + + if in_comment: + if '*/' in line: + in_comment = False + result.append(line) + else: + result.append(line.replace('\n', newline_token)) + else: + if line.lstrip().startswith('/* ') and '*/' not in line: + line = line.lstrip() # cython adds space before /* for some reason + line = line.replace('\n', newline_token) + result.append(line) + in_comment = True + else: + result.append(line) + return ''.join(result) + + +class Config(object): + + def __init__(self, configuration): + self.conditions = set(configuration) + + def is_condition_true(self, directive): + if directive.startswith('#if '): + parameter = directive.split(' ', 1)[1] + elif directive.startswith('#ifdef '): + parameter = directive.split(' ', 1)[1] + parameter = 'defined(%s)' % parameter + else: + raise AssertionError('Invalid directive: %r' % directive) + cond = (parameter, True) + return cond in self.conditions + + +def get_conditions(filename): + conditions = set() + condition_stack = [] + linecount = 0 + for line in open(filename): + linecount += 1 + try: + m = match_condition(line) + if m is not None: + split = m.group(1).strip().split(' ', 1) + directive = split[0].strip() + if len(split) == 1: + parameter = None + assert directive in ('else', 'endif'), directive + else: + parameter = split[1].strip() + assert directive in ('if', 'ifdef'), directive + if directive == 'ifdef': + directive = 'if' + parameter = 'defined(%s)' % parameter + if directive == 'if': + condition_stack.append((parameter, True)) + elif directive == 'else': + if not condition_stack: + raise SyntaxError('Unexpected "#else"') + last_cond, true = condition_stack.pop() + assert true is True, true + condition_stack.append((last_cond, not true)) + elif directive == 'endif': + if not condition_stack: + raise SyntaxError('Unexpected "#endif"') + condition_stack.pop() + else: + raise AssertionError('Internal error') + else: + conditions.add(tuple(condition_stack)) + except BaseException: + ex = _ex() + log('%s:%s: %s', filename, linecount, ex) + if type(ex) is SyntaxError: + sys.exit(1) + else: + raise + return conditions + + +def flat_tuple(x): + result = [] + for item in x: + for subitem in item: + result.append(subitem) + return tuple(result) + + +def get_selections(items): + return set([flat_tuple(sorted(set(x))) for x in product(items, repeat=len(items))]) + + +def is_impossible(configuration): + conds = {} + for cond, flag in configuration: + if cond in conds: + if conds.get(cond) != flag: + return True + conds[cond] = flag + + +def get_configurations(filename): + conditions = get_conditions(filename) + + configurations = [] + allconds = set() + + for configuration in get_selections(conditions): + if not is_impossible(configuration): + configurations.append(configuration) + for cond, flag in configuration: + allconds.add(cond) + + result = set() + for configuration in configurations: + conds = set(x[0] for x in configuration) + missing_conds = allconds - conds + for cond in missing_conds: + configuration = configuration + ((cond, False), ) + result.add(tuple(sorted(configuration))) + + return result + + +def log(message, *args): + try: + string = message % args + except Exception: + try: + prefix = 'Traceback (most recent call last):\n' + lines = traceback.format_stack()[:-1] + error_lines = traceback.format_exc().replace(prefix, '') + last_length = len(lines[-1].strip().rsplit(' ', 1)[-1]) + last_length = min(80, last_length) + last_length = max(5, last_length) + msg = '%s%s %s\n%s' % (prefix, ''.join(lines), '^' * last_length, error_lines) + sys.stderr.write(msg) + except Exception: + traceback.print_exc() + try: + message = '%r %% %r\n\n' % (message, args) + except Exception: + pass + try: + sys.stderr.write(message) + except Exception: + traceback.print_exc() + else: + sys.stderr.write(string + '\n') + + +def dbg(*args): + if not DEBUG: + return + return log(*args) + + +# itertools is not available on python 2.5 +# itertools.combinations has a problem on 2.6.1 + +def combinations(iterable, r): + # combinations('ABCD', 2) --> AB AC AD BC BD CD + # combinations(range(4), 3) --> 012 013 023 123 + pool = tuple(iterable) + n = len(pool) + if r > n: + return + indices = list(range(r)) + yield tuple(pool[i] for i in indices) + while True: + for i in reversed(range(r)): + if indices[i] != i + n - r: + break + else: + return + indices[i] += 1 + for j in range(i+1, r): + indices[j] = indices[j-1] + 1 + yield tuple(pool[i] for i in indices) + + +def product(*args, **kwds): + # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy + # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111 + pools = tuple(map(tuple, args)) * kwds.get('repeat', 1) + result = [[]] + for pool in pools: + result = [x+[y] for x in result for y in pool] + for prod in result: + yield tuple(prod) + + +if __name__ == '__main__': + import optparse + parser = optparse.OptionParser() + parser.add_option('--debug', action='store_true') + parser.add_option('--list', action='store_true', help='Show the list of different conditions') + parser.add_option('--list-cond', action='store_true') + parser.add_option('--ignore-cond', action='store_true', help='Ignore conditional directives (only expand definitions)') + parser.add_option('--write-intermediate', action='store_true', help='Save intermediate files produced by preprocessor and Cython') + parser.add_option('-o', '--output-file', help='Specify name of generated C file') + + options, args = parser.parse_args() + if len(args) != 1: + sys.exit('Expected one argument, got %s' % len(args)) + filename = args[0] + + if options.debug: + DEBUG = True + + if options.write_intermediate: + WRITE_OUTPUT = True + + run = True + + if options.list_cond: + run = False + for x in get_conditions(filename): + sys.stdout.write('* %s\n' % (x, )) + + if options.list: + run = False + for x in get_configurations(filename): + sys.stdout.write('* %s\n' % (x, )) + + if options.ignore_cond: + run = False + + class FakeConfig(object): + def is_condition_true(*args): + return False + + sys.stdout.write(preprocess_filename(filename, FakeConfig())) + + if run: + process_filename(filename, options.output_file) diff -Nru python-gevent-0.13.7/util/makedeb.sh python-gevent-1.0/util/makedeb.sh --- python-gevent-0.13.7/util/makedeb.sh 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/util/makedeb.sh 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +CWD=`pwd` +rm -fr /tmp/build_gevent_deb +set -x +mkdir /tmp/build_gevent_deb +#util/makedist.py --dest /tmp/build_gevent_deb/gevent.tar.gz --version dev +cd /tmp/build_gevent_deb +tar -xf $CWD/dist/gevent-1.0.tar.gz +fpm --no-python-dependencies -s python -t deb gevent*/setup.py +mkdir -p $CWD/build +mv *.deb $CWD/build/ diff -Nru python-gevent-0.13.7/util/makedist.py python-gevent-1.0/util/makedist.py --- python-gevent-0.13.7/util/makedist.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/util/makedist.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,91 @@ +#!/usr/bin/python +# Copyright (C) 2012 Denis Bilenko (http://denisbilenko.com) +""" +Create a source distribution of gevent. + +Does the following: + + - Clones the repo into a temporary location. + - Run set_version.py that will update gevent/__init__.py. + - Run 'python setup.py sdist'. +""" +import sys +import os +import glob +import optparse +from os.path import exists, join, abspath, basename +from pipes import quote + + +TMPDIR = '/tmp/gevent-make-dist' + + +def system(cmd, noisy=True): + if noisy: + print cmd + res = os.system(cmd) + if res: + sys.exit('%r failed with %s' % (cmd, res)) + + +def makedist(*args, **kwargs): + cwd = os.getcwd() + try: + return _makedist(*args, **kwargs) + finally: + os.chdir(cwd) + + +def _makedist(version=None, dest=None): + assert exists('gevent/__init__.py'), 'Where am I?' + basedir = abspath(os.getcwd()) + version = version or 'dev' + set_version_command = 'util/set_version.py --version %s ./gevent/__init__.py' % version + os.chdir('/tmp') + system('rm -fr ' + TMPDIR) + os.mkdir(TMPDIR) + os.chdir(TMPDIR) + + system('git clone %s gevent' % basedir) + + directory = os.listdir('.') + assert len(directory) == 1, directory + + os.chdir(directory[0]) + system('git branch') + system(set_version_command) + system('git diff', noisy=False) + system('python setup.py -q sdist') + + dist_filename = glob.glob('dist/gevent-*.tar.gz') + assert len(dist_filename) == 1, dist_filename + dist_path = abspath(dist_filename[0]) + dist_filename = basename(dist_path) + + if dest: + if os.path.isdir(dest): + dest = join(dest, dist_filename) + else: + if not exists(join(basedir, 'dist')): + os.mkdir(join(basedir, 'dist')) + dest = join(basedir, 'dist', dist_filename) + + copy(dist_path, dest) + return dist_path + + +def main(): + parser = optparse.OptionParser() + parser.add_option('--dest') + parser.add_option('--version') + options, args = parser.parse_args() + assert not args, 'Expected no arguments' + return makedist(options.version, dest=options.dest) + + +def copy(source, dest): + system('cp -a %s %s' % (quote(source), quote(dest))) + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/util/set_version.py python-gevent-1.0/util/set_version.py --- python-gevent-0.13.7/util/set_version.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/util/set_version.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,157 @@ +#!/usr/bin/python +"""Update __version__, version_info and add __changeset__. + +'dev' in version_info should be replaced with alpha|beta|candidate|final +'dev' in __version__ should be replaced with a|b|rc| +""" + +import sys +import os +import re +from optparse import OptionParser +from distutils.version import LooseVersion + + +version_re = re.compile("^__version__\s*=\s*'([^']+)'", re.M) +version_info_re = re.compile(r"^version_info\s*=\s*([^\n]+)", re.M) +strict_version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE) + + +def read(command): + popen = os.popen(command) + data = popen.read() + retcode = popen.close() + if retcode: + sys.exit('Failed (%s) to run %r' % (retcode, command)) + return data.strip() + + +def get_changeset(): + return read('git describe --tags --always --dirty --long') + + +def get_version_info(version): + """ + >>> get_version_info('0.13.6') + (0, 13, 6, 'final', 0) + >>> get_version_info('1.1') + (1, 1, 0, 'final', 0) + >>> get_version_info('1') + (1, 0, 0, 'final', 0) + >>> get_version_info('1.0dev1') + (1, 0, 0, 'dev', 1) + >>> get_version_info('1.0a3') + (1, 0, 0, 'alpha', 3) + >>> get_version_info('1.0rc1') + (1, 0, 0, 'candidate', 1) + """ + + repl = {'a': 'alpha', + 'b': 'beta', + 'rc': 'candidate', + 'dev': 'dev'} + + components = LooseVersion(version).version + result = [] + + for component in components: + if isinstance(component, int): + result.append(component) + else: + while len(result) < 3: + result.append(0) + component = repl[component] + result.append(component) + + while len(result) < 3: + result.append(0) + + if len(result) == 3: + result.append('final') + result.append(0) + + return tuple(result) + + +def modify_version(filename, new_version): + # return (current_contents, modified_contents, is_match) + original_data = open(filename).read() + assert '__changeset__' not in original_data, 'Must revert the old update first' + data = original_data + + if new_version: + new_version_info = get_version_info(new_version) + + def repl_version_info(m): + return 'version_info = %s' % (new_version_info, ) + + data, count = version_info_re.subn(repl_version_info, data) + if not count: + raise AssertionError('version_info not found in %s' % filename) + if count != 1: + raise AssertionError('version_info found more than once in %s' % filename) + + def repl_version(m): + result = m.group(0).replace(m.group(1), new_version or m.group(1)) + result += "\n__changeset__ = '%s'" % get_changeset() + return result + + data, count = version_re.subn(repl_version, data) + if not count: + raise AssertionError('__version__ not found in %s' % filename) + if count != 1: + raise AssertionError('__version__ found more than once in %s' % filename) + + return original_data, data + + +def unlink(path): + try: + os.unlink(path) + except OSError, ex: + if ex.errno == 2: # No such file or directory + return + raise + + +def write(filename, data): + # intentionally breaking links here so that util/makedist.py can use "cp --link" + tmpname = filename + '.tmp.%s' % os.getpid() + f = open(tmpname, 'w') + try: + f.write(data) + f.flush() + os.fsync(f.fileno()) + f.close() + os.rename(tmpname, filename) + except: + unlink(tmpname) + raise + + +def main(): + global options + parser = OptionParser() + parser.add_option('--version', default='dev') + parser.add_option('--dry-run', action='store_true') + options, args = parser.parse_args() + assert len(args) == 1, 'One argument is expected, got %s' % len(args) + version = options.version + if version.lower() == 'dev': + version = '' + if version and strict_version_re.match(version) is None: + sys.stderr.write('WARNING: Not a strict version: %r (bdist_msi will fail)' % version) + filename = args[0] + original_content, new_content = modify_version(filename, version) + if options.dry_run: + tmpname = '/tmp/' + os.path.basename(filename) + '.set_version' + write(tmpname, new_content) + if not os.system('diff -u %s %s' % (filename, tmpname)): + sys.exit('No differences applied') + else: + write(filename, new_content) + print 'Updated %s' % filename + + +if __name__ == '__main__': + main() diff -Nru python-gevent-0.13.7/util/wintest.py python-gevent-1.0/util/wintest.py --- python-gevent-0.13.7/util/wintest.py 1970-01-01 00:00:00.000000000 +0000 +++ python-gevent-1.0/util/wintest.py 2013-11-26 16:25:45.000000000 +0000 @@ -0,0 +1,80 @@ +#!/usr/bin/python -u +""" +Unix utilities must be installed on target machine for this to work: http://unxutils.sourceforge.net/ +""" +import sys +import os +import optparse + + +def system(cmd, exit=True): + sys.stderr.write('+ %s\n' % cmd) + retcode = os.system(cmd) + if retcode: + if exit: + sys.exit('%r failed' % cmd) + return retcode + + +parser = optparse.OptionParser() +parser.add_option('--host') +parser.add_option('--username', default='Administrator') +parser.add_option('--source') +parser.add_option('--dist', action='store_true') +parser.add_option('--python', default='27') +options, args = parser.parse_args() + + +def prepare(): + source_name = args[1] + tar_name = source_name.rsplit('.', 1)[0] + dir_name = tar_name.rsplit('.', 1)[0] + system('rm -fr %s %s' % (tar_name, dir_name)) + system('gzip -d %s && tar -xf %s' % (source_name, tar_name)) + os.chdir(dir_name) + os.environ.setdefault('VS90COMNTOOLS', 'C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\Tools\\') + +if args[0:1] == ['test']: + prepare() + system('%s setup.py build' % sys.executable) + os.chdir('greentest') + os.environ['PYTHONPATH'] = '.;..;../..' + system('%s testrunner.py --expected ../known_failures.txt' % sys.executable) +elif args[0:1] == ['dist']: + prepare() + success = 0 + for command in ['bdist_egg', 'bdist_wininst', 'bdist_msi']: + cmd = sys.executable + ' setup.py ' + command + if not system(cmd, exit=False): + success += 1 + if not success: + sys.exit('bdist_egg bdist_wininst and bdist_msi all failed') +elif not args: + assert options.host + if not options.source: + import makedist + options.source = makedist.makedist() + + options.source_name = os.path.basename(options.source) + options.script_path = os.path.abspath(__file__) + options.script_name = os.path.basename(__file__) + + if options.python.isdigit(): + options.python = 'C:/Python' + options.python + '/python.exe' + + tar_name = options.source_name.rsplit('.', 1)[0] + dir_name = tar_name.rsplit('.', 1)[0] + options.dir_name = dir_name + + system('scp %(source)s %(script_path)s %(username)s@%(host)s:' % options.__dict__) + if options.dist: + system('ssh %(username)s@%(host)s %(python)s -u %(script_name)s dist %(source_name)s' % options.__dict__) + try: + os.mkdir('dist') + except OSError: + pass + system('scp -r %(username)s@%(host)s:%(dir_name)s/dist/ dist' % options.__dict__) + else: + system('ssh %(username)s@%(host)s C:/Python27/python.exe -u %(script_name)s test %(source_name)s' % options.__dict__) +else: + sys.exit('Invalid args: %r' % (args, ))