Skip to content

fix: stop fixed-width string decoding at first NUL - #220

Open
SaiDeepikaKuchibhotla wants to merge 4 commits into
tektronix:mainfrom
SaiDeepikaKuchibhotla:fix/issue-211
Open

fix: stop fixed-width string decoding at first NUL#220
SaiDeepikaKuchibhotla wants to merge 4 commits into
tektronix:mainfrom
SaiDeepikaKuchibhotla:fix/issue-211

Conversation

@SaiDeepikaKuchibhotla

Copy link
Copy Markdown
Contributor

Proposed changes

Description

Fixes an issue where converting WFM waveform data to CSV could raise a UnicodeDecodeError when fixed-width axis-unit fields contained non-UTF-8 padding bytes after a valid null terminator. This can occur with WFM files generated by a Tektronix DPO71254C.
For example, the axis-unit fields may contain:

  • s followed by a null terminator and non-UTF-8 padding bytes
  • V followed by a null terminator and non-UTF-8 padding bytes

Previously, String.__str__() decoded the entire fixed-width byte field before removing trailing null characters:

self.decode("utf_8").rstrip("\x00")

Addresses #211

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Functionality update (non-breaking change which updates or changes existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • CI/CD update (an update to the CI/CD workflows, scripts, and/or configurations)
  • Documentation update (an update to enhance the user experience when reading through the docs)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have followed the guidelines in the CONTRIBUTING document
  • I have signed the CLA
  • I have checked to ensure there aren't other open Pull Requests for the same update/change
  • I have created (or updated) an Issue to track the status of this update/change and updated the link in this PR description (see above in the Proposed changes section) using the wording Addresses #<issue_number>
  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • Basic linting passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added necessary documentation (if appropriate)
  • I have updated the Changelog with a brief description of my changes

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.91%. Comparing base (27dd5d8) to head (2d1c843).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #220   +/-   ##
=======================================
  Coverage   82.91%   82.91%           
=======================================
  Files          33       33           
  Lines        2763     2763           
  Branches      359      359           
=======================================
  Hits         2291     2291           
  Misses        337      337           
  Partials      135      135           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread CHANGELOG.md
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
{python = ">=3.13", version = "^2.1"},
]
pip = "^26.0"
pip = ">=26.2.0,<27.0.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need to change this?

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results (ubuntu)

path passed skipped subtotal
tests/test_fastframe.py 24 24
tests/test_fastframe_analog_waveform.py 13 3 16
tests/test_fastframe_digital_waveform.py 11 11
tests/test_tm_data_types.py 20 1 21
tests/test_tss_reader.py 3 3
TOTAL 68 7 75
tests/test_fastframe_analog_waveform.py
('/home/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /home/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF5MhzX100From5Series.wfm')('/home/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /home/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF1MX5005Series.wfm')('/home/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /home/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF1MX1095Series.wfm')
tests/test_tm_data_types.py
('/home/runner/work/tm_data_types/tm_data_types/tests/test_tm_data_types.py', 549, 'Skipped: Skipping 1G test in GitHub Actions environment')
tests/test_tss_reader.py
('/home/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 16, 'Skipped: TSS fixture missing')('/home/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 25, 'Skipped: TSS fixture missing')('/home/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 35, 'Skipped: TSS fixture missing')

Link to workflow run

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results (windows)

path passed skipped subtotal
tests\test_fastframe.py 24 24
tests\test_fastframe_analog_waveform.py 13 3 16
tests\test_fastframe_digital_waveform.py 11 11
tests\test_tm_data_types.py 20 1 21
tests\test_tss_reader.py 3 3
TOTAL 68 7 75
tests\test_fastframe_analog_waveform.py
('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: D:\\a\\tm_data_types\\tm_data_types\\archive\\test_wfms\\FastFrame_waveforms\\FF5MhzX100From5Series.wfm')('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: D:\\a\\tm_data_types\\tm_data_types\\archive\\test_wfms\\FastFrame_waveforms\\FF1MX5005Series.wfm')('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: D:\\a\\tm_data_types\\tm_data_types\\archive\\test_wfms\\FastFrame_waveforms\\FF1MX1095Series.wfm')
tests\test_tm_data_types.py
('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_tm_data_types.py', 549, 'Skipped: Skipping 1G test in GitHub Actions environment')
tests\test_tss_reader.py
('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_tss_reader.py', 16, 'Skipped: TSS fixture missing')('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_tss_reader.py', 25, 'Skipped: TSS fixture missing')('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_tss_reader.py', 35, 'Skipped: TSS fixture missing')

Link to workflow run

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results (macos)

path passed skipped subtotal
tests/test_fastframe.py 24 24
tests/test_fastframe_analog_waveform.py 13 3 16
tests/test_fastframe_digital_waveform.py 11 11
tests/test_tm_data_types.py 20 1 21
tests/test_tss_reader.py 3 3
TOTAL 68 7 75
tests/test_fastframe_analog_waveform.py
('/Users/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /Users/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF5MhzX100From5Series.wfm')('/Users/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /Users/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF1MX5005Series.wfm')('/Users/runner/work/tm_data_types/tm_data_types/tests/test_fastframe_analog_waveform.py', 73, 'Skipped: Corpus file missing: /Users/runner/work/tm_data_types/tm_data_types/archive/test_wfms/FastFrame_waveforms/FF1MX1095Series.wfm')
tests/test_tm_data_types.py
('/Users/runner/work/tm_data_types/tm_data_types/tests/test_tm_data_types.py', 549, 'Skipped: Skipping 1G test in GitHub Actions environment')
tests/test_tss_reader.py
('/Users/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 16, 'Skipped: TSS fixture missing')('/Users/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 25, 'Skipped: TSS fixture missing')('/Users/runner/work/tm_data_types/tm_data_types/tests/test_tss_reader.py', 35, 'Skipped: TSS fixture missing')

Link to workflow run

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.

2 participants