Skip to content

Interpreter uses DK_IS_UNICODE where it should use dk_kind == DICT_KEYS_UNICODE #142908

@colesbury

Description

@colesbury

We are unintentionally specializing LOAD_GLOBAL for globals and module dictionaries that have "split" keys (i.e., keys from a class instance's __dict__).

For example:

cpython/Python/specialize.c

Lines 1283 to 1286 in 6e625f8

if (!DK_IS_UNICODE(globals_keys)) {
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_LOAD_GLOBAL_NON_STRING_OR_SPLIT);
goto fail;
}

This doesn't actually affect the behavior, because split keys have NULL me_value entries and we de-opt in that case:

cpython/Python/bytecodes.c

Lines 1816 to 1817 in 6e625f8

PyObject *res_o = FT_ATOMIC_LOAD_PTR_RELAXED(entries[index].me_value);
DEOPT_IF(res_o == NULL);

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions