Skip to content

Commit 66cc521

Browse files
committed
Document GIL assumptions in CApiContext.(getOrCreate|free)SmallInts
1 parent cbedd6d commit 66cc521

File tree

1 file changed

+4
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+4
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ public PrimitiveNativeWrapper getCachedPrimitiveNativeWrapper(long l) {
350350
*/
351351
Object getOrCreateSmallInts() {
352352
CompilerAsserts.neverPartOfCompilation();
353+
// TODO(fa): this should not require the GIL (GR-51314)
354+
assert getContext().ownsGil();
353355
if (nativeSmallIntsArray == null) {
354356
int nSmallNegativeInts = CConstants._PY_NSMALLNEGINTS.intValue();
355357
int nSmallPositiveInts = CConstants._PY_NSMALLPOSINTS.intValue();
@@ -364,6 +366,8 @@ Object getOrCreateSmallInts() {
364366

365367
private void freeSmallInts() {
366368
CompilerAsserts.neverPartOfCompilation();
369+
// TODO(fa): this should not require the GIL (GR-51314)
370+
assert getContext().ownsGil();
367371
if (nativeSmallIntsArray != null) {
368372
int nSmallNegativeInts = CConstants._PY_NSMALLNEGINTS.intValue();
369373
int nSmallPositiveInts = CConstants._PY_NSMALLPOSINTS.intValue();

0 commit comments

Comments
 (0)