Correct cause of NPE in python wrapper 91/1191/4
authorE. Scott Daniels <daniels@research.att.com>
Mon, 21 Oct 2019 19:58:22 +0000 (15:58 -0400)
committerE. Scott Daniels <daniels@research.att.com>
Tue, 22 Oct 2019 01:53:06 +0000 (21:53 -0400)
The message summary funciton was attempting to reference
a payload when RMR left it as a null pointer.

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: Id1e6da44c9f79d8f69f5266b9bed1f25dd8af0d9

src/bindings/rmr-python/docs/Changelog.rst
src/bindings/rmr-python/rmr/rmr.py
src/bindings/rmr-python/setup.py
src/bindings/rmr-python/tests/test_rmr_mocks.py

index 3e353c3..28c5314 100644 (file)
@@ -7,6 +7,13 @@ The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
 and this project adheres to `Semantic
 Versioning <http://semver.org/>`__.
 
+[0.13.4] - 10/21/2019
+--------------------
+
+::
+
+    * Correct cause of nil pointer exception in message summary.
+
 
 [0.13.3] - 10/10/2019
 --------------------
index 2ae40c8..9e45dd6 100644 (file)
@@ -438,7 +438,7 @@ def message_summary(ptr_mbuf):
         dict message summary
     """
     return {
-        "payload": get_payload(ptr_mbuf),
+        "payload": get_payload(ptr_mbuf) if ptr_mbuf.contents.state == RMR_OK else None,
         "payload length": ptr_mbuf.contents.len,
         "message type": ptr_mbuf.contents.mtype,
         "subscription id": ptr_mbuf.contents.sub_id,
index d2b7a9e..d8095b1 100644 (file)
@@ -32,7 +32,7 @@ def _long_descr():
 
 setup(
     name="rmr",
-    version="0.13.3",
+    version="0.13.4",
     packages=find_packages(),
     author="Tommy Carpenter, E. Scott Daniels",
     description="Python wrapper for RIC RMR",
index 9fa9625..e3b0fea 100644 (file)
@@ -66,7 +66,7 @@ def test_send_mock(monkeypatch):
         "message state": 12,
         "message type": 666,
         "message status": "RMR_ERR_TIMEOUT",
-        "payload": b"testttt",
+        "payload": None,
         "payload length": 7,
         "payload max size": 4096,
         "subscription id": 0,