Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(90)

Side by Side Diff: src/org/python/core/PyBaseException.java

Issue 2888: __findattr__ refactor (Closed) SVN Base: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm
Patch Set: This is the actually commited patch (on r5155), in case you have more comments Created 1 year, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2008 Jython Developers */ 1 /* Copyright (c) 2008 Jython Developers */
2 package org.python.core; 2 package org.python.core;
3 3
4 import org.python.expose.ExposedDelete; 4 import org.python.expose.ExposedDelete;
5 import org.python.expose.ExposedGet; 5 import org.python.expose.ExposedGet;
6 import org.python.expose.ExposedMethod; 6 import org.python.expose.ExposedMethod;
7 import org.python.expose.ExposedNew; 7 import org.python.expose.ExposedNew;
8 import org.python.expose.ExposedSet; 8 import org.python.expose.ExposedSet;
9 import org.python.expose.ExposedType; 9 import org.python.expose.ExposedType;
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (!(state instanceof PyStringMap) && !(state instanceof PyDictiona ry)) { 94 if (!(state instanceof PyStringMap) && !(state instanceof PyDictiona ry)) {
95 throw Py.TypeError("state is not a dictionary"); 95 throw Py.TypeError("state is not a dictionary");
96 } 96 }
97 for (PyObject key : state.asIterable()) { 97 for (PyObject key : state.asIterable()) {
98 __setattr__((PyString)key, state.__finditem__(key)); 98 __setattr__((PyString)key, state.__finditem__(key));
99 } 99 }
100 } 100 }
101 return Py.None; 101 return Py.None;
102 } 102 }
103 103
104 public PyObject __findattr__(String name) { 104 public PyObject __findattr_ex__(String name) {
105 return BaseException___findattr__(name); 105 return BaseException___findattr__(name);
106 } 106 }
107 107
108 final PyObject BaseException___findattr__(String name) { 108 final PyObject BaseException___findattr__(String name) {
109 if (__dict__ != null) { 109 if (__dict__ != null) {
110 PyObject attr = __dict__.__finditem__(name); 110 PyObject attr = __dict__.__finditem__(name);
111 if (attr != null) { 111 if (attr != null) {
112 return attr; 112 return attr;
113 } 113 }
114 } 114 }
115 115
116 return super.__findattr__(name); 116 return super.__findattr_ex__(name);
117 } 117 }
118 118
119 public void __setattr__(String name, PyObject value) { 119 public void __setattr__(String name, PyObject value) {
120 BaseException___setattr__(name, value); 120 BaseException___setattr__(name, value);
121 } 121 }
122 122
123 @ExposedMethod 123 @ExposedMethod
124 final void BaseException___setattr__(String name, PyObject value) { 124 final void BaseException___setattr__(String name, PyObject value) {
125 ensureDict(); 125 ensureDict();
126 super.__setattr__(name, value); 126 super.__setattr__(name, value);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 @ExposedSet(name = "args") 188 @ExposedSet(name = "args")
189 public void setArgs(PyObject val) { 189 public void setArgs(PyObject val) {
190 args = PyTuple.fromIterable(val); 190 args = PyTuple.fromIterable(val);
191 } 191 }
192 192
193 @ExposedDelete(name = "message") 193 @ExposedDelete(name = "message")
194 public void delMessage() { 194 public void delMessage() {
195 message = Py.None; 195 message = Py.None;
196 } 196 }
197 } 197 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497