Skip to content

Commit 6b668fa

Browse files
committed
remove some __graalpython__ builtins unless an expert option is set
1 parent 26578d2 commit 6b668fa

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GraalPythonModuleBuiltins.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ public void postInitialize(Python3Core core) {
197197
PList executableList = PythonObjectFactory.getUncached().createList(arr);
198198
mod.setAttribute("executable_list", executableList);
199199
mod.setAttribute("ForeignType", core.lookupType(PythonBuiltinClassType.ForeignObject));
200+
201+
if (!context.getOption(PythonOptions.EnableDebuggingBuiltins)) {
202+
mod.setAttribute("dump_truffle_ast", PNone.NO_VALUE);
203+
mod.setAttribute("tdebug", PNone.NO_VALUE);
204+
mod.setAttribute("set_storage_strategy", PNone.NO_VALUE);
205+
mod.setAttribute("dump_heap", PNone.NO_VALUE);
206+
}
200207
}
201208

202209
private static Object[] convertToObjectArray(String[] arr) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ private PythonOptions() {
244244
@Option(category = OptionCategory.EXPERT, help = "Set by the launcher to true (false means that GraalPython is being embedded in an application).") //
245245
public static final OptionKey<Boolean> RunViaLauncher = new OptionKey<>(false);
246246

247+
@Option(category = OptionCategory.EXPERT, help = "Enable built-in functions on the __graalpython__ module that are useful for debugging.") //
248+
public static final OptionKey<Boolean> EnableDebuggingBuiltins = new OptionKey<>(false);
249+
247250
public static final OptionDescriptors DESCRIPTORS = new PythonOptionsOptionDescriptors();
248251

249252
@CompilationFinal(dimensions = 1) private static final OptionKey<?>[] ENGINE_OPTION_KEYS;

mx.graalpython/mx_graalpython.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ def run_python_unittests(python_binary, args=None, paths=None, aot_compatible=Fa
593593

594594
args = args or []
595595
args = ["--experimental-options=true",
596+
"--python.EnableDebuggingBuiltins",
596597
"--python.CatchAllExceptions=true"] + args
597598
exclude = exclude or []
598599
if env is None:

0 commit comments

Comments
 (0)