1. 29 Oct, 2001 18 commits
  2. 28 Oct, 2001 3 commits
  3. 27 Oct, 2001 19 commits
    • Guido van Rossum's avatar
      0232a29b
    • Guido van Rossum's avatar
      Made SocketType and socket the same thing: a subclassable type whose · 13e58864
      Guido van Rossum authored
      constructor acts just like socket() before.  All three arguments have
      a sensible default now; socket() is equivalent to
      socket(AF_INET, SOCK_STREAM).
      
      One minor issue: the socket() function and the SocketType had
      different doc strings; socket.__doc__ gave the signature,
      SocketType.__doc__ gave the methods.  I've merged these for now, but
      maybe the list of methods is no longer necessary since it can easily
      be recovered through socket.__dict__.keys().  The problem with keeping
      it is that the total doc string is a bit long (34 lines -- it scrolls
      of a standard tty screen).
      
      Another general issue with the socket module is that it's a big mess.
      There's pages and pages of random platform #ifdefs, and the naming
      conventions are totally wrong: it uses Py prefixes and CapWords for
      static functions.  That's a cleanup for another day...  (Also I think
      the big starting comment that summarizes the API can go -- it's a
      repeat of the docstring.)
      13e58864
    • Guido van Rossum's avatar
      SF patch #475657 (Dietmar Schwertberger) · 58be0670
      Guido van Rossum authored
      RISCOS/Makefile:
      include structseq and weakrefobject;
      changes to keep command line length below 2048
      
      RISCOS/Modules/riscosmodule.c:
      typos from the stat structseq patch
      
      Include/pyport.h:
      don't re-#define __attribute__(__x) on RISC OS as it is already defined in c library
      58be0670
    • Tim Peters's avatar
      SF bug #475327: type() produces incorrect error msg · f1910020
      Tim Peters authored
      object.h:  Added PyType_CheckExact macro.
      
      typeobject.c, type_new():
      
      + Use the new macro.
      + Assert that the arguments have the right types rather than do incomplete
        runtime checks "sometimes".
      + If this isn't the 1-argument flavor() of type, and there aren't 3 args
        total, produce a "types() takes 1 or 3 args" msg before
        PyArg_ParseTupleAndKeywords produces a "takes exactly 3" msg.
      f1910020
    • Tim Peters's avatar
      dictionary() constructor: · 48812620
      Tim Peters authored
      + Change keyword arg name from "x" to "items".  People passing a mapping
        object can stretch their imaginations <wink>.
      + Simplify the docstring text.
      48812620
    • Tim Peters's avatar
      vgetargskeywords() · 05518295
      Tim Peters authored
      + Squash another potential buffer overrun.
      + Simplify the keyword-arg loop by decrementing the count of keywords
        remaining instead of incrementing Yet Another Variable; also break
        out early if the number of keyword args remaining hits 0.
      
      Since I hit the function's closing curly brace with this patch, that's
      enough of this for now <wink>.
      05518295
    • Tim Peters's avatar
      vgetargskeywords: Now that it's clear that nkwlist must equal max, and · 641fb8e1
      Tim Peters authored
      we're ensuring that's true during the format parse, get rid of nkwlist.
      641fb8e1
    • Tim Peters's avatar
    • Tim Peters's avatar
      vgetargskeywords: Verify kwlist has the required length while parsing · 2689436a
      Tim Peters authored
      the format, instead of waiting until after we can overindex it by
      mistake.
      2689436a
    • Fred Drake's avatar
      PyObject_CallFunction(), PyObject_CallMethod(): Make sure we do not touch · cba31f29
      Fred Drake authored
      the va_list until we are sure we have a format string and need to use it;
      this avoid premature initialization and having to finalize it several
      different places because of error returns.
      cba31f29
    • Tim Peters's avatar
      vgetargskeywords: Removed all PyErr_Clear() calls. It's possible that · 50f7e976
      Tim Peters authored
      this routine will report an error now when it didn't before, but, if so,
      it's a legitimate error that should never have been suppressed.
      50f7e976
    • Tim Peters's avatar
      vgetargskeywords: The keywords arg is a dict (if non-NULL), so use the · 989e724a
      Tim Peters authored
      dict API everywhere on it instead of sometimes using the slower mapping
      API.
      989e724a
    • Tim Peters's avatar
      vgetargskeywords: Removed one of the mysterious PyErr_Clear() calls. · 932d8768
      Tim Peters authored
      The "need" for this was probably removed by an earlier patch that stopped
      the loop right before it from passing NULL to a dict lookup routine.
      I still haven't convinced myself that the next loop is correct, so am
      leaving the next mysterious PyErr_Clear() call in for now.
      932d8768
    • Tim Peters's avatar
      vgetargskeywords: · 9506e8f5
      Tim Peters authored
      + Generally test nkeywords against 0 instead of keywords against NULL
        (saves a little work if an empty keywords dict is passed, and is
        conceptually more on-target regardless).
      + When a call erroneously specifies a keyword argument both by position
        and by keyword name:
          - It was easy to provoke this routine into an internal buffer overrun
            by using a long argument name.  Now uses PyErr_format instead (which
            computes a safe buffer size).
          - Improved the error msg.
      9506e8f5
    • Tim Peters's avatar
      vgetargskeywords: · d1797d46
      Tim Peters authored
      + Got rid of now-redundant dict typecheck.
      + Renamed nkwds to nkwlist.  Now all the "counting" vrbls have names
        related to the things they're counting in an obvious way.
      d1797d46
    • Tim Peters's avatar
      vgetargskeywords: · 918bef0f
      Tim Peters authored
      + Renamed argslen to nargs.
      + Renamed kwlen to nkeywords.  This one was especially confusing because
        kwlen wasn't the length of the kwlist argument, but of the keywords
        argument.
      918bef0f
    • Tim Peters's avatar
      vgetargskeywords: · 437daef5
      Tim Peters authored
      + Removed now-redundant tuple typecheck.
      + Renamed "tplen" local to "argslen" (it's the length of the "args"
        argument; I suppose "tp" was for "Tim Peters should rename me
        someday <wink>).
      437daef5
    • Tim Peters's avatar
      PyArg_ParseTupleAndKeywords: return false on internal error, not -1 (I · ec317243
      Tim Peters authored
      introduced this bug just a little while ago, when *adding* internal error
      checks).
      
      vgetargskeywords:  Rewrote the section that crawls over the format string.
      + Added block comment so it won't take the next person 15 minutes to
        reverse-engineer what it's doing.
      + Lined up the "else" clauses.
      + Rearranged the ifs in decreasing order of likelihood (for speed).
      ec317243
    • Tim Peters's avatar
      PyArg_ParseTupleAndKeywords: do basic sanity checks on the arguments, · 9aacd39e
      Tim Peters authored
      and raise an error if they're insane.
      vgetargskeywords:  the same, except that since this is an internal routine,
      just assert that the arguments are sane.
      9aacd39e