Code Cleanup: line length and use Py_ssize_t for PyC_AsArray utility function.

This commit is contained in:
2012-02-05 02:04:26 +00:00
parent 5c395b69f5
commit 4acab3eb33
4 changed files with 37 additions and 16 deletions
@@ -112,7 +112,9 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
return NULL;
if (WM_operatortype_find(opname, TRUE) == NULL) {
PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid operator id", opname);
PyErr_Format(PyExc_ValueError,
"Macro Define: '%s' is not a valid operator id",
opname);
return NULL;
}
@@ -123,7 +125,9 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
ot = WM_operatortype_find(macroname, TRUE);
if (!ot) {
PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid macro or hasn't been registered yet", macroname);
PyErr_Format(PyExc_ValueError,
"Macro Define: '%s' is not a valid macro or hasn't been registered yet",
macroname);
return NULL;
}
+19 -7
View File
@@ -2571,7 +2571,8 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
return NULL;
}
else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
/* note, no significant advantage with optimizing [:] slice as with collections but include here for consistency with collection slice func */
/* note, no significant advantage with optimizing [:] slice as with collections
* but include here for consistency with collection slice func */
Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self);
return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
}
@@ -2834,7 +2835,8 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
const char *keyname = _PyUnicode_AsString(key);
if (keyname == NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string or a typle of strings");
PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.__contains__: expected a string or a typle of strings");
return -1;
}
@@ -5102,7 +5104,14 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
// if (PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
/*
if (PyList_GET_SIZE(string_free_ls)) {
printf("%.200s.%.200s(): has %d strings\n",
RNA_struct_identifier(self_ptr->type),
RNA_function_identifier(self_func),
(int)PyList_GET_SIZE(string_free_ls));
}
*/
Py_DECREF(string_free_ls);
#undef DEBUG_STRING_FREE
#endif
@@ -5126,7 +5135,10 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
PyTypeObject pyrna_struct_meta_idprop_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_struct_meta_idprop", /* tp_name */
sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's
/* NOTE! would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's */
sizeof(PyHeapTypeObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
NULL, /* tp_dealloc */
@@ -5380,16 +5392,16 @@ PyTypeObject pyrna_prop_Type = {
PyTypeObject pyrna_prop_array_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_array", /* tp_name */
"bpy_prop_array", /* tp_name */
sizeof(BPy_PropertyArrayRNA), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_itemsize */
/* methods */
(destructor)pyrna_prop_array_dealloc, /* tp_dealloc */
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
NULL,/* subclassed */ /* tp_repr */
NULL,/* subclassed */ /* tp_repr */
/* Method suites for standard classes */