| 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 // TODO: We should speed this up. As the __getattribute__ slot almost ne
ver |
| 954 // changes, it is a good candidate for caching, as PyClass does wi
th |
| 955 // __getattr__. See #1102. |
| 953 PyObject getattribute=self_type.lookup("__getattribute__"); | 956 PyObject getattribute=self_type.lookup("__getattribute__"); |
| 954 PyString py_name=null; | 957 PyString py_name=null; |
| 958 PyException firstAttributeError=null; |
| 955 try { | 959 try { |
| 956 if (getattribute!=null) { | 960 if (getattribute!=null) { |
| 957 return getattribute.__get__(this,self_type).__call__(py_name=PyS
tring.fromInterned(name)); | 961 py_name=PyString.fromInterned(name); |
| 962 return getattribute.__get__(this,self_type).__call__(py_name); |
| 958 } else { | 963 } else { |
| 959 return super.__findattr__(name); | 964 Py.Warning(String.format("__getattribute__ not found on type %s"
,self_type.getName())); |
| 965 PyObject ret=super.__findattr_ex__(name); |
| 966 if (ret!=null) { |
| 967 return ret; |
| 968 } // else: pass through to __getitem__ invocation |
| 960 } | 969 } |
| 961 } catch (PyException e) { | 970 } catch (PyException e) { |
| 962 if (Py.matchException(e,Py.AttributeError)) { | 971 if (!Py.matchException(e,Py.AttributeError)) { |
| 963 PyObject getattr=self_type.lookup("__getattr__"); | 972 throw e; |
| 964 if (getattr!=null) | 973 } else { |
| 965 try { | 974 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)); | 975 // 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 } | 976 } |
| 973 throw e; | |
| 974 } | 977 } |
| 978 PyObject getattr=self_type.lookup("__getattr__"); |
| 979 if (getattr!=null) { |
| 980 if (py_name==null) { |
| 981 py_name=PyString.fromInterned(name); |
| 982 } |
| 983 return getattr.__get__(this,self_type).__call__(py_name); |
| 984 } |
| 985 if (firstAttributeError!=null) { |
| 986 throw firstAttributeError; |
| 987 } |
| 988 return null; |
| 975 } | 989 } |
| 976 | 990 |
| 977 public void __setattr__(String name,PyObject value) { | 991 public void __setattr__(String name,PyObject value) { |
| 978 PyType self_type=getType(); | 992 PyType self_type=getType(); |
| 979 PyObject impl=self_type.lookup("__setattr__"); | 993 PyObject impl=self_type.lookup("__setattr__"); |
| 980 if (impl!=null) { | 994 if (impl!=null) { |
| 981 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); | 995 impl.__get__(this,self_type).__call__(PyString.fromInterned(name),va
lue); |
| 982 return; | 996 return; |
| 983 } | 997 } |
| 984 super.__setattr__(name,value); | 998 super.__setattr__(name,value); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 if (impl!=null) { | 1121 if (impl!=null) { |
| 1108 PyObject res=impl.__get__(this,self_type).__call__(); | 1122 PyObject res=impl.__get__(this,self_type).__call__(); |
| 1109 if (!(res instanceof PyString)) | 1123 if (!(res instanceof PyString)) |
| 1110 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); | 1124 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); |
| 1111 return((PyString)res).toString(); | 1125 return((PyString)res).toString(); |
| 1112 } | 1126 } |
| 1113 return super.toString(); | 1127 return super.toString(); |
| 1114 } | 1128 } |
| 1115 | 1129 |
| 1116 } | 1130 } |
| OLD | NEW |