@ -648,18 +648,6 @@ static PyObject* PyUpb_Descriptor_GetOneofsByName(PyObject* _self,
return PyUpb_ByNameMap_New ( & funcs , self - > def , self - > pool ) ;
}
static PyObject * PyUpb_Descriptor_GetSyntax ( PyObject * self , void * closure ) {
PyErr_WarnEx ( NULL ,
" descriptor.syntax is deprecated. It will be removed soon. "
" Most usages are checking field descriptors. Consider to use "
" has_presence, is_packed on field descriptors. " ,
1 ) ;
const upb_MessageDef * msgdef = PyUpb_Descriptor_GetDef ( self ) ;
const char * syntax =
upb_MessageDef_Syntax ( msgdef ) = = kUpb_Syntax_Proto2 ? " proto2 " : " proto3 " ;
return PyUnicode_InternFromString ( syntax ) ;
}
static PyGetSetDef PyUpb_Descriptor_Getters [ ] = {
{ " name " , PyUpb_Descriptor_GetName , NULL , " Last name " } ,
{ " full_name " , PyUpb_Descriptor_GetFullName , NULL , " Full name " } ,
@ -694,13 +682,6 @@ static PyGetSetDef PyUpb_Descriptor_Getters[] = {
" Containing type " } ,
{ " is_extendable " , PyUpb_Descriptor_GetIsExtendable , NULL } ,
{ " has_options " , PyUpb_Descriptor_GetHasOptions , NULL , " Has Options " } ,
// begin:github_only
{ " syntax " , & PyUpb_Descriptor_GetSyntax , NULL , " Syntax " } ,
// end:github_only
// begin:google_only
// // TODO Use this to open-source syntax deprecation.
// {"deprecated_syntax", &PyUpb_Descriptor_GetSyntax, NULL, "Syntax"},
// end:google_only
{ NULL } } ;
static PyMethodDef PyUpb_Descriptor_Methods [ ] = {
@ -1384,17 +1365,10 @@ static PyObject* PyUpb_FileDescriptor_GetPublicDependencies(PyObject* _self,
return PyUpb_GenericSequence_New ( & funcs , self - > def , self - > pool ) ;
}
static PyObject * PyUpb_FileDescriptor_GetSyntax ( PyObject * _self ,
void * closure ) {
PyErr_WarnEx ( NULL ,
" descriptor.syntax is deprecated. It will be removed soon. "
" Most usages are checking field descriptors. Consider to use "
" has_presence, is_packed on field descriptors. " ,
1 ) ;
static PyObject * PyUpb_FileDescriptor_GetEdition ( PyObject * _self ,
void * closure ) {
PyUpb_DescriptorBase * self = ( void * ) _self ;
const char * syntax =
upb_FileDef_Syntax ( self - > def ) = = kUpb_Syntax_Proto2 ? " proto2 " : " proto3 " ;
return PyUnicode_FromString ( syntax ) ;
return PyLong_FromLong ( upb_FileDef_Edition ( self - > def ) ) ;
}
static PyObject * PyUpb_FileDescriptor_GetHasOptions ( PyObject * _self ,
@ -1445,14 +1419,7 @@ static PyGetSetDef PyUpb_FileDescriptor_Getters[] = {
{ " public_dependencies " , PyUpb_FileDescriptor_GetPublicDependencies , NULL ,
" Dependencies " } ,
{ " has_options " , PyUpb_FileDescriptor_GetHasOptions , NULL , " Has Options " } ,
// begin:github_only
{ " syntax " , PyUpb_FileDescriptor_GetSyntax , ( setter ) NULL , " Syntax " } ,
// end:github_only
// begin:google_only
// // TODO Use this to open-source syntax deprecation.
// {"deprecated_syntax", PyUpb_FileDescriptor_GetSyntax, (setter)NULL,
// "Syntax"},
// end:google_only
{ " edition " , PyUpb_FileDescriptor_GetEdition , ( setter ) NULL , " Edition " } ,
{ NULL } ,
} ;