@@ -16,7 +16,7 @@ const PyJuliaBase_Type = Ref(C.PyNULL)
16
16
17
17
# we store the actual julia values here
18
18
# the `value` field of `PyJuliaValueObject` indexes into here
19
- const PYJLVALUES = Lockable ((; values= IdDict {Int,Any} (), free = Int[], next = Ref (1 )))
19
+ const PYJLVALUES = Lockable ((; values= IdDict {Int,Any} (), free_slots = Int[], next_slot = Ref (1 )))
20
20
21
21
function _pyjl_new (t:: C.PyPtr , :: C.PyPtr , :: C.PyPtr )
22
22
o = ccall (UnsafePtr {C.PyTypeObject} (t). alloc[! ], C. PyPtr, (C. PyPtr, C. Py_ssize_t), t, 0 )
@@ -31,7 +31,7 @@ function _pyjl_dealloc(o::C.PyPtr)
31
31
if idx != 0
32
32
Base. @lock PYJLVALUES begin
33
33
delete! (PYJLVALUES[]. values, idx)
34
- push! (PYJLVALUES[]. free , idx)
34
+ push! (PYJLVALUES[]. free_slots , idx)
35
35
end
36
36
end
37
37
UnsafePtr {PyJuliaValueObject} (o). weaklist[! ] == C. PyNULL || C. PyObject_ClearWeakRefs (o)
@@ -351,11 +351,11 @@ PyJuliaValue_SetValue(_o, @nospecialize(v)) = Base.GC.@preserve _o begin
351
351
idx = UnsafePtr {PyJuliaValueObject} (o). value[]
352
352
if idx == 0
353
353
Base. @lock PYJLVALUES begin
354
- if isempty (PYJLVALUES[]. free )
355
- idx = PYJLVALUES[]. next []
356
- PYJLVALUES[]. next [] += 1
354
+ if isempty (PYJLVALUES[]. free_slots )
355
+ idx = PYJLVALUES[]. next_slot []
356
+ PYJLVALUES[]. next_slot [] += 1
357
357
else
358
- idx = pop! (PYJLVALUES[]. free )
358
+ idx = pop! (PYJLVALUES[]. free_slots )
359
359
end
360
360
PYJLVALUES[]. values[idx] = v
361
361
end
0 commit comments