@@ -37,8 +37,10 @@ newclassobject(bases, dict, name)
3737 object * dict ;
3838 object * name ; /* String; NULL if unknown */
3939{
40+ #ifdef SUPPORT_OBSOLETE_ACCESS
4041 int pos ;
4142 object * key , * value ;
43+ #endif
4244 classobject * op , * dummy ;
4345 static object * getattrstr , * setattrstr , * delattrstr ;
4446 if (dictlookup (dict , "__doc__" ) == NULL ) {
@@ -73,11 +75,13 @@ newclassobject(bases, dict, name)
7375 XINCREF (op -> cl_getattr );
7476 XINCREF (op -> cl_setattr );
7577 XINCREF (op -> cl_delattr );
78+ #ifdef SUPPORT_OBSOLETE_ACCESS
7679 pos = 0 ;
7780 while (mappinggetnext (dict , & pos , & key , & value )) {
7881 if (is_accessobject (value ))
7982 setaccessowner (value , (object * )op );
8083 }
84+ #endif
8185 return (object * ) op ;
8286}
8387
@@ -151,12 +155,14 @@ class_getattr(op, name)
151155 err_setval (AttributeError , name );
152156 return NULL ;
153157 }
158+ #ifdef SUPPORT_OBSOLETE_ACCESS
154159 if (is_accessobject (v )) {
155160 v = getaccessvalue (v , getowner ());
156161 if (v == NULL )
157162 return NULL ;
158163 }
159164 else
165+ #endif
160166 INCREF (v );
161167 if (is_funcobject (v )) {
162168 object * w = newinstancemethodobject (v , (object * )NULL ,
@@ -173,7 +179,9 @@ class_setattr(op, name, v)
173179 object * name ;
174180 object * v ;
175181{
182+ #ifdef SUPPORT_OBSOLETE_ACCESS
176183 object * ac ;
184+ #endif
177185 char * sname = getstringvalue (name );
178186 if (sname [0 ] == '_' && sname [1 ] == '_' ) {
179187 int n = getstringsize (name );
@@ -187,9 +195,11 @@ class_setattr(op, name, v)
187195 "classes are read-only in restricted mode" );
188196 return -1 ;
189197 }
198+ #ifdef SUPPORT_OBSOLETE_ACCESS
190199 ac = mappinglookup (op -> cl_dict , name );
191200 if (ac != NULL && is_accessobject (ac ))
192201 return setaccessvalue (ac , getowner (), v );
202+ #endif
193203 if (v == NULL ) {
194204 int rv = mappingremove (op -> cl_dict , name );
195205 if (rv < 0 )
@@ -260,6 +270,7 @@ issubclass(class, base)
260270
261271/* Instance objects */
262272
273+ #ifdef SUPPORT_OBSOLETE_ACCESS
263274static int
264275addaccess (class , inst )
265276 classobject * class ;
@@ -295,6 +306,7 @@ addaccess(class, inst)
295306 }
296307 return 0 ;
297308}
309+ #endif
298310
299311object *
300312newinstanceobject (class , arg , kw )
@@ -315,8 +327,11 @@ newinstanceobject(class, arg, kw)
315327 INCREF (class );
316328 inst -> in_class = (classobject * )class ;
317329 inst -> in_dict = newdictobject ();
318- if (inst -> in_dict == NULL ||
319- addaccess ((classobject * )class , inst ) != 0 ) {
330+ if (inst -> in_dict == NULL
331+ #ifdef SUPPORT_OBSOLETE_ACCESS
332+ || addaccess ((classobject * )class , inst ) != 0
333+ #endif
334+ ) {
320335 DECREF (inst );
321336 return NULL ;
322337 }
@@ -382,8 +397,12 @@ instance_dealloc(inst)
382397 if ((del = instance_getattr1 (inst , delstr )) != NULL ) {
383398 object * res = call_object (del , (object * )NULL );
384399 DECREF (del );
385- XDECREF (res );
386- /* XXX If __del__ raised an exception, it is ignored! */
400+ if (res == NULL ) {
401+ writestring ("exception in __del__ method ignored\n" ,
402+ sysget ("stdout" ));
403+ }
404+ else
405+ DECREF (res );
387406 }
388407 /* Restore the saved exception and undo the temporary revival */
389408 err_restore (error_type , error_value , error_traceback );
@@ -438,12 +457,14 @@ instance_getattr1(inst, name)
438457 return NULL ;
439458 }
440459 }
460+ #ifdef SUPPORT_OBSOLETE_ACCESS
441461 if (is_accessobject (v )) {
442462 v = getaccessvalue (v , getowner ());
443463 if (v == NULL )
444464 return NULL ;
445465 }
446466 else
467+ #endif
447468 INCREF (v );
448469 if (class != NULL ) {
449470 if (is_funcobject (v )) {
@@ -492,10 +513,12 @@ instance_setattr1(inst, name, v)
492513 object * name ;
493514 object * v ;
494515{
516+ #ifdef SUPPORT_OBSOLETE_ACCESS
495517 object * ac ;
496518 ac = mappinglookup (inst -> in_dict , name );
497519 if (ac != NULL && is_accessobject (ac ))
498520 return setaccessvalue (ac , getowner (), v );
521+ #endif
499522 if (v == NULL ) {
500523 int rv = mappingremove (inst -> in_dict , name );
501524 if (rv < 0 )
0 commit comments