Skip to content

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

Closed

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

Activity

  1. added a commit that references this issue on Dec 17, 2025
  2. added a commit that references this issue on Jan 8, 2026
  3. added a commit that references this issue on Jan 12, 2026
  4. added a commit that references this issue on Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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