Commits

Alex Grönholm committed 64e0412

Added missing __format__() to the PyObjectDerived class

Comments (0)

Files changed (2)

src/org/python/core/PyObjectDerived.java

         return super.__ne__(other);
     }
 
+    public PyObject __format__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__format__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__format__(other);
+    }
+
     public PyObject __iadd__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__iadd__");

src/templates/object.derived

   __and__ __rand__ \
   __or__ __ror__  \
   __xor__ __rxor__ \
-  __lt__ __le__ __gt__ __ge__ __eq__ __ne__
+  __lt__ __le__ __gt__ __ge__ __eq__ __ne__ \
+  __format__
 ibinary: __iadd__ \
   __isub__ \
   __imul__ \