Commit Graph

14 Commits

Author SHA1 Message Date
Fred Drake f841aa6fc0 Add a simple test of the METH_CLASS and METH_STATIC flags for type methods. 2002-03-28 15:49:54 +00:00
Fred Drake 1de5a722d6 Change the example code to prefer PyModule_Add*() instead of using the
module dictionary directly.  Also, be more careful about not re-initializing
globals in the event of re-initialization of a C extension.
2002-03-12 21:49:44 +00:00
Tim Peters 4befff95e9 initxxsubtype(): Add a comment to make the magic clearer; I doubt it's
obvious to anyone except PyType_Ready's author <0.9 wink>.
2001-12-17 18:26:19 +00:00
Guido van Rossum a7b9b3ccba Use PyType_Ready() for initialization of the ob_type field of our
types (the tp_base field must be initialized prior to that call).
2001-12-17 17:25:53 +00:00
Tim Peters dd5c05fe6d David Abrahams tried to compile this as a separate DLL under MSVC, and
got a barrage of compile errors that didn't make sense to the C++ brain:
MSVC does not allow C (but does allow C++) initializers to contain
data addresses supplied by other DLLs.  So changed the initializers here
to use dummy nulls, and changed module init to plug in the foreign
addresses at runtime (manually simulating what C++ does by magic).  Tested
on Windows, and Guido tested on Linux (thanks!).  BTW, the *point* is that
people are going to use this module as a template for writing their own
subtypes, and it's unusual for extension authors to build their extensions
into Python directly (separate DLLs are the norm on Windows); so it's
better if we give them a template that works <wink>.
2001-12-17 01:27:01 +00:00
Tim Peters 65760b2173 Give xxsubtype a module docstring, so its oddball purpose is discoverable
from a prompt without searching the source code (there was an SF bug
report about this, already closed ...  "479568 xxsubtype builtin").
2001-12-10 22:53:30 +00:00
Neil Schemenauer 2677512fc1 Adding missing "static" declarations (found by "make smelly"). 2001-10-21 22:26:43 +00:00
Guido van Rossum 32d34c809f Add optional docstrings to getset descriptors. Fortunately, there's
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.
2001-09-20 21:45:26 +00:00
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 83f56cb2db Change the type names to xxsublist.<name>. 2001-08-16 09:10:42 +00:00
Guido van Rossum 88dcf03068 Add 'state' as a get/set attribute to spamlist. This serves as an
example.
2001-08-15 18:18:58 +00:00
Guido van Rossum e6b90eaea1 Add 'state' as a read-only attribute to spamdict. This serves as an
example.
2001-08-15 18:09:11 +00:00
Guido van Rossum 528b7eb0b0 - Rename PyType_InitDict() to PyType_Ready().
- Add an explicit call to PyType_Ready(&PyList_Type) to pythonrun.c
  (just for the heck of it, really -- we should either explicitly
  ready all types, or none).
2001-08-07 17:24:28 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00