[issue9660] PEP 383: socket module doesn't handle undecodable protocol or service names

David Watson report at bugs.python.org
Sun Aug 22 20:26:02 CEST 2010


New submission from David Watson <baikie at users.sourceforge.net>:

The protocol and service/port number databases are typically
implemented as text files on Unix and can contain non-ASCII names
in any encoding (presumably for local services), but the socket
module tries to decode them as strict UTF-8.  In particular,
getservbyport() and getnameinfo() will raise UnicodeError when
this fails.

Attached is a patch for 3.2 to use the file system encoding and
surrogateescape handler instead, in line with PEP 383.  This is
what Python already does for the passwd and group databases, and
it will allow protocol and service names to be given correctly as
command line arguments.

----------
components: Extension Modules
files: proto-service-pep383-3.2.diff
keywords: patch
messages: 114687
nosy: baikie
priority: normal
severity: normal
status: open
title: PEP 383: socket module doesn't handle undecodable protocol or service names
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file18608/proto-service-pep383-3.2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9660>
_______________________________________


More information about the Python-bugs-list mailing list