mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
changed for incrementer
This commit is contained in:
parent
0a69536643
commit
1847075287
@ -685,13 +685,10 @@ pack_object(PyObject *object) {
|
|||||||
|
|
||||||
if (PyInt_Check(object)) {
|
if (PyInt_Check(object)) {
|
||||||
pack_int(PyInt_AS_LONG(object));
|
pack_int(PyInt_AS_LONG(object));
|
||||||
|
|
||||||
} else if (PyFloat_Check(object)) {
|
} else if (PyFloat_Check(object)) {
|
||||||
pack_double(PyFloat_AS_DOUBLE(object));
|
pack_double(PyFloat_AS_DOUBLE(object));
|
||||||
|
|
||||||
} else if (PyLong_Check(object)) {
|
} else if (PyLong_Check(object)) {
|
||||||
pack_int64(PyLong_AsLongLong(object));
|
pack_int64(PyLong_AsLongLong(object));
|
||||||
|
|
||||||
} else if (PyString_Check(object) || PyUnicode_Check(object)) {
|
} else if (PyString_Check(object) || PyUnicode_Check(object)) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int length;
|
int length;
|
||||||
@ -699,9 +696,7 @@ pack_object(PyObject *object) {
|
|||||||
if (buffer) {
|
if (buffer) {
|
||||||
pack_string(string(buffer, length));
|
pack_string(string(buffer, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// For some reason, PySequence_Check() is incorrectly reporting
|
// For some reason, PySequence_Check() is incorrectly reporting
|
||||||
// that a class instance is a sequence, even if it doesn't provide
|
// that a class instance is a sequence, even if it doesn't provide
|
||||||
// __len__, so we double-check by testing for __len__ explicitly.
|
// __len__, so we double-check by testing for __len__ explicitly.
|
||||||
@ -747,13 +742,12 @@ pack_object(PyObject *object) {
|
|||||||
// class object, or it is not a sequence--this is case (1) or
|
// class object, or it is not a sequence--this is case (1) or
|
||||||
// (3).
|
// (3).
|
||||||
pack_class_object(dclass, object);
|
pack_class_object(dclass, object);
|
||||||
|
|
||||||
} else if (is_sequence) {
|
} else if (is_sequence) {
|
||||||
// The supplied object is not an instance of the expected class
|
// The supplied object is not an instance of the expected class
|
||||||
// object, but it is a sequence. This is case (2).
|
// object, but it is a sequence. This is case (2).
|
||||||
push();
|
push();
|
||||||
int size = PySequence_Size(object);
|
int size = PySequence_Size(object);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; ++i) {
|
||||||
PyObject *element = PySequence_GetItem(object, i);
|
PyObject *element = PySequence_GetItem(object, i);
|
||||||
if (element != (PyObject *)NULL) {
|
if (element != (PyObject *)NULL) {
|
||||||
pack_object(element);
|
pack_object(element);
|
||||||
@ -763,7 +757,6 @@ pack_object(PyObject *object) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pop();
|
pop();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// The supplied object is not a sequence, and we weren't
|
// The supplied object is not a sequence, and we weren't
|
||||||
// expecting a class parameter. This is none of the above, an
|
// expecting a class parameter. This is none of the above, an
|
||||||
|
Loading…
x
Reference in New Issue
Block a user