Skip to content

Commit 1db5721

Browse files
committed
sys.warnoptions must be a list
1 parent 4a2b0c7 commit 1db5721

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ public void postInitialize(PythonCore core) {
199199
sys.setAttribute("dont_write_bytecode", context.getOption(PythonOptions.DontWriteBytecodeFlag));
200200
String pycachePrefix = context.getOption(PythonOptions.PyCachePrefix);
201201
sys.setAttribute("pycache_prefix", pycachePrefix.isEmpty() ? PNone.NONE : pycachePrefix);
202-
sys.setAttribute("warnoptions", core.factory().createTuple(context.getOption(PythonOptions.WarnOptions).split(",")));
202+
203+
String[] strWarnoptions = context.getOption(PythonOptions.WarnOptions).split(",");
204+
Object[] warnoptions = new Object[strWarnoptions.length];
205+
System.arraycopy(strWarnoptions, 0, warnoptions, 0, strWarnoptions.length);
206+
sys.setAttribute("warnoptions", core.factory().createList(warnoptions));
203207
sys.setAttribute("__flags__", core.factory().createTuple(new Object[]{
204208
false, // bytes_warning
205209
!context.getOption(PythonOptions.PythonOptimizeFlag), // debug

0 commit comments

Comments
 (0)