python string conversion
- use _PyUnicode_AsStringAndSize where possible - use %R for PyErr_Format(...) rather then running repr on the object explicitly - use const char
This commit is contained in:
@@ -380,7 +380,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
PointerRNA ptr;
|
||||
char *opname= _PyUnicode_AsString(value);
|
||||
const char *opname= _PyUnicode_AsString(value);
|
||||
BPy_StructRNA *pyrna= NULL;
|
||||
|
||||
if (opname==NULL) {
|
||||
@@ -413,7 +413,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
|
||||
wmOperatorType *ot;
|
||||
wmOperator *op;
|
||||
PointerRNA ptr;
|
||||
char *opname= _PyUnicode_AsString(value);
|
||||
const char *opname= _PyUnicode_AsString(value);
|
||||
BPy_StructRNA *pyrna= NULL;
|
||||
|
||||
if (opname==NULL) {
|
||||
|
@@ -1211,7 +1211,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
|
||||
if (!srna) {
|
||||
if (PyErr_Occurred()) {
|
||||
PyObject *msg= PyC_ExceptionBuffer();
|
||||
char *msg_char= _PyUnicode_AsString(msg);
|
||||
const char *msg_char= _PyUnicode_AsString(msg);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s expected an RNA type derived from PropertyGroup, failed with: %s",
|
||||
error_prefix, msg_char);
|
||||
|
Reference in New Issue
Block a user