[New-bugs-announce] [issue6944] socket.getnameinfo raises SystemError on bogus input

Marien Zwart report at bugs.python.org
Sat Sep 19 07:36:10 CEST 2009


New submission from Marien Zwart <m_zwart at 123mail.org>:

socket.getnameinfo passes a PyObject* to PyArg_ParseTuple without
checking if it's a tuple first. That means it raises SystemError on
invalid input where TypeError would make more sense:

>>> socket.getnameinfo('localhost', 0)
SystemError: new style getargs format but argument is not a tuple

An explicit check for TypeError seems like the best way to fix this.
Patch (against Python 3.1.1, but it looked like this applies easily to
other branches too) attached, which also removes a bit of dead code.

----------
components: Extension Modules
files: diff.patch
keywords: patch
messages: 92858
nosy: marienz
severity: normal
status: open
title: socket.getnameinfo raises SystemError on bogus input
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file14929/diff.patch

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


More information about the New-bugs-announce mailing list