fix cppcoreguidelines-*

* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
This commit is contained in:
wmayer
2023-11-15 17:12:50 +01:00
parent 39337ea12e
commit 08b10cd287
38 changed files with 418 additions and 166 deletions

View File

@@ -96,8 +96,12 @@ public:
/// constructor does the whole job
PyException();
PyException(const Py::Object& obj);
PyException(const PyException&) = default;
PyException(PyException&&) = default;
~PyException() noexcept override;
PyException& operator=(const PyException&) = default;
PyException& operator=(PyException&&) = default;
void raiseException();
/// this method determines if the original exception
@@ -122,7 +126,7 @@ public:
/// Sets the Python error indicator and an error message
void setPyException() const override;
protected:
private:
std::string _stackTrace;
std::string _errorType;
PyObject* _exceptionType;
@@ -155,7 +159,11 @@ class BaseExport SystemExitException: public Exception
{
public:
SystemExitException();
SystemExitException(const SystemExitException&) = default;
SystemExitException(SystemExitException&&) = default;
~SystemExitException() noexcept override = default;
SystemExitException& operator=(const SystemExitException&) = default;
SystemExitException& operator=(SystemExitException&&) = default;
long getExitCode() const
{
return _exitCode;
@@ -177,13 +185,18 @@ class BaseExport PyGILStateLocker
public:
PyGILStateLocker()
{
gstate = PyGILState_Ensure();
gstate = PyGILState_Ensure(); // NOLINT
}
~PyGILStateLocker()
{
PyGILState_Release(gstate);
}
PyGILStateLocker(const PyGILStateLocker&) = delete;
PyGILStateLocker(PyGILStateLocker&&) = delete;
PyGILStateLocker& operator=(const PyGILStateLocker&) = delete;
PyGILStateLocker& operator=(PyGILStateLocker&&) = delete;
private:
PyGILState_STATE gstate;
};
@@ -203,7 +216,7 @@ public:
PyGILStateRelease()
{
// release the global interpreter lock
state = PyEval_SaveThread();
state = PyEval_SaveThread(); // NOLINT
}
~PyGILStateRelease()
{
@@ -211,6 +224,11 @@ public:
PyEval_RestoreThread(state);
}
PyGILStateRelease(const PyGILStateRelease&) = delete;
PyGILStateRelease(PyGILStateRelease&&) = delete;
PyGILStateRelease& operator=(const PyGILStateRelease&) = delete;
PyGILStateRelease& operator=(PyGILStateRelease&&) = delete;
private:
PyThreadState* state;
};
@@ -226,6 +244,11 @@ public:
InterpreterSingleton();
~InterpreterSingleton();
InterpreterSingleton(const InterpreterSingleton&) = delete;
InterpreterSingleton(InterpreterSingleton&&) = delete;
InterpreterSingleton& operator=(const InterpreterSingleton&) = delete;
InterpreterSingleton& operator=(InterpreterSingleton&&) = delete;
/** @name execution methods
*/
//@{