Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.

Commit 28a5bab

Browse files
committed
don't use GoString hack
fixes #2
1 parent 9d25e45 commit 28a5bab

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

python.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

python.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ package python
1313
#include <stdint.h>
1414
#include <stdlib.h>
1515
16-
PyObject *String_FromGoStringPtr(void *);
17-
1816
static void INCREF(PyObject *o) {
1917
Py_INCREF(o);
2018
}
@@ -602,7 +600,7 @@ func encode(x interface{}) (pyValue *C.PyObject, err error) {
602600
pyValue = C.Long_FromInt64(C.int64_t(value))
603601

604602
case string:
605-
pyValue = C.String_FromGoStringPtr(unsafe.Pointer(&value))
603+
pyValue = C.PyString_FromStringAndSize(C.CString(value), C.long(len(value)))
606604

607605
case uint:
608606
pyValue = C.Long_FromUint64(C.uint64_t(value))

0 commit comments

Comments
 (0)