2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 17:12:22 +00:00

Add from/to_python for signed char and unsigned char

[SVN r8130]
This commit is contained in:
Dave Abrahams
2000-11-04 09:28:46 +00:00
parent 8fdc849980
commit 7a3a0229d5
2 changed files with 38 additions and 0 deletions

20
py.cpp
View File

@@ -170,6 +170,26 @@ unsigned short from_python(PyObject* p, py::Type<unsigned short> type)
return integer_from_python(p, type);
}
PyObject* to_python(unsigned char i)
{
return integer_to_python(i);
}
unsigned char from_python(PyObject* p, py::Type<unsigned char> type)
{
return integer_from_python(p, type);
}
PyObject* to_python(signed char i)
{
return integer_to_python(i);
}
signed char from_python(PyObject* p, py::Type<signed char> type)
{
return integer_from_python(p, type);
}
PyObject* to_python(unsigned long x)
{
return integer_to_python(x);

18
py.h
View File

@@ -73,6 +73,14 @@ PyObject* to_python(unsigned short);
unsigned short from_python(PyObject*, py::Type<unsigned short>);
unsigned short from_python(PyObject*, py::Type<const unsigned short&>);
PyObject* to_python(signed char);
signed char from_python(PyObject*, py::Type<signed char>);
signed char from_python(PyObject*, py::Type<const signed char&>);
PyObject* to_python(unsigned char);
unsigned char from_python(PyObject*, py::Type<unsigned char>);
unsigned char from_python(PyObject*, py::Type<const unsigned char&>);
PyObject* to_python(float);
float from_python(PyObject*, py::Type<float>);
float from_python(PyObject*, py::Type<const float&>);
@@ -269,6 +277,16 @@ inline unsigned short from_python(PyObject* p, py::Type<const unsigned short&>)
return from_python(p, py::Type<unsigned short>());
}
inline signed char from_python(PyObject* p, py::Type<const signed char&>)
{
return from_python(p, py::Type<signed char>());
}
inline unsigned char from_python(PyObject* p, py::Type<const unsigned char&>)
{
return from_python(p, py::Type<unsigned char>());
}
inline unsigned long from_python(PyObject* p, py::Type<const unsigned long&>)
{
return from_python(p, py::Type<unsigned long>());