Accept long integers in `_fileobj_to_fd`
fixes
MODIFY
CHANGES.rst
CHANGES.rst
@@ -4,6 +4,8 @@ Changes
dev (master)
------------
+* Fix ``util.selectors._fileobj_to_fd`` to accept ``long`` (Issue #1247).
+
* Dropped Python 3.3 support. (Pull #1242)
* Put the connection back in the pool when calling stream() or read_chunked() on

MODIFY
CONTRIBUTORS.txt
CONTRIBUTORS.txt
@@ -239,5 +239,9 @@ In chronological order:
* Mike Miller <github@mikeage.net>
* Logging improvements to include the HTTP(S) port when opening a new connection
+* Ioannis Tziakos <mail@itziakos.gr>
+ * Fix ``util.selectors._fileobj_to_fd`` to accept ``long``.
+ * Update appveyor tox setup to use the 64bit python.
+
* [Your name or handle] <[email or website]>
* [Brief summary of your changes]

MODIFY
urllib3/util/selectors.py
urllib3/util/selectors.py
@@ -12,12 +12,14 @@ import socket
import sys
import time
from collections import namedtuple, Mapping
+from ..packages.six import integer_types
try:
monotonic = time.monotonic
except (AttributeError, ImportError): # Python 3.3<
monotonic = time.time
+
EVENT_READ = (1 << 0)
EVENT_WRITE = (1 << 1)
@@ -41,7 +43,7 @@ class SelectorError(Exception):
def _fileobj_to_fd(fileobj):
""" Return a file descriptor from a file object. If
given an integer will simply return that integer back. """
- if isinstance(fileobj, int):
+ if isinstance(fileobj, integer_types):
fd = fileobj
else:
try:

Accept long integers in `_fileobj_to_fd`

fixes #1247