Skip to content

Commit bbf7f1d

Browse files
anandoleecopybara-github
authored andcommitted
LSC: Remove deprecated protobuf python MessageFactory.CreatePrototype() usages
PiperOrigin-RevId: 684904603
1 parent ed430af commit bbf7f1d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pybind11_protobuf/tests/dynamic_message_test.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from pybind11_protobuf.tests import test_pb2
2020

2121
POOL = descriptor_pool.DescriptorPool()
22-
FACTORY = message_factory.MessageFactory(POOL)
2322
POOL.Add(
2423
descriptor_pb2.FileDescriptorProto(
2524
name='pybind11_protobuf/tests',
@@ -42,16 +41,18 @@
4241

4342
def get_py_dynamic_message(value=5):
4443
"""Returns a dynamic message that is wire-compatible with IntMessage."""
45-
prototype = FACTORY.CreatePrototype(
46-
POOL.FindMessageTypeByName('pybind11.test.DynamicMessage'))
44+
prototype = message_factory.GetMessageClass(
45+
POOL.FindMessageTypeByName('pybind11.test.DynamicMessage')
46+
)
4747
msg = prototype(value=value)
4848
return msg
4949

5050

5151
def get_py_dynamic_int_message(value=5):
5252
"""Returns a dynamic message named pybind11.test.IntMessage."""
53-
prototype = FACTORY.CreatePrototype(
54-
POOL.FindMessageTypeByName('pybind11.test.IntMessage'))
53+
prototype = message_factory.GetMessageClass(
54+
POOL.FindMessageTypeByName('pybind11.test.IntMessage')
55+
)
5556
msg = prototype(value=value)
5657
return msg
5758

0 commit comments

Comments
 (0)