A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-December/010843.html below:

[Python-Dev] Cryptic error messages

[Python-Dev] Cryptic error messagesKa-Ping Yee ping@lfw.org
Fri, 1 Dec 2000 02:23:56 -0800 (PST)
An attempt to use sockets for the first time yesterday left a
friend of mine bewildered:

    >>> import socket
    >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    >>> s.connect('localhost:234')
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    TypeError: 2-sequence, 13-sequence
    >>> 

"What the heck does '2-sequence, 13-sequence' mean?" he rightfully asked.


I see in getargs.c (line 275) that this type of message is documented:

    /* Convert a tuple argument.
    [...]
       If the argument is invalid:
    [...]
          *msgbuf contains an error message, whose format is:
             "<typename1>, <typename2>", where:
                <typename1> is the name of the expected type, and
                <typename2> is the name of the actual type,
             (so you can surround it by "expected ... found"),
          and msgbuf is returned.
    */

It's clear that the socketmodule is not prepending "expected" and
appending "found", as the author of converttuple intended.

But when i grepped through the source code, i couldn't find anyone
applying this "expected %s found" % msgbuf convention outside of
getargs.c.  Is it really in use?

Could we just change getargs.c so that converttuple() returns a
message like "expected ..., got ..." instead of seterror()?

Additionally it would be nice to say '13-character string' instead
of '13-sequence'...


-- ?!ng

"All models are wrong; some models are useful."
    -- George Box




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