Xuanwo opened a new pull request, #8832: URL: https://github.com/apache/opendal/pull/8832
# Which issue does this PR close? None. This fixes a Python binding panic found when calling `Operator.open()` or `AsyncOperator.open()` with a read range whose `offset + size` exceeds `u64::MAX`. # Rationale for this change `Operator::open` and `AsyncOperator::open` in `bindings/python/src/operator.rs` converted the user-supplied `BytesRange` via `range.to_range()` before passing it to `reader.into_std_read(...)` and `reader.into_futures_async_read(...)`. `BytesRange::to_range()` panics when `offset + size` overflows `u64::MAX`, which PyO3 surfaces as `pyo3_runtime.PanicException` (a `BaseException` that bypasses `except Exception:`) instead of `opendal.exceptions.RangeNotSatisfied`. Both `into_std_read` and `into_futures_async_read` already accept `impl Into<BytesRange>` directly and validate the range in `ReadContext::parse_into_range`, returning `ErrorKind::RangeNotSatisfied` on overflow. # What changes are included in this PR? - Pass `BytesRange` directly to `reader.into_std_read(range)` in `Operator::open` and `reader.into_futures_async_read(range)` in `AsyncOperator::open`, removing the panicking `range.to_range()` calls. - Audited `bindings/python/src/` for any remaining `.to_range()` calls on user-supplied ranges; none remain. - Add memory-backed sync and async regression tests in `bindings/python/tests/test_read.py` verifying that overflowing `(offset, size)` ranges in `open()` (and `read()`) raise `opendal.exceptions.RangeNotSatisfied`. # Are there any user-facing changes? Calling `Operator.open(..., "rb", offset=..., size=...)` or `await AsyncOperator.open(..., "rb", offset=..., size=...)` when `offset + size` exceeds `u64::MAX` now raises `opendal.exceptions.RangeNotSatisfied` instead of `pyo3_runtime.PanicException`. # Breaking changes # AI Usage Statement - Harness: T3 Code with the pi coding agent - Model: Gemini 4 Neon - Effort: high - Role: Audited `bindings/python/src/` for `BytesRange::to_range()` calls, replaced them with direct `BytesRange` forwarding in `Operator::open` and `AsyncOperator::open`, added sync and async regression tests, and ran Rust and Python lint/test checks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
