Skip to content

[3.15] gh-154902: Type-check the SET_ADD operand - #155071

Merged
hugovk merged 3 commits into
python:3.15from
deadlovelll:gh-154902-rebind-check
Aug 4, 2026
Merged

[3.15] gh-154902: Type-check the SET_ADD operand#155071
hugovk merged 3 commits into
python:3.15from
deadlovelll:gh-154902-rebind-check

Conversation

@deadlovelll

@deadlovelll deadlovelll commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Type-check the SET_ADD operand

This is an alternative version of fix for #154902, but dedicated to 3.15 and 3.14 only, because we cant change bytecode here

@deadlovelll deadlovelll changed the title gh-154902: Type-check the SET_ADD operand [3.15] gh-154902: Type-check the SET_ADD operand Aug 2, 2026
@deadlovelll

Copy link
Copy Markdown
Contributor Author

Looked at the checks, I think these are flakes. Could someone with the rights rerun the failed jobs?

Comment thread Python/bytecodes.c Outdated
// gh-154902: user code can rebind __conditional_annotations__
if (!PySet_Check(set_o)) {
_PyErr_Format(tstate, PyExc_TypeError,
"__conditional_annotations__ must be a set, not %T",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Error message shouldn't mention __conditional_annotations__ as this is a generic opcode (though probably the only way this is reachable is through __conditional_annotations__).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed

Comment thread Python/bytecodes.c Outdated
int err = _PySet_AddTakeRef((PySetObject *)PyStackRef_AsPyObjectBorrow(set),
PyObject *set_o = PyStackRef_AsPyObjectBorrow(set);
// gh-154902: user code can rebind __conditional_annotations__
if (!PySet_Check(set_o)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thoughts on whether this should be CheckExact?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

missed that it applies here too , changed to CheckExact

@hugovk
hugovk merged commit 398dbef into python:3.15 Aug 4, 2026
116 of 119 checks passed
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 CentOS9 NoGIL Refleaks 3.15 (tier-1) has failed when building commit 398dbef.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/2078/builds/383) and take a look at the build logs.
  4. Check if the failure is related to this commit (398dbef) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/2078/builds/383

Failed tests:

  • test_lazy_import

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.15.itamaro-centos-aws.refleak.nogil/build/Lib/test/test_lazy_import/__init__.py", line 1828, in test_concurrent_lazy_import_reification
    self.assertEqual(errors, [], f"Errors occurred: {errors}")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Lists differ: [(3, AttributeError("module 'test.test_laz[39 chars]'"))] != []


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.15.itamaro-centos-aws.refleak.nogil/build/Lib/test/test_lazy_import/__init__.py", line 1828, in test_concurrent_lazy_import_reification
    self.assertEqual(errors, [], f"Errors occurred: {errors}")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Lists differ: [(0, AttributeError("module 'test.test_laz[39 chars]'"))] != []

@hugovk

hugovk commented Aug 4, 2026

Copy link
Copy Markdown
Member

@deadlovelll

Copy link
Copy Markdown
Contributor Author

I think that is an unrelated failure, looks like:

Yeah, not related to this pr

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants