)]}'
{
  "commit": "9f1d7f58438c0361e56cc55549ea4ea71a1ee9b7",
  "tree": "1a07e990e576228cd3764ef7b99b5a87b6bd7221",
  "parents": [
    "481725b34080f5f5df175ceac0f4cb1fb544cfc8"
  ],
  "author": {
    "name": "Henry Schreiner",
    "email": "HenrySchreinerIII@gmail.com",
    "time": "Mon Nov 02 23:23:06 2026 -0500"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Nov 02 23:23:06 2026 -0500"
  },
  "message": "feat: create types with PyType_FromMetaclass on CPython 3.12+ (#6231)\n\n* feat: create types with PyType_FromMetaclass on CPython 3.12+\n\npybind11_static_property, the pybind11_type metaclass, pybind11_object\nand the classes from make_new_python_type() are now created from a\nPyType_Spec on CPython 3.12+ instead of by filling in PyHeapTypeObject\nfields. PYBIND11_TYPE_CREATION_VIA_SPEC (0/1) controls this; define it\nas 0, or configure with -DPYBIND11_TYPE_CREATION_VIA_SPEC\u003dOFF, to keep\nthe legacy path. PyPy, GraalPy and Python \u003c 3.12 keep the legacy path.\n\npy::custom_type_setup(), metaclasses with a custom tp_new, and metaclass\ncombinations that PyType_FromMetaclass() rejects (such as a base whose\nmetaclass is not related to pybind11_type) still use the legacy path. A\nuser-defined PYBIND11_BACKWARD_COMPATIBILITY_TP_DICTOFFSET also selects\nthe legacy path, so all bound classes share one __dict__ layout.\n\nThe instance layout and the internals ID do not change. The macro is\nencoded in the precompiled config check. A new CI job tests the legacy\npath on CPython 3.12+.\n\nSee https://github.com/pybind/pybind11/discussions/6104.\n\nAssisted-by: ClaudeCode:claude-opus-5-5\n\n* fix: preserve bound class names containing dots\n\n— codex GPT-6 on behalf of Ralf —\n\nUse the existing legacy type-creation fallback when a bound name contains\na dot. PyType_FromMetaclass() treats the last dot as the module separator,\ntruncating names such as Wrapper[pkg.Value].\n\nPreserve both the public __name__/__qualname__ and the fully qualified C\ntp_name. Assigning __name__ after creation would also overwrite tp_name.\n\nAdd top-level and nested regression cases; both fail without the fix.\n\n* Revert \"fix: preserve bound class names containing dots\"\n\n— codex GPT-6 on behalf of Ralf —\n\nRevert f9eda9d4d63782b7ac3d00ad9d6ea069e3509075 so the naming behavior\nintroduced by spec-based type creation can be characterized across CI.\nThe naming policy will be discussed separately after collecting results.\n\n* test: characterize supplied class-name spelling\n\n— codex GPT-6 on behalf of Ralf —\n\nRecord name, qualified name, literal lookup, construction, reference-return\nidentity and generated signatures for dotted and bracketed class names.\nInclude nested scopes, a child of a dotted class, and custom type setup.\n\nKeep expectations specific to the current creation path and Python runtime.\nThese tests collect evidence for the naming-policy discussion without\nchoosing whether to retain, reject or accommodate the changed behavior.\n\n* test: use boolean literals for type-creation config\n\n— codex GPT-6 on behalf of Ralf —\n\nSelect true/false with the preprocessor instead of casting the numeric\nconfiguration macro to bool. This satisfies modernize-use-bool-literals\nin Clang-Tidy, including the Python3.11 macro-zero branch.\n\n* fix: preserve supplied class names in the spec type-creation path\n\nPyType_FromMetaclass() splits the spec name at the last dot, so a class\nnamed \"a[b.c]\" got __name__ \"c]\". After creation, set ht_name,\nht_qualname, and tp_name the same way as the legacy path, through a\nhelper that both paths share. This matches type(), which never splits\ndots in a name. The characterization tests now assert the preserved\nnames on both paths.\n\nAssisted-by: ClaudeCode:claude-opus-5-5\n\n* fix: silence unused module_ parameter on PyPy\n\nAssisted-by: ClaudeCode:claude-fable-5-1\n\n* fix: set spec-path type names through the __name__/__qualname__ setters\n\nAfter PyType_FromMetaclass() the type is reachable through its bases\u0027\n__subclasses__(), so replacing ht_name/ht_qualname directly races with\nconcurrent readers on free-threaded builds (CPython\u0027s own setters use a\nstop-the-world pause for this, gh-133467). Go through the setters, and\nonly when the spec did not already produce the right strings. tp_name\nonly ever points at buffers that outlive the type, so that pointer swap\nstays direct. The legacy path keeps the direct writes: it runs before\nPyType_Ready(), when nothing else can see the type.\n\nAssisted-by: ClaudeCode:claude-fable-5-1\n\n* fix: initialize names without metaclass rename hooks\n\n— codex GPT-6 on behalf of Ralf —\n\nCall the builtin type name descriptors directly so metaclasses that reject\nlater renaming still work during class creation. Preserve the interpreter\u0027s\nsetter implementation and the existing conditional updates.\n\nCover dotted module names and ordinary nested names with a metaclass that\nrejects renaming. The regression fails before the fix and passes afterward\non default and free-threaded CPython 3.14.4. All-files pre-commit passes.\n\n* test: compare bound class names with Python type()\n\n— codex GPT-6 on behalf of Ralf —\n\nDerive naming expectations from independently created Python types,\nincluding reference parents for nested classes. Retain construction,\nidentity, lookup, signature, and custom-setup coverage.\n\nKeep raw C type spelling separate through the existing obj_class_name\nhelper. Apply known interpreter name xfails only after unaffected checks.\n\nValidation: full default/free-threaded suites pass (1416/1414 tests),\nplus 39 Catch2 cases and 11444 assertions each. Focused CPython 3.11,\n3.12, legacy, PyPy 3.11/3.12, and GraalPy checks pass with expected\nskips/xfails. A qualname mutation is XFAIL in the old test and FAIL in\nthe new test. All-files pre-commit passes.\n\n* test: return class_ objects as py::object in bind_with_metaclass\n\npy::make_tuple of a py::class_ needs handle_type_name, which the\nPYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION CI job turns off.\n\nAssisted-by: ClaudeCode:claude-fable-5-1\n\n---------\n\nCo-authored-by: Ralf W. Grosse-Kunstleve \u003crgrossekunst@nvidia.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "8ec69ad746eb63df2a37fb297659437cbf6c83aa",
      "old_mode": 33188,
      "old_path": ".github/workflows/ci.yml",
      "new_id": "fa74569a78968568b6f8d595cbd976f3e53f8416",
      "new_mode": 33188,
      "new_path": ".github/workflows/ci.yml"
    },
    {
      "type": "modify",
      "old_id": "46f0a1f11df06ff78d84dc393353bbbede68a605",
      "old_mode": 33188,
      "old_path": "CMakeLists.txt",
      "new_id": "77a19add9d810302d078b18966a8aaaa3f4f3cf9",
      "new_mode": 33188,
      "new_path": "CMakeLists.txt"
    },
    {
      "type": "modify",
      "old_id": "a81b16fead6fcc316e30e3ce803cbbbafb6e1b39",
      "old_mode": 33188,
      "old_path": "docs/compiling.rst",
      "new_id": "5169f5feab26c18128a4089d848c87dca0656ce0",
      "new_mode": 33188,
      "new_path": "docs/compiling.rst"
    },
    {
      "type": "modify",
      "old_id": "5cbaee50c338a942c44facae8b9570b3a48997de",
      "old_mode": 33188,
      "old_path": "include/pybind11/detail/class-inl.h",
      "new_id": "727ffaf8676eb666f21a643fbdd7d1c287b58b1a",
      "new_mode": 33188,
      "new_path": "include/pybind11/detail/class-inl.h"
    },
    {
      "type": "modify",
      "old_id": "8716223d685c5d8f5ecac9ff5aa17b2f30b61ec2",
      "old_mode": 33188,
      "old_path": "include/pybind11/detail/class.h",
      "new_id": "0492be064e88e2053f71a801b0a32aa901547f15",
      "new_mode": 33188,
      "new_path": "include/pybind11/detail/class.h"
    },
    {
      "type": "modify",
      "old_id": "142c23c77220610de707cbe9905542774e75ba9d",
      "old_mode": 33188,
      "old_path": "include/pybind11/detail/common.h",
      "new_id": "e706708527a3c0109fff91351a8d668b0ae52cfa",
      "new_mode": 33188,
      "new_path": "include/pybind11/detail/common.h"
    },
    {
      "type": "modify",
      "old_id": "76bb3827a3a2e25f62ba9b2f03d564617a154e3b",
      "old_mode": 33188,
      "old_path": "include/pybind11/detail/internals.h",
      "new_id": "7e4b77ca84fb13ad4e9146a08c1b5c0df49bccd6",
      "new_mode": 33188,
      "new_path": "include/pybind11/detail/internals.h"
    },
    {
      "type": "modify",
      "old_id": "47430d3a291b916df13fb46433e76c403855dbf6",
      "old_mode": 33188,
      "old_path": "tests/test_class.cpp",
      "new_id": "163a379400ef8ebdb915c073cc02e3fd5a3a7e24",
      "new_mode": 33188,
      "new_path": "tests/test_class.cpp"
    },
    {
      "type": "modify",
      "old_id": "81bf67e6f724c49762a8dffa23682dde934ed863",
      "old_mode": 33188,
      "old_path": "tests/test_class.py",
      "new_id": "2063e0f37866b2c92b91f6a781e840f0bf71365d",
      "new_mode": 33188,
      "new_path": "tests/test_class.py"
    },
    {
      "type": "modify",
      "old_id": "5235729e40e04d34c8603b36a5211e4108137630",
      "old_mode": 33188,
      "old_path": "tests/test_custom_type_setup.cpp",
      "new_id": "b262e3845518a5fa10b8bc20a051947db02b831c",
      "new_mode": 33188,
      "new_path": "tests/test_custom_type_setup.cpp"
    },
    {
      "type": "modify",
      "old_id": "a200b02b5ad0014a6fbb072b1f34c7fe2725db41",
      "old_mode": 33188,
      "old_path": "tests/test_custom_type_setup.py",
      "new_id": "2216c768f6f5e6680f01a177c19b35ee793e2205",
      "new_mode": 33188,
      "new_path": "tests/test_custom_type_setup.py"
    },
    {
      "type": "modify",
      "old_id": "f46563cec3032b2cac472e3ec101e3748a0b18c5",
      "old_mode": 33188,
      "old_path": "tests/test_methods_and_attributes.cpp",
      "new_id": "ddfc00d22eabdd17f6928a394851a25e569101d5",
      "new_mode": 33188,
      "new_path": "tests/test_methods_and_attributes.cpp"
    },
    {
      "type": "modify",
      "old_id": "c0943742dae3004e891286718f4f3dc3a6d17199",
      "old_mode": 33188,
      "old_path": "tests/test_methods_and_attributes.py",
      "new_id": "99bbc8c2cd4f1fa9752d9a1749bc8f8bf5a96faa",
      "new_mode": 33188,
      "new_path": "tests/test_methods_and_attributes.py"
    },
    {
      "type": "modify",
      "old_id": "271f5e49dfc6d87c81b858dce78bda6975164854",
      "old_mode": 33261,
      "old_path": "tools/check_inl_headers.py",
      "new_id": "aef0f0d3fe1a3cf2898edd8df02713ff02970068",
      "new_mode": 33261,
      "new_path": "tools/check_inl_headers.py"
    }
  ]
}
