Skip to content

Commit

Permalink
Remove RegisterExtension in message class
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 539568063
  • Loading branch information
anandolee authored and copybara-github committed Jun 12, 2023
1 parent 56a7708 commit cbacdf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions python/extension_dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ static PyObject* PyUpb_ExtensionDict_FindExtensionByName(PyObject* _self,
PyObject* key) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const char* name = PyUpb_GetStrData(key);
if (!name) {
PyErr_Format(PyExc_TypeError, "_FindExtensionByName expect a str");
return NULL;
}
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(self->msg);
const upb_FileDef* file = upb_MessageDef_File(m);
const upb_DefPool* symtab = upb_FileDef_Pool(file);
Expand All @@ -73,6 +77,7 @@ static PyObject* PyUpb_ExtensionDict_FindExtensionByNumber(PyObject* _self,
const upb_DefPool* symtab = upb_FileDef_Pool(file);
const upb_ExtensionRegistry* reg = upb_DefPool_ExtensionRegistry(symtab);
int64_t number = PyLong_AsLong(arg);
if (number == -1 && PyErr_Occurred()) return NULL;
const upb_MiniTableExtension* ext =
(upb_MiniTableExtension*)upb_ExtensionRegistry_Lookup(reg, l, number);
if (ext) {
Expand Down
4 changes: 0 additions & 4 deletions python/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,10 +1677,6 @@ static PyMethodDef PyUpb_Message_Methods[] = {
"Merges a serialized message into the current message."},
{"ParseFromString", PyUpb_Message_ParseFromString, METH_O,
"Parses a serialized message into the current message."},
// TODO(https://github.com/protocolbuffers/upb/issues/459)
//{ "RegisterExtension", (PyCFunction)RegisterExtension, METH_O |
// METH_CLASS,
// "Registers an extension with the current message." },
{"SerializePartialToString",
(PyCFunction)PyUpb_Message_SerializePartialToString,
METH_VARARGS | METH_KEYWORDS,
Expand Down

0 comments on commit cbacdf1

Please sign in to comment.