Skip to content

Commit 962b439

Browse files
committed
default to dont_write_bytecode and let the launcher set it to false
1 parent 5caaae0 commit 962b439

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
import java.util.Date;
5252
import java.util.List;
5353

54-
import com.oracle.graal.python.util.OverflowException;
55-
import org.graalvm.nativeimage.ImageInfo;
56-
5754
import com.oracle.graal.python.PythonLanguage;
5855
import com.oracle.graal.python.builtins.Builtin;
5956
import com.oracle.graal.python.builtins.CoreFunctions;
@@ -85,6 +82,7 @@
8582
import com.oracle.graal.python.runtime.PythonOptions;
8683
import com.oracle.graal.python.runtime.exception.PException;
8784
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
85+
import com.oracle.graal.python.util.OverflowException;
8886
import com.oracle.graal.python.util.PythonUtils;
8987
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
9088
import com.oracle.truffle.api.Truffle;
@@ -99,6 +97,8 @@
9997
import com.oracle.truffle.api.library.CachedLibrary;
10098
import com.oracle.truffle.api.profiles.ConditionProfile;
10199

100+
import org.graalvm.nativeimage.ImageInfo;
101+
102102
@CoreFunctions(defineModule = "sys")
103103
public class SysModuleBuiltins extends PythonBuiltins {
104104
private static final String LICENSE = "Copyright (c) Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.";
@@ -193,13 +193,13 @@ public void postInitialize(PythonCore core) {
193193
sys.setAttribute("executable", context.getOption(PythonOptions.Executable));
194194
sys.setAttribute("_base_executable", context.getOption(PythonOptions.Executable));
195195
}
196-
sys.setAttribute("dont_write_bytecode", ImageInfo.inImageBuildtimeCode() || context.getOption(PythonOptions.DontWriteBytecodeFlag));
196+
sys.setAttribute("dont_write_bytecode", context.getOption(PythonOptions.DontWriteBytecodeFlag));
197197
String pycachePrefix = context.getOption(PythonOptions.PyCachePrefix);
198198
sys.setAttribute("pycache_prefix", pycachePrefix.isEmpty() ? PNone.NONE : pycachePrefix);
199199
sys.setAttribute("__flags__", core.factory().createTuple(new Object[]{
200200
false, // bytes_warning
201201
!context.getOption(PythonOptions.PythonOptimizeFlag), // debug
202-
ImageInfo.inImageBuildtimeCode() || context.getOption(PythonOptions.DontWriteBytecodeFlag), // dont_write_bytecode
202+
context.getOption(PythonOptions.DontWriteBytecodeFlag), // dont_write_bytecode
203203
false, // hash_randomization
204204
context.getOption(PythonOptions.IgnoreEnvironmentFlag), // ignore_environment
205205
context.getOption(PythonOptions.InspectFlag), // inspect

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
@@ -107,7 +107,7 @@ private PythonOptions() {
107107
public static final OptionKey<Boolean> IsolateFlag = new OptionKey<>(false);
108108

109109
@Option(category = OptionCategory.USER, help = "Equivalent to the Python -B flag. Don't write bytecode files.", stability = OptionStability.STABLE) //
110-
public static final OptionKey<Boolean> DontWriteBytecodeFlag = new OptionKey<>(false);
110+
public static final OptionKey<Boolean> DontWriteBytecodeFlag = new OptionKey<>(true);
111111

112112
@Option(category = OptionCategory.USER, help = "If this is set, GraalPython will write .pyc files in a mirror directory tree at this path, " +
113113
"instead of in __pycache__ directories within the source tree. " +

0 commit comments

Comments
 (0)