1. 27 Oct, 2001 11 commits
    • 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
    • Tim Peters's avatar
      tuple(3,4,5,x=2) dumped core on my box. vgetargskeywords() overindexed · fd013b4a
      Tim Peters authored
      the kwlist vector whenever there was a mix of positional and keyword
      arguments, and the number of positional arguments exceeded the length
      of the kwlist vector.  If there was just one more positional arg than
      keyword, the kwlist-terminating NULL got passed to PyMapping_HasKeyString,
      which set an internal error that vgetargskeywords() then squashed (but
      it's impossible to say whether it knew it was masking an error).  If
      more than one more positional argument, it went on to pass random trash
      to PyMapping_HasKeyString, which is why the example at the start
      happened to kill the process.
      
      Pure bugfix candidate.
      fd013b4a
    • Tim Peters's avatar
      vgetargskeywords(): remove test that can't succeed. Not a bugfix, just · fa8553e9
      Tim Peters authored
      removing useless obfuscation.
      fa8553e9
  2. 26 Oct, 2001 29 commits