pybind / pybind/pybind11

[BUG]: KeysView/ItemsView does not support set operations

Open
#5,876 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Required prerequisites
What version (or hash if on master) of pybind11 are you using?

master

Problem description

When calling .items()/.keys() on the result of bind_map<>() return a custom KeysView/ItemsView which don't implement set operations. Ref. Looking at the history there seems to be a lot of issues/pull requests around them. I assume there is some history about why they don't use collections.abc.KeysView/collections.abc.ItemsView type at runtime and have a custom implementation.

Reproducible example code

No set operations exist. See https://github.com/pybind/pybind11/pull/5877 for an example of 1.

Is this a regression? Put the last known working version here if it is.

Not a regression

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 with the bind_map<> result and the custom KeysView/ItemsView behavior described in the issue, then review the example in pull request #5877. Compare the available operations with Python's collections.abc KeysView and ItemsView expectations; done means the reported set operations work for these views without regressing existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.