Skip to content

Commit bd0fcd8

Browse files
committed
Wrap more ccall with disable_sigint
1 parent 0d85d79 commit bd0fcd8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/PyCall.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ function getindex(o::PyObject, s::AbstractString)
283283
if ispynull(o)
284284
throw(ArgumentError("ref of NULL PyObject"))
285285
end
286-
p = ccall((@pysym :PyObject_GetAttrString), PyPtr, (PyPtr, Cstring), o, s)
286+
p = disable_sigint() do
287+
ccall((@pysym :PyObject_GetAttrString), PyPtr, (PyPtr, Cstring), o, s)
288+
end
287289
if p == C_NULL
288290
pyerr_clear()
289291
throw(KeyError(s))
@@ -297,8 +299,11 @@ function setindex!(o::PyObject, v, s::Union{Symbol,AbstractString})
297299
if ispynull(o)
298300
throw(ArgumentError("assign of NULL PyObject"))
299301
end
300-
if -1 == ccall((@pysym :PyObject_SetAttrString), Cint,
301-
(PyPtr, Cstring, PyPtr), o, s, PyObject(v))
302+
e = disable_sigint() do
303+
ccall((@pysym :PyObject_SetAttrString), Cint,
304+
(PyPtr, Cstring, PyPtr), o, s, PyObject(v))
305+
end
306+
if -1 == e
302307
pyerr_clear()
303308
throw(KeyError(s))
304309
end
@@ -309,8 +314,11 @@ function haskey(o::PyObject, s::Union{Symbol,AbstractString})
309314
if ispynull(o)
310315
throw(ArgumentError("haskey of NULL PyObject"))
311316
end
312-
return 1 == ccall((@pysym :PyObject_HasAttrString), Cint,
313-
(PyPtr, Cstring), o, s)
317+
318+
return 1 == disable_sigint() do
319+
ccall((@pysym :PyObject_HasAttrString), Cint,
320+
(PyPtr, Cstring), o, s)
321+
end
314322
end
315323

316324
#########################################################################

0 commit comments

Comments
 (0)