You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SystemError buffer overflow on Python 3.14+ and add Python 3.14 support (#351)
* Fix SystemError buffer overflow on Python 3.14+ and add Python 3.14 support
This commit addresses issue Backblaze#1119 where B2 CLI crashes with SystemError
on Python 3.14+ due to a buffer overflow bug in the rst2ansi dependency.
Changes:
- Add try-except handler in arg_parser.py to catch SystemError from rst2ansi
- Fall back to plain text formatting when rst2ansi fails
- Add integration test to verify the fix works with real PTY on Python 3.14
- Add dedicated nox session (integration_pty) for PTY tests without xdist
- Add Python 3.14 to noxfile.py, CI matrix, and pyproject.toml
The root cause is in rst2ansi's get_terminal_size() which passes a 4-byte
buffer to TIOCGWINSZ ioctl instead of the required 8 bytes. Python 3.14
enforces stricter buffer validation, triggering the error.
FixesBackblaze#1119
* Run PTY test directly in CI without xdist, remove dedicated nox session
The PTY test doesn't work properly with pytest-xdist parallelization.
Instead of a dedicated nox session, run it directly in CI on Python 3.14
without xdist to properly test the buffer overflow fix.
* Fix CI condition syntax for PTY test
The condition needs to be wrapped in ${{ }} for proper evaluation.
* Remove separate PTY CI step - regular integration tests catch the bug
The test_help_with_tty test works correctly with pytest-xdist in CI,
so we don't need a separate step. Updated docstring to note that
local execution may not trigger the bug due to environment differences.
* Use skipif decorator directly, consistent with repo pattern
* Simplify test docstring
* Extract patched_spawn to test/helpers.py for reuse
Move pexpect wrapper with improved error messages from test_autocomplete
to shared helpers module, and use it in test_help PTY test.
* Filter resource_tracker warnings in integration tests
Python 3.14+ emits multiprocessing resource_tracker warnings about
leaked semaphores during test subprocess cleanup. These warnings appear
in stderr and cause test assertions to fail. Filter them out the same
way we already filter DeprecationWarnings.
Fixes integration test failures on Python 3.14.
Fixed SystemError buffer overflow crash on Python 3.14+ caused by rst2ansi's terminal size detection bug. The CLI now gracefully handles this error and continues to function normally.
0 commit comments