Deprecated APIs that add non top descriptors to pool will be removed soon

PiperOrigin-RevId: 529840421
pull/12690/head
Jie Luo 2 years ago committed by Copybara-Service
parent 8a443699f7
commit 3f5d844d90
  1. 10
      python/google/protobuf/descriptor_pool.py

@ -74,8 +74,8 @@ def _Deprecated(func):
def NewFunc(*args, **kwargs):
warnings.warn(
'Call to deprecated function %s(). Note: Do add unlinked descriptors '
'to descriptor_pool is wrong. Use Add() or AddSerializedFile() '
'instead.' % func.__name__,
'to descriptor_pool is wrong. Please use Add() or AddSerializedFile() '
'instead. This function will be removed soon.' % func.__name__,
category=DeprecationWarning)
return func(*args, **kwargs)
NewFunc.__name__ = func.__name__
@ -246,12 +246,6 @@ class DescriptorPool(object):
self._descriptors[desc.full_name] = desc
self._AddFileDescriptor(desc.file)
# Add EnumDescriptor to descriptor pool is deprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@_Deprecated
def AddEnumDescriptor(self, enum_desc):
self._AddEnumDescriptor(enum_desc)
# Never call this method. It is for internal usage only.
def _AddEnumDescriptor(self, enum_desc):
"""Adds an EnumDescriptor to the pool.

Loading…
Cancel
Save