Merge pull request #115 from agessaman/fix/python-310-311-messaging-import

Fix Python 3.10/3.11 import failure in messaging commands
This commit is contained in:
fdlamotte
2026-10-16 09:06:25 -04:00
committed by GitHub
2 changed files with 25 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
name: Python package import
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
import:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: python -m pip install .
- name: Import installed package
run: python -c "import meshcore"
+1 -1
View File
@@ -404,7 +404,7 @@ class MessagingCommands(CommandHandlerBase):
raise ValueError("path must be shorter than 255 bytes") raise ValueError("path must be shorter than 255 bytes")
path_len = int(len(path) / (path_hash_mode + 1)) path_len = int(len(path) / (path_hash_mode + 1))
path_bytes = bytes([path_len | (path_hash_mode << 6)]) + path path_bytes = bytes([path_len | (path_hash_mode << 6)]) + path
logger.debug(f"Sending raw data {payload.hex()} through path {"Flood" if path is None else path.hex()} of len {"-1" if path is None else path_len} with mode {path_hash_mode} (raw path: {path_bytes.hex()})") logger.debug(f"Sending raw data {payload.hex()} through path {'Flood' if path is None else path.hex()} of len {'-1' if path is None else path_len} with mode {path_hash_mode} (raw path: {path_bytes.hex()})")
data = bytes([CommandType.SEND_CHANNEL_DATA.value, chan]) + path_bytes + data_type.to_bytes(2, "little") + bytes(payload) data = bytes([CommandType.SEND_CHANNEL_DATA.value, chan]) + path_bytes + data_type.to_bytes(2, "little") + bytes(payload)
return await self.send(data, [EventType.OK, EventType.ERROR]) return await self.send(data, [EventType.OK, EventType.ERROR])