Skip to content

Commit

Permalink
Drop support for EOL Python 3.2 and 3.3 (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored and berkerpeksag committed Jul 29, 2018
1 parent cdd1478 commit 78208c8
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 1,186 deletions.
1 change: 0 additions & 1 deletion .pylintrc
Expand Up @@ -8,7 +8,6 @@ ignore=
_compat.py,
argparse_compat.py,
six.py,
selectors.py,
_gaiohttp.py,

[MESSAGES CONTROL]
Expand Down
53 changes: 0 additions & 53 deletions NOTICE
Expand Up @@ -122,56 +122,3 @@ util/unlink.py
--------------

backport frop python3 Lib/test/support.py


gunicorn/selectors.py
---------------------
Copyright (c) 2001-2016 Python Software Foundation; All Rights Reserved

PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------

1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.

2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001-2016 Python Software Foundation; All Rights
Reserved" are retained in Python alone or in any derivative version prepared
by Licensee.

3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.

4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.

5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.

7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.

8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -28,7 +28,7 @@ The documentation is hosted at http://docs.gunicorn.org.
Installation
------------

Gunicorn requires **Python 2.x >= 2.6** or **Python 3.x >= 3.2**.
Gunicorn requires **Python 2.x >= 2.6** or **Python 3.x >= 3.4**.

Install from PyPI::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Expand Up @@ -23,7 +23,7 @@ Features
* Simple Python configuration
* Multiple worker configurations
* Various server hooks for extensibility
* Compatible with Python 2.x >= 2.6 or 3.x >= 3.2
* Compatible with Python 2.x >= 2.6 or 3.x >= 3.4


Contents
Expand Down
2 changes: 1 addition & 1 deletion docs/source/install.rst
Expand Up @@ -4,7 +4,7 @@ Installation

.. highlight:: bash

:Requirements: **Python 2.x >= 2.6** or **Python 3.x >= 3.2**
:Requirements: **Python 2.x >= 2.6** or **Python 3.x >= 3.4**

To install the latest released version of Gunicorn::

Expand Down
90 changes: 0 additions & 90 deletions gunicorn/_compat.py
Expand Up @@ -3,7 +3,6 @@
from gunicorn import six

PY26 = (sys.version_info[:2] == (2, 6))
PY33 = (sys.version_info >= (3, 3))


def _check_if_pyc(fname):
Expand Down Expand Up @@ -110,95 +109,6 @@ def _wrap_error(exc, mapping, key):
six.reraise(new_err_cls, new_err,
exc.__traceback__ if hasattr(exc, '__traceback__') else sys.exc_info()[2])

if PY33:
import builtins

BlockingIOError = builtins.BlockingIOError
BrokenPipeError = builtins.BrokenPipeError
ChildProcessError = builtins.ChildProcessError
ConnectionRefusedError = builtins.ConnectionRefusedError
ConnectionResetError = builtins.ConnectionResetError
InterruptedError = builtins.InterruptedError
ConnectionAbortedError = builtins.ConnectionAbortedError
PermissionError = builtins.PermissionError
FileNotFoundError = builtins.FileNotFoundError
ProcessLookupError = builtins.ProcessLookupError

def wrap_error(func, *args, **kw):
return func(*args, **kw)
else:
import errno
import select
import socket

class BlockingIOError(OSError):
pass

class BrokenPipeError(OSError):
pass

class ChildProcessError(OSError):
pass

class ConnectionRefusedError(OSError):
pass

class InterruptedError(OSError):
pass

class ConnectionResetError(OSError):
pass

class ConnectionAbortedError(OSError):
pass

class PermissionError(OSError):
pass

class FileNotFoundError(OSError):
pass

class ProcessLookupError(OSError):
pass

_MAP_ERRNO = {
errno.EACCES: PermissionError,
errno.EAGAIN: BlockingIOError,
errno.EALREADY: BlockingIOError,
errno.ECHILD: ChildProcessError,
errno.ECONNABORTED: ConnectionAbortedError,
errno.ECONNREFUSED: ConnectionRefusedError,
errno.ECONNRESET: ConnectionResetError,
errno.EINPROGRESS: BlockingIOError,
errno.EINTR: InterruptedError,
errno.ENOENT: FileNotFoundError,
errno.EPERM: PermissionError,
errno.EPIPE: BrokenPipeError,
errno.ESHUTDOWN: BrokenPipeError,
errno.EWOULDBLOCK: BlockingIOError,
errno.ESRCH: ProcessLookupError,
}

def wrap_error(func, *args, **kw):
"""
Wrap socket.error, IOError, OSError, select.error to raise new specialized
exceptions of Python 3.3 like InterruptedError (PEP 3151).
"""
try:
return func(*args, **kw)
except (socket.error, IOError, OSError) as exc:
if hasattr(exc, 'winerror'):
_wrap_error(exc, _MAP_ERRNO, exc.winerror)
# _MAP_ERRNO does not contain all Windows errors.
# For some errors like "file not found", exc.errno should
# be used (ex: ENOENT).
_wrap_error(exc, _MAP_ERRNO, exc.errno)
raise
except select.error as exc:
if exc.args:
_wrap_error(exc, _MAP_ERRNO, exc.args[0])
raise

if PY26:
from urlparse import (
_parse_cache, MAX_CACHE_SIZE, clear_cache, _splitnetloc, SplitResult,
Expand Down

0 comments on commit 78208c8

Please sign in to comment.