Make function record subinterpreter safe (#5771)

* Make function_record type subinterpreter safe

* Get rid of static state in implicit conversion

* style: pre-commit fixes

* Fix lambda

* Bump ABI because we added an internals member

* Set __module__ on the type instance to get rid of DepricationWarning

* Work around internal compiler error in CUDA by not using typedef

hopefully

* Make clang-tidy happy

* Use the same __module__ as pybind11_static_property

* style: pre-commit fixes

* Oops, find-replace error

* style: pre-commit fixes

* Move the once initialization to happen more behind the scenes

* Oops, need those casts...

* Undo implicit conversion change, will do a separate PR

* Use local_internals for function_record pointer to avoid ABI bump

* style: pre-commit fixes

* Get rid of this auto for readability

* Change back to using unqualified tp_name, set __module__ attribute, explicitly add Py_TPFLAGS_HEAPTYPE → does not resolve DeprecationWarning :-(

* Revert "Change back to using unqualified tp_name, set __module__ attribute, explicitly add Py_TPFLAGS_HEAPTYPE → does not resolve DeprecationWarning :-("

This reverts commit 9ccd6de9b739f7cf91c3a8f34b35111bf3e9df6f.

* Add Py_TPFLAGS_HEAPTYPE to be explicit (more readable).

* Remove obsolete PYBIND11_WARNING_DISABLE_...

* Make tp_plainname_impl, tp_qualname_impl more DRY

* Change PYBIND11_INTERNAL_MODULE_NAME → PYBIND11_DUMMY_MODULE_NAME

* Add a long comment to explain the tp_qualname_impl workaround.

* Rename local_internals::function_record → function_record_py_type

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
5 files changed