[Jython-checkins] jython: Use invoke to handle getattr/call. Thanks pjenvey!

frank.wierzbicki jython-checkins at python.org
Fri Apr 6 04:36:59 CEST 2012


http://hg.python.org/jython/rev/c2969d81507d
changeset:   6536:c2969d81507d
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Thu Apr 05 19:36:46 2012 -0700
summary:
  Use invoke to handle getattr/call. Thanks pjenvey!

files:
  src/org/python/core/PyInteger.java |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/src/org/python/core/PyInteger.java b/src/org/python/core/PyInteger.java
--- a/src/org/python/core/PyInteger.java
+++ b/src/org/python/core/PyInteger.java
@@ -108,7 +108,7 @@
                 throw pye;
             }
             try {
-                PyObject integral = x.__getattr__("__trunc__").__call__();
+                PyObject integral = x.invoke("__trunc__");
                 return convertIntegralToInt(integral);
             } catch (PyException pye2) {
                 if (!pye2.match(Py.AttributeError)) {
@@ -126,7 +126,7 @@
      */
     private static PyObject convertIntegralToInt(PyObject integral) {
         if (!(integral instanceof PyInteger) && !(integral instanceof PyLong)) {
-            PyObject i = integral.__getattr__("__int__").__call__();
+            PyObject i = integral.invoke("__int__");
             if (!(i instanceof PyInteger) && !(i instanceof PyLong)) {
                 throw Py.TypeError(String.format("__trunc__ returned non-Integral (type %.200s)",
                                                  integral.getType().fastGetName()));

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list