| 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 PyBaseExceptionDerived extends PyBaseException implements Slotted { | 4 public class PyBaseExceptionDerived extends PyBaseException 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 PyType self_type=getType(); | 941 PyType self_type=getType(); |
| 942 PyObject impl=self_type.lookup("__call__"); | 942 PyObject impl=self_type.lookup("__call__"); |
| 943 if (impl!=null) | 943 if (impl!=null) |
| 944 return impl.__get__(this,self_type).__call__(args,keywords); | 944 return impl.__get__(this,self_type).__call__(args,keywords); |
| 945 return super.__call__(args,keywords); | 945 return super.__call__(args,keywords); |
| 946 } finally { | 946 } finally { |
| 947 --ts.recursion_depth; | 947 --ts.recursion_depth; |
| 948 } | 948 } |
| 949 } | 949 } |
| 950 | 950 |
| 951 public PyObject __findattr__(String name) { | 951 public PyObject __findattr_ex__(String name) { |
| 952 PyType self_type=getType(); | 952 PyType self_type=getType(); |
| 953 PyObject getattribute=self_type.lookup("__getattribute__"); | 953 PyObject getattribute=self_type.lookup("__getattribute__"); |
| 954 PyString py_name=null; | 954 PyString py_name=null; |
| 955 PyException firstAttributeError=null; |
| 955 try { | 956 try { |
| 956 if (getattribute!=null) { | 957 if (getattribute!=null) { |
| 957 return getattribute.__get__(this,self_type).__call__(py_name=PyS
tring.fromInterned(name)); | 958 return getattribute.__get__(this,self_type).__call__(py_name=PyS
tring.fromInterned(name)); |
| 958 } else { | 959 } else { |
| 959 return super.__findattr__(name); | 960 // XXX: This shouldn't happen, becase PyObject exposes |
| 961 // __getattribute__. |
| 962 // |
| 963 // And, by the way, invoking object__getattribute__ is the |
| 964 // common case. We should optimize that to avoid doing the |
| 965 // '__getattribute__' lookup each time. |
| 966 PyObject ret=super.__findattr_ex__(name); |
| 967 if (ret!=null) { |
| 968 return ret; |
| 969 } // else: pass through to __getitem__ invocation |
| 960 } | 970 } |
| 961 } catch (PyException e) { | 971 } catch (PyException e) { |
| 962 if (Py.matchException(e,Py.AttributeError)) { | 972 if (!Py.matchException(e,Py.AttributeError)) { |
| 963 PyObject getattr=self_type.lookup("__getattr__"); | 973 throw e; |
| 964 if (getattr!=null) | 974 } else { |
| 965 try { | 975 firstAttributeError=e; // saved to avoid swallowing custom Attri
buteErrors |
| 966 return getattr.__get__(this,self_type).__call__(py_name!
=null?py_name:PyString.fromInterned(name)); | 976 // and pass through to __getattr__ invocation. |
| 967 } catch (PyException e1) { | |
| 968 if (!Py.matchException(e1,Py.AttributeError)) | |
| 969 throw e1; | |
| 970 } | |
| 971 return null; | |
| 972 } | 977 } |
| 973 throw e; | 978 } |
| 979 PyObject getattr=self_type.lookup("__getattr__"); |
| 980 if (getattr!=null) { |
| 981 return getattr.__get__(this,self_type).__call__(py_name!=null?py_nam
e:PyString.fromInterned(name)); |
| 982 } |
| 983 if (firstAttributeError!=null) { |
| 984 throw firstAttributeError; |
| 985 } else { |
| 986 return null; |
| 974 } | 987 } |
| 975 } | 988 } |
| 976 | 989 |
| 977 public void __setattr__(String name,PyObject value) { | 990 public void __setattr__(String name,PyObject value) { |
| 978 PyType self_type=getType(); | 991 PyType self_type=getType(); |
| 979 PyObject impl=self_type.lookup("__setattr__"); | 992 PyObject impl=self_type.lookup("__setattr__"); |
| 980 if (impl!=null) { | 993 if (impl!=null) { |
| 981 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); | 994 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); |
| 982 return; | 995 return; |
| 983 } | 996 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 if (impl!=null) { | 1120 if (impl!=null) { |
| 1108 PyObject res=impl.__get__(this,self_type).__call__(); | 1121 PyObject res=impl.__get__(this,self_type).__call__(); |
| 1109 if (!(res instanceof PyString)) | 1122 if (!(res instanceof PyString)) |
| 1110 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); | 1123 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); |
| 1111 return((PyString)res).toString(); | 1124 return((PyString)res).toString(); |
| 1112 } | 1125 } |
| 1113 return super.toString(); | 1126 return super.toString(); |
| 1114 } | 1127 } |
| 1115 | 1128 |
| 1116 } | 1129 } |
| OLD | NEW |