Skip to content

Commit b7beb77

Browse files
committed
Remove error check in ConfigParser
1 parent 8a6e407 commit b7beb77

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

pytensor/configparser.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,7 @@ def add(self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool):
236236
raise ValueError(
237237
f"Dot-based sections were removed. Use double underscores! ({name})"
238238
)
239-
# Can't use hasattr here, because it returns False upon AttributeErrors
240-
if name in dir(self):
241-
raise AttributeError(
242-
f"A config parameter with the name '{name}' was already registered on another config instance."
243-
)
239+
244240
configparam.doc = doc
245241
configparam.name = name
246242
configparam.in_c_key = in_c_key

tests/test_config.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,6 @@ def test_invalid_configvar_access():
194194
with pytest.raises(configparser.ConfigAccessViolation, match="different instance"):
195195
print(root.test__on_test_instance)
196196

197-
# And also that we can't add two configs of the same name to different instances:
198-
with pytest.raises(AttributeError, match="already registered"):
199-
root.add(
200-
"test__on_test_instance",
201-
"This config setting was already added to another instance.",
202-
configparser.IntParam(5),
203-
in_c_key=False,
204-
)
205-
206197

207198
def test_no_more_dotting():
208199
root = configdefaults.config

0 commit comments

Comments
 (0)