Skip to content

Conversation

@Carreau
Copy link
Contributor

@Carreau Carreau commented Nov 11, 2025

As discussed in gh-141183, the test suite did not
test that PySet_Contains does not convert unhashable key into a frozenset.

This commit adds a regression test for this
behavior, to ensure that any behavior change is
caught by the test suite.

--

I'm not sure opening a GitHub issue, or having a blurb is necessary as this only adds a test.

Here is the link to the comment where @kumaraditya303 suggested for me to send a test as a separate PR.

@python-cla-bot
Copy link

python-cla-bot bot commented Nov 11, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

As discussed in pythongh-141183, the test suite did not
test that PySet_Contains does not convert unhashable key
into a frozenset.

This commit adds a regression test for this
behavior, to ensure that any behavior change is
caught by the test suite.
static PyObject *
test_set_contains_does_not_convert_unhashable_key(PyObject *self, PyObject *Py_UNUSED(obj))
{
// The documentation of PySet_Contains state:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just add a link to docs, the code is self-explanatory of the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants