These changes add a weakreflist member to SwigPyObject, and set
tp_weaklistoffset to its offset. This fixes#1792.
The Py_TPFLAGS_MANAGED_WEAKREF introduced in Python 3.12 requires
Py_TPFLAGS_HAVE_GC to be set as well, which it currently isn't for
SwigPyObjectType. (See https://github.com/python/cpython/issues/134786).