Skip to content

Commit

Permalink
return dict copy on sel.attrib
Browse files Browse the repository at this point in the history
This is done to prevent:

- changes in this object be reflected in a tree;
- keeping a reference to a tree and preventing response GC;
- isinstance(sel.attrib, dict) to be False

Thanks @kmike !
  • Loading branch information
eliasdorneles committed Jun 8, 2018
1 parent ec6d3cb commit ee042d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parsel/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def remove_namespaces(self):
def attrib(self):
"""Return the attributes dictionary for underlying element.
"""
return self.root.attrib
return dict(self.root.attrib)

def __bool__(self):
"""
Expand Down

0 comments on commit ee042d1

Please sign in to comment.