[Python-checkins] python/dist/src/Modules xxmodule.c,2.33,2.34

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 11 Feb 2003 13:19:14 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv32006

Modified Files:
	xxmodule.c 
Log Message:
Add Str, a subclass of str.


Index: xxmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v
retrieving revision 2.33
retrieving revision 2.34
diff -C2 -d -r2.33 -r2.34
*** xxmodule.c	29 Dec 2002 17:16:49 -0000	2.33
--- xxmodule.c	11 Feb 2003 21:19:11 -0000	2.34
***************
*** 212,215 ****
--- 212,268 ----
  
  
+ /* ---------- */
+ 
+ static PyTypeObject Str_Type = {
+ 	/* The ob_type field must be initialized in the module init function
+ 	 * to be portable to Windows without using C++. */
+ 	PyObject_HEAD_INIT(NULL)
+ 	0,			/*ob_size*/
+ 	"xxmodule.Str",		/*tp_name*/
+ 	0,			/*tp_basicsize*/
+ 	0,			/*tp_itemsize*/
+ 	/* methods */
+ 	0,			/*tp_dealloc*/
+ 	0,			/*tp_print*/
+ 	0,			/*tp_getattr*/
+ 	0,			/*tp_setattr*/
+ 	0,			/*tp_compare*/
+ 	0,			/*tp_repr*/
+ 	0,			/*tp_as_number*/
+ 	0,			/*tp_as_sequence*/
+ 	0,			/*tp_as_mapping*/
+ 	0,			/*tp_hash*/
+ 	0,			/*tp_call*/
+ 	0,			/*tp_str*/
+ 	0,			/*tp_getattro*/
+ 	0,			/*tp_setattro*/
+ 	0,			/*tp_as_buffer*/
+ 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 	0,			/*tp_doc*/
+ 	0,			/*tp_traverse*/
+ 	0,			/*tp_clear*/
+ 	0,			/*tp_richcompare*/
+ 	0,			/*tp_weaklistoffset*/
+ 	0,			/*tp_iter*/
+ 	0,			/*tp_iternext*/
+ 	0,			/*tp_methods*/
+ 	0,			/*tp_members*/
+ 	0,			/*tp_getset*/
+ 	&PyString_Type,		/*tp_base*/
+ 	0,			/*tp_dict*/
+ 	0,			/*tp_descr_get*/
+ 	0,			/*tp_descr_set*/
+ 	0,			/*tp_dictoffset*/
+ 	0,			/*tp_init*/
+ 	0,			/*tp_alloc*/
+ 	0,			/*tp_new*/
+ 	0,			/*tp_free*/
+ 	0,			/*tp_is_gc*/
+ };
+ 
+ 
+ /* ---------- */
+ 
+ 
  /* List of functions defined in the module */
  
***************
*** 253,255 ****
--- 306,313 ----
  	Py_INCREF(ErrorObject);
  	PyModule_AddObject(m, "error", ErrorObject);
+ 
+ 	/* Add Str */
+ 	if (PyType_Ready(&Str_Type) < 0)
+ 		return;
+ 	PyModule_AddObject(m, "Str", (PyObject *)&Str_Type);
  }