Skip to content

sigrokdriver: fix TypeError in stop() by passing bytes to communicate()#1850

Open
xistadi wants to merge 1 commit intolabgrid-project:masterfrom
xistadi:fix/sigrok-stop-bytes-input
Open

sigrokdriver: fix TypeError in stop() by passing bytes to communicate()#1850
xistadi wants to merge 1 commit intolabgrid-project:masterfrom
xistadi:fix/sigrok-stop-bytes-input

Conversation

@xistadi
Copy link
Copy Markdown

@xistadi xistadi commented Apr 5, 2026

Popen is opened without text=True so stdin is in binary mode. communicate(input=...) must receive bytes, not str. Fixes Python 3.11+ TypeError: memoryview requires bytes, not str.

Fixes #1847

SigrokDriver.stop() calls self._process.communicate(input="q"), but
Popen is created without text=True, so stdin is in binary mode.
On Python 3.11+, this raises:
TypeError: memoryview: a bytes-like object is required, not 'str'
Fix: pass b"q" instead of "q".

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 45.8%. Comparing base (3912486) to head (bda43fd).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/sigrokdriver.py 0.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1850   +/-   ##
======================================
  Coverage    45.8%   45.8%           
======================================
  Files         182     182           
  Lines       14718   14718           
======================================
  Hits         6743    6743           
  Misses       7975    7975           
Flag Coverage Δ
3.10 45.8% <0.0%> (ø)
3.11 45.8% <0.0%> (ø)
3.12 45.8% <0.0%> (ø)
3.13 45.7% <0.0%> (ø)
3.14 45.7% <0.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Emantor
Copy link
Copy Markdown
Member

Emantor commented Apr 7, 2026

Hi, you will need to fix the DCO error by adding your Signed-off-by, see DCO site.

Popen is opened without text=True so stdin is in binary mode.
communicate(input=...) must receive bytes, not str.
Fixes Python 3.11+ TypeError: memoryview requires bytes, not str.

Fixes labgrid-project#1847

Signed-off-by: xistadi <xistadi@users.noreply.github.com>
@xistadi xistadi force-pushed the fix/sigrok-stop-bytes-input branch from f328d2d to bda43fd Compare April 7, 2026 16:17
@xistadi
Copy link
Copy Markdown
Author

xistadi commented Apr 7, 2026

Hi, you will need to fix the DCO error by adding your Signed-off-by, see DCO site.

Hey! Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SigrokDriver.stop() passes str to Popen.communicate() with binary stdin (Python 3.11+)

2 participants