Skip to content

Commit 9925248

Browse files
📜🤖 Added by blurb_it.
1 parent 63891cc commit 9925248

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This pull request addresses the issue described in `issue #129538 <https://github.com/python/cpython/issues/129538>`_, where the `IPv6Interface.ip` loses the scope ID information when accessing the IP address.
2+
3+
The problem occurs when an IPv6 address with a scope ID is converted into an `IPv6Interface` and then accessed via the `ip` property, resulting in the loss of the scope ID information. This behavior is unexpected and not documented.
4+
5+
Minimal Example Demonstrating the Issue::
6+
7+
addr = ipaddress.IPv6Address("fe80::%10")
8+
addr_with_prefix = ipaddress.IPv6Interface((addr, 64))
9+
print(addr_with_prefix.ip) # Expected: IPv6Address('fe80::%10'), Actual: IPv6Address('fe80::')
10+
11+
Changes Made:
12+
1. Fix in `IPv6Interface` Class:
13+
- Updated the `IPv6Interface` class to ensure the scope ID is preserved when converting the IP address.
14+
- Modified the `ip` property to include the scope ID in the address string.
15+
16+
2. Added Test Case:
17+
- Added a test case to verify that the scope ID is preserved when converting the IP address in the `IPv6Interface` class.
18+
19+
Tests and Documentation:
20+
- Updated the tests in `Lib/test/test_ipaddress.py` to include the new test case.
21+
- No changes to documentation as the behavior is expected and intuitive.

0 commit comments

Comments
 (0)