| OLD | NEW |
| 1 // Copyright (c) Corporation for National Research Initiatives | 1 // Copyright (c) Corporation for National Research Initiatives |
| 2 package org.python.core; | 2 package org.python.core; |
| 3 | 3 |
| 4 /** | 4 /** |
| 5 * An implementation of PyCode where the actual executable content | 5 * An implementation of PyCode where the actual executable content |
| 6 * is stored as a PyFunctionTable instance and an integer index. | 6 * is stored as a PyFunctionTable instance and an integer index. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 public class PyTableCode extends PyCode | 9 public class PyTableCode extends PyCode |
| 10 { | 10 { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 // Handle trace function for profiling | 220 // Handle trace function for profiling |
| 221 if (ts.profilefunc != null) { | 221 if (ts.profilefunc != null) { |
| 222 ts.profilefunc.traceReturn(frame, ret); | 222 ts.profilefunc.traceReturn(frame, ret); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Restore previously defined exception | 225 // Restore previously defined exception |
| 226 ts.exception = previous_exception; | 226 ts.exception = previous_exception; |
| 227 | 227 |
| 228 ts.frame = ts.frame.f_back; | 228 ts.frame = ts.frame.f_back; |
| 229 |
| 230 // Check for interruption, which is used for restarting the interpreter |
| 231 // on Jython |
| 232 if (Thread.currentThread().isInterrupted()) { |
| 233 throw Py.SystemRestart(); |
| 234 } |
| 229 return ret; | 235 return ret; |
| 230 } | 236 } |
| 231 | 237 |
| 232 public PyObject call(PyObject globals, PyObject[] defaults, | 238 public PyObject call(PyObject globals, PyObject[] defaults, |
| 233 PyObject closure) | 239 PyObject closure) |
| 234 { | 240 { |
| 235 if (co_argcount != 0 || varargs || varkwargs) | 241 if (co_argcount != 0 || varargs || varkwargs) |
| 236 return call(Py.EmptyObjects, Py.NoKeywords, globals, defaults, | 242 return call(Py.EmptyObjects, Py.NoKeywords, globals, defaults, |
| 237 closure); | 243 closure); |
| 238 PyFrame frame = new PyFrame(this, globals); | 244 PyFrame frame = new PyFrame(this, globals); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return new PyGenerator(frame, closure); | 408 return new PyGenerator(frame, closure); |
| 403 } | 409 } |
| 404 return call(frame, closure); | 410 return call(frame, closure); |
| 405 } | 411 } |
| 406 | 412 |
| 407 public String toString() { | 413 public String toString() { |
| 408 return String.format("<code object %.100s at %s, file \"%.300s\", line %
d>", | 414 return String.format("<code object %.100s at %s, file \"%.300s\", line %
d>", |
| 409 co_name, Py.idstr(this), co_filename, co_firstlinen
o); | 415 co_name, Py.idstr(this), co_filename, co_firstlinen
o); |
| 410 } | 416 } |
| 411 } | 417 } |
| OLD | NEW |