Skip to content

Commit

Permalink
updated pybind dependency, a bit more monkeying with cmake and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilger26 committed Jan 16, 2025
1 parent b854600 commit 7b00e35
Show file tree
Hide file tree
Showing 31 changed files with 2,702 additions and 880 deletions.
2 changes: 1 addition & 1 deletion .github/actions/BuildTestInstall/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:
working-directory: ${{github.workspace}}/test/pytest
run: pytest

- name: gtest
- name: ctest
shell: ${{inputs.shell}}
working-directory: ${{github.workspace}}/build
run: ctest
Expand Down
11 changes: 11 additions & 0 deletions test/pytest/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ find_package(Python 3.11 REQUIRED
Development.Module
)

if(UNIX)
execute_process(
COMMAND
python3-config --ldflags
OUTPUT_VARIABLE
PYTHON_LD_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

target_link_libraries(${TARGET_NAME} PRIVATE
Python::Module
${PYTHON_LD_FLAGS}
${ALL_INTERFACE_TARGET}
)

Expand Down
28 changes: 14 additions & 14 deletions test/pytest/src/pybind11/pybind11/buffer_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@ struct buffer_info {
template <typename T>
buffer_info(const T *ptr, ssize_t size, bool readonly = true)
: buffer_info(
const_cast<T *>(ptr), sizeof(T), format_descriptor<T>::format(), size, readonly) {}
const_cast<T *>(ptr), sizeof(T), format_descriptor<T>::format(), size, readonly) {}

explicit buffer_info(Py_buffer *view, bool ownview = true)
: buffer_info(
view->buf,
view->itemsize,
view->format,
view->ndim,
{view->shape, view->shape + view->ndim},
/* Though buffer::request() requests PyBUF_STRIDES, ctypes objects
* ignore this flag and return a view with NULL strides.
* When strides are NULL, build them manually. */
view->strides
? std::vector<ssize_t>(view->strides, view->strides + view->ndim)
: detail::c_strides({view->shape, view->shape + view->ndim}, view->itemsize),
(view->readonly != 0)) {
view->buf,
view->itemsize,
view->format,
view->ndim,
{view->shape, view->shape + view->ndim},
/* Though buffer::request() requests PyBUF_STRIDES, ctypes objects
* ignore this flag and return a view with NULL strides.
* When strides are NULL, build them manually. */
view->strides
? std::vector<ssize_t>(view->strides, view->strides + view->ndim)
: detail::c_strides({view->shape, view->shape + view->ndim}, view->itemsize),
(view->readonly != 0)) {
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
this->m_view = view;
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
Expand Down Expand Up @@ -176,7 +176,7 @@ struct buffer_info {
detail::any_container<ssize_t> &&strides_in,
bool readonly)
: buffer_info(
ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in), readonly) {}
ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in), readonly) {}

Py_buffer *m_view = nullptr;
bool ownview = false;
Expand Down
Loading

0 comments on commit 7b00e35

Please sign in to comment.