Skip to content

Parameter Passing Issue after support class #50

Description

@toaction

After introducing Python classes, Python objects now have specific types instead of all being *py.Object. For example, we can create a Dog instance through the constructor:

type Dog struct {
    py.Object
}

dog := NewDog(py.Str("dahuang"))

However, the obtained Python object can only call struct methods and cannot be passed as a parameter to functions or methods, which is obviously inconsistent with Python syntax.
Python demo:

def say(dog):
    pass

LLGo Binding:

//go:linkname Say py.say
func Say(dog *py.Object) *py.Object

LLGo use:

Say(dog)

Fault:

cannot use dog (variable of type *Dog) as *py.Object value in argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions