Commit Graph

62 Commits

Author SHA1 Message Date
Guido van Rossum 6f7993765a Add optional docstrings to member descriptors. For backwards
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.
2001-09-20 20:46:19 +00:00
Guido van Rossum 8bce4acb17 Rename 'getset' to 'property'. 2001-09-06 21:56:42 +00:00
Guido van Rossum 147b13c069 Make getset subclassable. 2001-08-30 03:10:36 +00:00
Guido van Rossum 239abf7e23 getset_init(): the function name in the PyArg_ParseTuple() format
should just be "getset", not "getset.__init__".
2001-08-24 18:49:10 +00:00
Barry Warsaw 7ce3694a52 repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.

Closes patch #454743.
2001-08-24 18:34:26 +00:00
Guido van Rossum 271410ad18 Change the getset type to take an optional third function argument:
the delete function.  (Question: should the attribute name also be
recorded in the getset object?  That makes the protocol more work, but
may give us better error messages.)
2001-08-24 15:23:20 +00:00
Guido van Rossum 845fc48bf7 getset_descr_set(): guard against deletion (indicated by a set call
with a NULL value), in a somewhat lame way: call the set() function
with one argument.  Should I add a 3rd function, 'del', instead?
2001-08-24 10:17:36 +00:00
Guido van Rossum 91c0d8a922 getset_init(): make the arguments optional.
getset_doc: add docstring.
2001-08-24 09:55:51 +00:00
Guido van Rossum 29a62dd6eb Add new built-in type 'getset' (PyGetSet_Type).
This implements the 'getset' class from test_binop.py.
2001-08-23 21:40:38 +00:00
Martin v. Löwis e3eb1f2b23 Patch #427190: Implement and use METH_NOARGS and METH_O. 2001-08-16 13:15:00 +00:00
Guido van Rossum 8098ddbe81 Subtle change to make None.__class__ work:
- descrobject.c:descr_check(): only believe None means the same as
  NULL if the type given is None's type.

- typeobject.c:wrap_descr_get(): don't "conventiently" default an
  absent type to the type of the object argument.  Let the called
  function figure it out.
2001-08-16 08:27:33 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00