Commit 4213ddb1 authored by Jason Madden's avatar Jason Madden

PyPy can build and use the cython ares extension, at least on my system, so...

PyPy can build and use the cython ares extension, at least on my system, so turn it on for travis testing.
parent 7f407c27
......@@ -17,10 +17,10 @@ install:
# disables the cache.
- travis_retry pip install -U tox cython greenlet pep8 pyflakes
script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' && $LINT == true ]]; then python setup.py develop && make travis_test_linters; elif [[ $LINT == false && $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then python setup.py develop && make toxtest; elif [[ $LINT == false ]]; then python setup.py develop && make fulltoxtest; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' && $LINT == true ]]; then python setup.py develop && make travis_test_linters; elif [[ $LINT == false && $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then python setup.py develop && make fulltoxtest; elif [[ $LINT == false ]]; then python setup.py develop && make fulltoxtest; fi
notifications:
email: false
# cache: pip seems not to work
# cache: pip seems not to work if `install` is replaced (https://github.com/travis-ci/travis-ci/issues/3239)
cache:
directories:
- $HOME/.cache/pip
......
......@@ -6,7 +6,7 @@ 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, text_type, reraise, PY3
from gevent.hub import Waiter, get_hub, string_types, text_type, integer_types, reraise, PY3
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
......@@ -25,8 +25,10 @@ class Resolver(object):
In comparison to :class:`gevent.resolver_thread.Resolver`, the
implementation is much more complex. In addition, there have been
reports of it not properly honoring certain system configurations.
Finally, it is not available on PyPy. However, because it does not
use threads, it may scale better.
However, because it does not use threads, it may scale better.
.. note:: This module is considered experimental on PyPy, and
due to its implementation in cython, it may be slower.
.. _c-ares: http://c-ares.haxx.se
"""
......@@ -133,10 +135,10 @@ class Resolver(object):
raise error('Int or String expected')
elif port is None:
port = 0
elif isinstance(port, int):
elif isinstance(port, integer_types):
pass
else:
raise error('Int or String expected')
raise error('Int or String expected', port, type(port))
port = int(port % 65536)
if not socktypes and socktype:
socktypes.append(socktype)
......
......@@ -332,6 +332,7 @@ elif PYPY:
system('cd gevent/libev && ./configure > configure_output.txt')
from gevent import corecffi
ext_modules = [corecffi.ffi.verifier.get_extension(),
ARES,
# By building the semaphore with Cython under PyPy, we get
# atomic operations (specifically, exiting/releasing), at the
# cost of some speed (one trivial semaphore micro-benchmark put the pure-python version
......@@ -404,5 +405,5 @@ if __name__ == '__main__':
raise
ext_modules.remove(ARES)
run_setup(ext_modules, run_make=run_make)
if not PYPY and ARES not in ext_modules:
if ARES not in ext_modules:
sys.stderr.write('\nWARNING: The gevent.ares extension has been disabled.\n')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment