Skip to content

Commit 9691759

Browse files
author
Adam Hrbac
committed
Remove contextVarsContextInitialized
1 parent dacf741 commit 9691759

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,8 @@ public static final class PythonThreadState {
248248
TraceEvent tracingWhat;
249249

250250
/*
251-
* tracks whether a contextVarsContext was ever set. This is useful to make bugs where
252-
* contextVarsContext gets set to null noticable.
251+
* the current contextvars.Context for the thread.
253252
*/
254-
boolean contextVarsContextInitialized = false;
255-
256253
PContextVarsContext contextVarsContext;
257254

258255
/*
@@ -339,16 +336,15 @@ public void setNativeWrapper(PThreadState nativeWrapper) {
339336
}
340337

341338
public PContextVarsContext getContextVarsContext() {
342-
if (!contextVarsContextInitialized) {
339+
if (contextVarsContext == null) {
343340
contextVarsContext = PythonObjectFactory.getUncached().createContextVarsContext();
344-
contextVarsContextInitialized = true;
345341
}
346342
return contextVarsContext;
347343
}
348344

349345
public void setContextVarsContext(PContextVarsContext contextVarsContext) {
346+
assert contextVarsContext != null;
350347
this.contextVarsContext = contextVarsContext;
351-
this.contextVarsContextInitialized = true;
352348
}
353349

354350
public void dispose() {

0 commit comments

Comments
 (0)