Message9952
This patch should be null-safe; it makes the example work at least:
diff -r 95d09ba14aa7 src/org/python/modules/gc.java
--- a/src/org/python/modules/gc.java Wed Apr 15 18:34:17 2015 -0400
+++ b/src/org/python/modules/gc.java Fri Apr 24 08:22:23 2015 -0500
@@ -706,8 +706,12 @@
public boolean equals(Object ob) {
if (ob instanceof WeakReferenceGC) {
- return ((WeakReferenceGC) ob).get().equals(get())
- && ((WeakReferenceGC) ob).hashCode() == hashCode();
+ WeakReferenceGC otherRef = (WeakReferenceGC)ob;
+ Object mine = get();
+ Object theirs = otherRef.get();
+ return (mine == theirs //same object, or both null
+ || (mine != null && mine.equals(theirs))) //at least one is not null
+ && hashCode() == otherRef.hashCode();
} else if (ob instanceof WeakrefGCCompareDummy) {
return ((WeakrefGCCompareDummy) ob).compare != null
&& ((WeakrefGCCompareDummy) ob).compare.equals(get()); |
|
Date |
User |
Action |
Args |
2015-04-24 13:24:43 | jmadden | set | messageid: <1429881883.78.0.621277580217.issue2336@psf.upfronthosting.co.za> |
2015-04-24 13:24:43 | jmadden | set | recipients:
+ jmadden, zyasoft, stefan.richthofer |
2015-04-24 13:24:43 | jmadden | link | issue2336 messages |
2015-04-24 13:24:43 | jmadden | create | |
|