Skip to content

Fix the documented type of IPv4Address.ipv6_mapped - #157887

Merged
StanFromIreland merged 1 commit into
python:mainfrom
Prafyl:docs/ipaddress-ipv6-mapped
Sep 21, 2026
Merged

StanFromIreland merged 1 commit into
python:mainfrom
Prafyl:docs/ipaddress-ipv6-mapped

Conversation

@Prafyl

@Prafyl Prafyl commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

The docs for IPv4Address.ipv6_mapped in Doc/library/ipaddress.rst say it is an

:class:IPv4Address object representing the IPv4-mapped IPv6 address.

but it returns an IPv6Address:

>>> import ipaddress
>>> ipaddress.IPv4Address('192.0.2.1').ipv6_mapped
IPv6Address('::ffff:192.0.2.1')

The implementation is return IPv6Address(f'::ffff:{self}') and the docstring already says "Return the IPv4-mapped IPv6 address", so its just the class name in the docs thats wrong. An IPv4-mapped IPv6 address cant really be an IPv4Address anyway.

Docs only, one word, no behaviour change. ipv6_mapped was added in 3.13 so this applies to 3.13 onwards.

It is documented as an IPv4Address object, but it returns an
IPv6Address, as its own docstring says.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34668605 | 📁 Comparing 7d2ebd9 against main (e9ae46f)

  🔍 Preview build  

1 file changed
± library/ipaddress.html

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StanFromIreland StanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 21, 2026
@StanFromIreland
StanFromIreland merged commit 34cff00 into python:main Sep 21, 2026
49 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @Prafyl for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Sep 21, 2026
@bedevere-app

bedevere-app Bot commented Sep 21, 2026

Copy link
Copy Markdown

GH-157918 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 21, 2026
@bedevere-app

bedevere-app Bot commented Sep 21, 2026

Copy link
Copy Markdown

GH-157919 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 21, 2026
@bedevere-app

bedevere-app Bot commented Sep 21, 2026

Copy link
Copy Markdown

GH-157920 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants