@@ -1855,32 +1855,6 @@ static PyObject* ByteSize(CMessage* self, PyObject* args) {
18551855 return PyLong_FromLong (self->message ->ByteSizeLong ());
18561856}
18571857
1858- PyObject* RegisterExtension (PyObject* cls, PyObject* extension_handle) {
1859- const FieldDescriptor* descriptor =
1860- GetExtensionDescriptor (extension_handle);
1861- if (descriptor == nullptr ) {
1862- return nullptr ;
1863- }
1864- if (!PyObject_TypeCheck (cls, CMessageClass_Type)) {
1865- PyErr_Format (PyExc_TypeError, " Expected a message class, got %s" ,
1866- cls->ob_type ->tp_name );
1867- return nullptr ;
1868- }
1869- CMessageClass *message_class = reinterpret_cast <CMessageClass*>(cls);
1870- if (message_class == nullptr ) {
1871- return nullptr ;
1872- }
1873- // If the extension was already registered, check that it is the same.
1874- const FieldDescriptor* existing_extension =
1875- message_class->py_message_factory ->pool ->pool ->FindExtensionByNumber (
1876- descriptor->containing_type (), descriptor->number ());
1877- if (existing_extension != nullptr && existing_extension != descriptor) {
1878- PyErr_SetString (PyExc_ValueError, " Double registration of Extensions" );
1879- return nullptr ;
1880- }
1881- Py_RETURN_NONE;
1882- }
1883-
18841858static PyObject* SetInParent (CMessage* self, PyObject* args) {
18851859 AssureWritable (self);
18861860 Py_RETURN_NONE;
@@ -2391,8 +2365,6 @@ static PyMethodDef Methods[] = {
23912365 " Merges a serialized message into the current message." },
23922366 {" ParseFromString" , (PyCFunction)ParseFromString, METH_O,
23932367 " Parses a serialized message into the current message." },
2394- {" RegisterExtension" , (PyCFunction)RegisterExtension, METH_O | METH_CLASS,
2395- " Registers an extension with the current message." },
23962368 {" SerializePartialToString" , (PyCFunction)SerializePartialToString,
23972369 METH_VARARGS | METH_KEYWORDS,
23982370 " Serializes the message to a string, even if it isn't initialized." },
0 commit comments