File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ What's New in Python 2.5 alpha 1?
1212Core and builtins
1313-----------------
1414
15+ - Previously, Python code had no easy way to access the contents of a
16+ cell object. Now, a ``cell_contents`` attribute has been added
17+ (closes patch #1170323).
18+
1519- Patch #1123430: Python's small-object allocator now returns an arena to
1620 the system ``free()`` when all memory within an arena becomes unused
1721 again. Prior to Python 2.5, arenas (256KB chunks of memory) were never
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ cell_clear(PyCellObject *op)
8686 return 0 ;
8787}
8888
89+ static PyObject *
90+ cell_get_contents (PyCellObject * op , void * closure )
91+ {
92+ Py_XINCREF (op -> ob_ref );
93+ return op -> ob_ref ;
94+ }
95+
96+ static PyGetSetDef cell_getsetlist [] = {
97+ {"cell_contents" , (getter )cell_get_contents , NULL },
98+ {NULL } /* sentinel */
99+ };
100+
89101PyTypeObject PyCell_Type = {
90102 PyObject_HEAD_INIT (& PyType_Type )
91103 0 ,
@@ -111,4 +123,11 @@ PyTypeObject PyCell_Type = {
111123 0 , /* tp_doc */
112124 (traverseproc )cell_traverse , /* tp_traverse */
113125 (inquiry )cell_clear , /* tp_clear */
126+ 0 , /* tp_richcompare */
127+ 0 , /* tp_weaklistoffset */
128+ 0 , /* tp_iter */
129+ 0 , /* tp_iternext */
130+ 0 , /* tp_methods */
131+ 0 , /* tp_members */
132+ cell_getsetlist , /* tp_getset */
114133};
You can’t perform that action at this time.
0 commit comments