Skip to content

Commit

Permalink
Merge pull request #214 from gigony/fix_segfault_py39
Browse files Browse the repository at this point in the history
Implicit conversion from `uint_32_t` to `py::int_` causes segmentation fault from Python 3.9+.

This patch fixes the issue by using the proper type.

Fixes #213

Signed-off-by: Gigon Bae <[email protected]>

Authors:
   - Gigon Bae (https://github.com/gigony)

Approvers:
   - Jordan Jacobelli (https://github.com/Ethyling)
   - https://github.com/jakirkham
  • Loading branch information
jjacobelli authored Feb 1, 2022
2 parents 292c963 + c73c643 commit 9d70348
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/pybind11/cache/cache_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void py_image_cache_reserve(ImageCache& cache, uint32_t memory_capacity, py::kwa
cache.reserve(config);
}

py::int_ py_preferred_memory_capacity(const py::object& img,
uint32_t py_preferred_memory_capacity(const py::object& img,
const std::optional<const std::vector<uint64_t>>& image_size,
const std::optional<const std::vector<uint32_t>>& tile_size,
const std::optional<const std::vector<uint32_t>>& patch_size,
Expand Down
2 changes: 1 addition & 1 deletion python/pybind11/cache/cache_py.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ py::dict py_config(ImageCache& cache);

void py_image_cache_reserve(ImageCache& cache, uint32_t memory_capacity, py::kwargs kwargs);

py::int_ py_preferred_memory_capacity(const py::object& img,
uint32_t py_preferred_memory_capacity(const py::object& img,
const std::optional<const std::vector<uint64_t>>& image_size,
const std::optional<const std::vector<uint32_t>>& tile_size,
const std::optional<const std::vector<uint32_t>>& patch_size,
Expand Down

0 comments on commit 9d70348

Please sign in to comment.