[Python-checkins] r43131 - in python/trunk: Misc/NEWS Objects/cellobject.c
georg.brandl
python-checkins at python.org
Sat Mar 18 09:00:01 CET 2006
Author: georg.brandl
Date: Sat Mar 18 08:59:59 2006
New Revision: 43131
Modified:
python/trunk/Misc/NEWS
python/trunk/Objects/cellobject.c
Log:
Previously, Python code had no easy way to access the contents of a
cell object. Now, a ``cell_contents`` attribute has been added
(closes patch #1170323).
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sat Mar 18 08:59:59 2006
@@ -12,6 +12,10 @@
Core and builtins
-----------------
+- Previously, Python code had no easy way to access the contents of a
+ cell object. Now, a ``cell_contents`` attribute has been added
+ (closes patch #1170323).
+
- Patch #1123430: Python's small-object allocator now returns an arena to
the system ``free()`` when all memory within an arena becomes unused
again. Prior to Python 2.5, arenas (256KB chunks of memory) were never
Modified: python/trunk/Objects/cellobject.c
==============================================================================
--- python/trunk/Objects/cellobject.c (original)
+++ python/trunk/Objects/cellobject.c Sat Mar 18 08:59:59 2006
@@ -86,6 +86,18 @@
return 0;
}
+static PyObject *
+cell_get_contents(PyCellObject *op, void *closure)
+{
+ Py_XINCREF(op->ob_ref);
+ return op->ob_ref;
+}
+
+static PyGetSetDef cell_getsetlist[] = {
+ {"cell_contents", (getter)cell_get_contents, NULL},
+ {NULL} /* sentinel */
+};
+
PyTypeObject PyCell_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
@@ -111,4 +123,11 @@
0, /* tp_doc */
(traverseproc)cell_traverse, /* tp_traverse */
(inquiry)cell_clear, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ cell_getsetlist, /* tp_getset */
};
More information about the Python-checkins
mailing list