Skip to content

Commit 239eef5

Browse files
authored
[Py OV] Fix export_model() fails Unable to cast Python instance of type <class 'int'> to C++ type 'int' (#30468)
### Details: - `OutPyStream.seekoff` calls `io.BytesIO.seek()` method which return type is python's `int`. In Python3 `int` type can expand to the limit of the available memory. Error occurs when casting numbers bigger than 2^32-1 to C++'s int which is 16-bit or 32-bit. Solution: cast seek() return value to `long long int` which is at least 64-bit. ### Tickets: - [CVS-165443](https://jira.devtools.intel.com/browse/CVS-165443) --------- Signed-off-by: Alicja Miloszewska <alicja.miloszewska@intel.com>
1 parent dd840df commit 239eef5

File tree

1 file changed

+1
-1
lines changed
  • src/bindings/python/src/pyopenvino/utils

1 file changed

+1
-1
lines changed

src/bindings/python/src/pyopenvino/utils/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class OutPyBuffer : public std::streambuf {
6666
if (python_direction == -1) {
6767
return pos_type(off_type(-1));
6868
}
69-
const auto abs_pos = m_py_stream.attr("seek")(off, python_direction).cast<int>();
69+
const auto abs_pos = m_py_stream.attr("seek")(off, python_direction).cast<int64_t>();
7070
return pos_type(abs_pos);
7171
}
7272

0 commit comments

Comments
 (0)