pybind / pybind/pybind11

buffer protocol, format_descriptor for long long missing?

Open
#1,424 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

buffer = np.array([1,2,3], dtype='int64')

this buffer array is diagnosed by the following code as having format == "l", but the format_descriptor<long long>::format() == q, what's wrong with my implementation then?

// inside pybind c++ function
    auto info = buffer.request();
    if (info.format != py::format_descriptor<long long>::format()) {
      std::cerr << "buffer format is not correct, do nothing, "
          << info.format << " vs " << py::format_descriptor<long long>::format();
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported comparison in the shown pybind C++ function using a NumPy int64 buffer, then inspect how buffer.request() and format_descriptor::format() produce their format strings. Done means the mismatch is explained and the expected behavior or required change is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.