Skip to content

The cases_generator handles some instructions incorrectly #106250

Closed
@brandtbucher

Description

@brandtbucher

I triggered this assert...

Traceback (most recent call last):
  File "/home/brandtbucher/cpython/./Tools/cases_generator/generate_cases.py", line 1609, in <module>
    main()
  File "/home/brandtbucher/cpython/./Tools/cases_generator/generate_cases.py", line 1604, in main
    a.write_metadata()
  File "/home/brandtbucher/cpython/./Tools/cases_generator/generate_cases.py", line 1260, in write_metadata
    assert not instr.active_caches, (instr.name, instr.cache_effects)
AssertionError: ('TO_BOOL_ALWAYS_TRUE', [CacheEffect(context=<Python/bytecodes.c: 1807-1810>, name='unused', size=1), CacheEffect(context=<Python/bytecodes.c: 1811-1814>, name='version', size=2)]

...while defining this new instruction...

        inst(TO_BOOL_ALWAYS_TRUE, (unused/1, version/2, value -- res)) {
            // This one is a bit weird, because we expect *some* failures:
            assert(version);
            DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL);
            STAT_INC(TO_BOOL, hit);
            DECREF_INPUTS();
            res = Py_True;
        }

@gvanrossum thinks that the assert is incorrect: it appears that the current code doesn't know how to handle an instruction that uses caches but doesn't have an oparg.

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions