Skip to content

Commit a996b4f

Browse files
author
Christopher Doris
committed
fixes after merge
1 parent c995cb5 commit a996b4f

File tree

7 files changed

+40
-36
lines changed

7 files changed

+40
-36
lines changed

src/API/exports.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ export pyclassmethod
127127
export pyfunc
128128
export pyisjl
129129
export pyjl
130+
export pyjlcollection
131+
export pyjlarray
132+
export pyjldict
133+
export pyjlset
130134
export pyjlraw
131135
export pyjltype
132136
export pyjlvalue

src/JlWrap/C.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,6 @@ PyJuliaValue_GetValue(o) = Base.GC.@preserve o begin
446446
end
447447
end
448448

449-
PyJuliaValue_IsNull(o) =
450-
Base.GC.@preserve o UnsafePtr{PyJuliaValueObject}(C.asptr(o)).value[] == 0
451-
452449
PyJuliaValue_SetValue(o, v::Union{Nothing,Bool}) = Base.GC.@preserve o begin
453450
optr = UnsafePtr{PyJuliaValueObject}(C.asptr(o))
454451
idx = optr.value[]

src/JlWrap/any.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,5 @@ end
585585
Create a Python `juliacall.Jl` object wrapping the Julia object `x`.
586586
"""
587587
pyjl(v) = pyjl(pyjlanytype, v)
588-
export pyjl
589588

590589
pyjliter(x) = pyjl(pyjlitertype, x)

src/JlWrap/array.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,5 @@ This object can be converted to a Numpy array with `numpy.array(v)`, `v.to_numpy
390390
If `x` is one-dimensional (an `AbstractVector`) then it also behaves as a `list`.
391391
"""
392392
pyjlarray(x::AbstractArray) = pyjl(pyjlarraytype, x)
393-
export pyjlarray
394393

395394
Py(x::AbstractArray) = pyjlarray(x)

src/JlWrap/collection.jl

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,47 @@ const pyjlcollectiontype = pynew()
22

33
pyjlcollection_clear(x) = (empty!(x); Py(nothing))
44

5-
pyjlcollection_contains(x, v::Py) = pybool(in(@pyconvert(eltype(x), v, (return Py(false))), x)::Bool)
5+
pyjlcollection_contains(x, v::Py) =
6+
pybool(in(@pyconvert(eltype(x), v, (return Py(false))), x)::Bool)
67

78
pyjlcollection_eq(self, other) = pybool((self == pyjlvalue(other))::Bool)
89

910
function init_collection()
1011
jl = pyjuliacallmodule
11-
pybuiltins.exec(pybuiltins.compile("""
12-
$("\n"^(@__LINE__()-1))
13-
class JlCollection(JlBase2):
14-
__slots__ = ()
15-
def __len__(self):
16-
return self._jl_callmethod($(pyjl_methodnum(pyint length)))
17-
def __bool__(self):
18-
return self._jl_callmethod($(pyjl_methodnum(pybool !isempty)))
19-
def __iter__(self):
20-
return self._jl_callmethod($(pyjl_methodnum(pyjliter Iterator)))
21-
def __hash__(self):
22-
return self._jl_callmethod($(pyjl_methodnum(pyjlany_hash)))
23-
def __eq__(self, other):
24-
if isinstance(self, type(other)) or isinstance(other, type(self)):
25-
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_eq)), other)
26-
else:
27-
return NotImplemented
28-
def __contains__(self, v):
29-
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_contains)), v)
30-
def copy(self):
31-
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection copy)))
32-
def clear(self):
33-
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_clear)))
34-
import collections.abc
35-
collections.abc.Collection.register(JlCollection)
36-
del collections
37-
""", @__FILE__(), "exec"), jl.__dict__)
12+
pybuiltins.exec(
13+
pybuiltins.compile(
14+
"""
15+
$("\n"^(@__LINE__()-1))
16+
class JlCollection(JlBase2):
17+
__slots__ = ()
18+
def __len__(self):
19+
return self._jl_callmethod($(pyjl_methodnum(pyint length)))
20+
def __bool__(self):
21+
return self._jl_callmethod($(pyjl_methodnum(pybool !isempty)))
22+
def __iter__(self):
23+
return self._jl_callmethod($(pyjl_methodnum(pyjliter Iterator)))
24+
def __hash__(self):
25+
return self._jl_callmethod($(pyjl_methodnum(pyjlany_hash)))
26+
def __eq__(self, other):
27+
if isinstance(self, type(other)) or isinstance(other, type(self)):
28+
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_eq)), other)
29+
else:
30+
return NotImplemented
31+
def __contains__(self, v):
32+
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_contains)), v)
33+
def copy(self):
34+
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection copy)))
35+
def clear(self):
36+
return self._jl_callmethod($(pyjl_methodnum(pyjlcollection_clear)))
37+
import collections.abc
38+
collections.abc.Collection.register(JlCollection)
39+
del collections
40+
""",
41+
@__FILE__(),
42+
"exec",
43+
),
44+
jl.__dict__,
45+
)
3846
pycopy!(pyjlcollectiontype, jl.JlCollection)
3947
end
4048

@@ -51,7 +59,6 @@ pyjlcollection(x) = pyjl(pyjlcollectiontype, x)
5159
pyjlcollection(x::AbstractSet) = pyjlset(x)
5260
pyjlcollection(x::AbstractArray) = pyjlarray(x)
5361
pyjlcollection(x::AbstractDict) = pyjldict(x)
54-
export pyjlcollection
5562

5663
Py(x::Base.ValueIterator) = pyjlcollection(x)
5764
Py(x::Base.RefValue) = pyjlcollection(x)

src/JlWrap/dict.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,5 @@ end
118118
Wrap `x` as a Python `dict`-like object.
119119
"""
120120
pyjldict(x::AbstractDict) = pyjl(pyjldicttype, x)
121-
export pyjldict
122121

123122
Py(x::AbstractDict) = pyjldict(x)

src/JlWrap/set.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,5 @@ end
130130
Wrap `x` as a Python `set`-like object.
131131
"""
132132
pyjlset(x::AbstractSet) = pyjl(pyjlsettype, x)
133-
export pyjlset
134133

135134
Py(x::AbstractSet) = pyjlset(x)

0 commit comments

Comments
 (0)