bpo-40170: PyType_SUPPORTS_WEAKREFS() becomes a regular function (GH-30938)

Convert the PyType_SUPPORTS_WEAKREFS() macro to a regular function.
It no longer access the PyTypeObject.tp_weaklistoffset member
directly.

Add _PyType_SUPPORTS_WEAKREFS() static inline functions, used
internally by Python for best performance.
7 files changed