1. 01 Haz, 2000 3 kayıt (commit)
  2. 09 May, 2000 4 kayıt (commit)
    • Fred Drake's avatar
      Minimal change so I can add the rest of MAL's checkin message: · 785d14f9
      Fred Drake yazdı
      M.-A. Lemburg <mal@lemburg.com>:
      Fixed a core dump in PyUnicode_Format().
      785d14f9
    • Fred Drake's avatar
      M.-A. Lemburg <mal@lemburg.com>: · e4315f58
      Fred Drake yazdı
      Added support for user settable default encodings. The
      current implementation uses a per-process global which
      defines the value of the encoding parameter in case it
      is set to NULL (meaning: use the default encoding).
      e4315f58
    • Guido van Rossum's avatar
      Replace PyErr_BadArgument() error in PyInt_AsLong() with "an integer · c18a6f46
      Guido van Rossum yazdı
      is required" (we can't say more because we don't know in which context
      it is called).
      c18a6f46
    • Guido van Rossum's avatar
      Trent Mick: · b8872e61
      Guido van Rossum yazdı
      Fix the string methods that implement slice-like semantics with
      optional args (count, find, endswith, etc.) to properly handle
      indeces outside [INT_MIN, INT_MAX]. Previously the "i" formatter
      for PyArg_ParseTuple was used to get the indices. These could overflow.
      
      This patch changes the string methods to use the "O&" formatter with
      the slice_index() function from ceval.c which is used to do the same
      job for Python code slices (e.g. 'abcabcabc'[0:1000000000L]).
      b8872e61
  3. 08 May, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Trent Mick: · c682140d
      Guido van Rossum yazdı
      Fix the string methods that implement slice-like semantics with
      optional args (count, find, endswith, etc.) to properly handle
      indeces outside [INT_MIN, INT_MAX]. Previously the "i" formatter
      for PyArg_ParseTuple was used to get the indices. These could overflow.
      
      This patch changes the string methods to use the "O&" formatter with
      the slice_index() function from ceval.c which is used to do the same
      job for Python code slices (e.g. 'abcabcabc'[0:1000000000L]). slice_index()
      is renamed _PyEval_SliceIndex() and is now exported. As well, the return
      values for success/fail were changed to make slice_index directly
      usable as required by the "O&" formatter.
      
      [GvR: shouldn't a similar patch be applied to unicodeobject.c?]
      c682140d
  4. 05 May, 2000 1 kayıt (commit)
  5. 04 May, 2000 1 kayıt (commit)
  6. 03 May, 2000 4 kayıt (commit)
  7. 02 May, 2000 1 kayıt (commit)
  8. 01 May, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · 0e4f657a
      Guido van Rossum yazdı
      Fixed \OOO interpretation for Unicode objects. \777 now
      correctly produces the Unicode character with ordinal 511.
      0e4f657a
  9. 27 Nis, 2000 3 kayıt (commit)
  10. 26 Nis, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      potentially useless optimization · 9e392e24
      Jeremy Hylton yazdı
      The previous checkin (2.84) added a PyErr_Format call that made the
      cost of raising an AttributeError much more expensive.  In general
      this doesn't matter, except that checks for __init__ and
      __del__ methods, where exceptions are caught and cleared in C, also
      got much more expensive.
      
      The fix is to split instance_getattr1 into two calls:
      
      instance_getattr2 checks the instance and the class for the attribute
      and returns it or returns NULL on error.  It does not raise an
      exception.
      
      instance_getattr1 does rexec checks, then calls instance_getattr2.  It
      raises an exception if instance_getattr2 returns NULL.
      
      PyInstance_New and instance_dealloc now call instance_getattr2
      directly.
      9e392e24
  11. 24 Nis, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Christian Tismer -- total rewrite on trashcan code. · e92e610a
      Guido van Rossum yazdı
      Improvements:
      - does no longer need any extra memory
      - has no relationship to tstate
      - works in debug mode
      - can easily be modified for free threading (hi Greg:)
      
      Side effects:
      Trashcan does change the order of object destruction.
      Prevending that would be quite an immense effort, as
      my attempts have shown. This version works always
      the same, with debug mode or not. The slightly
      changed destruction order should therefore be no problem.
      
      Algorithm:
      While the old idea of delaying the destruction of some
      obejcts at a certain recursion level was kept, we now
      no longer aloocate an object to hold these objects.
      The delayed objects are instead chained together
      via their ob_type field. The type is encoded via
      ob_refcnt. When it comes to the destruction of the
      chain of waiting objects, the topmost object is popped
      off the chain and revived with type and refcount 1,
      then it gets a normal Py_DECREF.
      
      I am confident that this solution is near optimum
      for minimizing side effects and code bloat.
      e92e610a
  12. 21 Nis, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Patch by Charles G Waldman to avoid a sneaky memory leak in · 5ce78f8e
      Guido van Rossum yazdı
      _PyTuple_Resize().  In addition, a change suggested by Jeremy Hylton
      to limit the size of the free lists is also merged into this patch.
      
      Charles wrote initially:
      
      """
      Test Case:  run the following code:
      
      class Nothing:
          def __len__(self):
              return 5
          def __getitem__(self, i):
              if i < 3:
                  return i
              else:
                  raise IndexError, i
      
      def g(a,*b,**c):
          return
      
      for x in xrange(1000000):
          g(*Nothing())
      
      
      and watch Python's memory use go up and up.
      
      
      Diagnosis:
      
      The analysis begins with the call to PySequence_Tuple at line 1641 in
      ceval.c - the argument to g is seen to be a sequence but not a tuple,
      so it needs to be converted from an abstract sequence to a concrete
      tuple.  PySequence_Tuple starts off by creating a new tuple of length
      5 (line 1122 in abstract.c).  Then at line 1149, since only 3 elements
      were assigned, _PyTuple_Resize is called to make the 5-tuple into a
      3-tuple.  When we're all done the 3-tuple is decrefed, but rather than
      being freed it is placed on the free_tuples cache.
      
      The basic problem is that the 3-tuples are being added to the cache
      but never picked up again, since _PyTuple_Resize doesn't make use of
      the free_tuples cache.  If you are resizing a 5-tuple to a 3-tuple and
      there is already a 3-tuple in free_tuples[3], instead of using this
      tuple, _PyTuple_Resize will realloc the 5-tuple to a 3-tuple.  It
      would more efficient to use the existing 3-tuple and cache the
      5-tuple.
      
      By making _PyTuple_Resize aware of the free_tuples (just as
      PyTuple_New), we not only save a few calls to realloc, but also
      prevent this misbehavior whereby tuples are being added to the
      free_tuples list but never properly "recycled".
      """
      
      And later:
      
      """
      This patch replaces my submission of Sun, 16 Apr and addresses Jeremy
      Hylton's suggestions that we also limit the size of the free tuple
      list.  I chose 2000 as the maximum number of tuples of any particular
      size to save.
      
      There was also a problem with the previous version of this patch
      causing a core dump if Python was built with Py_TRACE_REFS.  This is
      fixed in the below version of the patch, which uses tupledealloc
      instead of _Py_Dealloc.
      """
      5ce78f8e
  13. 14 Nis, 2000 1 kayıt (commit)
  14. 11 Nis, 2000 3 kayıt (commit)
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · f0b7b04a
      Guido van Rossum yazdı
      The maxsplit functionality in .splitlines() was replaced by the keepends
      functionality which allows keeping the line end markers together
      with the string.
      
      Added support for '%r' % obj: this inserts repr(obj) rather
      than str(obj).
      f0b7b04a
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · dc742b31
      Guido van Rossum yazdı
      Added a few missing whitespace Unicode char mappings.
      Thanks to Brian Hooper.
      dc742b31
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · 86662914
      Guido van Rossum yazdı
      The maxsplit functionality in .splitlines() was replaced by the keepends
      functionality which allows keeping the line end markers together
      with the string.
      86662914
  15. 10 Nis, 2000 6 kayıt (commit)
    • Guido van Rossum's avatar
      Simple optimization by Christian Tismer, who gives credit to Lenny · ba71a247
      Guido van Rossum yazdı
      Kneler for reporting this issue: long_mult() is faster when the
      smaller argument is on the left.  Swap the arguments accordingly.
      ba71a247
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · fd4b957b
      Guido van Rossum yazdı
      * New exported API PyUnicode_Resize()
      
      * The experimental Keep-Alive optimization was turned back
        on after some tweaks to the implementation. It should now
        work without causing core dumps... this has yet to tested
        though (switching it off is easy: see the unicodeobject.c
        file for details).
      
      * Fixed a memory leak in the Unicode freelist cleanup code.
      
      * Added tests to correctly process the return code from
        _PyUnicode_Resize().
      
      * Fixed a bug in the 'ignore' error handling routines
        of some builtin codecs. Added test cases for these to
        test_unicode.py.
      fd4b957b
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · 90daa875
      Guido van Rossum yazdı
      * string_contains now calls PyUnicode_Contains() only when the other
        operand is a Unicode string (not whenever it's not a string).
      
      * New format style '%r' inserts repr(arg) instead of str(arg).
      
      * '...%s...' % u"abc" now coerces to Unicode just like
        string methods. Care is taken not to reevaluate already formatted
        arguments -- only the first Unicode object appearing in the
        argument mapping is looked up twice. Added test cases for
        this to test_unicode.py.
      90daa875
    • Guido van Rossum's avatar
      Marc-Andre Lemburg: · b244f695
      Guido van Rossum yazdı
      * TypeErrors during comparing of mixed type arguments including
        a Unicode object are now masked (just like they are for all
        other combinations).
      b244f695
    • Guido van Rossum's avatar
      Mark Hammond: · 5f8b12f2
      Guido van Rossum yazdı
      In line with a similar checkin to object.c a while ago, this patch
      gives a more descriptive error message for an attribute error on a
      class instance.  The message now looks like:
      
      AttributeError: 'Descriptor' instance has no attribute 'GetReturnType'
      5f8b12f2
    • Guido van Rossum's avatar
      Skip Montanaro: add string precisions to calls to PyErr_Format · 5db862dd
      Guido van Rossum yazdı
      to prevent possible buffer overruns.
      5db862dd
  16. 06 Nis, 2000 1 kayıt (commit)
  17. 05 Nis, 2000 2 kayıt (commit)
    • Guido van Rossum's avatar
      34888ed6
    • Guido van Rossum's avatar
      Marc-Andre's third try at this bulk patch seems to work (except that · 9e896b37
      Guido van Rossum yazdı
      his copy of test_contains.py seems to be broken -- the lines he
      deleted were already absent).  Checkin messages:
      
      
      New Unicode support for int(), float(), complex() and long().
      
      - new APIs PyInt_FromUnicode() and PyLong_FromUnicode()
      - added support for Unicode to PyFloat_FromString()
      - new encoding API PyUnicode_EncodeDecimal() which converts
        Unicode to a decimal char* string (used in the above new
        APIs)
      - shortcuts for calls like int(<int object>) and float(<float obj>)
      - tests for all of the above
      
      Unicode compares and contains checks:
      - comparing Unicode and non-string types now works; TypeErrors
        are masked, all other errors such as ValueError during
        Unicode coercion are passed through (note that PyUnicode_Compare
        does not implement the masking -- PyObject_Compare does this)
      - contains now works for non-string types too; TypeErrors are
        masked and 0 returned; all other errors are passed through
      
      Better testing support for the standard codecs.
      
      Misc minor enhancements, such as an alias dbcs for the mbcs codec.
      
      Changes:
      - PyLong_FromString() now applies the same error checks as
        does PyInt_FromString(): trailing garbage is reported
        as error and not longer silently ignored. The only characters
        which may be trailing the digits are 'L' and 'l' -- these
        are still silently ignored.
      - string.ato?() now directly interface to int(), long() and
        float(). The error strings are now a little different, but
        the type still remains the same. These functions are now
        ready to get declared obsolete ;-)
      - PyNumber_Int() now also does a check for embedded NULL chars
        in the input string; PyNumber_Long() already did this (and
        still does)
      
      Followed by:
      
      Looks like I've gone a step too far there... (and test_contains.py
      seem to have a bug too).
      
      I've changed back to reporting all errors in PyUnicode_Contains()
      and added a few more test cases to test_contains.py (plus corrected
      the join() NameError).
      9e896b37
  18. 31 Mar, 2000 1 kayıt (commit)
  19. 30 Mar, 2000 1 kayıt (commit)
  20. 28 Mar, 2000 1 kayıt (commit)
  21. 25 Mar, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Christian Tismer: · 13ff8eb4
      Guido van Rossum yazdı
      Added "better safe than sorry" patch to the new
      trashcan code in object.c, to ensure that tstate
      is not touched when it might be undefined.
      13ff8eb4
  22. 20 Mar, 2000 1 kayıt (commit)
    • Barry Warsaw's avatar
      On 17-Mar-2000, Marc-Andre Lemburg said: · 51ac5803
      Barry Warsaw yazdı
          Attached you find an update of the Unicode implementation.
      
          The patch is against the current CVS version. I would appreciate
          if someone with CVS checkin permissions could check the changes
          in.
      
          The patch contains all bugs and patches sent this week and also
          fixes a leak in the codecs code and a bug in the free list code
          for Unicode objects (which only shows up when compiling Python
          with Py_DEBUG; thanks to MarkH for spotting this one).
      51ac5803