-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <iostream>
#endif
+#if PY_VERSION_HEX < 0x03050000
+static char*
+Py_EncodeLocale(const wchar_t *arg, size_t *size)
+{
+ return _Py_wchar2char(arg, size);
+}
+static wchar_t*
+Py_DecodeLocale(const char *arg, size_t *size)
+{
+ return _Py_char2wchar(arg, size);
+}
+#endif
+
/**
* \class PyLockWrapper
* \brief Python GIL wrapper.
* Utility class wrapping the Python GIL acquisition. This makes use of the high level
* API (PyGILState_Ensure and PyGILState_Release), and is hence compatible with only
* one running Python interpreter (no call to Py_NewInterpreter()).
- * When the class is instanciated the lock is acquired. It is released at destruction time.
+ * When the class is instantiated the lock is acquired. It is released at destruction time.
* Copy construction (and hence assignation) is forbidden.
*/
class PYINTERP_EXPORT PyLockWrapper
~PyLockWrapper()
{
PyThreadState* _currState = PyGILState_GetThisThreadState();
+ (void)_currState;
#ifdef _DEBUG_
if (_currState != _state)
{
{
Py_XDECREF(myObject);
myObject = theObjWrapper->myObject;
+ Py_XINCREF(myObject);
+ return *this;
+ }
+ PyObjWrapper& operator=(const PyObjWrapper& theObjWrapper)
+ {
+ Py_XDECREF(myObject);
+ myObject = theObjWrapper.myObject;
+ Py_XINCREF(myObject);
return *this;
}
};