Skip to content

Commit 05d1cd8

Browse files
NivekTfacebook-github-bot
authored andcommitted
Safeguarding DL2Iterator's __getattr__ (#1004)
Summary: Pull Request resolved: #1004 Fixes #1000 As reported in the issue, in some uncommon cases, it is possible for the attribute to be missing, leading to infinite recursion. This should prevent it. Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D43197744 Pulled By: NivekT fbshipit-source-id: 64e6edfe129dcca06f5cf3054bb7f8c2e510536c
1 parent 90fdad7 commit 05d1cd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchdata/dataloader2/dataloader2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __getattr__(self, name):
7777
"""
7878
To delegate operations to ``dataloader._datapipe_iter``.
7979
"""
80-
if self.dataloader._datapipe_iter is None:
80+
if "dataloader" not in self.__dict__ or self.dataloader._datapipe_iter is None:
8181
raise AttributeError
8282
return getattr(self.dataloader._datapipe_iter, name)
8383

0 commit comments

Comments
 (0)