def __getstate__(self) -> Mapping[str, Any]:
        """Reset cached lxml objects which could not be pickled."""
        state: dict[str, Any] = {}
        for cls in type(self).mro():
            cls_slots = getattr(cls, "__slots__", ())
            for slot_name in cls_slots:
                if hasattr(self, slot_name):
                    state[slot_name] = getattr(self, slot_name)
        state["_lxml_tree"] = None
        state["_strict_lxml_tree"] = None
        state["_lxml_form"] = None
        return state
Reset cached lxml objects which could not be pickled.
grab/document.py