Skip to content

Commit

Permalink
Merge pull request #1483 from gevent/py38-take2
Browse files Browse the repository at this point in the history
Update Python versions, including 3.8 final on Appveyor
  • Loading branch information
jamadden committed Nov 18, 2019
2 parents bb1d6c9 + e00c797 commit 625c88b
Show file tree
Hide file tree
Showing 40 changed files with 1,239 additions and 685 deletions.
7 changes: 6 additions & 1 deletion .pylintrc
Expand Up @@ -49,6 +49,9 @@ limit-inference-results=1
# @property
# def foo(self):
# return None # generates useless-return
# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching.
# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we
# "export" the variable and don't have a __all__.
disable=wrong-import-position,
wrong-import-order,
missing-docstring,
Expand All @@ -69,7 +72,9 @@ disable=wrong-import-position,
undefined-all-variable,
inconsistent-return-statements,
useless-return,
useless-object-inheritance
useless-object-inheritance,
import-outside-toplevel,
self-assigning-variable


[FORMAT]
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.rst
Expand Up @@ -7,7 +7,9 @@
1.5a3 (unreleased)
==================

- Nothing changed yet.
- Python version updates: gevent is now tested with CPython 2.7.17,
3.5.9, 3.6.9, 3.7.5 and 3.8.0 (final). It is also tested with PyPy2
7.2 and PyPy 3.6 7.2


1.5a2 (2019-10-21)
Expand Down
17 changes: 13 additions & 4 deletions appveyor.yml
Expand Up @@ -19,6 +19,10 @@ environment:
# a later point release.

# 64-bit
- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "64"
PYTHON_EXE: python

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
Expand All @@ -41,13 +45,18 @@ environment:
PYTHON_EXE: python

# 32-bit
- PYTHON: "C:\\pypy2.7-v7.1.0-win32"
- PYTHON: "C:\\pypy2.7-v7.2.0-win32"
PYTHON_ID: "pypy"
PYTHON_EXE: pypy
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"

# 32-bit, wheel only (no testing)
- PYTHON: "C:\\Python38"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"
PYTHON_EXE: python
GWHEEL_ONLY: true

- PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7.x"
Expand Down Expand Up @@ -110,10 +119,10 @@ install:
New-Item -ItemType directory -Path "$env:PYTMP" | Out-Null;
}
if ("${env:PYTHON_ID}" -eq "pypy") {
if (!(Test-Path "${env:PYTMP}\pypy2-v7.1.0-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-win32.zip', "${env:PYTMP}\pypy2-v7.1.0-win32.zip");
if (!(Test-Path "${env:PYTMP}\pypy2-v7.2.0-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.2.0-win32.zip', "${env:PYTMP}\pypy2-v7.2.0-win32.zip");
}
7z x -y "${env:PYTMP}\pypy2-v7.1.0-win32.zip" -oC:\ | Out-Null;
7z x -y "${env:PYTMP}\pypy2-v7.2.0-win32.zip" -oC:\ | Out-Null;
& "${env:PYTHON}\pypy.exe" "-mensurepip";

}
Expand Down
14 changes: 7 additions & 7 deletions scripts/install.sh
Expand Up @@ -96,25 +96,25 @@ install () {
for var in "$@"; do
case "${var}" in
2.7)
install 2.7.16 python2.7 2.7.d
install 2.7.17 python2.7 2.7.d
;;
3.5)
install 3.5.6 python3.5 3.5.d
install 3.5.9 python3.5 3.5.d
;;
3.6)
install 3.6.8 python3.6 3.6.d
install 3.6.9 python3.6 3.6.d
;;
3.7)
install 3.7.4 python3.7 3.7.d
install 3.7.5 python3.7 3.7.d
;;
3.8)
install 3.8.0b4 python3.8 3.8.d
install 3.8.0 python3.8 3.8.d
;;
pypy2.7)
install pypy2.7-7.1.0 pypy2.7 pypy2.7.d
install pypy2.7-7.2.0 pypy2.7 pypy2.7.d
;;
pypy3.6)
install pypy3.6-7.1.0 pypy3.6 pypy3.6.d
install pypy3.6-7.2.0 pypy3.6 pypy3.6.d
;;
esac
done
34 changes: 16 additions & 18 deletions src/gevent/__init__.py
Expand Up @@ -31,29 +31,29 @@


__all__ = [
'get_hub',
'Greenlet',
'GreenletExit',
'spawn',
'spawn_later',
'spawn_raw',
'iwait',
'wait',
'killall',
'Timeout',
'with_timeout',
'config', # Added in 1.3a2
'fork',
'get_hub',
'getcurrent',
'sleep',
'getswitchinterval',
'idle',
'iwait',
'joinall',
'kill',
'signal', # deprecated
'signal_handler',
'fork',
'killall',
'reinit',
'getswitchinterval',
'setswitchinterval',
# Added in 1.3a2
'config',
'signal', # deprecated
'signal_handler',
'sleep',
'spawn',
'spawn_later',
'spawn_raw',
'wait',
'with_timeout',
]


Expand Down Expand Up @@ -89,11 +89,9 @@ def setswitchinterval(interval):
from gevent._hub_primitives import wait_on_objects as wait

from gevent.greenlet import Greenlet, joinall, killall
joinall = joinall # export for pylint
spawn = Greenlet.spawn
spawn_later = Greenlet.spawn_later
#: The singleton configuration object for gevent.
config = config

from gevent.timeout import Timeout, with_timeout
from gevent.hub import getcurrent, GreenletExit, spawn_raw, sleep, idle, kill, reinit
Expand Down Expand Up @@ -163,7 +161,7 @@ def __new__(cls, *args, **kwargs):
# outdated on each major release.

def __dependencies_for_freezing(): # pragma: no cover
# pylint:disable=unused-import
# pylint:disable=unused-import, import-outside-toplevel
from gevent import core
from gevent import resolver_thread
from gevent import resolver_ares
Expand Down
33 changes: 32 additions & 1 deletion src/gevent/_compat.py
Expand Up @@ -47,6 +47,14 @@ def NativeStrIO():
import io
return io.BytesIO() if str is bytes else io.StringIO()

try:
from abc import ABC
except ImportError:
import abc
ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
del abc


## Exceptions
if PY3:
def reraise(t, value, tb=None): # pylint:disable=unused-argument
Expand Down Expand Up @@ -87,6 +95,16 @@ def exc_clear():
from itertools import izip # python 3: pylint:disable=no-member,no-name-in-module
izip = izip

## The __fspath__ protocol

try:
from os import PathLike # pylint:disable=unused-import
except ImportError:
class PathLike(ABC):
@classmethod
def __subclasshook__(cls, subclass):
return hasattr(subclass, '__fspath__')

# fspath from 3.6 os.py, but modified to raise the same exceptions as the
# real native implementation.
# Define for testing
Expand Down Expand Up @@ -152,6 +170,19 @@ def fsencode(filename):
# Not sure how to handle this.
raise UnicodeEncodeError("Can't encode path to filesystem encoding")

try:
from os import fsdecode # pylint:disable=unused-import
except ImportError:
def fsdecode(filename):
"""Decode filename (an os.PathLike, bytes, or str) from the filesystem
encoding with 'surrogateescape' error handler, return str unchanged. On
Windows, use 'strict' error handler if the file system encoding is
'mbcs' (which is the default encoding).
"""
filename = fspath(filename) # Does type-checking of `filename`.
if PY3 and isinstance(filename, bytes):
return filename.decode(encoding, errors)
return filename

## Clocks
try:
Expand All @@ -162,7 +193,7 @@ def fsencode(filename):
import time

if sys.platform == "win32":
perf_counter = time.clock
perf_counter = time.clock # pylint:disable=no-member
else:
perf_counter = time.time

Expand Down
3 changes: 1 addition & 2 deletions src/gevent/_imap.py
Expand Up @@ -206,8 +206,7 @@ def _inext(self):
index, value = self.queue.get()
if index == self.index:
break
else:
self._results[index] = value
self._results[index] = value
self.index += 1
return value

Expand Down
2 changes: 1 addition & 1 deletion src/gevent/_socket2.py
Expand Up @@ -261,7 +261,7 @@ def connect(self, address):
result = self._sock.connect_ex(address)
if not result or result == EISCONN:
break
elif (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows):
if (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows):
self._wait(self._write_event)
else:
raise error(result, strerror(result))
Expand Down
2 changes: 1 addition & 1 deletion src/gevent/_socket3.py
Expand Up @@ -398,7 +398,7 @@ def connect(self, address):

if not result or result == EISCONN:
break
elif (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows):
if (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows):
self._wait(self._write_event)
else:
if (isinstance(address, tuple)
Expand Down
3 changes: 1 addition & 2 deletions src/gevent/_ssl2.py
Expand Up @@ -235,8 +235,7 @@ def recv_into(self, buffer, nbytes=None, flags=0):
sys.exc_clear()
self._wait(self._read_event)
continue
else:
raise
raise
else:
return socket.recv_into(self, buffer, nbytes, flags)

Expand Down

0 comments on commit 625c88b

Please sign in to comment.