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

Commit eefd9db

Browse files
remicalixtehush-hush
authored andcommitted
Don't use non constant in initializer
1 parent 67b7b05 commit eefd9db

File tree

14 files changed

+21
-77
lines changed

14 files changed

+21
-77
lines changed

boolean.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615

16+
import (
17+
"unsafe"
18+
)
19+
1720
//python boolean constants
1821
var (
1922
Py_False = togo(C.Py_False)
2023
Py_True = togo(C.Py_True)
2124
)
2225

2326
//Bool : https://docs.python.org/3/c-api/bool.html#c.PyBool_Type
24-
var Bool = togo(C._go_PyBool_Type)
27+
var Bool = togo((*C.PyObject)(unsafe.Pointer(&C.PyBool_Type)))
2528

2629
//PyBool_Check : https://docs.python.org/3/c-api/bool.html#c.PyBool_Check
2730
func PyBool_Check(o *PyObject) bool {

byte_array.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615
import "unsafe"
1716

1817
//ByteArray : https://docs.python.org/3/c-api/bytearray.html#c.PyByteArray_Type
19-
var ByteArray = togo(C._go_PyByteArray_Type)
18+
var ByteArray = togo((*C.PyObject)(unsafe.Pointer(&C.PyByteArray_Type)))
2019

2120
//PyByteArray_Check : https://docs.python.org/3/c-api/bytearray.html#c.PyByteArray_Check
2221
func PyByteArray_Check(o *PyObject) bool {

bytes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615
import "unsafe"
1716

1817
//Bytes : https://docs.python.org/3/c-api/bytes.html#c.PyBytes_Type
19-
var Bytes = togo(C._go_PyBytes_Type)
18+
var Bytes = togo((*C.PyObject)(unsafe.Pointer(&C.PyBytes_Type)))
2019

2120
//PyBytes_Check : https://docs.python.org/3/c-api/bytes.html#c.PyBytes_Check
2221
func PyBytes_Check(o *PyObject) bool {

complex.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
15+
import "unsafe"
1616

1717
//Complex : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Type
18-
var Complex = togo(C._go_PyComplex_Type)
18+
var Complex = togo((*C.PyObject)(unsafe.Pointer(&C.PyComplex_Type)))
1919

2020
//PyComplex_Check : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Check
2121
func PyComplex_Check(p *PyObject) bool {

dict.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615
import (
1716
"unsafe"
1817
)
1918

2019
//Dict : https://docs.python.org/3/c-api/dict.html#c.PyDict_Type
21-
var Dict = togo(C._go_PyDict_Type)
20+
var Dict = togo((*C.PyObject)(unsafe.Pointer(&C.PyDict_Type)))
2221

2322
//PyDict_Check : https://docs.python.org/3/c-api/dict.html#c.PyDict_Check
2423
func PyDict_Check(p *PyObject) bool {

float.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
15+
import "unsafe"
1616

1717
//Float : https://docs.python.org/3/c-api/float.html#c.PyFloat_Type
18-
var Float = togo(C._go_PyFloat_Type)
18+
var Float = togo((*C.PyObject)(unsafe.Pointer(&C.PyFloat_Type)))
1919

2020
//PyFloat_Check : https://docs.python.org/3/c-api/float.html#c.PyFloat_Check
2121
func PyFloat_Check(p *PyObject) bool {

integer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615
import (
1716
"unsafe"
1817
)
1918

2019
//Long : https://docs.python.org/3/c-api/long.html#c.PyLong_Type
21-
var Long = togo(C._go_PyLong_Type)
20+
var Long = togo((*C.PyObject)(unsafe.Pointer(&C.PyLong_Type)))
2221

2322
//PyLong_Check : https://docs.python.org/3/c-api/long.html#c.PyLong_Check
2423
func PyLong_Check(p *PyObject) bool {

list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
15+
import "unsafe"
1616

1717
//List : https://docs.python.org/3/c-api/list.html#c.PyList_Type
18-
var List = togo(C._go_PyList_Type)
18+
var List = togo((*C.PyObject)(unsafe.Pointer(&C.PyList_Type)))
1919

2020
//PyList_Check : https://docs.python.org/3/c-api/list.html#c.PyList_Check
2121
func PyList_Check(p *PyObject) bool {

module.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
1615
import "unsafe"
1716

1817
//Module : https://docs.python.org/3/c-api/module.html#c.PyModule_Type
19-
var Module = togo(C._go_PyModule_Type)
18+
var Module = togo((*C.PyObject)(unsafe.Pointer(&C.PyModule_Type)))
2019

2120
//PyModule_Check : https://docs.python.org/3/c-api/module.html#c.PyModule_Check
2221
func PyModule_Check(p *PyObject) bool {

tuple.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ package python3
1010
/*
1111
#include "Python.h"
1212
#include "macro.h"
13-
#include "type.h"
1413
*/
1514
import "C"
15+
import "unsafe"
1616

1717
//Tuple : https://docs.python.org/3/c-api/tuple.html#c.PyTuple_Type
18-
var Tuple = togo(C._go_PyTuple_Type)
18+
var Tuple = togo((*C.PyObject)(unsafe.Pointer(&C.PyTuple_Type)))
1919

2020
//PyTuple_Check : https://docs.python.org/3/c-api/tuple.html#c.PyTuple_Check
2121
func PyTuple_Check(p *PyObject) bool {

0 commit comments

Comments
 (0)