From bb95a186313f5b589c1566b38731503743f9e625 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 16 Jan 2022 23:23:45 -0800 Subject: [PATCH] Fixed a bug in the enum value map, fixing a few unit tests. --- python/descriptor.c | 2 +- python/pb_unit_tests/descriptor_test_wrapper.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/python/descriptor.c b/python/descriptor.c index 6286d89b6e..c60c8f50ee 100644 --- a/python/descriptor.c +++ b/python/descriptor.c @@ -533,7 +533,7 @@ static PyObject* PyUpb_Descriptor_GetEnumValuesByName(PyObject* _self, // bang for the buck. const upb_EnumValueDef* ev = upb_EnumDef_Value(e, j); const char* name = upb_EnumValueDef_Name(ev); - PyObject* val = PyLong_FromLong(upb_EnumValueDef_Number(ev)); + PyObject* val = PyUpb_EnumValueDescriptor_Get(ev); if (!val || PyDict_SetItemString(ret, name, val) < 0) { Py_XDECREF(val); Py_DECREF(ret); diff --git a/python/pb_unit_tests/descriptor_test_wrapper.py b/python/pb_unit_tests/descriptor_test_wrapper.py index b17f8518c8..92485e5b0b 100644 --- a/python/pb_unit_tests/descriptor_test_wrapper.py +++ b/python/pb_unit_tests/descriptor_test_wrapper.py @@ -31,8 +31,6 @@ descriptor_test.GeneratedDescriptorTest.testDescriptor.__unittest_expecting_fail descriptor_test.MakeDescriptorTest.testCamelcaseName.__unittest_expecting_failure__ = True descriptor_test.MakeDescriptorTest.testJsonName.__unittest_expecting_failure__ = True descriptor_test.NewDescriptorTest.testImmutableCppDescriptor.__unittest_expecting_failure__ = True -descriptor_test.NewDescriptorTest.testNestedOptions.__unittest_expecting_failure__ = True -descriptor_test.NewDescriptorTest.testSimpleCustomOptions.__unittest_expecting_failure__ = True if __name__ == '__main__': unittest.main(module=descriptor_test, verbosity=2)