1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +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
@@ -5,5 +5,5 @@ import sys
if sys.version_info[:2] >= (3, 0):
def exec_file_wrapper(fpath, g_vars, l_vars):
with open(fpath) as f:
code = compile(f.read(), os.path.basename(fpath), 'exec')
code = compile(f.read(), fpath, 'exec')
exec(code, g_vars, l_vars)
+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<>
+1 -1
View File
@@ -81,7 +81,7 @@ class Hackathon244Tests(NewOpenCVTests):
mc, mr = cv.minEnclosingCircle(a)
be0 = ((150.2511749267578, 150.77322387695312), (158.024658203125, 197.57696533203125), 37.57804489135742)
br0 = ((161.2974090576172, 154.41793823242188), (207.7177734375, 199.2301483154297), 80.83544921875)
br0 = ((161.2974090576172, 154.41793823242188), (199.2301483154297, 207.7177734375), -9.164555549621582)
mc0, mr0 = (160.41790771484375, 144.55152893066406), 136.713500977
self.check_close_boxes(be, be0, 5, 15)