@@ -648,18 +648,6 @@ static PyObject* PyUpb_Descriptor_GetOneofsByName(PyObject* _self,
648648 return PyUpb_ByNameMap_New (& funcs , self -> def , self -> pool );
649649}
650650
651- static PyObject * PyUpb_Descriptor_GetSyntax (PyObject * self , void * closure ) {
652- PyErr_WarnEx (NULL ,
653- "descriptor.syntax is deprecated. It will be removed soon. "
654- "Most usages are checking field descriptors. Consider to use "
655- "has_presence, is_packed on field descriptors." ,
656- 1 );
657- const upb_MessageDef * msgdef = PyUpb_Descriptor_GetDef (self );
658- const char * syntax =
659- upb_MessageDef_Syntax (msgdef ) == kUpb_Syntax_Proto2 ? "proto2" : "proto3" ;
660- return PyUnicode_InternFromString (syntax );
661- }
662-
663651static PyGetSetDef PyUpb_Descriptor_Getters [] = {
664652 {"name" , PyUpb_Descriptor_GetName , NULL , "Last name" },
665653 {"full_name" , PyUpb_Descriptor_GetFullName , NULL , "Full name" },
@@ -694,13 +682,6 @@ static PyGetSetDef PyUpb_Descriptor_Getters[] = {
694682 "Containing type" },
695683 {"is_extendable" , PyUpb_Descriptor_GetIsExtendable , NULL },
696684 {"has_options" , PyUpb_Descriptor_GetHasOptions , NULL , "Has Options" },
697- // begin:github_only
698- {"syntax" , & PyUpb_Descriptor_GetSyntax , NULL , "Syntax" },
699- // end:github_only
700- // begin:google_only
701- // // TODO Use this to open-source syntax deprecation.
702- // {"deprecated_syntax", &PyUpb_Descriptor_GetSyntax, NULL, "Syntax"},
703- // end:google_only
704685 {NULL }};
705686
706687static PyMethodDef PyUpb_Descriptor_Methods [] = {
@@ -1384,17 +1365,10 @@ static PyObject* PyUpb_FileDescriptor_GetPublicDependencies(PyObject* _self,
13841365 return PyUpb_GenericSequence_New (& funcs , self -> def , self -> pool );
13851366}
13861367
1387- static PyObject * PyUpb_FileDescriptor_GetSyntax (PyObject * _self ,
1388- void * closure ) {
1389- PyErr_WarnEx (NULL ,
1390- "descriptor.syntax is deprecated. It will be removed soon. "
1391- "Most usages are checking field descriptors. Consider to use "
1392- "has_presence, is_packed on field descriptors." ,
1393- 1 );
1368+ static PyObject * PyUpb_FileDescriptor_GetEdition (PyObject * _self ,
1369+ void * closure ) {
13941370 PyUpb_DescriptorBase * self = (void * )_self ;
1395- const char * syntax =
1396- upb_FileDef_Syntax (self -> def ) == kUpb_Syntax_Proto2 ? "proto2" : "proto3" ;
1397- return PyUnicode_FromString (syntax );
1371+ return PyLong_FromLong (upb_FileDef_Edition (self -> def ));
13981372}
13991373
14001374static PyObject * PyUpb_FileDescriptor_GetHasOptions (PyObject * _self ,
@@ -1445,14 +1419,7 @@ static PyGetSetDef PyUpb_FileDescriptor_Getters[] = {
14451419 {"public_dependencies" , PyUpb_FileDescriptor_GetPublicDependencies , NULL ,
14461420 "Dependencies" },
14471421 {"has_options" , PyUpb_FileDescriptor_GetHasOptions , NULL , "Has Options" },
1448- // begin:github_only
1449- {"syntax" , PyUpb_FileDescriptor_GetSyntax , (setter )NULL , "Syntax" },
1450- // end:github_only
1451- // begin:google_only
1452- // // TODO Use this to open-source syntax deprecation.
1453- // {"deprecated_syntax", PyUpb_FileDescriptor_GetSyntax, (setter)NULL,
1454- // "Syntax"},
1455- // end:google_only
1422+ {"edition" , PyUpb_FileDescriptor_GetEdition , (setter )NULL , "Edition" },
14561423 {NULL },
14571424};
14581425
0 commit comments