Skip to content

Commit d455460

Browse files
committed
Simplify config.add(linker)
1 parent 9f4b89d commit d455460

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

pytensor/configdefaults.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,23 +371,11 @@ def add_compile_configvars():
371371

372372
if rc == 0 and config.cxx != "":
373373
# Keep the default linker the same as the one for the mode FAST_RUN
374-
config.add(
375-
"linker",
376-
"Default linker used if the pytensor flags mode is Mode",
377-
EnumStr(
378-
"cvm", ["c|py", "py", "c", "c|py_nogc", "vm", "vm_nogc", "cvm_nogc"]
379-
),
380-
in_c_key=False,
381-
)
374+
linker_options = ["c|py", "py", "c", "c|py_nogc", "vm", "vm_nogc", "cvm_nogc"]
382375
else:
383376
# g++ is not present or the user disabled it,
384377
# linker should default to python only.
385-
config.add(
386-
"linker",
387-
"Default linker used if the pytensor flags mode is Mode",
388-
EnumStr("vm", ["py", "vm_nogc"]),
389-
in_c_key=False,
390-
)
378+
linker_options = ["py", "vm_nogc"]
391379
if type(config).cxx.is_default:
392380
# If the user provided an empty value for cxx, do not warn.
393381
_logger.warning(
@@ -397,6 +385,13 @@ def add_compile_configvars():
397385
"To remove this warning, set PyTensor flags cxx to an empty string."
398386
)
399387

388+
config.add(
389+
"linker",
390+
"Default linker used if the pytensor flags mode is Mode",
391+
EnumStr("cvm", linker_options),
392+
in_c_key=False,
393+
)
394+
400395
# Keep the default value the same as the one for the mode FAST_RUN
401396
config.add(
402397
"allow_gc",

0 commit comments

Comments
 (0)