Skip to content

Commit

Permalink
Merge branch 'implicit-narrowing' into 'master'
Browse files Browse the repository at this point in the history
Avoid assert due to implicit narrowing cast on 32 bit architectures

See merge request hepmc/HepMC3!358
  • Loading branch information
Andrii Verbytskyi committed Jun 19, 2024
2 parents 7f0f39c + c1aeded commit 578f28e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/src/pystreambuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ class streambuf : public std::basic_streambuf<char>
}
farthest_pptr = (std::max)(farthest_pptr, pptr());
off_type n_written = (off_type)(farthest_pptr - pbase());
py::bytes chunk(pbase(), n_written);
py::ssize_t py_n_written = (py::ssize_t)n_written;
py::bytes chunk(pbase(), py_n_written);
py_write(chunk);
if (!traits_type::eq_int_type(c, traits_type::eof())) {
char cs = traits_type::to_char_type(c);
Expand Down Expand Up @@ -587,4 +588,4 @@ namespace pybind11 { namespace detail {
};
}} // namespace pybind11::detail

#endif
#endif

0 comments on commit 578f28e

Please sign in to comment.