| OLD | NEW |
| 1 /* Generated file, do not modify. See jython/src/templates/gderived.py. */ | 1 /* Generated file, do not modify. See jython/src/templates/gderived.py. */ |
| 2 package org.python.core; | 2 package org.python.core; |
| 3 | 3 |
| 4 public class PyFileDerived extends PyFile implements Slotted { | 4 public class PyFileDerived extends PyFile implements Slotted { |
| 5 | 5 |
| 6 public PyObject getSlot(int index) { | 6 public PyObject getSlot(int index) { |
| 7 return slots[index]; | 7 return slots[index]; |
| 8 } | 8 } |
| 9 | 9 |
| 10 public void setSlot(int index,PyObject value) { | 10 public void setSlot(int index,PyObject value) { |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 PyType self_type=getType(); | 965 PyType self_type=getType(); |
| 966 PyObject impl=self_type.lookup("__call__"); | 966 PyObject impl=self_type.lookup("__call__"); |
| 967 if (impl!=null) | 967 if (impl!=null) |
| 968 return impl.__get__(this,self_type).__call__(args,keywords); | 968 return impl.__get__(this,self_type).__call__(args,keywords); |
| 969 return super.__call__(args,keywords); | 969 return super.__call__(args,keywords); |
| 970 } finally { | 970 } finally { |
| 971 --ts.recursion_depth; | 971 --ts.recursion_depth; |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 | 974 |
| 975 public PyObject __findattr__(String name) { | 975 public PyObject __findattr_ex__(String name) { |
| 976 PyType self_type=getType(); | 976 PyType self_type=getType(); |
| 977 PyObject getattribute=self_type.lookup("__getattribute__"); | 977 PyObject getattribute=self_type.lookup("__getattribute__"); |
| 978 PyString py_name=null; | 978 PyString py_name=null; |
| 979 PyException firstAttributeError=null; |
| 979 try { | 980 try { |
| 980 if (getattribute!=null) { | 981 if (getattribute!=null) { |
| 981 return getattribute.__get__(this,self_type).__call__(py_name=PyS
tring.fromInterned(name)); | 982 return getattribute.__get__(this,self_type).__call__(py_name=PyS
tring.fromInterned(name)); |
| 982 } else { | 983 } else { |
| 983 return super.__findattr__(name); | 984 // XXX: This shouldn't happen, becase PyObject exposes |
| 985 // __getattribute__. |
| 986 // |
| 987 // And, by the way, invoking object__getattribute__ is the |
| 988 // common case. We should optimize that to avoid doing the |
| 989 // '__getattribute__' lookup each time. |
| 990 PyObject ret=super.__findattr_ex__(name); |
| 991 if (ret!=null) { |
| 992 return ret; |
| 993 } // else: pass through to __getitem__ invocation |
| 984 } | 994 } |
| 985 } catch (PyException e) { | 995 } catch (PyException e) { |
| 986 if (Py.matchException(e,Py.AttributeError)) { | 996 if (!Py.matchException(e,Py.AttributeError)) { |
| 987 PyObject getattr=self_type.lookup("__getattr__"); | 997 throw e; |
| 988 if (getattr!=null) | 998 } else { |
| 989 try { | 999 firstAttributeError=e; // saved to avoid swallowing custom Attri
buteErrors |
| 990 return getattr.__get__(this,self_type).__call__(py_name!
=null?py_name:PyString.fromInterned(name)); | 1000 // and pass through to __getattr__ invocation. |
| 991 } catch (PyException e1) { | |
| 992 if (!Py.matchException(e1,Py.AttributeError)) | |
| 993 throw e1; | |
| 994 } | |
| 995 return null; | |
| 996 } | 1001 } |
| 997 throw e; | 1002 } |
| 1003 PyObject getattr=self_type.lookup("__getattr__"); |
| 1004 if (getattr!=null) { |
| 1005 return getattr.__get__(this,self_type).__call__(py_name!=null?py_nam
e:PyString.fromInterned(name)); |
| 1006 } |
| 1007 if (firstAttributeError!=null) { |
| 1008 throw firstAttributeError; |
| 1009 } else { |
| 1010 return null; |
| 998 } | 1011 } |
| 999 } | 1012 } |
| 1000 | 1013 |
| 1001 public void __setattr__(String name,PyObject value) { | 1014 public void __setattr__(String name,PyObject value) { |
| 1002 PyType self_type=getType(); | 1015 PyType self_type=getType(); |
| 1003 PyObject impl=self_type.lookup("__setattr__"); | 1016 PyObject impl=self_type.lookup("__setattr__"); |
| 1004 if (impl!=null) { | 1017 if (impl!=null) { |
| 1005 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); | 1018 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); |
| 1006 return; | 1019 return; |
| 1007 } | 1020 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 if (impl!=null) { | 1144 if (impl!=null) { |
| 1132 PyObject res=impl.__get__(this,self_type).__call__(); | 1145 PyObject res=impl.__get__(this,self_type).__call__(); |
| 1133 if (!(res instanceof PyString)) | 1146 if (!(res instanceof PyString)) |
| 1134 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); | 1147 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); |
| 1135 return((PyString)res).toString(); | 1148 return((PyString)res).toString(); |
| 1136 } | 1149 } |
| 1137 return super.toString(); | 1150 return super.toString(); |
| 1138 } | 1151 } |
| 1139 | 1152 |
| 1140 } | 1153 } |
| OLD | NEW |