Scrapy, a fast high-level web crawling & scraping framework for Python.
python3: scrapy.__version__, NoneType, urlparse_monkeypatches
alexanderlukanin136c7292a08e6c
diff --git a/scrapy/__init__.py b/scrapy/__init__.pyindex af904e89d..cd362dac5 100644--- a/scrapy/__init__.py+++ b/scrapy/__init__.py@@ -4,6 +4,8 @@ Scrapy - a screen scraping framework written in Pythonfrom __future__ import print_functionimport 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, warningsdiff --git a/scrapy/utils/trackref.py b/scrapy/utils/trackref.pyindex 59d6e6727..b930b95dd 100644--- a/scrapy/utils/trackref.py+++ b/scrapy/utils/trackref.py@@ -14,7 +14,8 @@ import weakref, osfrom collections import defaultdictfrom time import timefrom 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.pyindex fc37810d6..e0ae45b64 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')