Skip to content

Commit fa917f3

Browse files
author
Christopher Doris
committed
revert this too - entering paranoia mode
1 parent 24aee96 commit fa917f3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Core/Py.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ pyconvert(::Type{Py}, x::Py) = x
5151

5252
setptr!(x::Py, ptr::C.PyPtr) = (setfield!(x, :ptr, ptr); x)
5353

54-
incref(x::Py) = Base.GC.@preserve x (incref(getptr(x)); x)
55-
decref(x::Py) = Base.GC.@preserve x (decref(getptr(x)); x)
56-
57-
Base.unsafe_convert(::Type{C.PyPtr}, x::Py) = getptr(x)
58-
5954
const PYNULL_CACHE = Py[]
6055

6156
"""
@@ -80,7 +75,7 @@ const PyNULL = pynew()
8075

8176
pynew(ptr::C.PyPtr) = setptr!(pynew(), ptr)
8277

83-
pynew(x::Py) = Base.GC.@preserve x pynew(incref(getptr(x)))
78+
pynew(x::Py) = pynew(incref(getptr(x)))
8479

8580
"""
8681
pycopy!(dst::Py, src)
@@ -169,13 +164,13 @@ Base.print(io::IO, x::Py) = print(io, string(x))
169164

170165
function Base.show(io::IO, x::Py)
171166
if get(io, :typeinfo, Any) == Py
172-
if pyisnull(x)
167+
if getptr(x) == C.PyNULL
173168
print(io, "NULL")
174169
else
175170
print(io, pyrepr(String, x))
176171
end
177172
else
178-
if pyisnull(x)
173+
if getptr(x) == C.PyNULL
179174
print(io, "<py NULL>")
180175
else
181176
s = pyrepr(String, x)

0 commit comments

Comments
 (0)