cppcoreguidelines-pro-type-union-access

According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour.
 Replace it with std::memcpy
This commit is contained in:
wmayer
2022-06-24 14:29:50 +02:00
parent 393352387d
commit c955372ecf
12 changed files with 46 additions and 59 deletions

View File

@@ -513,8 +513,7 @@ void InterpreterSingleton::addType(PyTypeObject* Type,PyObject* Module, const ch
// This function is responsible for adding inherited slots from a type's base class.
if (PyType_Ready(Type) < 0)
return;
union PyType_Object pyType = {Type};
PyModule_AddObject(Module, Name, pyType.o);
PyModule_AddObject(Module, Name, Base::getTypeAsObject(Type));
}
void InterpreterSingleton::addPythonPath(const char* Path)