Create a gist now

Instantly share code, notes, and snippets.

@darjus /diff
Created Mar 8, 2017

What would you like to do?
➜ jython hg diff
diff --git a/src/org/python/core/Deriveds.java b/src/org/python/core/Deriveds.java
--- a/src/org/python/core/Deriveds.java
+++ b/src/org/python/core/Deriveds.java
@@ -48,7 +48,7 @@
PyObject getattribute = type.lookup("__getattribute__");
// This is a horrible hack for eventual consistency of the cache. We hope that the cached version
// becomes available, but don't wait forever.
- for (int i = 0; i < 100000; i++) {
+ for (int i = 0; i < 100000000; i++) {
if (getattribute != null) {
break;
}
diff --git a/src/org/python/core/PyType.java b/src/org/python/core/PyType.java
--- a/src/org/python/core/PyType.java
+++ b/src/org/python/core/PyType.java
@@ -1539,13 +1539,16 @@
return fromClass(c, true);
}
+ /**
+ * This method is not thread safe at the moment and requires hackery in
+ * @see org.python.core.Deriveds#__findattr_ex__() for example, to be used safely in multithreaded
+ * environmnet.
+ *
+ **/
public static PyType fromClass(Class<?> c, boolean hardRef) {
PyType type = getClassToType().get(c);
if (type != null) {
- // synchronize on the c here to make sure the compiler does not re-order
- synchronized (c) {
- return type;
- }
+ return type;
}
// We haven't seen this class before, so its type needs to be created. If it's being
// exposed as a Java class, defer processing its inner types until it's completely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment