PyType (@NotNull final PyCallable callable) { return RecursionManager.doPreventingRecursion( Pair.create(callable, this), false, () -> { synchronized (myEvaluatedReturn) { if (myEvaluatedReturn.containsKey(callable)) { final PyType type = myEvaluatedReturn.get(callable); assertValid(type, callable); return type; } } final PyType type = callable.getReturnType(this, Key.INSTANCE); assertValid(type, callable); synchronized (myEvaluatedReturn) { myEvaluatedReturn.put(callable, type); } return type; } ); }