1. 17 Eki, 2001 23 kayıt (commit)
  2. 16 Eki, 2001 17 kayıt (commit)
    • Jeremy Hylton's avatar
      Undo needless INCREF chicanery introduced by SF patch #450702. · ba3dd999
      Jeremy Hylton yazdı
          Apparently this patch (rev 2.41) replaced all the good old "s#"
          formats in PyArg_ParseTuple() with "S".  Then it did
          PyString_FromStringAndSize() to get back the values setup by the
          "s#" format.  It also incref'd and decref'd the string obtained by
          "S" even though the argument tuple had a reference to it.
      
      Replace PyString_AsString() calls with PyString_AS_STRING().
      
          A good rule of thumb -- if you never check the return value of
          PyString_AsString() to see if it's NULL, you ought to be using the
          macro <wink>.
      ba3dd999
    • Jeremy Hylton's avatar
      Simplify and fix error handling for most cases. · 9d620d01
      Jeremy Hylton yazdı
      Many functions used a local variable called return_error, which was
      initialized to zero.  If an error occurred, it was set to true.  Most
      of the code paths checked were only executed if return_error was
      false.  goto is clearer.
      
      The code also seemed to be written under the curious assumption that
      calling Py_DECREF() on a local variable would assign the variable to
      NULL.  As a result, more of the error-exit code paths returned an
      object that had a reference count of zero instead of just returning
      NULL.  Fixed the code to explicitly assign NULL after the DECREF.
      
      A bit more reformatting, but not much.
      
      XXX Need a much better test suite for zlib, since it the current tests
      don't exercise any of this broken code.
      9d620d01
    • Tim Peters's avatar
      SF bug [#471111] inspect.getframeinfo() needs docs. · 61acf067
      Tim Peters yazdı
      TeX-ified its docstring.
      61acf067
    • Jeremy Hylton's avatar
      More reformatting. · 49900000
      Jeremy Hylton yazdı
      49900000
    • Jeremy Hylton's avatar
      Add zlib_error() helper. · 0965e084
      Jeremy Hylton yazdı
      It sets a ZlibError exception, using the msg from the z_stream pointer
      if one is available.
      0965e084
    • Guido van Rossum's avatar
      Fix a bug in the previous checkin. The wrong bootstrap function was · 2c40adb1
      Guido van Rossum yazdı
      passed to _beginthread().
      2c40adb1
    • Guido van Rossum's avatar
    • Guido van Rossum's avatar
      SF patch #471852 (anonymous) notes that getattr(obj, name, default) · d892357b
      Guido van Rossum yazdı
      masks any exception, not just AttributeError.  Fix this.
      d892357b
    • Jeremy Hylton's avatar
      Remove many calls to set MemoryError exceptions. · 9bc9d66e
      Jeremy Hylton yazdı
      When PyString_FromStringAndSize() and _PyString_Resize() fail, they
      set an exception.  There's no need to set a new exception.
      9bc9d66e
    • Jeremy Hylton's avatar
      Reformat! · 9714f99d
      Jeremy Hylton yazdı
      Consistently indent 4 spaces.
      Use whitespace around operators.
      Put braces in the right places.
      9714f99d
    • Guido van Rossum's avatar
      Partial patch from SF #452266, by Jason Petrone. · 3c28863e
      Guido van Rossum yazdı
      This changes Pythread_start_thread() to return the thread ID, or -1
      for an error.  (It's technically an incompatible API change, but I
      doubt anyone calls it.)
      3c28863e
    • Jeremy Hylton's avatar
      Add note about new zlib feature. · 6f543b60
      Jeremy Hylton yazdı
      6f543b60
    • Jeremy Hylton's avatar
      [ #403753 ] zlib decompress; uncontrollable memory usage · 511e2cac
      Jeremy Hylton yazdı
      Mostly by Toby Dickenson and Titus Brown.
      
      Add an optional argument to a decompression object's decompress()
      method.  The argument specifies the maximum length of the return
      value.  If the uncompressed data exceeds this length, the excess data
      is stored as the unconsumed_tail attribute.  (Not to be confused with
      unused_data, which is a separate issue.)
      
      Difference from SF patch: Default value for unconsumed_tail is ""
      rather than None.  It's simpler if the attribute is always a string.
      511e2cac
    • Guido van Rossum's avatar
      Document required return values -1, 0, 1 for tp_compare handler, as · 7a59445e
      Guido van Rossum yazdı
      suggested in SF patch #424475.  Also document exception return.
      7a59445e
    • Tim Peters's avatar
      SF bug [#468061] __str__ ignored in str subclass. · c993315b
      Tim Peters yazdı
      object.c, PyObject_Str:  Don't try to optimize anything except exact
      string objects here; in particular, let str subclasses go thru tp_str,
      same as non-str objects.  This allows overrides of tp_str to take
      effect.
      
      stringobject.c:
      + string_print (str's tp_print):  If the argument isn't an exact string
        object, get one from PyObject_Str.
      
      + string_str (str's tp_str):  Make a genuine-string copy of the object if
        it's of a proper str subclass type.  str() applied to a str subclass
        that doesn't override __str__ ends up here.
      
      test_descr.py:  New str_of_str_subclass() test.
      c993315b
    • Guido van Rossum's avatar
      Add Shane. · dfefc06f
      Guido van Rossum yazdı
      dfefc06f
    • Guido van Rossum's avatar
      SF patch #471839: Bug when extensions import extensions (Shane Hathaway) · ae9e7960
      Guido van Rossum yazdı
          When an extension imports another extension in its
          initXXX() function, the variable _Py_PackageContext is
          prematurely reset to NULL. If the outer extension then
          calls Py_InitModule(), the extension is installed in
          sys.modules without its package name. The
          manifestation of this bug is a "SystemError:
          _PyImport_FixupExtension: module <package>.<extension>
          not loaded".
      
          To fix this, importdl.c just needs to retain the old
          value of _Py_PackageContext and restore it after the
          initXXX() method is called. The attached patch does this.
      
          This patch applies to Python 2.1.1 and the current CVS.
      ae9e7960