diff --git a/scrapy/xpath/document.py b/scrapy/xpath/document.py index 78fb58306..308342cdb 100644 --- a/scrapy/xpath/document.py +++ b/scrapy/xpath/document.py @@ -10,6 +10,7 @@ from scrapy.xpath.factories import xmlDoc_from_html class 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.py index 67c272e35..993e158f5 100644 --- a/scrapy/xpath/selector.py +++ b/scrapy/xpath/selector.py @@ -16,6 +16,8 @@ from scrapy.utils.decorator import deprecated class 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