1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-28 23:03:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-12-02 15:22:25 +03:00
56 changed files with 1639 additions and 876 deletions
+12 -6
View File
@@ -714,28 +714,29 @@ bool pyopencv_to(PyObject* obj, String &value, const ArgInfo& info)
std::string str;
#if ((PY_VERSION_HEX >= 0x03060000) && !defined(Py_LIMITED_API)) || (Py_LIMITED_API >= 0x03060000)
PyObject* path_obj = NULL;
if (info.pathlike)
{
obj = PyOS_FSPath(obj);
path_obj = PyOS_FSPath(obj);
if (PyErr_Occurred())
{
failmsg("Expected '%s' to be a str or path-like object", info.name);
return false;
}
obj = path_obj;
}
#endif
bool result = false;
if (getUnicodeString(obj, str))
{
value = str;
return true;
result = true;
}
else
{
// If error hasn't been already set by Python conversion functions
if (!PyErr_Occurred())
{
// Direct access to underlying slots of PyObjectType is not allowed
// when limited API is enabled
#ifdef Py_LIMITED_API
failmsg("Can't convert object to 'str' for '%s'", info.name);
#else
@@ -744,7 +745,12 @@ bool pyopencv_to(PyObject* obj, String &value, const ArgInfo& info)
#endif
}
}
return false;
#if ((PY_VERSION_HEX >= 0x03060000) && !defined(Py_LIMITED_API)) || (Py_LIMITED_API >= 0x03060000)
Py_XDECREF(path_obj);
#endif
return result;
}
template<>