A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-January/019314.html below:

[Python-Dev] Re: PyArg_ParseTuple

[Python-Dev] Re: PyArg_ParseTuple [Python-Dev] Re: PyArg_ParseTupleGuido van Rossum guido@python.org
Wed, 09 Jan 2002 10:30:50 -0500
> Offtopic again: PyArg_ParseTuple() is also nice for parsing a tuple
> in C code, which you for example receive as a result from calling a method.
> IIRC the only problem here is that it may throw weird error
> messages if the object is not a tuple.
> Instead of 'TypeError: unpack non-sequence' you get a
> 'SystemError: new style getargs format but argument is not a tuple'.
> 
> Should this be changed?

No, you should test for PyTuple_Check before calling
PyArg_ParseTuple.  Why do you think it's called that?

The other problem with this use, alas, is that when it catches a
legitimate error, the error it reports is confusing if you don't
change it.  Example:

>>> from socket import *
>>> s = socket(AF_INET, SOCK_STREAM)
>>> s.bind(())
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: getsockaddrarg() takes exactly 2 arguments (0 given)
>>> 

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4