1. Alexander Hesse
  2. pypy

Commits

Armin Rigo  committed 49d683b

Fix: apply this change, even if it's incompatible with CPython 2.2(!).
It fixes an issue reported by adoven on irc. Add a test.

  • Participants
  • Parent commits c519e30
  • Branches default

Comments (0)

Files changed (2)

File lib_pypy/datetime.py

View file
             self._checkOverflow(t.year)
             result = date(t.year, t.month, t.day)
             return result
-        raise TypeError
-        # XXX Should be 'return NotImplemented', but there's a bug in 2.2...
+        return NotImplemented    # note that this doesn't work on CPython 2.2
 
     __radd__ = __add__
 

File pypy/module/test_lib_pypy/test_datetime.py

View file
     assert type(dt.microsecond) is int
 
     copy.copy(dt)
+
+def test_radd():
+    class X(object):
+        def __radd__(self, other):
+            return "radd"
+    assert datetime.date(10, 10, 10) + X() == "radd"