Permalink
Browse files

Fix comparisons between date and datetime to match CPython (see Oddba…

…lls.test_bug_1028306 in test_datetime.py).
  • Loading branch information...
1 parent 92405ec commit 568774299f9b82a0404b44a2df1e23520ed70684 @jdhardy jdhardy committed Mar 28, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 Languages/IronPython/IronPython.Modules/datetime.cs
@@ -567,10 +567,9 @@ public class date : ICodeFormattable {
public override bool Equals(object obj) {
if (obj == null) return false;
-
- Type t = obj.GetType();
- if (t == typeof(date) || t == typeof(datetime)) {
- date other = (date)obj;
+
+ date other = obj as date;
+ if (other != null && !(obj is datetime)) {
return this._dateTime == other._dateTime;
} else {
return false;

0 comments on commit 5687742

Please sign in to comment.