File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from test .test_support import verify , TESTFN , TestFailed
66from UserList import UserList
77
8+ # verify expected attributes exist
9+ f = file (TESTFN , 'w' )
10+ softspace = f .softspace
11+ f .name # merely shouldn't blow up
12+ f .mode # ditto
13+ f .closed # ditto
14+
15+ # verify softspace is writable
16+ f .softspace = softspace # merely shouldn't blow up
17+
18+ # verify the others aren't
19+ for attr in 'name' , 'mode' , 'closed' :
20+ try :
21+ setattr (f , attr , 'oops' )
22+ except TypeError :
23+ pass
24+ else :
25+ raise TestFailed ('expected TypeError setting file attr %r' % attr )
26+ f .close ()
27+
828# verify writelines with instance sequence
929l = UserList (['1' , '2' ])
1030f = open (TESTFN , 'wb' )
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ What's New in Python 2.3 beta 2?
1212Core and builtins
1313-----------------
1414
15+ - The softspace attribute of file objects became read-only by oversight.
16+ It's writable again.
17+
1518Extension modules
1619-----------------
1720
Original file line number Diff line number Diff line change @@ -1962,7 +1962,8 @@ PyTypeObject PyFile_Type = {
19621962 0 , /* tp_call */
19631963 0 , /* tp_str */
19641964 PyObject_GenericGetAttr , /* tp_getattro */
1965- 0 , /* tp_setattro */
1965+ /* softspace is writable: we must supply tp_setattro */
1966+ PyObject_GenericSetAttr , /* tp_setattro */
19661967 0 , /* tp_as_buffer */
19671968 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE , /* tp_flags */
19681969 file_doc , /* tp_doc */
You can’t perform that action at this time.
0 commit comments