Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-proto-plus for 
openSUSE:Factory checked in at 2023-11-08 22:19:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-proto-plus (Old)
 and      /work/SRC/openSUSE:Factory/.python-proto-plus.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-proto-plus"

Wed Nov  8 22:19:11 2023 rev:9 rq:1124262 version:1.22.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-proto-plus/python-proto-plus.changes      
2023-03-03 22:31:42.892109963 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-proto-plus.new.17445/python-proto-plus.changes
   2023-11-08 22:20:32.381370891 +0100
@@ -1,0 +2,7 @@
+Tue Nov  7 12:59:38 UTC 2023 - Matthias Fehring <[email protected]>
+
+- Update to 1.22.3
+  * Resolve issue where marshal fails with cross api dependency
+    (gh#googleapis/proto-plus-python#349)
+
+-------------------------------------------------------------------

Old:
----
  proto-plus-1.22.2.tar.gz

New:
----
  proto-plus-1.22.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-proto-plus.spec ++++++
--- /var/tmp/diff_new_pack.9LqCDU/_old  2023-11-08 22:20:32.905390141 +0100
+++ /var/tmp/diff_new_pack.9LqCDU/_new  2023-11-08 22:20:32.909390288 +0100
@@ -27,7 +27,7 @@
 %define skip_python2 1
 %define modname proto-plus
 Name:           python-proto-plus%{psuffix}
-Version:        1.22.2
+Version:        1.22.3
 Release:        0
 Summary:        Pythonic Protocol Buffers
 License:        Apache-2.0

++++++ proto-plus-1.22.2.tar.gz -> proto-plus-1.22.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proto-plus-1.22.2/PKG-INFO 
new/proto-plus-1.22.3/PKG-INFO
--- old/proto-plus-1.22.2/PKG-INFO      2023-01-09 16:58:23.803348800 +0100
+++ new/proto-plus-1.22.3/PKG-INFO      2023-06-22 16:59:42.527792700 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: proto-plus
-Version: 1.22.2
+Version: 1.22.3
 Summary: Beautiful, Pythonic protocol buffers.
 Home-page: https://github.com/googleapis/proto-plus-python.git
 Author: Google LLC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proto-plus-1.22.2/proto/marshal/marshal.py 
new/proto-plus-1.22.3/proto/marshal/marshal.py
--- old/proto-plus-1.22.2/proto/marshal/marshal.py      2023-01-09 
16:58:15.000000000 +0100
+++ new/proto-plus-1.22.3/proto/marshal/marshal.py      2023-06-22 
16:57:14.000000000 +0200
@@ -159,6 +159,22 @@
         for rule_class in stringy_numbers.STRINGY_NUMBER_RULES:
             self.register(rule_class._proto_type, rule_class())
 
+    def get_rule(self, proto_type):
+        # Rules are needed to convert values between proto-plus and pb.
+        # Retrieve the rule for the specified proto type.
+        # The NoopRule will be used when a rule is not found.
+        rule = self._rules.get(proto_type, self._noop)
+
+        # If we don't find a rule, also check under `_instances`
+        # in case there is a rule in another package.
+        # See https://github.com/googleapis/proto-plus-python/issues/349
+        if rule == self._noop and hasattr(self, "_instances"):
+            for _, instance in self._instances.items():
+                rule = instance._rules.get(proto_type, self._noop)
+                if rule != self._noop:
+                    break
+        return rule
+
     def to_python(self, proto_type, value, *, absent: bool = None):
         # Internal protobuf has its own special type for lists of values.
         # Return a view around it that implements MutableSequence.
@@ -174,10 +190,7 @@
         # Same thing for maps of messages.
         if value_type in compat.map_composite_types:
             return MapComposite(value, marshal=self)
-
-        # Convert ordinary values.
-        rule = self._rules.get(proto_type, self._noop)
-        return rule.to_python(value, absent=absent)
+        return self.get_rule(proto_type=proto_type).to_python(value, 
absent=absent)
 
     def to_proto(self, proto_type, value, *, strict: bool = False):
         # The protos in google/protobuf/struct.proto are exceptional cases,
@@ -212,9 +225,7 @@
             recursive_type = type(proto_type().value)
             return {k: self.to_proto(recursive_type, v) for k, v in 
value.items()}
 
-        # Convert ordinary values.
-        rule = self._rules.get(proto_type, self._noop)
-        pb_value = rule.to_proto(value)
+        pb_value = self.get_rule(proto_type=proto_type).to_proto(value)
 
         # Sanity check: If we are in strict mode, did we get the value we want?
         if strict and not isinstance(pb_value, proto_type):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proto-plus-1.22.2/proto_plus.egg-info/PKG-INFO 
new/proto-plus-1.22.3/proto_plus.egg-info/PKG-INFO
--- old/proto-plus-1.22.2/proto_plus.egg-info/PKG-INFO  2023-01-09 
16:58:23.000000000 +0100
+++ new/proto-plus-1.22.3/proto_plus.egg-info/PKG-INFO  2023-06-22 
16:59:42.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: proto-plus
-Version: 1.22.2
+Version: 1.22.3
 Summary: Beautiful, Pythonic protocol buffers.
 Home-page: https://github.com/googleapis/proto-plus-python.git
 Author: Google LLC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proto-plus-1.22.2/setup.py 
new/proto-plus-1.22.3/setup.py
--- old/proto-plus-1.22.2/setup.py      2023-01-09 16:58:15.000000000 +0100
+++ new/proto-plus-1.22.3/setup.py      2023-06-22 16:57:14.000000000 +0200
@@ -17,7 +17,7 @@
 
 from setuptools import find_packages, setup
 
-version = "1.22.2"
+version = "1.22.3"
 
 PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proto-plus-1.22.2/tests/test_modules.py 
new/proto-plus-1.22.3/tests/test_modules.py
--- old/proto-plus-1.22.2/tests/test_modules.py 2023-01-09 16:58:15.000000000 
+0100
+++ new/proto-plus-1.22.3/tests/test_modules.py 2023-06-22 16:57:14.000000000 
+0200
@@ -36,6 +36,38 @@
         del sys.modules[__name__].__protobuf__
 
 
+def test_module_package_cross_api():
+    sys.modules[__name__].__protobuf__ = proto.module(package="spam.eggs.v1")
+    try:
+
+        class Baz(proto.Message):
+            foo = proto.RepeatedField(proto.INT64, number=1)
+
+        marshal = proto.Marshal(name="spam.eggs.v1")
+
+        assert Baz.meta.package == "spam.eggs.v1"
+        assert Baz.pb() in marshal._rules
+
+        sys.modules[__name__].__protobuf__ = 
proto.module(package="ham.pancakes.v1")
+
+        class AnotherMessage(proto.Message):
+            qux = proto.Field(proto.MESSAGE, number=1, message=Baz)
+
+        marshal = proto.Marshal(name="ham.pancakes.v1")
+
+        assert AnotherMessage.meta.package == "ham.pancakes.v1"
+        assert AnotherMessage.pb() in marshal._rules
+        # Confirm that Baz.pb() is no longer present in marshal._rules
+        assert Baz.pb() not in marshal._rules
+
+        # Test using multiple packages together
+        # See https://github.com/googleapis/proto-plus-python/issues/349.
+        msg = AnotherMessage(qux=Baz())
+        assert type(msg) == AnotherMessage
+    finally:
+        del sys.modules[__name__].__protobuf__
+
+
 def test_module_package_explicit_marshal():
     sys.modules[__name__].__protobuf__ = proto.module(
         package="spam.eggs.v1",

Reply via email to