From f869d4330a698608605a9f101dde87cf78d727dc Mon Sep 17 00:00:00 2001 From: Ivan Sinkarenko <ivan.sinkarenko@cern.ch> Date: Thu, 20 Apr 2023 11:10:53 +0200 Subject: [PATCH] Update customizersUsed to get the robust imports, add extra protection from duplicated supertypes --- stubgenj/_stubgenj.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stubgenj/_stubgenj.py b/stubgenj/_stubgenj.py index d3d2cc9..59aa1b0 100644 --- a/stubgenj/_stubgenj.py +++ b/stubgenj/_stubgenj.py @@ -1111,10 +1111,11 @@ def jpypeCustomizerSuperTypes(jClass: jpype.JClass, classTypeVars: List[TypeVarS typeStr += '[' + ', '.join([tv.pythonName for tv in classTypeVars]) + ']' extraSuperTypes.append(typeStr) customizersUsed.add(customizer) - if jClass.class_.getName() == 'java.lang.Throwable': + if jClass.class_.getName() == 'java.lang.Throwable' and 'jpype.JException' not in extraSuperTypes: # Workaround to allow Throwable-derived exception types be recognized # as JException, so that they can be assigned as Exception.__cause__ extraSuperTypes.append('jpype.JException') + customizersUsed.add(jpype.JException) return extraSuperTypes -- GitLab