Get the next parent node (including self) which is an instance of the given class.
(self, cls: Type[_NodeType])
| 415 | self.session._setupstate.addfinalizer(fin, self) |
| 416 | |
| 417 | def getparent(self, cls: Type[_NodeType]) -> Optional[_NodeType]: |
| 418 | """Get the next parent node (including self) which is an instance of |
| 419 | the given class.""" |
| 420 | current: Optional[Node] = self |
| 421 | while current and not isinstance(current, cls): |
| 422 | current = current.parent |
| 423 | assert current is None or isinstance(current, cls) |
| 424 | return current |
| 425 | |
| 426 | def _prunetraceback(self, excinfo: ExceptionInfo[BaseException]) -> None: |
| 427 | pass |
no outgoing calls