Scrapy, a fast high-level web crawling & scraping framework for Python.
Monkey patch configparser module to ease the dropping of py2 support
Eugenio Lacuesta27e63e689089
diff --git a/scrapy/_monkeypatches.py b/scrapy/_monkeypatches.pyindex f55ecc213..16bb4008b 100644--- a/scrapy/_monkeypatches.py+++ b/scrapy/_monkeypatches.py@@ -14,6 +14,11 @@ if sys.version_info[0] == 2:from urlparse import uses_queryuses_query.append('s3')+ # Prevent the DeprecationWarning about SafeConfigParser -> ConfigParser+ import configparser+ if not getattr(configparser, 'ConfigParser', None):+ configparser.ConfigParser = configparser.SafeConfigParser+# Undo what Twisted's perspective broker adds to pickle register# to prevent bugs like Twisted#7989 while serializing requestsdiff --git a/scrapy/utils/conf.py b/scrapy/utils/conf.pyindex fbd297340..26d66eaf8 100644--- a/scrapy/utils/conf.py+++ b/scrapy/utils/conf.py@@ -1,10 +1,10 @@import osimport sysimport numbers+import configparserfrom operator import itemgetterimport six-from six.moves.configparser import SafeConfigParserfrom scrapy.settings import BaseSettingsfrom scrapy.utils.deprecate import update_classpath@@ -92,9 +92,9 @@ def init_env(project='default', set_syspath=True):def get_config(use_closest=True):- """Get Scrapy config file as a SafeConfigParser"""+ """Get Scrapy config file as a ConfigParser"""sources = get_sources(use_closest)- cfg = SafeConfigParser()+ cfg = configparser.ConfigParser()cfg.read(sources)return cfg