Skip to content

Commit 9f73466

Browse files
committed
update the deriveds for better unhashable TypeError messages
1 parent 1e95991 commit 9f73466

31 files changed

Lines changed: 31 additions & 31 deletions

src/org/python/core/PyArrayDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyBaseExceptionDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ public int hashCode() {
720720
throw Py.TypeError("__hash__ should return a int");
721721
}
722722
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
723-
throw Py.TypeError("unhashable type");
723+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
724724
}
725725
return super.hashCode();
726726
}

src/org/python/core/PyBooleanDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyClassMethodDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyComplexDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyDictionaryDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyEnumerateDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyFileDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyFloatDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

src/org/python/core/PyFrozenSetDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public int hashCode() {
744744
throw Py.TypeError("__hash__ should return a int");
745745
}
746746
if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
747-
throw Py.TypeError("unhashable type");
747+
throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
748748
}
749749
return super.hashCode();
750750
}

0 commit comments

Comments
 (0)