Commit 1de3e36d authored by Jason Madden's avatar Jason Madden Committed by GitHub

Switch off prospector, go back to plain pylint (#1230)

* Switch off prospector, go back to plain pylint.

prospector wasn't working on CI for some reason.

Fix the outstanding pylint errors.

* Explicitly request pylint 2 on Python 3

* Also need to update astroid.

* pylint warning generated on Travis (case-sensitive filesystem.)
parent 40959196
...@@ -37,6 +37,10 @@ extension-pkg-whitelist=gevent.libuv._corecffi,gevent.libev._corecffi,gevent.loc ...@@ -37,6 +37,10 @@ extension-pkg-whitelist=gevent.libuv._corecffi,gevent.libev._corecffi,gevent.loc
# def foo(): # def foo():
# if baz: # if baz:
# return 1 # return 1
# In Pylint 2dev1, needed for Python 3.7, we get spurious 'useless return' errors:
# @property
# def foo(self):
# return None # generates useless-return
disable=wrong-import-position, disable=wrong-import-position,
wrong-import-order, wrong-import-order,
missing-docstring, missing-docstring,
...@@ -55,7 +59,8 @@ disable=wrong-import-position, ...@@ -55,7 +59,8 @@ disable=wrong-import-position,
useless-suppression, useless-suppression,
duplicate-code, duplicate-code,
undefined-all-variable, undefined-all-variable,
inconsistent-return-statements inconsistent-return-statements,
useless-return
[FORMAT] [FORMAT]
......
...@@ -37,8 +37,8 @@ whitespace: ...@@ -37,8 +37,8 @@ whitespace:
! find . -not -path "*.pem" -not -path "./.eggs/*" -not -path "./src/greentest/htmlcov/*" -not -path "./src/greentest/.coverage.*" -not -path "./.tox/*" -not -path "*/__pycache__/*" -not -path "*.so" -not -path "*.pyc" -not -path "./.git/*" -not -path "./build/*" -not -path "./src/gevent/libev/*" -not -path "./src/gevent.egg-info/*" -not -path "./dist/*" -not -path "./.DS_Store" -not -path "./deps/*" -not -path "./src/gevent/libev/corecext.*.[ch]" -not -path "./src/gevent/resolver/cares.*" -not -path "./doc/_build/*" -not -path "./doc/mytheme/static/*" -type f | xargs egrep -l " $$" ! find . -not -path "*.pem" -not -path "./.eggs/*" -not -path "./src/greentest/htmlcov/*" -not -path "./src/greentest/.coverage.*" -not -path "./.tox/*" -not -path "*/__pycache__/*" -not -path "*.so" -not -path "*.pyc" -not -path "./.git/*" -not -path "./build/*" -not -path "./src/gevent/libev/*" -not -path "./src/gevent.egg-info/*" -not -path "./dist/*" -not -path "./.DS_Store" -not -path "./deps/*" -not -path "./src/gevent/libev/corecext.*.[ch]" -not -path "./src/gevent/resolver/cares.*" -not -path "./doc/_build/*" -not -path "./doc/mytheme/static/*" -type f | xargs egrep -l " $$"
prospector: prospector:
which prospector
which pylint which pylint
pylint --rcfile=.pylintrc gevent
# debugging # debugging
# pylint --rcfile=.pylintrc --init-hook="import sys, code; sys.excepthook = lambda exc, exc_type, tb: print(tb.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_frame.f_locals['self'])" gevent src/greentest/* || true # pylint --rcfile=.pylintrc --init-hook="import sys, code; sys.excepthook = lambda exc, exc_type, tb: print(tb.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_frame.f_locals['self'])" gevent src/greentest/* || true
# XXX: prospector is failing right now. I can't reproduce locally: # XXX: prospector is failing right now. I can't reproduce locally:
...@@ -185,7 +185,7 @@ develop: ...@@ -185,7 +185,7 @@ develop:
@${PYTHON} scripts/travis.py fold_end install @${PYTHON} scripts/travis.py fold_end install
test-py27: $(PY27) test-py27: $(PY27)
PYTHON=python2.7.14 PATH=$(BUILD_RUNTIMES)/versions/python2.7.14/bin:$(PATH) make develop lint leaktest cffibackendtest coverage_combine PYTHON=python2.7.14 PATH=$(BUILD_RUNTIMES)/versions/python2.7.14/bin:$(PATH) make develop leaktest cffibackendtest coverage_combine
test-py34: $(PY34) test-py34: $(PY34)
PYTHON=python3.4.7 PATH=$(BUILD_RUNTIMES)/versions/python3.4.7/bin:$(PATH) make develop basictest PYTHON=python3.4.7 PATH=$(BUILD_RUNTIMES)/versions/python3.4.7/bin:$(PATH) make develop basictest
...@@ -194,7 +194,7 @@ test-py35: $(PY35) ...@@ -194,7 +194,7 @@ test-py35: $(PY35)
PYTHON=python3.5.5 PATH=$(BUILD_RUNTIMES)/versions/python3.5.5/bin:$(PATH) make develop basictest PYTHON=python3.5.5 PATH=$(BUILD_RUNTIMES)/versions/python3.5.5/bin:$(PATH) make develop basictest
test-py36: $(PY36) test-py36: $(PY36)
PYTHON=python3.6.4 PATH=$(BUILD_RUNTIMES)/versions/python3.6.4/bin:$(PATH) make develop allbackendtest PYTHON=python3.6.4 PATH=$(BUILD_RUNTIMES)/versions/python3.6.4/bin:$(PATH) make develop lint allbackendtest
test-py37: $(PY37) test-py37: $(PY37)
LD_LIBRARY_PATH=$(BUILD_RUNTIMES)/versions/python3.7.0b4/openssl/lib PYTHON=python3.7.0b4 PATH=$(BUILD_RUNTIMES)/versions/python3.7.0b4/bin:$(PATH) make develop leaktest cffibackendtest coverage_combine LD_LIBRARY_PATH=$(BUILD_RUNTIMES)/versions/python3.7.0b4/openssl/lib PYTHON=python3.7.0b4 PATH=$(BUILD_RUNTIMES)/versions/python3.7.0b4/bin:$(PATH) make develop leaktest cffibackendtest coverage_combine
......
...@@ -9,9 +9,11 @@ Cython >= 0.28.1 ...@@ -9,9 +9,11 @@ Cython >= 0.28.1
# Python 3.7b1 requires this. # Python 3.7b1 requires this.
greenlet>=0.4.13 ; platform_python_implementation == "CPython" greenlet>=0.4.13 ; platform_python_implementation == "CPython"
pylint>=1.8.0 pylint>=1.8.0 ; python_version < "3.4"
# pyyaml is included here and doesn't install on travis with 3.7a3 pylint >= 2.0.0.dev1 ; python_version >= "3.4"
prospector[with_pyroma] ; python_version < '3.7' # pylint 2 needs astroid 2; unfortunately, it uses `typed_ast`
# which has a C extension that doesn't build on PyPy
astroid >= 2.0.0.dev1 ; python_version >= "3.4" and platform_python_implementation == "CPython"
# See version requirements in setup.py # See version requirements in setup.py
cffi >= 1.11.5 ; platform_python_implementation == "CPython" cffi >= 1.11.5 ; platform_python_implementation == "CPython"
......
...@@ -77,7 +77,7 @@ else: ...@@ -77,7 +77,7 @@ else:
iteritems = dict.iteritems # python 3: pylint:disable=no-member iteritems = dict.iteritems # python 3: pylint:disable=no-member
itervalues = dict.itervalues # python 3: pylint:disable=no-member itervalues = dict.itervalues # python 3: pylint:disable=no-member
xrange = __builtin__.xrange xrange = __builtin__.xrange
from itertools import izip # python 3: pylint:disable=no-member from itertools import izip # python 3: pylint:disable=no-member,no-name-in-module
izip = izip izip = izip
# fspath from 3.6 os.py, but modified to raise the same exceptions as the # fspath from 3.6 os.py, but modified to raise the same exceptions as the
......
...@@ -206,7 +206,7 @@ class AbstractCallbacks(object): ...@@ -206,7 +206,7 @@ class AbstractCallbacks(object):
if watcher is not None: if watcher is not None:
watcher.loop.handle_error(None, t, v, tb) watcher.loop.handle_error(None, t, v, tb)
return 1 return 1
else:
# Raising it causes a lot of noise from CFFI # Raising it causes a lot of noise from CFFI
print("WARNING: gevent: Unhandled error with no watcher", print("WARNING: gevent: Unhandled error with no watcher",
file=sys.stderr) file=sys.stderr)
...@@ -270,7 +270,6 @@ class AbstractCallbacks(object): ...@@ -270,7 +270,6 @@ class AbstractCallbacks(object):
# in the main greenlet. # in the main greenlet.
loop.handle_error(None, t, v, tb) loop.handle_error(None, t, v, tb)
return None return None
else:
raise v # Let CFFI print raise v # Let CFFI print
def _find_loop_from_c_watcher(self, watcher_ptr): def _find_loop_from_c_watcher(self, watcher_ptr):
......
...@@ -10,6 +10,7 @@ from __future__ import absolute_import ...@@ -10,6 +10,7 @@ from __future__ import absolute_import
from gevent import _socketcommon from gevent import _socketcommon
from gevent._util import copy_globals from gevent._util import copy_globals
from gevent._compat import PYPY from gevent._compat import PYPY
from gevent.timeout import Timeout
copy_globals(_socketcommon, globals(), copy_globals(_socketcommon, globals(),
names_to_ignore=_socketcommon.__py3_imports__ + _socketcommon.__extensions__, names_to_ignore=_socketcommon.__py3_imports__ + _socketcommon.__extensions__,
...@@ -255,7 +256,6 @@ class socket(object): ...@@ -255,7 +256,6 @@ class socket(object):
except error as ex: except error as ex:
if type(ex) is error: # pylint:disable=unidiomatic-typecheck if type(ex) is error: # pylint:disable=unidiomatic-typecheck
return ex.args[0] return ex.args[0]
else:
raise # gaierror is not silenced by connect_ex raise # gaierror is not silenced by connect_ex
def dup(self): def dup(self):
......
...@@ -14,6 +14,7 @@ import sys ...@@ -14,6 +14,7 @@ import sys
from gevent import _socketcommon from gevent import _socketcommon
from gevent._util import copy_globals from gevent._util import copy_globals
from gevent._compat import PYPY from gevent._compat import PYPY
from gevent.timeout import Timeout
import _socket import _socket
from os import dup from os import dup
...@@ -361,7 +362,7 @@ class socket(object): ...@@ -361,7 +362,7 @@ class socket(object):
return self.connect(address) or 0 return self.connect(address) or 0
except timeout: except timeout:
return EAGAIN return EAGAIN
except gaierror: except gaierror: # pylint:disable=try-except-raise
# gaierror/overflowerror/typerror is not silenced by connect_ex; # gaierror/overflowerror/typerror is not silenced by connect_ex;
# gaierror extends OSError (aka error) so catch it first # gaierror extends OSError (aka error) so catch it first
raise raise
......
...@@ -71,11 +71,8 @@ __imports__.extend(__py3_imports__) ...@@ -71,11 +71,8 @@ __imports__.extend(__py3_imports__)
import time import time
import sys import sys
from gevent._hub_local import get_hub_noargs as get_hub from gevent._hub_local import get_hub_noargs as get_hub
from gevent.exceptions import ConcurrentObjectUseError
from gevent.timeout import Timeout
from gevent._compat import string_types, integer_types, PY3 from gevent._compat import string_types, integer_types, PY3
from gevent._util import copy_globals from gevent._util import copy_globals
from gevent._util import _NONE
is_windows = sys.platform == 'win32' is_windows = sys.platform == 'win32'
is_macos = sys.platform == 'darwin' is_macos = sys.platform == 'darwin'
......
...@@ -109,7 +109,7 @@ class SSLSocket(socket): ...@@ -109,7 +109,7 @@ class SSLSocket(socket):
except SSLError as ex: except SSLError as ex:
if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:
return '' return ''
elif ex.args[0] == SSL_ERROR_WANT_READ: if ex.args[0] == SSL_ERROR_WANT_READ:
if self.timeout == 0.0: if self.timeout == 0.0:
raise raise
sys.exc_clear() sys.exc_clear()
...@@ -211,7 +211,6 @@ class SSLSocket(socket): ...@@ -211,7 +211,6 @@ class SSLSocket(socket):
self.__class__) self.__class__)
# QQQ Shouldn't we wrap the SSL_WANT_READ errors as socket.timeout errors to match socket.recv's behavior? # QQQ Shouldn't we wrap the SSL_WANT_READ errors as socket.timeout errors to match socket.recv's behavior?
return self.read(buflen) return self.read(buflen)
else:
return socket.recv(self, buflen, flags) return socket.recv(self, buflen, flags)
def recv_into(self, buffer, nbytes=None, flags=0): def recv_into(self, buffer, nbytes=None, flags=0):
...@@ -268,7 +267,7 @@ class SSLSocket(socket): ...@@ -268,7 +267,7 @@ class SSLSocket(socket):
except SSLError as ex: except SSLError as ex:
if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:
return '' return ''
elif ex.args[0] == SSL_ERROR_WANT_READ: if ex.args[0] == SSL_ERROR_WANT_READ:
if self.timeout == 0.0: if self.timeout == 0.0:
raise raise
sys.exc_clear() sys.exc_clear()
...@@ -282,12 +281,11 @@ class SSLSocket(socket): ...@@ -282,12 +281,11 @@ class SSLSocket(socket):
raise raise
def unwrap(self): def unwrap(self):
if self._sslobj: if not self._sslobj:
raise ValueError("No SSL wrapper around " + str(self))
s = self._sslobj_shutdown() s = self._sslobj_shutdown()
self._sslobj = None self._sslobj = None
return socket(_sock=s) return socket(_sock=s)
else:
raise ValueError("No SSL wrapper around " + str(self))
def shutdown(self, how): def shutdown(self, how):
self._sslobj = None self._sslobj = None
......
...@@ -8,11 +8,12 @@ This module implements cooperative SSL socket wrappers. ...@@ -8,11 +8,12 @@ This module implements cooperative SSL socket wrappers.
""" """
# Our import magic sadly makes this warning useless # Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable # pylint: disable=undefined-variable
# pylint:disable=no-member
from __future__ import absolute_import from __future__ import absolute_import
import ssl as __ssl__ import ssl as __ssl__
_ssl = __ssl__._ssl # pylint:disable=no-member _ssl = __ssl__._ssl
import errno import errno
from gevent.socket import socket, timeout_default from gevent.socket import socket, timeout_default
...@@ -339,7 +340,6 @@ class SSLSocket(socket): ...@@ -339,7 +340,6 @@ class SSLSocket(socket):
if buffer is None: if buffer is None:
return b'' return b''
return 0 return 0
else:
raise raise
def write(self, data): def write(self, data):
...@@ -489,7 +489,6 @@ class SSLSocket(socket): ...@@ -489,7 +489,6 @@ class SSLSocket(socket):
# Python #23804 # Python #23804
return b'' return b''
return self.read(buflen) return self.read(buflen)
else:
return socket.recv(self, buflen, flags) return socket.recv(self, buflen, flags)
def recv_into(self, buffer, nbytes=None, flags=0): def recv_into(self, buffer, nbytes=None, flags=0):
...@@ -502,7 +501,6 @@ class SSLSocket(socket): ...@@ -502,7 +501,6 @@ class SSLSocket(socket):
if flags != 0: if flags != 0:
raise ValueError("non-zero flags not allowed in calls to recv_into() on %s" % self.__class__) raise ValueError("non-zero flags not allowed in calls to recv_into() on %s" % self.__class__)
return self.read(nbytes, buffer) return self.read(nbytes, buffer)
else:
return socket.recv_into(self, buffer, nbytes, flags) return socket.recv_into(self, buffer, nbytes, flags)
def recvfrom(self, buflen=1024, flags=0): def recvfrom(self, buflen=1024, flags=0):
...@@ -541,7 +539,9 @@ class SSLSocket(socket): ...@@ -541,7 +539,9 @@ class SSLSocket(socket):
socket.shutdown(self, how) socket.shutdown(self, how)
def unwrap(self): def unwrap(self):
if self._sslobj: if not self._sslobj:
raise ValueError("No SSL wrapper around " + str(self))
while True: while True:
try: try:
s = self._sslobj.shutdown() s = self._sslobj.shutdown()
...@@ -573,8 +573,6 @@ class SSLSocket(socket): ...@@ -573,8 +573,6 @@ class SSLSocket(socket):
# See test_ftplib.py:TestTLS_FTPClass.test_ccc # See test_ftplib.py:TestTLS_FTPClass.test_ccc
return self return self
else:
raise ValueError("No SSL wrapper around " + str(self))
def _real_close(self): def _real_close(self):
self._sslobj = None self._sslobj = None
......
...@@ -326,7 +326,6 @@ class SSLSocket(socket): ...@@ -326,7 +326,6 @@ class SSLSocket(socket):
if buffer is not None: if buffer is not None:
return 0 return 0
return b'' return b''
else:
raise raise
def write(self, data): def write(self, data):
...@@ -456,7 +455,6 @@ class SSLSocket(socket): ...@@ -456,7 +455,6 @@ class SSLSocket(socket):
if buflen == 0: if buflen == 0:
return b'' return b''
return self.read(buflen) return self.read(buflen)
else:
return socket.recv(self, buflen, flags) return socket.recv(self, buflen, flags)
def recv_into(self, buffer, nbytes=None, flags=0): def recv_into(self, buffer, nbytes=None, flags=0):
...@@ -473,7 +471,6 @@ class SSLSocket(socket): ...@@ -473,7 +471,6 @@ class SSLSocket(socket):
"non-zero flags not allowed in calls to recv_into() on %s" % "non-zero flags not allowed in calls to recv_into() on %s" %
self.__class__) self.__class__)
return self.read(nbytes, buffer) return self.read(nbytes, buffer)
else:
return socket.recv_into(self, buffer, nbytes, flags) return socket.recv_into(self, buffer, nbytes, flags)
def recvfrom(self, buflen=1024, flags=0): def recvfrom(self, buflen=1024, flags=0):
...@@ -481,7 +478,6 @@ class SSLSocket(socket): ...@@ -481,7 +478,6 @@ class SSLSocket(socket):
if self._sslobj: if self._sslobj:
raise ValueError("recvfrom not allowed on instances of %s" % raise ValueError("recvfrom not allowed on instances of %s" %
self.__class__) self.__class__)
else:
return socket.recvfrom(self, buflen, flags) return socket.recvfrom(self, buflen, flags)
def recvfrom_into(self, buffer, nbytes=None, flags=0): def recvfrom_into(self, buffer, nbytes=None, flags=0):
...@@ -536,7 +532,7 @@ class SSLSocket(socket): ...@@ -536,7 +532,7 @@ class SSLSocket(socket):
except SSLError as ex: except SSLError as ex:
if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: if ex.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:
return '' return ''
elif ex.args[0] == SSL_ERROR_WANT_READ: if ex.args[0] == SSL_ERROR_WANT_READ:
if self.timeout == 0.0: if self.timeout == 0.0:
raise raise
sys.exc_clear() sys.exc_clear()
...@@ -550,15 +546,15 @@ class SSLSocket(socket): ...@@ -550,15 +546,15 @@ class SSLSocket(socket):
raise raise
def unwrap(self): def unwrap(self):
if self._sslobj: if not self._sslobj:
raise ValueError("No SSL wrapper around " + str(self))
s = self._sslobj_shutdown() s = self._sslobj_shutdown()
self._sslobj = None self._sslobj = None
# match _ssl2; critical to drop/reuse here on PyPy # match _ssl2; critical to drop/reuse here on PyPy
# XXX: _ssl3 returns an SSLSocket. Is that what the standard lib does on # XXX: _ssl3 returns an SSLSocket. Is that what the standard lib does on
# Python 2? Should we do that? # Python 2? Should we do that?
return socket(_sock=s) return socket(_sock=s)
else:
raise ValueError("No SSL wrapper around " + str(self))
def _real_close(self): def _real_close(self):
self._sslobj = None self._sslobj = None
......
# this produces syntax error on Python3 import sys
__all__ = ['reraise'] __all__ = ['reraise']
def reraise(type, value, tb): def exec_(_code_, _globs_=None, _locs_=None):
raise type, value, tb """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_""")
exec_("""def reraise(tp, value, tb=None):
try:
raise tp, value, tb
finally:
tb = None
""")
...@@ -142,7 +142,6 @@ class Waiter(object): ...@@ -142,7 +142,6 @@ class Waiter(object):
if self._exception is not _NONE: if self._exception is not _NONE:
if self._exception is None: if self._exception is None:
return self.value return self.value
else:
getcurrent().throw(*self._exception) # pylint:disable=undefined-variable getcurrent().throw(*self._exception) # pylint:disable=undefined-variable
else: else:
if self.greenlet is not None: if self.greenlet is not None:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Use :mod:`gevent.resolver.cares` Use :mod:`gevent.resolver.cares`
""" """
from gevent.resolver.cares import * # pylint:disable=wildcard-import,unused-wildcard-import from gevent.resolver.cares import * # pylint:disable=wildcard-import,unused-wildcard-import,
import gevent.resolver.cares as _cares import gevent.resolver.cares as _cares
__all__ = _cares.__all__ __all__ = _cares.__all__ # pylint:disable=c-extension-no-member
del _cares del _cares
...@@ -400,5 +400,5 @@ def _parse_address(address): ...@@ -400,5 +400,5 @@ def _parse_address(address):
def parse_address(address): def parse_address(address):
try: try:
return _parse_address(address) return _parse_address(address)
except ValueError as ex: except ValueError as ex: # pylint:disable=try-except-raise
raise ValueError('Failed to parse address %r: %s' % (address, ex)) raise ValueError('Failed to parse address %r: %s' % (address, ex))
...@@ -17,7 +17,7 @@ __all__ = [ ...@@ -17,7 +17,7 @@ __all__ = [
from gevent._util import implementer from gevent._util import implementer
from gevent._interfaces import ILoop from gevent._interfaces import ILoop
import gevent.libev._corecffi as _corecffi # pylint:disable=no-name-in-module,import-error from gevent.libev import _corecffi # pylint:disable=no-name-in-module,import-error
ffi = _corecffi.ffi # pylint:disable=no-member ffi = _corecffi.ffi # pylint:disable=no-member
libev = _corecffi.lib # pylint:disable=no-member libev = _corecffi.lib # pylint:disable=no-member
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
import sys import sys
import gevent.libev._corecffi as _corecffi # pylint:disable=no-name-in-module,import-error from gevent.libev import _corecffi # pylint:disable=no-name-in-module,import-error
ffi = _corecffi.ffi # pylint:disable=no-member ffi = _corecffi.ffi # pylint:disable=no-member
libev = _corecffi.lib # pylint:disable=no-member libev = _corecffi.lib # pylint:disable=no-member
......
...@@ -5,7 +5,7 @@ from __future__ import absolute_import, print_function ...@@ -5,7 +5,7 @@ from __future__ import absolute_import, print_function
import functools import functools
import sys import sys
import gevent.libuv._corecffi as _corecffi # pylint:disable=no-name-in-module,import-error from gevent.libuv import _corecffi # pylint:disable=no-name-in-module,import-error
ffi = _corecffi.ffi ffi = _corecffi.ffi
libuv = _corecffi.lib libuv = _corecffi.lib
......
...@@ -436,7 +436,8 @@ class local(object): ...@@ -436,7 +436,8 @@ class local(object):
return type(type_attr).__get__(type_attr, self, self._local_type) return type(type_attr).__get__(type_attr, self, self._local_type)
# Last case is a non-data descriptor. Instance wins. # Last case is a non-data descriptor. Instance wins.
return dct[name] return dct[name]
elif name in self._local_type_vars:
if name in self._local_type_vars:
type_attr = getattr(self._local_type, name) type_attr = getattr(self._local_type, name)
# It's not in the dict at all. Is it in the type? # It's not in the dict at all. Is it in the type?
......
...@@ -512,7 +512,7 @@ def patch_thread(threading=True, _threading_local=True, Event=True, logging=True ...@@ -512,7 +512,7 @@ def patch_thread(threading=True, _threading_local=True, Event=True, logging=True
``Event`` defaults to True. ``Event`` defaults to True.
""" """
# XXX: Simplify # XXX: Simplify
# pylint:disable=too-many-branches,too-many-locals # pylint:disable=too-many-branches,too-many-locals,too-many-statements
# Description of the hang: # Description of the hang:
# There is an incompatibility with patching 'thread' and the 'multiprocessing' module: # There is an incompatibility with patching 'thread' and the 'multiprocessing' module:
......
...@@ -355,7 +355,7 @@ if hasattr(os, 'fork'): ...@@ -355,7 +355,7 @@ if hasattr(os, 'fork'):
return result[:2] return result[:2]
# it's not finished # it's not finished
return (0, 0) return (0, 0)
else:
# Ok, we need to "block". Do so via a watcher so that we're # Ok, we need to "block". Do so via a watcher so that we're
# cooperative. We know it's our child, etc, so this should work. # cooperative. We know it's our child, etc, so this should work.
watcher = _watched_children[pid] watcher = _watched_children[pid]
......
...@@ -35,7 +35,7 @@ from heapq import heapify as _heapify ...@@ -35,7 +35,7 @@ from heapq import heapify as _heapify
import collections import collections
if sys.version_info[0] == 2: if sys.version_info[0] == 2:
import Queue as __queue__ import Queue as __queue__ # python 3: pylint:disable=import-error
else: else:
import queue as __queue__ # python 2: pylint:disable=import-error import queue as __queue__ # python 2: pylint:disable=import-error
Full = __queue__.Full Full = __queue__.Full
...@@ -52,7 +52,7 @@ __extensions__ = ['JoinableQueue', 'Channel'] ...@@ -52,7 +52,7 @@ __extensions__ = ['JoinableQueue', 'Channel']
__imports__ = ['Empty', 'Full'] __imports__ = ['Empty', 'Full']
if hasattr(__queue__, 'SimpleQueue'): if hasattr(__queue__, 'SimpleQueue'):
__imports__.append('SimpleQueue') # New in 3.7 __imports__.append('SimpleQueue') # New in 3.7
SimpleQueue = __queue__.SimpleQueue SimpleQueue = __queue__.SimpleQueue # pylint:disable=no-member
__all__ = __implements__ + __extensions__ + __imports__ __all__ = __implements__ + __extensions__ + __imports__
......
...@@ -353,6 +353,5 @@ class Values(object): ...@@ -353,6 +353,5 @@ class Values(object):
self.waiter.get() self.waiter.get()
if self.values: if self.values:
return self.values return self.values
else:
assert error is not None assert error is not None
raise self.error # pylint:disable=raising-bad-type raise self.error # pylint:disable=raising-bad-type
...@@ -130,6 +130,7 @@ def _getaddrinfo(host=None, service=None, family=AF_UNSPEC, socktype=0, ...@@ -130,6 +130,7 @@ def _getaddrinfo(host=None, service=None, family=AF_UNSPEC, socktype=0,
# pylint:disable=too-many-locals,broad-except,too-many-statements # pylint:disable=too-many-locals,broad-except,too-many-statements
# pylint:disable=too-many-branches # pylint:disable=too-many-branches
# pylint:disable=redefined-argument-from-local # pylint:disable=redefined-argument-from-local
# pylint:disable=consider-using-in
if flags & (socket.AI_ADDRCONFIG | socket.AI_V4MAPPED) != 0: if flags & (socket.AI_ADDRCONFIG | socket.AI_V4MAPPED) != 0:
raise NotImplementedError raise NotImplementedError
if host is None and service is None: if host is None and service is None:
......
...@@ -95,7 +95,7 @@ def signal(signalnum, handler): ...@@ -95,7 +95,7 @@ def signal(signalnum, handler):
old_handler = getsignal(signalnum) old_handler = getsignal(signalnum)
global _child_handler global _child_handler
_child_handler = handler _child_handler = handler
if handler == _signal.SIG_IGN or handler == _signal.SIG_DFL: if handler in (_signal.SIG_IGN, _signal.SIG_DFL):
# Allow resetting/ignoring this signal at the process level. # Allow resetting/ignoring this signal at the process level.
# Note that this conflicts with gevent.subprocess and other users # Note that this conflicts with gevent.subprocess and other users
# of child watchers, until the next time gevent.subprocess/loop.install_sigchld() # of child watchers, until the next time gevent.subprocess/loop.install_sigchld()
......
...@@ -1296,7 +1296,7 @@ class Popen(object): ...@@ -1296,7 +1296,7 @@ class Popen(object):
# is possible that it is overwritten (#12607). # is possible that it is overwritten (#12607).
if c2pwrite == 0: if c2pwrite == 0:
c2pwrite = os.dup(c2pwrite) c2pwrite = os.dup(c2pwrite)
while errwrite == 0 or errwrite == 1: while errwrite in (0, 1):
errwrite = os.dup(errwrite) errwrite = os.dup(errwrite)
# Dup fds for child # Dup fds for child
......
...@@ -98,9 +98,8 @@ if hasattr(__thread__, 'stack_size'): ...@@ -98,9 +98,8 @@ if hasattr(__thread__, 'stack_size'):
return _original_stack_size() return _original_stack_size()
if size > _original_stack_size(): if size > _original_stack_size():
return _original_stack_size(size) return _original_stack_size(size)
else: # not going to decrease stack_size, because otherwise other
pass # greenlets in this thread will suffer
# not going to decrease stack_size, because otherwise other greenlets in this thread will suffer
else: else:
__implements__.remove('stack_size') __implements__.remove('stack_size')
......
...@@ -105,8 +105,8 @@ class _DummyThread(_DummyThread_): ...@@ -105,8 +105,8 @@ class _DummyThread(_DummyThread_):
_Thread__started.set() _Thread__started.set()
_tstate_lock = None _tstate_lock = None
def __init__(self): def __init__(self): # pylint:disable=super-init-not-called
#_DummyThread_.__init__(self) # pylint:disable=super-init-not-called #_DummyThread_.__init__(self)
# It'd be nice to use a pattern like "greenlet-%d", but maybe somebody out # It'd be nice to use a pattern like "greenlet-%d", but maybe somebody out
# there is checking thread names... # there is checking thread names...
......
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