Skip to content

Commit 2ba1f54

Browse files
committed
Enable WarnExperimentalFeatures by default for embedding
1 parent 8163278 commit 2ba1f54

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ language runtime. The main focus is on user-observable behavior of the engine.
77
* Updated developer metadata of Maven artifacts.
88

99
## Version 24.1.0
10-
* GraalPy is now considered stable for pure Python workloads. While many workloads involving native extension modules work, we continue to consider them experimental. You can use the command-line option `--python.WarnExperimentalFeatures` to enable warnings for such modules at runtime. In Java embeddings, set the context option `python.WarnExperimentalFeatures` to true.
10+
* GraalPy is now considered stable for pure Python workloads. While many workloads involving native extension modules work, we continue to consider them experimental. You can use the command-line option `--python.WarnExperimentalFeatures` to enable warnings for such modules at runtime. In Java embeddings the warnings are enabled by default and you can suppress them by setting the context option 'python.WarnExperimentalFeatures' to 'false'.
1111
* Update to Python 3.11.7
1212
* We now provide intrinsified `_pickle` module also in the community version.
1313
* `polyglot.eval` now raises more meaningful exceptions. Unavaliable languages raise `ValueError`. Exceptions from the polyglot language are raised directly as interop objects (typed as `polyglot.ForeignException`). The shortcut for executing python files without specifying language has been removed, use regular `eval` for executing Python code.

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ protected void launch(Builder contextBuilder) {
791791
contextBuilder.option("python.PosixModuleBackend", "java");
792792
}
793793

794+
if (!hasContextOptionSetViaCommandLine("WarnExperimentalFeatures")) {
795+
contextBuilder.option("python.WarnExperimentalFeatures", "false");
796+
}
797+
794798
if (multiContext) {
795799
contextBuilder.engine(Engine.newBuilder().allowExperimentalOptions(true).options(enginePolyglotOptions).build());
796800
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtContext.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,13 @@ public static Object loadCExtModule(Node location, PythonContext context, Module
306306
throws IOException, ApiInitException, ImportException {
307307

308308
if (context.getOption(PythonOptions.WarnExperimentalFeatures) && !C_EXT_SUPPORTED_LIST.contains(spec.name.toJavaStringUncached())) {
309-
getLogger().warning(() -> "Loading C extension module %s from '%s'. Support for the Python C API is considered experimental.".formatted(spec.name, spec.path));
309+
getLogger().warning(() -> {
310+
String message = "Loading C extension module %s from '%s'. Support for the Python C API is considered experimental.";
311+
if (!context.getOption(PythonOptions.RunViaLauncher)) {
312+
message += " You can suppress this warning by setting the context option 'python.WarnExperimentalFeatures' to 'false'";
313+
}
314+
return message.formatted(spec.name, spec.path);
315+
});
310316
}
311317

312318
// we always need to load the CPython C API

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ private PythonOptions() {
389389
public static final OptionKey<Boolean> UseNativePrimitiveStorageStrategy = new OptionKey<>(false);
390390

391391
@Option(category = OptionCategory.EXPERT, usageSyntax = "true|false", help = "Print warnings when using experimental features at runtime.", stability = OptionStability.STABLE) //
392-
public static final OptionKey<Boolean> WarnExperimentalFeatures = new OptionKey<>(false);
392+
public static final OptionKey<Boolean> WarnExperimentalFeatures = new OptionKey<>(true);
393393

394394
public static final OptionDescriptors DESCRIPTORS = new PythonOptionsOptionDescriptors();
395395

0 commit comments

Comments
 (0)