mirror of https://github.com/scrapy/scrapy.git
Monkey patch configparser module to ease the dropping of py2 support
This commit is contained in:
parent
09e27d2d2e
commit
27e63e6890
|
|
@ -14,6 +14,11 @@ if sys.version_info[0] == 2:
|
|||
from urlparse import uses_query
|
||||
uses_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 requests
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import os
|
||||
import sys
|
||||
import numbers
|
||||
import configparser
|
||||
from operator import itemgetter
|
||||
|
||||
import six
|
||||
from six.moves.configparser import SafeConfigParser
|
||||
|
||||
from scrapy.settings import BaseSettings
|
||||
from 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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue