Base: C++ core guidelines: init variables

This commit is contained in:
wmayer
2023-08-24 14:21:05 +02:00
committed by wwmayer
parent 53a4fb14c3
commit 010dca8303
43 changed files with 622 additions and 626 deletions

View File

@@ -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) {