Skip to content

Commit 7d9bf05

Browse files
committed
PosixModuleBuiltins: the gil can be acquired only once by the current thread while calling pipe
1 parent f68187c commit 7d9bf05

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
9494
import com.oracle.graal.python.nodes.util.CastToJavaLongLossyNode;
9595
import com.oracle.graal.python.nodes.util.CastToJavaStringNode;
96+
import com.oracle.graal.python.runtime.GilNode;
9697
import com.oracle.graal.python.runtime.PosixConstants;
9798
import com.oracle.graal.python.runtime.PosixConstants.IntConstant;
9899
import com.oracle.graal.python.runtime.PosixSupportLibrary;
@@ -101,7 +102,6 @@
101102
import com.oracle.graal.python.runtime.PythonContext;
102103
import com.oracle.graal.python.runtime.PythonCore;
103104
import com.oracle.graal.python.runtime.PythonOptions;
104-
import com.oracle.graal.python.runtime.GilNode;
105105
import com.oracle.graal.python.runtime.exception.PException;
106106
import com.oracle.graal.python.runtime.exception.PythonExitException;
107107
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
@@ -730,18 +730,14 @@ PTuple pipe(VirtualFrame frame,
730730
@Cached GilNode gil,
731731
@CachedLibrary("getPosixSupport()") PosixSupportLibrary posixLib) {
732732
int[] pipe;
733-
boolean thrown = false;
734733
gil.release(true);
735734
try {
736735
pipe = posixLib.pipe(getPosixSupport());
737736
} catch (PosixException e) {
738-
thrown = true;
739737
gil.acquire(); // need to acquire the gil to construct the OSError object
740738
throw raiseOSErrorFromPosixException(frame, e);
741739
} finally {
742-
if (!thrown) {
743-
gil.acquire();
744-
}
740+
gil.acquire();
745741
}
746742
return factory().createTuple(new Object[]{pipe[0], pipe[1]});
747743
}

0 commit comments

Comments
 (0)