version 1.118 | version 1.119 | ||
---|---|---|---|
|
| ||
#include <Python.h> | #include <Python.h> | ||
static Tcl_Obj* python_tcl_convert(PyObject *obj) { | static Tcl_Obj* python_tcl_convert(PyObject *obj) { | ||
if ( PyInt_Check(obj) ) { | |||
return Tcl_NewLongObj(PyInt_AsLong(obj)); | |||
} | |||
if ( PyFloat_Check(obj) ) { | |||
return Tcl_NewDoubleObj(PyFloat_AsDouble(obj)); | |||
} | |||
if ( PyString_Check(obj) ) { | if ( PyString_Check(obj) ) { | ||
return Tcl_NewStringObj(PyString_AsString(obj), -1); | return Tcl_NewStringObj(PyString_AsString(obj), -1); | ||
} | } |
Legend:
|