Don't use non constant in initializer

master
Rémi Calixte 2018-12-20 17:59:29 -05:00 committed by Maxime Mouial
parent 67b7b05b0f
commit eefd9dbc8b
14 changed files with 21 additions and 77 deletions

View File

@ -10,10 +10,13 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import (
"unsafe"
)
//python boolean constants
var (
Py_False = togo(C.Py_False)
@ -21,7 +24,7 @@ var (
)
//Bool : https://docs.python.org/3/c-api/bool.html#c.PyBool_Type
var Bool = togo(C._go_PyBool_Type)
var Bool = togo((*C.PyObject)(unsafe.Pointer(&C.PyBool_Type)))
//PyBool_Check : https://docs.python.org/3/c-api/bool.html#c.PyBool_Check
func PyBool_Check(o *PyObject) bool {

View File

@ -10,13 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//ByteArray : https://docs.python.org/3/c-api/bytearray.html#c.PyByteArray_Type
var ByteArray = togo(C._go_PyByteArray_Type)
var ByteArray = togo((*C.PyObject)(unsafe.Pointer(&C.PyByteArray_Type)))
//PyByteArray_Check : https://docs.python.org/3/c-api/bytearray.html#c.PyByteArray_Check
func PyByteArray_Check(o *PyObject) bool {

View File

@ -10,13 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Bytes : https://docs.python.org/3/c-api/bytes.html#c.PyBytes_Type
var Bytes = togo(C._go_PyBytes_Type)
var Bytes = togo((*C.PyObject)(unsafe.Pointer(&C.PyBytes_Type)))
//PyBytes_Check : https://docs.python.org/3/c-api/bytes.html#c.PyBytes_Check
func PyBytes_Check(o *PyObject) bool {

View File

@ -10,12 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Complex : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Type
var Complex = togo(C._go_PyComplex_Type)
var Complex = togo((*C.PyObject)(unsafe.Pointer(&C.PyComplex_Type)))
//PyComplex_Check : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Check
func PyComplex_Check(p *PyObject) bool {

View File

@ -10,7 +10,6 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import (
@ -18,7 +17,7 @@ import (
)
//Dict : https://docs.python.org/3/c-api/dict.html#c.PyDict_Type
var Dict = togo(C._go_PyDict_Type)
var Dict = togo((*C.PyObject)(unsafe.Pointer(&C.PyDict_Type)))
//PyDict_Check : https://docs.python.org/3/c-api/dict.html#c.PyDict_Check
func PyDict_Check(p *PyObject) bool {

View File

@ -10,12 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Float : https://docs.python.org/3/c-api/float.html#c.PyFloat_Type
var Float = togo(C._go_PyFloat_Type)
var Float = togo((*C.PyObject)(unsafe.Pointer(&C.PyFloat_Type)))
//PyFloat_Check : https://docs.python.org/3/c-api/float.html#c.PyFloat_Check
func PyFloat_Check(p *PyObject) bool {

View File

@ -10,7 +10,6 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import (
@ -18,7 +17,7 @@ import (
)
//Long : https://docs.python.org/3/c-api/long.html#c.PyLong_Type
var Long = togo(C._go_PyLong_Type)
var Long = togo((*C.PyObject)(unsafe.Pointer(&C.PyLong_Type)))
//PyLong_Check : https://docs.python.org/3/c-api/long.html#c.PyLong_Check
func PyLong_Check(p *PyObject) bool {

View File

@ -10,12 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//List : https://docs.python.org/3/c-api/list.html#c.PyList_Type
var List = togo(C._go_PyList_Type)
var List = togo((*C.PyObject)(unsafe.Pointer(&C.PyList_Type)))
//PyList_Check : https://docs.python.org/3/c-api/list.html#c.PyList_Check
func PyList_Check(p *PyObject) bool {

View File

@ -10,13 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Module : https://docs.python.org/3/c-api/module.html#c.PyModule_Type
var Module = togo(C._go_PyModule_Type)
var Module = togo((*C.PyObject)(unsafe.Pointer(&C.PyModule_Type)))
//PyModule_Check : https://docs.python.org/3/c-api/module.html#c.PyModule_Check
func PyModule_Check(p *PyObject) bool {

View File

@ -10,12 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Tuple : https://docs.python.org/3/c-api/tuple.html#c.PyTuple_Type
var Tuple = togo(C._go_PyTuple_Type)
var Tuple = togo((*C.PyObject)(unsafe.Pointer(&C.PyTuple_Type)))
//PyTuple_Check : https://docs.python.org/3/c-api/tuple.html#c.PyTuple_Check
func PyTuple_Check(p *PyObject) bool {

24
type.c
View File

@ -1,24 +0,0 @@
/*
Unless explicitly stated otherwise all files in this repository are licensed
under the $license_for_repo License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2018 Datadog, Inc.
*/
#include "type.h"
PyObject *_go_PyType_Type = (PyObject *)&PyType_Type;
PyObject *_go_PyLong_Type = (PyObject *)&PyLong_Type;
PyObject *_go_PyBool_Type = (PyObject *)&PyBool_Type;
PyObject *_go_PyFloat_Type = (PyObject *)&PyFloat_Type;
PyObject *_go_PyComplex_Type = (PyObject *)&PyComplex_Type;
PyObject *_go_PyBytes_Type = (PyObject *)&PyBytes_Type;
PyObject *_go_PyByteArray_Type = (PyObject *)&PyByteArray_Type;
PyObject *_go_PyUnicode_Type = (PyObject *)&PyUnicode_Type;
PyObject *_go_PyTuple_Type = (PyObject *)&PyTuple_Type;
PyObject *_go_PyList_Type = (PyObject *)&PyList_Type;
PyObject *_go_PyDict_Type = (PyObject *)&PyDict_Type;
PyObject *_go_PyModule_Type = (PyObject *)&PyModule_Type;

View File

@ -10,12 +10,12 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import "unsafe"
//Type : https://docs.python.org/3/c-api/type.html#c.PyType_Type
var Type = togo(C._go_PyType_Type)
var Type = togo((*C.PyObject)(unsafe.Pointer(&C.PyType_Type)))
//PyType_Check : https://docs.python.org/3/c-api/type.html#c.PyType_Check
func PyType_Check(o *PyObject) bool {

29
type.h
View File

@ -1,29 +0,0 @@
/*
Unless explicitly stated otherwise all files in this repository are licensed
under the $license_for_repo License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2018 Datadog, Inc.
*/
#ifndef TYPE_H
#define TYPE_H
#include "Python.h"
extern PyObject *_go_PyType_Type;
extern PyObject *_go_PyLong_Type;
extern PyObject *_go_PyBool_Type;
extern PyObject *_go_PyFloat_Type;
extern PyObject *_go_PyComplex_Type;
extern PyObject *_go_PyBytes_Type;
extern PyObject *_go_PyByteArray_Type;
extern PyObject *_go_PyUnicode_Type;
extern PyObject *_go_PyTuple_Type;
extern PyObject *_go_PyList_Type;
extern PyObject *_go_PyDict_Type;
extern PyObject *_go_PyModule_Type;
#endif

View File

@ -10,7 +10,6 @@ package python3
/*
#include "Python.h"
#include "macro.h"
#include "type.h"
*/
import "C"
import (
@ -18,7 +17,7 @@ import (
)
//Unicode : https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_Type
var Unicode = togo(C._go_PyUnicode_Type)
var Unicode = togo((*C.PyObject)(unsafe.Pointer(&C.PyUnicode_Type)))
//PyUnicode_Check : https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_Check
func PyUnicode_Check(o *PyObject) bool {