Skip to content

Commit f9f5c5b

Browse files
committed
Remove default in_c_key and change for cast_policy
1 parent b9f2dde commit f9f5c5b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pytensor/configdefaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def add_basic_configvars():
258258
# was expected, so it is currently not available.
259259
# numpy,
260260
),
261+
in_c_key=False,
261262
)
262263

263264
config.add(

pytensor/configparser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ def get_config_hash(self):
214214
)
215215
)
216216

217-
def add(
218-
self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool = True
219-
):
217+
def add(self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool):
220218
"""Add a new variable to PyTensorConfigParser.
221219
222220
This method performs some of the work of initializing `ConfigParam` instances.

tests/test_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def test_config_hash():
9898
"test__config_hash",
9999
"A config var from a test case.",
100100
configparser.StrParam("test_default"),
101+
in_c_key=True,
101102
)
102103

103104
h0 = root.get_config_hash()
@@ -160,6 +161,7 @@ def test_config_context():
160161
"test__config_context",
161162
"A config var from a test case.",
162163
configparser.StrParam("test_default"),
164+
in_c_key=False,
163165
)
164166
assert hasattr(root, "test__config_context")
165167
assert root.test__config_context == "test_default"
@@ -181,6 +183,7 @@ def test_invalid_configvar_access():
181183
"test__on_test_instance",
182184
"This config setting was added to the test instance.",
183185
configparser.IntParam(5),
186+
in_c_key=False,
184187
)
185188
assert hasattr(root_test, "test__on_test_instance")
186189
# While the property _actually_ exists on all instances,
@@ -197,6 +200,7 @@ def test_invalid_configvar_access():
197200
"test__on_test_instance",
198201
"This config setting was already added to another instance.",
199202
configparser.IntParam(5),
203+
in_c_key=False,
200204
)
201205

202206

@@ -248,6 +252,7 @@ def test_config_pickling():
248252
"test__lambda_kills_pickling",
249253
"Lambda functions cause pickling problems.",
250254
configparser.IntParam(5, lambda i: i > 0),
255+
in_c_key=False,
251256
)
252257
with pytest.raises(AttributeError, match="Can't pickle local object"):
253258
pickle.dump(root, io.BytesIO())

0 commit comments

Comments
 (0)