Skip to content

Commit

Permalink
Fix comparisons between date and datetime to match CPython (see Oddba…
Browse files Browse the repository at this point in the history
…lls.test_bug_1028306 in test_datetime.py).
  • Loading branch information
jdhardy committed Mar 28, 2012
1 parent 92405ec commit 5687742
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Languages/IronPython/IronPython.Modules/datetime.cs
Expand Up @@ -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;
Expand Down

0 comments on commit 5687742

Please sign in to comment.