Skip to content

Commit e4ac0bc

Browse files
author
Christopher Doris
committed
tweaking juliaaa.As
1 parent ba57c72 commit e4ac0bc

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/cpython/as.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ PyAs_ConvertRule_tryconvert(o, ::Type{S}) where {S} = begin
1313
# get the value
1414
vo = PyObject_GetAttrString(o, "value")
1515
isnull(vo) && return -1
16-
err = PyObject_TryConvert(vo, t)
16+
err = PyObject_Convert(vo, t)
1717
Py_DecRef(vo)
18-
err == 1 || return err
18+
ism1(err) && return -1
1919
v = takeresult(t)
2020
# convert
2121
putresult(tryconvert(S, v))

src/cpython/juliaany.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ PyJuliaValue_From(x) = PyJuliaAnyValue_New(x)
6666
pyjlany_repr(xo::PyPtr) =
6767
try
6868
x = PyJuliaValue_GetValue(xo)
69-
s = repr(x)
70-
s = string("jl:", '\n' in s ? '\n' : ' ', s)
69+
s = "<jl $(repr(x))>"
7170
PyUnicode_From(s)
7271
catch err
7372
PyErr_SetJuliaError(err)

src/init.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@
243243
def __init__(self, value, type):
244244
self.value = value
245245
self.type = type
246+
def __repr__(self):
247+
return "juliaaa.As({!r}, {!r})".format(self.value, self.type)
246248
"""
247249
exec(code, jl.__dict__)
248250
```

0 commit comments

Comments
 (0)