fix: accept str addresses in ServiceInfo.addresses under cython - #1836
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1836 +/- ##
=======================================
Coverage 99.87% 99.87%
=======================================
Files 33 33
Lines 3883 3883
Branches 567 567
=======================================
Hits 3878 3878
Misses 3 3
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bdraco
marked this pull request as ready for review
August 28, 2026 23:28
bdraco
marked this pull request as draft
August 28, 2026 23:31
bdraco
marked this pull request as ready for review
August 28, 2026 23:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under the Cython 3.3 build, assigning
ServiceInfo.addresseswith string addresses raisesTypeError: Expected bytes, got str; the pure Python build still accepts them. This restores the setter contract, which has always advertised str as well as bytes.Details
addressesconstructor kwarg were annotatedlist[bytes]; Cython 3.3 uses the element type to narrow the loop variable, so any non bytes item is rejected beforecached_ip_addressesever sees it. The annotation is nowSequence[bytes | str], matching whatcached_ip_addressesaccepts.ip_bytes_and_scope_to_addressalready handled str at runtime; its parameter type is widened to match so mypy is satisfied. Its.pxddeclares the argument asobject, so no.pxdchange is needed.Test plan
tests/services/test_info.pycovering str, bytes, and mixed lists for both the setter and the constructor kwarg, plus a TypeError case for an invalid addresstests/services/test_info.py,tests/utils/test_ipaddress.pyandtests/test_core.pypass on the Cython build (REQUIRE_CYTHON=1 poetry install)