Base: C++ core guidelines: init variables
This commit is contained in:
@@ -282,7 +282,7 @@ PyMethodDef PyObjectBase::Methods[] = {
|
||||
|
||||
PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
{
|
||||
const char *attr;
|
||||
const char *attr{};
|
||||
attr = PyUnicode_AsUTF8(attro);
|
||||
|
||||
// For the __class__ attribute get it directly as with
|
||||
@@ -346,7 +346,7 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
|
||||
int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
|
||||
{
|
||||
const char *attr;
|
||||
const char *attr{};
|
||||
attr = PyUnicode_AsUTF8(attro);
|
||||
|
||||
//Hint: In general we don't allow to delete attributes (i.e. value=0). However, if we want to allow
|
||||
@@ -409,7 +409,7 @@ PyObject *PyObjectBase::_getattr(const char *attr)
|
||||
}
|
||||
else {
|
||||
// As fallback solution use Python's default method to get generic attributes
|
||||
PyObject *w, *res;
|
||||
PyObject *w{}, *res{};
|
||||
w = PyUnicode_InternFromString(attr);
|
||||
if (w) {
|
||||
res = PyObject_GenericGetAttr(this, w);
|
||||
@@ -428,7 +428,7 @@ int PyObjectBase::_setattr(const char *attr, PyObject *value)
|
||||
{
|
||||
if (streq(attr,"softspace"))
|
||||
return -1; // filter out softspace
|
||||
PyObject *w;
|
||||
PyObject *w{};
|
||||
// As fallback solution use Python's default method to get generic attributes
|
||||
w = PyUnicode_InternFromString(attr); // new reference
|
||||
if (w) {
|
||||
|
||||
Reference in New Issue
Block a user