1. 26 Eki, 2001 1 kayıt (commit)
  2. 22 Eki, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      Fix for SF bug #472940: can't getattr() attribute shown by dir() · 56ff387a
      Guido van Rossum yazdı
      There really isn't a good reason for instance method objects to have
      their own __dict__, __doc__ and __name__ properties that just delegate
      the request to the function (callable); the default attribute behavior
      already does this.
      
      The test suite had to be fixed because the error changes from
      TypeError to AttributeError.
      56ff387a
  3. 17 Eki, 2001 1 kayıt (commit)
  4. 30 Eyl, 2001 1 kayıt (commit)
  5. 20 Eyl, 2001 2 kayıt (commit)
    • Guido van Rossum's avatar
      Add optional docstrings to getset descriptors. Fortunately, there's · 32d34c80
      Guido van Rossum yazdı
      no backwards compatibility to worry about, so I just pushed the
      'closure' struct member to the back -- it's never used in the current
      code base (I may eliminate it, but that's more work because the getter
      and setter signatures would have to change.)
      
      As examples, I added actual docstrings to the getset attributes of a
      few types: file.closed, xxsubtype.spamdict.state.
      32d34c80
    • Guido van Rossum's avatar
      Add optional docstrings to member descriptors. For backwards · 6f799376
      Guido van Rossum yazdı
      compatibility, this required all places where an array of "struct
      memberlist" structures was declared that is referenced from a type's
      tp_members slot to change the type of the structure to PyMemberDef;
      "struct memberlist" is now only used by old code that still calls
      PyMember_Get/Set.  The code in PyObject_GenericGetAttr/SetAttr now
      calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef
      argument.
      
      As examples, I added actual docstrings to the attributes of a few
      types: file, complex, instance method, super, and xxsubtype.spamlist.
      
      Also converted the symtable to new style getattr.
      6f799376
  6. 18 Eyl, 2001 2 kayıt (commit)
    • Martin v. Löwis's avatar
      cf95f9ca
    • Guido van Rossum's avatar
      Redo the PyMethod attributes using a dir()-friendly approach, creating · f0b35e15
      Guido van Rossum yazdı
      descriptors for each attribute.  The getattr() implementation is
      similar to PyObject_GenericGetAttr(), but delegates to im_self instead
      of looking in __dict__; I couldn't do this as a wrapper around
      PyObject_GenericGetAttr().
      
      XXX A problem here is that this is a case of *delegation*.  dir()
      doesn't see exactly the same attributes that are actually defined;
      e.g. if the delegate is a Python function object, it supports
      attributes like func_code etc., but these are not visible to dir(); on
      the other hand, dynamic function attributes (stored in the function's
      __dict__) *are* visible to dir().  Maybe we need a mechanism to tell
      dir() about the delegation mechanism?  I vaguely recall seeing a
      request in the newsgroup for a more formal definition of attribute
      delegation too.  Sigh, time for a new PEP.
      f0b35e15
  7. 08 Eyl, 2001 1 kayıt (commit)
    • Tim Peters's avatar
      Generalize operator.indexOf (PySequence_Index) to work with any · 16a77adf
      Tim Peters yazdı
      iterable object.  I'm not sure how that got overlooked before!
      
      Got rid of the internal _PySequence_IterContains, introduced a new
      internal _PySequence_IterSearch, and rewrote all the iteration-based
      "count of", "index of", and "is the object in it or not?" routines to
      just call the new function.  I suppose it's slower this way, but the
      code duplication was getting depressing.
      16a77adf
  8. 07 Eyl, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      PyClass_New(): put the extended Don Beaudry hook back in. When one of · 28d80b10
      Guido van Rossum yazdı
      the base classes is not a classic class, and its class (the metaclass)
      is callable, call the metaclass to do the deed.
      
      One effect of this is that, when mixing classic and new-style classes
      amongst the bases of a class, it doesn't matter whether the first base
      class is a classic class or not: you will always get the error
      "TypeError: metatype conflict among bases".  (Formerly, with a classic
      class first, you'd get "TypeError: PyClass_New: base must be a class".)
      
      Another effect is that multiple inheritance from ExtensionClass.Base,
      with a classic class as the first class, transfers control to the
      ExtensionClass.Base class.  This is what we need for SF #443239 (and
      also for running Zope under 2.2a4, before ExtensionClass is replaced).
      28d80b10
  9. 05 Eyl, 2001 1 kayıt (commit)
  10. 29 Agu, 2001 1 kayıt (commit)
  11. 24 Agu, 2001 2 kayıt (commit)
  12. 17 Agu, 2001 3 kayıt (commit)
  13. 16 Agu, 2001 1 kayıt (commit)
  14. 15 Agu, 2001 1 kayıt (commit)
  15. 08 Agu, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      Implement PEP 238 in its (almost) full glory. · 4668b000
      Guido van Rossum yazdı
      This introduces:
      
      - A new operator // that means floor division (the kind of division
        where 1/2 is 0).
      
      - The "future division" statement ("from __future__ import division)
        which changes the meaning of the / operator to implement "true
        division" (where 1/2 is 0.5).
      
      - New overloadable operators __truediv__ and __floordiv__.
      
      - New slots in the PyNumberMethods struct for true and floor division,
        new abstract APIs for them, new opcodes, and so on.
      
      I emphasize that without the future division statement, the semantics
      of / will remain unchanged until Python 3.0.
      
      Not yet implemented are warnings (default off) when / is used with int
      or long arguments.
      
      This has been on display since 7/31 as SF patch #443474.
      
      Flames to /dev/null.
      4668b000
  16. 02 Agu, 2001 2 kayıt (commit)
  17. 22 May, 2001 1 kayıt (commit)
  18. 11 May, 2001 1 kayıt (commit)
    • Jeremy Hylton's avatar
      Variant of SF patch 423181 · 1b0feb4a
      Jeremy Hylton yazdı
      For rich comparisons, use instance_getattr2() when possible to avoid
      the expense of setting an AttributeError.  Also intern the name_op[]
      table and use the interned strings rather than creating a new string
      and interning it each time through.
      1b0feb4a
  19. 05 May, 2001 1 kayıt (commit)
    • Tim Peters's avatar
      Reimplement PySequence_Contains() and instance_contains(), so they work · cb8d368b
      Tim Peters yazdı
      safely together and don't duplicate logic (the common logic was factored
      out into new private API function _PySequence_IterContains()).
      Visible change:
          some_complex_number  in  some_instance
      no longer blows up if some_instance has __getitem__ but neither
      __contains__ nor __iter__.  test_iter changed to ensure that remains true.
      cb8d368b
  20. 03 May, 2001 1 kayıt (commit)
  21. 30 Nis, 2001 1 kayıt (commit)
  22. 23 Nis, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      Mondo changes to the iterator stuff, without changing how Python code · 213c7a6a
      Guido van Rossum yazdı
      sees it (test_iter.py is unchanged).
      
      - Added a tp_iternext slot, which calls the iterator's next() method;
        this is much faster for built-in iterators over built-in types
        such as lists and dicts, speeding up pybench's ForLoop with about
        25% compared to Python 2.1.  (Now there's a good argument for
        iterators. ;-)
      
      - Renamed the built-in sequence iterator SeqIter, affecting the C API
        functions for it.  (This frees up the PyIter prefix for generic
        iterator operations.)
      
      - Added PyIter_Check(obj), which checks that obj's type has a
        tp_iternext slot and that the proper feature flag is set.
      
      - Added PyIter_Next(obj) which calls the tp_iternext slot.  It has a
        somewhat complex return condition due to the need for speed: when it
        returns NULL, it may not have set an exception condition, meaning
        the iterator is exhausted; when the exception StopIteration is set
        (or a derived exception class), it means the same thing; any other
        exception means some other error occurred.
      213c7a6a
  23. 20 Nis, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      Iterators phase 1. This comprises: · 59d1d2b4
      Guido van Rossum yazdı
      new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
      new C API PyObject_GetIter(), calls tp_iter
      new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
      new internal object types iterobject and calliterobject
      new exception StopIteration
      new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
      new magic number for .pyc files
      new special method for instances: __iter__() returns an iterator
      iteration over dictionaries: "for x in dict" iterates over the keys
      iteration over files: "for x in file" iterates over lines
      
      TODO:
      
      documentation
      test suite
      decide whether to use a different way to spell iter(function, sentinal)
      decide whether "for key in dict" is a good idea
      use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
      speed tuning (make next() a slot tp_next???)
      59d1d2b4
  24. 23 Mar, 2001 1 kayıt (commit)
  25. 22 Mar, 2001 1 kayıt (commit)
    • Fred Drake's avatar
      A small change to the C API for weakly-referencable types: Such types · 4e262a96
      Fred Drake yazdı
      must now initialize the extra field used by the weak-ref machinery to
      NULL themselves, to avoid having to require PyObject_INIT() to check
      if the type supports weak references and do it there.  This causes less
      work to be done for all objects (the type object does not need to be
      consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
      4e262a96
  26. 26 Şub, 2001 2 kayıt (commit)
  27. 01 Şub, 2001 1 kayıt (commit)
  28. 29 Ock, 2001 2 kayıt (commit)
  29. 28 Ock, 2001 1 kayıt (commit)
  30. 18 Ock, 2001 1 kayıt (commit)
  31. 17 Ock, 2001 2 kayıt (commit)
    • Guido van Rossum's avatar
      Fix a leak in instance_coerce(). This was introduced by Neil's · 24f67d56
      Guido van Rossum yazdı
      earlier coercion changes, not by rich comparisons.  When a coercion
      function returns 1 (meaning it cannot do it), it should not INCREF the
      arguments.  When no __coerce__() method was found, instance_coerce()
      originally returned 0, pretending it did it.  Neil changed the return
      value to 1, more accurately reflecting that it didn't do anything, but
      forgot to take out the two INCREF calls.
      24f67d56
    • Guido van Rossum's avatar
      Rich comparisons. · 8998b4f6
      Guido van Rossum yazdı
      - Got rid of instance_cmp(); refactored instance_compare().
      
      - Added instance_richcompare() which calls __lt__() etc.
      
      Some unrelated stuff mixed in:
      
      - Aligned comments in various large struct initializers.
      
      - Better test to avoid recursion if __coerce__ returns self as the
        first argument (this is an unrelated fix by Neil Schemenauer!).
      
      - Style nit: don't use Py_DECREF(Py_NotImplemented); use
        Py_DECREF(result) -- it just looks better. :-)
      8998b4f6