python3: scrapy.__version__, NoneType, urlparse_monkeypatches
diff --git a/scrapy/__init__.py b/scrapy/__init__.py
index af904e89df6..cd362dac565 100644
--- a/scrapy/__init__.py
+++ b/scrapy/__init__.py
@@ -4,6 +4,8 @@
 from __future__ import print_function
 import pkgutil
 __version__ = pkgutil.get_data(__package__, 'VERSION').strip()
+if not isinstance(__version__, str):
+    __version__ = __version__.decode('ascii')
 version_info = tuple(__version__.split('.')[:3])
 
 import sys, os, warnings
diff --git a/scrapy/utils/trackref.py b/scrapy/utils/trackref.py
index 59d6e6727b2..b930b95dd01 100644
--- a/scrapy/utils/trackref.py
+++ b/scrapy/utils/trackref.py
@@ -14,7 +14,8 @@
 from collections import defaultdict
 from time import time
 from operator import itemgetter
-from types import NoneType
+
+NoneType = type(None)
 
 live_refs = defaultdict(weakref.WeakKeyDictionary)
 
diff --git a/scrapy/xlib/urlparse_monkeypatches.py b/scrapy/xlib/urlparse_monkeypatches.py
index fc37810d643..e0ae45b648a 100644
--- a/scrapy/xlib/urlparse_monkeypatches.py
+++ b/scrapy/xlib/urlparse_monkeypatches.py
@@ -1,11 +1,14 @@
-from urlparse import urlparse
+import sys
 
-# workaround for http://bugs.python.org/issue7904 - Python < 2.7
-if urlparse('s3://bucket/key').netloc != 'bucket':
-    from urlparse import uses_netloc
-    uses_netloc.append('s3')
+if sys.version_info[0] == 2:
+    from urlparse import urlparse
 
-# workaround for http://bugs.python.org/issue9374 - Python < 2.7.4
-if urlparse('s3://bucket/key?key=value').query != 'key=value':
-    from urlparse import uses_query
-    uses_query.append('s3')
+    # workaround for http://bugs.python.org/issue7904 - Python < 2.7
+    if urlparse('s3://bucket/key').netloc != 'bucket':
+        from urlparse import uses_netloc
+        uses_netloc.append('s3')
+
+    # workaround for http://bugs.python.org/issue9374 - Python < 2.7.4
+    if urlparse('s3://bucket/key?key=value').query != 'key=value':
+        from urlparse import uses_query
+        uses_query.append('s3')

Python 3 compatibility changes:
1. `__version__` will be `str` in both 2 and 3. Necessary because pkgutil.get_data returns `bytes` in 3.
2. `NoneType` is not available in 3
3. Apply `urlparse_monkeypatches` in Python 2 only. Patches are not needed in 3 (tested in 3.2-3.4).
