Skip to content

Commit 1cedbc7

Browse files
committed
Speedup config access
1 parent 03a70fd commit 1cedbc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pytensor/configparser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ def __get__(self, cls, type_, delete_key=False):
410410
f"The config parameter '{self.name}' was registered on a different instance of the PyTensorConfigParser."
411411
f" It is not accessible through the instance with id '{id(cls)}' because of safeguarding."
412412
)
413-
if not hasattr(self, "val"):
413+
try:
414+
return self.val
415+
except AttributeError:
414416
try:
415417
val_str = cls.fetch_val_for_key(self.name, delete_key=delete_key)
416418
self.is_default = False

0 commit comments

Comments
 (0)