Remove the treacherous NDEBUG markers
This commit is contained in:
parent
203205849e
commit
99ef646132
|
|
@ -36,14 +36,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint2),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it != 'x' && *it != 'y') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3);
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint3),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ")";
|
||||
|
|
@ -38,14 +38,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint3),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'x' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4);
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint4),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ", "
|
||||
|
|
@ -40,14 +40,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint4),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'w' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
if (attr_name[0] == 'w') {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ __reduce__, PyObject *self) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *result = Py_BuildValue("(O(ff))", this_class,
|
||||
PyObject *result = Py_BuildValue("(O(ff))", this_class,
|
||||
(*this)[0], (*this)[1]);
|
||||
Py_DECREF(this_class);
|
||||
return result;
|
||||
|
|
@ -70,14 +70,12 @@ __reduce__, PyObject *self) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase2),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it != 'x' && *it != 'y') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
@ -118,14 +116,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// Whoosh.
|
||||
PyObject* fast = PySequence_Fast(assign, "");
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
|
|
@ -167,7 +165,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// and assign the floating-point value to every one of them.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
this->_v.data[(*it) - 'x'] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ __setitem__, int i, FLOATTYPE v) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase3),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ")";
|
||||
|
|
@ -59,7 +59,7 @@ __reduce__, PyObject *self) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *result = Py_BuildValue("(O(fff))", this_class,
|
||||
PyObject *result = Py_BuildValue("(O(fff))", this_class,
|
||||
(*this)[0], (*this)[1], (*this)[2]);
|
||||
Py_DECREF(this_class);
|
||||
return result;
|
||||
|
|
@ -72,14 +72,12 @@ __reduce__, PyObject *self) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase3),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'x' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
@ -123,14 +121,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// Whoosh.
|
||||
PyObject* fast = PySequence_Fast(assign, "");
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
|
|
@ -172,7 +170,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// and assign the floating-point value to every one of them.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
this->_v.data[(*it) - 'x'] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ __setitem__, int i, FLOATTYPE v) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase4),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ", "
|
||||
|
|
@ -61,7 +61,7 @@ __reduce__, PyObject *self) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *result = Py_BuildValue("(O(ffff))", this_class,
|
||||
PyObject *result = Py_BuildValue("(O(ffff))", this_class,
|
||||
(*this)[0], (*this)[1], (*this)[2], (*this)[3]);
|
||||
Py_DECREF(this_class);
|
||||
return result;
|
||||
|
|
@ -74,14 +74,12 @@ __reduce__, PyObject *self) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase4),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'w' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
if (attr_name[0] == 'w') {
|
||||
|
|
@ -137,14 +135,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// Whoosh.
|
||||
PyObject* fast = PySequence_Fast(assign, "");
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
|
|
@ -186,7 +184,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
|||
// and assign the floating-point value to every one of them.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
this->_v.data[((*it) == 'w') ? 3 : (*it) - 'x'] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2);
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector2),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ")";
|
||||
}
|
||||
|
|
@ -36,14 +36,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector2),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it != 'x' && *it != 'y') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3);
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector3),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ")";
|
||||
|
|
@ -38,14 +38,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector3),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'x' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4);
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector4),
|
||||
python_repr, ostream &out, const string &class_name) {
|
||||
out << class_name << "("
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(this->_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(this->_v.v._2) << ", "
|
||||
|
|
@ -40,14 +40,12 @@ python_repr, ostream &out, const string &class_name) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector4),
|
||||
__getattr__, const string &attr_name) {
|
||||
#ifndef NDEBUG
|
||||
// Validate the attribute name.
|
||||
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
|
||||
if (*it < 'w' || *it > 'z') {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr_name.size() == 1) {
|
||||
if (attr_name[0] == 'w') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue