Skip to content

Conversation

@miss-islington
Copy link
Contributor

IPv*Network and IPv*Interface constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the ipaddress.ip_* helper because of the %-formatting now expecting several arguments:

In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
    ...
TypeError: not all arguments converted during string formatting

Compared to:

In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
    ...
NetmaskValueError: 'foo' is not a valid netmask

Use an f-string to make sure the error is always properly formatted.

Co-authored-by: Jelle Zijlstra jelle.zijlstra@gmail.com
(cherry picked from commit 52dc9c3)

Co-authored-by: Thomas Cellerier thomascellerier@gmail.com

…rk,interface} helper functions (pythonGH-30642)

`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the `ipaddress.ip_*` helper because of the %-formatting now expecting several arguments:

	In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
        ...
	TypeError: not all arguments converted during string formatting

Compared to:

	In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
        ...
	NetmaskValueError: 'foo' is not a valid netmask

Use an f-string to make sure the error is always properly formatted.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 52dc9c3)

Co-authored-by: Thomas Cellerier <thomascellerier@gmail.com>
@miss-islington
Copy link
Contributor Author

@thomascellerier and @JelleZijlstra: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@thomascellerier and @JelleZijlstra: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@thomascellerier and @JelleZijlstra: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 020f5c4 into python:3.9 May 3, 2022
@miss-islington miss-islington deleted the backport-52dc9c3-3.9 branch May 3, 2022 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants