Skip to content

Commit

Permalink
Band-aid to avoid __deepcopy__ being looked up as a hierarchy scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Jun 30, 2023
1 parent 986fbeb commit 4b0769c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openff/toolkit/topology/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,10 @@ def hierarchy_iterator(

def __getattr__(self, name: str) -> List["HierarchyElement"]:
"""If a requested attribute is not found, check the hierarchy schemes"""
# Avoid attempting to process dunder methods as hierarchy scheme iterator names
if name.startswith("__"):
raise AttributeError

if name in dir(self):
raise HierarchyIteratorNameConflictError(
f"Name {name} is already defined as an attribute/method of `Topology`."
Expand Down

0 comments on commit 4b0769c

Please sign in to comment.