Xuanwo opened a new pull request, #8869: URL: https://github.com/apache/opendal/pull/8869
# Which issue does this PR close? <!-- No tracking issue; fixes two locally-reproduced defects in bindings/python. --> # Rationale for this change 1. `opendal.layers.ConcurrentLimitLayer(0)` constructs `opendal::layers::ConcurrentLimitLayer::new(0)` with a 0-permit semaphore that can never grant a permit, permanently deadlocking both `Operator` and `AsyncOperator` operations. Other layer constructors in `bindings/python` (`TimeoutLayer`, `RetryLayer`) validate invalid parameters up front and raise `ConfigInvalid`. 2. `extract_optional` in `bindings/python/src/options.rs` extracts values present in kwargs dicts without checking `v.is_none()`. Passing explicit `None` keyword arguments to `Operator.open()` or `AsyncOperator.open()` (such as `offset=None` or `content_type=None`) raised `TypeError`, inconsistent with `read()` and `write()` which treat explicit `None` as unset. # What changes are included in this PR? - Reject `limit == 0` in `ConcurrentLimitLayer::new` with `ConfigInvalid` (`"limit must be greater than 0"`), update its docstring, and regenerate `bindings/python/python/opendal/layers.pyi`. - Update `extract_optional` in `bindings/python/src/options.rs` to return `Ok(None)` when the Python value is `None`, while preserving `TypeError` for invalid non-`None` values. - Add Python tests covering `ConcurrentLimitLayer(0)` rejection and `ConcurrentLimitLayer(1)` sync/async operations on `memory`, as well as sync and async `open()` calls with explicit `None` read/write keyword arguments. # Are there any user-facing changes? - `opendal.layers.ConcurrentLimitLayer(0)` now raises `opendal.exceptions.ConfigInvalid` instead of creating a layer that deadlocks every operation. - `Operator.open()` and `AsyncOperator.open()` now accept explicit `None` values for optional keyword arguments, matching `read()` and `write()`. # Breaking changes # AI Usage Statement - Harness: pi / T3 Code - Model: Gemini 4 Neon - Effort: High - Role: Implemented both fixes, regenerated Python type stubs, added pytest coverage, and ran local formatting, linting, type checking, and test suites. No unresolved assumptions or unknowns remain. -- 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]
