Scrapy, a fast high-level web crawling & scraping framework for Python.
added __slots__ to XPathSelector and Libxml2Document classes
Pablo Hoffman00527fc93cf6
diff --git a/scrapy/xpath/document.py b/scrapy/xpath/document.pyindex 78fb58306..308342cdb 100644--- a/scrapy/xpath/document.py+++ b/scrapy/xpath/document.py@@ -10,6 +10,7 @@ from scrapy.xpath.factories import xmlDoc_from_htmlclass Libxml2Document(object):cache = weakref.WeakKeyDictionary()+ __slots__ = ['xmlDoc', 'xpathContext']def __new__(cls, response, factory=xmlDoc_from_html):cache = cls.cache.setdefault(response, {})diff --git a/scrapy/xpath/selector.py b/scrapy/xpath/selector.pyindex 67c272e35..993e158f5 100644--- a/scrapy/xpath/selector.py+++ b/scrapy/xpath/selector.py@@ -16,6 +16,8 @@ from scrapy.utils.decorator import deprecatedclass XPathSelector(object_ref):+ __slots__ = ['doc', 'xmlNode', 'response', 'expr']+def __init__(self, response=None, text=None, node=None, parent=None, expr=None):if parent:self.doc = parent.doc