Bug report
|
name = name.strip() |
|
if not name or name in ('0.0.0.0', '::'): |
|
name = gethostname() |
|
try: |
|
hostname, aliases, ipaddrs = gethostbyaddr(name) |
When 0.0.0.0, ::, or empty string is passed into socket.get_fqdn(name), instead of returning gethostname(), it performs a host name lookup using the hostname retrieved from gethostname(), and returns the result.
This differs from the documentation, which states
If name was empty, '0.0.0.0' or '::', hostname from gethostname() is returned.
Your environment
- CPython versions tested on: Python 3.13.0a0 (heads/main:01e1a60, Jul 7 2023, 11:22:09)
- Operating system and architecture: Pop!_OS 22.04 on x86_64
Linked PRs
Bug report
cpython/Lib/socket.py
Lines 791 to 795 in e1d45b8
When
0.0.0.0,::, or empty string is passed intosocket.get_fqdn(name), instead of returninggethostname(), it performs a host name lookup using the hostname retrieved fromgethostname(), and returns the result.This differs from the documentation, which states
Your environment
Linked PRs