pybind11 icon indicating copy to clipboard operation
pybind11 copied to clipboard

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

Open InvincibleRMC opened this issue 2 months ago • 0 comments

Required prerequisites

  • [x] Make sure you've read the documentation. Your issue may be addressed there.
  • [x] Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
  • [x] Consider asking first in the Gitter chat room or in a Discussion.

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

InvincibleRMC avatar Oct 21 '25 19:10 InvincibleRMC