Skip to content

re-entrancy issue in new pycall! #533

@stevengj

Description

@stevengj

Because the new pycall! implementation in #492 uses a global cache of Python tuples, we encounter some sticky problems due to lack of re-entrancy. In particular, if the PyObject call in pysetarg! itself calls pycall with the same number of arguments, we get the wrong results.

This can happen with the range conversions:

julia> f = py"lambda x,y,z: (x,y,z)"
PyObject <function <lambda> at 0x145cba510>

julia> pycall(f, PyObject, 3,4,5)
PyObject (3, 4, 5)

julia> pycall(f, PyObject, 3:6,4:10,5:11)  # WRONG RESULT:
PyObject (5, 12, range(5, 12))

cc @JobJob

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions