From 27bd511f0980e9c402ac85362ef41954037eb65d Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 20 Sep 2023 16:17:57 +0200 Subject: [PATCH 1/4] fix: avoid removal of null characters in bindings --- python/src/communication_interfaces_bindings.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/python/src/communication_interfaces_bindings.cpp b/python/src/communication_interfaces_bindings.cpp index b211449..8bade4d 100644 --- a/python/src/communication_interfaces_bindings.cpp +++ b/python/src/communication_interfaces_bindings.cpp @@ -44,7 +44,6 @@ PYBIND11_MODULE(communication_interfaces, m) { std::string buffer; auto res = socket.receive_bytes(buffer); if (res) { - buffer.erase(std::find(buffer.begin(), buffer.end(), '\0'), buffer.end()); return py::bytes(buffer); } else { return py::none(); From fff6b1baf4fefc13afe05e09dc59590a500458d0 Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 20 Sep 2023 16:18:08 +0200 Subject: [PATCH 2/4] fix: update tests --- python/test/test_tcp.py | 4 ++-- python/test/test_udp.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/test/test_tcp.py b/python/test/test_tcp.py index ae8b8ce..00d3bdf 100644 --- a/python/test/test_tcp.py +++ b/python/test/test_tcp.py @@ -16,7 +16,7 @@ def serve(self): response = self.server.receive_bytes() if response is None: pytest.fail("No response from client") - assert response.decode("utf-8") == self.client_message + assert response.decode("utf-8").rstrip("\x00") == self.client_message assert self.server.send_bytes(self.server_message) def test_comm(self): @@ -28,4 +28,4 @@ def test_comm(self): assert self.client.send_bytes(self.client_message) response = self.client.receive_bytes() assert response - assert response.decode("utf-8") == self.server_message + assert response.decode("utf-8").rstrip("\x00") == self.server_message diff --git a/python/test/test_udp.py b/python/test/test_udp.py index 0ea78a9..d5846f5 100644 --- a/python/test/test_udp.py +++ b/python/test/test_udp.py @@ -24,7 +24,7 @@ def client(udp_config): def test_send_receive(server, client): - send_string = b"Hello world" + send_string = "Hello world" try: server.open() @@ -39,7 +39,7 @@ def test_send_receive(server, client): assert client.send_bytes(send_string) response = server.receive_bytes() assert response - assert response == send_string + assert response.decode("utf-8").rstrip("\x00") == send_string def test_timeout(udp_config): From 71cf431db19549992337d8c1b387138ace083608 Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 20 Sep 2023 16:26:17 +0200 Subject: [PATCH 3/4] release: update version and changelog --- CHANGELOG.md | 8 ++++++++ python/setup.py | 2 +- source/communication_interfaces/CMakeLists.txt | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc872cf..afb82d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Release Versions: +- [2.0.1](#201) - [2.0.0](#200) - [1.4.1](#141) - [1.4.0](#140) @@ -12,6 +13,13 @@ Release Versions: - [0.2.0](#020) - [0.1.0](#010) +## 2.0.1 + +Version 2.0.1 contains a hotfix that enables socket communiction with any serialized message in Python, which was not +possible before due to an error in the bindings. + +- fix(python): avoid removal of null characters in bindings (#66) + ## 2.0.0 Version 2.0.0 is a major update to this repository and contains breaking changes. diff --git a/python/setup.py b/python/setup.py index 7d299b9..8285e1a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -6,7 +6,7 @@ from pybind11.setup_helpers import ParallelCompile, Pybind11Extension, build_ext, naive_recompile from setuptools import setup -__version__ = "1.0.0" +__version__ = "1.0.1" try: status = pkgconfig.installed('communication_interfaces', f'>= {__version__}') diff --git a/source/communication_interfaces/CMakeLists.txt b/source/communication_interfaces/CMakeLists.txt index 19bc0c3..461bc2a 100644 --- a/source/communication_interfaces/CMakeLists.txt +++ b/source/communication_interfaces/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15) -set(COMMUNICATION_INTERFACES_VERSION 1.0.0) +set(COMMUNICATION_INTERFACES_VERSION 1.0.1) project(communication_interfaces VERSION ${COMMUNICATION_INTERFACES_VERSION}) option(BUILD_TESTING "Build tests." OFF) From 29557b95084f1d7dd78d55f8be7d74a9fadaa06d Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 20 Sep 2023 16:31:20 +0200 Subject: [PATCH 4/4] fix: docker image name --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 00d6254..341e27b 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -IMAGE_NAME=ghcr.io/aica-technology/communication-interfaces +IMAGE_NAME=ghcr.io/aica-technology/network-interfaces IMAGE_TAG=latest ROS2_VERSION=humble