Skip to content

[]byte Parameter Results in Unexpected Integer Type #344

Description

@krypton-byte

I am facing an issue with Golang-to-Python interoperability. Specifically, when I call a Python function from Golang and pass a []byte data as a parameter, the Python function unexpectedly receives an integer instead of the intended MengByte/bytes object.

Code:

test.go

package hujan

type MengByte []byte
type Fungsi func(MengByte)

func Test(fun Fungsi) {
    fun(MengByte{255, 211, 21, 23, 0, 1, 2, 3, 82, 2, 33})
}

test.py

from out.hujan import Test, MengByte

def fun(arg: MengByte):
    print('arg: ', type(arg))
    return arg

Test(fun)

I would appreciate assistance in resolving this issue and ensuring that the Python function correctly receives the MengByte/bytes object.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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