@@ -45,10 +45,6 @@ PyClass_New(bases, dict, name)
4545 PyObject * dict ;
4646 PyObject * name ; /* String; NULL if unknown */
4747{
48- #ifdef SUPPORT_OBSOLETE_ACCESS
49- int pos ;
50- PyObject * key , * value ;
51- #endif
5248 PyClassObject * op , * dummy ;
5349 static PyObject * getattrstr , * setattrstr , * delattrstr ;
5450 static PyObject * docstr ;
@@ -89,13 +85,6 @@ PyClass_New(bases, dict, name)
8985 Py_XINCREF (op -> cl_getattr );
9086 Py_XINCREF (op -> cl_setattr );
9187 Py_XINCREF (op -> cl_delattr );
92- #ifdef SUPPORT_OBSOLETE_ACCESS
93- pos = 0 ;
94- while (PyDict_Next (dict , & pos , & key , & value )) {
95- if (PyAccess_Check (value ))
96- PyAccess_SetOwner (value , (PyObject * )op );
97- }
98- #endif
9988 return (PyObject * ) op ;
10089}
10190
@@ -170,15 +159,7 @@ class_getattr(op, name)
170159 PyErr_SetObject (PyExc_AttributeError , name );
171160 return NULL ;
172161 }
173- #ifdef SUPPORT_OBSOLETE_ACCESS
174- if (PyAccess_Check (v )) {
175- v = PyAccess_AsValue (v , PyEval_GetOwner ());
176- if (v == NULL )
177- return NULL ;
178- }
179- else
180- #endif
181- Py_INCREF (v );
162+ Py_INCREF (v );
182163 if (PyFunction_Check (v )) {
183164 PyObject * w = PyMethod_New (v , (PyObject * )NULL ,
184165 (PyObject * )class );
@@ -194,9 +175,6 @@ class_setattr(op, name, v)
194175 PyObject * name ;
195176 PyObject * v ;
196177{
197- #ifdef SUPPORT_OBSOLETE_ACCESS
198- PyObject * ac ;
199- #endif
200178 char * sname = PyString_AsString (name );
201179 if (sname [0 ] == '_' && sname [1 ] == '_' ) {
202180 int n = PyString_Size (name );
@@ -211,11 +189,6 @@ class_setattr(op, name, v)
211189 "classes are read-only in restricted mode" );
212190 return -1 ;
213191 }
214- #ifdef SUPPORT_OBSOLETE_ACCESS
215- ac = PyDict_GetItem (op -> cl_dict , name );
216- if (ac != NULL && PyAccess_Check (ac ))
217- return PyAccess_SetValue (ac , PyEval_GetOwner (), v );
218- #endif
219192 if (v == NULL ) {
220193 int rv = PyDict_DelItem (op -> cl_dict , name );
221194 if (rv < 0 )
@@ -286,45 +259,6 @@ PyClass_IsSubclass(class, base)
286259
287260/* Instance objects */
288261
289- #ifdef SUPPORT_OBSOLETE_ACCESS
290- static int
291- addaccess (class , inst )
292- PyClassObject * class ;
293- PyInstanceObject * inst ;
294- {
295- int i , n , pos , ret ;
296- PyObject * key , * value , * ac ;
297-
298- n = PyTuple_Size (class -> cl_bases );
299- for (i = 0 ; i < n ; i ++ ) {
300- if (addaccess ((PyClassObject * )PyTuple_GetItem (
301- class -> cl_bases , i ), inst ) < 0 )
302- return -1 ;
303- }
304-
305- pos = 0 ;
306- while (PyDict_Next (class -> cl_dict , & pos , & key , & value )) {
307- if (!PyAccess_Check (value ))
308- continue ;
309- if (PyAccess_HasValue (value ))
310- continue ;
311- ac = PyDict_GetItem (inst -> in_dict , key );
312- if (ac != NULL && PyAccess_Check (ac )) {
313- PyErr_SetObject (PyExc_ConflictError , key );
314- return -1 ;
315- }
316- ac = PyAccess_Clone (value );
317- if (ac == NULL )
318- return -1 ;
319- ret = PyDict_SetItem (inst -> in_dict , key , ac );
320- Py_DECREF (ac );
321- if (ret != 0 )
322- return -1 ;
323- }
324- return 0 ;
325- }
326- #endif
327-
328262PyObject *
329263PyInstance_New (class , arg , kw )
330264 PyObject * class ;
@@ -344,11 +278,7 @@ PyInstance_New(class, arg, kw)
344278 Py_INCREF (class );
345279 inst -> in_class = (PyClassObject * )class ;
346280 inst -> in_dict = PyDict_New ();
347- if (inst -> in_dict == NULL
348- #ifdef SUPPORT_OBSOLETE_ACCESS
349- || addaccess ((PyClassObject * )class , inst ) != 0
350- #endif
351- ) {
281+ if (inst -> in_dict == NULL ) {
352282 Py_DECREF (inst );
353283 return NULL ;
354284 }
@@ -495,15 +425,7 @@ instance_getattr1(inst, name)
495425 return NULL ;
496426 }
497427 }
498- #ifdef SUPPORT_OBSOLETE_ACCESS
499- if (PyAccess_Check (v )) {
500- v = PyAccess_AsValue (v , PyEval_GetOwner ());
501- if (v == NULL )
502- return NULL ;
503- }
504- else
505- #endif
506- Py_INCREF (v );
428+ Py_INCREF (v );
507429 if (class != NULL ) {
508430 if (PyFunction_Check (v )) {
509431 PyObject * w = PyMethod_New (v , (PyObject * )inst ,
@@ -551,12 +473,6 @@ instance_setattr1(inst, name, v)
551473 PyObject * name ;
552474 PyObject * v ;
553475{
554- #ifdef SUPPORT_OBSOLETE_ACCESS
555- PyObject * ac ;
556- ac = PyDict_GetItem (inst -> in_dict , name );
557- if (ac != NULL && PyAccess_Check (ac ))
558- return PyAccess_SetValue (ac , PyEval_GetOwner (), v );
559- #endif
560476 if (v == NULL ) {
561477 int rv = PyDict_DelItem (inst -> in_dict , name );
562478 if (rv < 0 )
0 commit comments