diff --git a/python/google/protobuf/pyext/repeated_composite_container.cc b/python/google/protobuf/pyext/repeated_composite_container.cc index cac8f1af69..b922a983f8 100644 --- a/python/google/protobuf/pyext/repeated_composite_container.cc +++ b/python/google/protobuf/pyext/repeated_composite_container.cc @@ -549,22 +549,26 @@ PyTypeObject RepeatedCompositeContainer_Type = { #if PY_VERSION_HEX >= 0x03080000 0, // tp_vectorcall_offset #else - nullptr, // tp_print + nullptr, // tp_print +#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare + repeated_composite_container::ToStr, // tp_repr + nullptr, // tp_as_number + &repeated_composite_container::SqMethods, // tp_as_sequence + &repeated_composite_container::MpMethods, // tp_as_mapping + PyObject_HashNotImplemented, // tp_hash + nullptr, // tp_call + nullptr, // tp_str + nullptr, // tp_getattro + nullptr, // tp_setattro + nullptr, // tp_as_buffer +#if PY_VERSION_HEX >= 0x030A0000 + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_SEQUENCE, // tp_flags +#else + Py_TPFLAGS_DEFAULT, // tp_flags #endif - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - repeated_composite_container::ToStr, // tp_repr - nullptr, // tp_as_number - &repeated_composite_container::SqMethods, // tp_as_sequence - &repeated_composite_container::MpMethods, // tp_as_mapping - PyObject_HashNotImplemented, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - nullptr, // tp_getattro - nullptr, // tp_setattro - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT, // tp_flags "A Repeated scalar container", // tp_doc nullptr, // tp_traverse nullptr, // tp_clear diff --git a/python/google/protobuf/pyext/repeated_scalar_container.cc b/python/google/protobuf/pyext/repeated_scalar_container.cc index ba24f0ffdc..edbb75d4d0 100644 --- a/python/google/protobuf/pyext/repeated_scalar_container.cc +++ b/python/google/protobuf/pyext/repeated_scalar_container.cc @@ -728,29 +728,33 @@ static PyMethodDef Methods[] = { PyTypeObject RepeatedScalarContainer_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) FULL_MODULE_NAME - ".RepeatedScalarContainer", // tp_name - sizeof(RepeatedScalarContainer), // tp_basicsize - 0, // tp_itemsize - repeated_scalar_container::Dealloc, // tp_dealloc + ".RepeatedScalarContainer", // tp_name + sizeof(RepeatedScalarContainer), // tp_basicsize + 0, // tp_itemsize + repeated_scalar_container::Dealloc, // tp_dealloc #if PY_VERSION_HEX >= 0x03080000 - 0, // tp_vectorcall_offset + 0, // tp_vectorcall_offset #else - nullptr, // tp_print + nullptr, // tp_print +#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare + repeated_scalar_container::ToStr, // tp_repr + nullptr, // tp_as_number + &repeated_scalar_container::SqMethods, // tp_as_sequence + &repeated_scalar_container::MpMethods, // tp_as_mapping + PyObject_HashNotImplemented, // tp_hash + nullptr, // tp_call + nullptr, // tp_str + nullptr, // tp_getattro + nullptr, // tp_setattro + nullptr, // tp_as_buffer +#if PY_VERSION_HEX >= 0x030A0000 + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_SEQUENCE, // tp_flags +#else + Py_TPFLAGS_DEFAULT, // tp_flags #endif - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - repeated_scalar_container::ToStr, // tp_repr - nullptr, // tp_as_number - &repeated_scalar_container::SqMethods, // tp_as_sequence - &repeated_scalar_container::MpMethods, // tp_as_mapping - PyObject_HashNotImplemented, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - nullptr, // tp_getattro - nullptr, // tp_setattro - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT, // tp_flags "A Repeated scalar container", // tp_doc nullptr, // tp_traverse nullptr, // tp_clear