diff --git a/Examples/RTTI/RTTI_component/Bindings/CSharp/RTTI.cs b/Examples/RTTI/RTTI_component/Bindings/CSharp/RTTI.cs
index 94a9e564..a1a3fc27 100644
--- a/Examples/RTTI/RTTI_component/Bindings/CSharp/RTTI.cs
+++ b/Examples/RTTI/RTTI_component/Bindings/CSharp/RTTI.cs
@@ -22,17 +22,17 @@ namespace RTTI {
///
/// Exception class for RTTI errors
///
- public class RTTIException : Exception
+ public class ERTTIException : Exception
{
private readonly int _errorCode;
private readonly string _errorMessage;
///
- /// Initializes a new instance of the RTTIException class
+ /// Initializes a new instance of the ERTTIException class
///
/// The error code
/// The error message
- public RTTIException(int errorCode, string errorMessage = "") : base(FormatMessage(errorCode, errorMessage))
+ public ERTTIException(int errorCode, string errorMessage = "") : base(FormatMessage(errorCode, errorMessage))
{
_errorCode = errorCode;
_errorMessage = errorMessage;
@@ -99,9 +99,9 @@ private static string FormatMessage(int errorCode, string errorMessage)
string errorName = GetErrorName(errorCode);
string errorDesc = GetErrorDescription(errorCode);
if (!string.IsNullOrEmpty(errorMessage))
- return $"RTTIException {errorName} ({errorCode}): {errorDesc} - {errorMessage}";
+ return $"ERTTIException {errorName} ({errorCode}): {errorDesc} - {errorMessage}";
else
- return $"RTTIException {errorName} ({errorCode}): {errorDesc}";
+ return $"ERTTIException {errorName} ({errorCode}): {errorDesc}";
}
private static string GetErrorName(int errorCode)
@@ -209,7 +209,7 @@ public static void ThrowError(IntPtr Handle, Int32 errorCode)
}
}
- throw new RTTIException(errorCode, sMessage);
+ throw new ERTTIException(errorCode, sMessage);
}
/**
diff --git a/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py b/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py
index fba4827f..85e978ac 100644
--- a/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py
+++ b/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py
@@ -327,10 +327,14 @@ def _checkBinaryVersion(self):
raise ERTTIException(ErrorCodes.INCOMPATIBLEBINARYVERSION)
def checkError(self, instance, errorCode):
- if errorCode != ErrorCodes.SUCCESS.value:
+ ec = globals().get('ErrorCodes')
+ if ec is None:
+ # Interpreter shutdown: ErrorCodes may already be cleared; avoid noisy teardown
+ return
+ if errorCode != ec.SUCCESS.value:
if instance:
if instance._wrapper != self:
- raise ERTTIException(ErrorCodes.INVALIDCAST, 'invalid wrapper call')
+ raise ERTTIException(ec.INVALIDCAST, 'invalid wrapper call')
message,_ = self.GetLastError(instance)
raise ERTTIException(errorCode, message)
diff --git a/Examples/RTTI/RTTI_component/Bindings/WASM/rtti_bindings.cpp b/Examples/RTTI/RTTI_component/Bindings/WASM/rtti_bindings.cpp
index f0d41e19..c0c968b7 100644
--- a/Examples/RTTI/RTTI_component/Bindings/WASM/rtti_bindings.cpp
+++ b/Examples/RTTI/RTTI_component/Bindings/WASM/rtti_bindings.cpp
@@ -4,7 +4,7 @@ Copyright (C) 2021 ADSK
All rights reserved.
-This file has been generated by the Automatic Component Toolkit (ACT) version 1.8.0-develop.
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.8.1-develop.
Abstract: C++ Emscripten wrapper for WebAssembly
@@ -99,13 +99,13 @@ EMSCRIPTEN_BINDINGS(RTTI) {
class_>("CTurtle")
.smart_ptr>("shared_ptr")
;
- class_("CAnimalIterator")
+ class_>("CAnimalIterator")
.smart_ptr>("shared_ptr")
.function("GetNextAnimal", &CAnimalIterator::GetNextAnimal)
.function("GetNextOptinalAnimal", &wrap_AnimalIterator_GetNextOptinalAnimal)
.function("GetNextMandatoryAnimal", &wrap_AnimalIterator_GetNextMandatoryAnimal)
;
- class_("CZoo")
+ class_>("CZoo")
.smart_ptr>("shared_ptr")
.function("Iterator", &CZoo::Iterator)
;
diff --git a/Examples/RTTI/RTTI_component/Examples/Python/build.sh b/Examples/RTTI/RTTI_component/Examples/Python/build.sh
index 4a1b501d..6ec5c226 100755
--- a/Examples/RTTI/RTTI_component/Examples/Python/build.sh
+++ b/Examples/RTTI/RTTI_component/Examples/Python/build.sh
@@ -5,6 +5,8 @@ set -euxo pipefail
cd "$(dirname "$0")"
source ../../../../../Build/build.inc
+which python3
+
echo "Test C++ library"
RUN "python3 RTTI_Example.py" $PWD/../../Implementations/Cpp/build
diff --git a/Examples/RTTI/RTTI_component/Implementations/Pascal/Interfaces/rtti_interfaces.pas b/Examples/RTTI/RTTI_component/Implementations/Pascal/Interfaces/rtti_interfaces.pas
index 6f623030..8b847e7a 100644
--- a/Examples/RTTI/RTTI_component/Implementations/Pascal/Interfaces/rtti_interfaces.pas
+++ b/Examples/RTTI/RTTI_component/Implementations/Pascal/Interfaces/rtti_interfaces.pas
@@ -32,7 +32,7 @@ interface
**************************************************************************************************************************)
IRTTIBase = interface
- ['{F71073EA-4326-4BF0-B1B7-6B5326CE0668}']
+ ['{6D5C237C-E78B-4657-B893-C8BE11BC6794}']
function GetLastErrorMessage(out AErrorMessage: String): Boolean;
procedure ClearErrorMessages();
@@ -48,7 +48,7 @@ interface
**************************************************************************************************************************)
IRTTIAnimal = interface(IRTTIBase)
- ['{710CB19F-03E6-4023-BACC-3C1A157E4C0A}']
+ ['{8B7F3A98-3978-4C5F-90AC-F3D2FA2CC468}']
function Name(): String;
end;
@@ -59,7 +59,7 @@ interface
**************************************************************************************************************************)
IRTTIMammal = interface(IRTTIAnimal)
- ['{B282E29A-0B7B-444D-AFB2-F7E36D634D07}']
+ ['{D9FFF1D8-FFFB-4EB4-AF81-25F9266571AA}']
end;
@@ -69,7 +69,7 @@ interface
**************************************************************************************************************************)
IRTTIReptile = interface(IRTTIAnimal)
- ['{9C3113BD-DBDB-479C-8109-0A9373897F4E}']
+ ['{AB96FE19-A8D1-4610-8EE6-0EB949DFB518}']
end;
@@ -79,7 +79,7 @@ interface
**************************************************************************************************************************)
IRTTIGiraffe = interface(IRTTIMammal)
- ['{7A758ACC-C9D8-4C26-8758-E0012209395E}']
+ ['{CFF41F38-7171-4D6E-A8DD-F0247C7C8FC2}']
end;
@@ -89,7 +89,7 @@ interface
**************************************************************************************************************************)
IRTTITiger = interface(IRTTIMammal)
- ['{8C10281D-9072-4B57-AF39-64903EA0A46B}']
+ ['{B3279D23-3017-4F14-BA80-2481BDC18F9D}']
procedure Roar();
end;
@@ -100,7 +100,7 @@ interface
**************************************************************************************************************************)
IRTTISnake = interface(IRTTIReptile)
- ['{F7EA7F1B-BDA5-4E51-BA15-54AB1E92580D}']
+ ['{02B026CC-EBE1-4A50-80C5-3E0E00419AE4}']
end;
@@ -110,7 +110,7 @@ interface
**************************************************************************************************************************)
IRTTITurtle = interface(IRTTIReptile)
- ['{E5BFFA76-FC6C-4C82-9302-E1BE903BCCFA}']
+ ['{D5071CDA-CFDB-41A2-BA42-CF2B3EB75381}']
end;
@@ -120,7 +120,7 @@ interface
**************************************************************************************************************************)
IRTTIAnimalIterator = interface(IRTTIBase)
- ['{F99A080B-B278-4A43-9523-FB353C9928FA}']
+ ['{30B15DE2-9548-4F1F-8A1C-28798D38ECF5}']
function GetNextAnimal(): TObject;
function GetNextOptinalAnimal(out AAnimal: TObject): Boolean;
@@ -133,7 +133,7 @@ interface
**************************************************************************************************************************)
IRTTIZoo = interface(IRTTIBase)
- ['{CA530586-4F80-45D7-B879-8FD0A52388E8}']
+ ['{4CE7CE21-14C4-4F98-801A-3E952D434366}']
function Iterator(): TObject;
end;
diff --git a/Source/buildbindingpython.go b/Source/buildbindingpython.go
index 880c7f66..2ab25ef8 100644
--- a/Source/buildbindingpython.go
+++ b/Source/buildbindingpython.go
@@ -402,10 +402,14 @@ func buildDynamicPythonImplementation(componentdefinition ComponentDefinition, w
w.Writeln(" def checkError(self, instance, errorCode):")
- w.Writeln(" if errorCode != ErrorCodes.SUCCESS.value:")
+ w.Writeln(" ec = globals().get('ErrorCodes')")
+ w.Writeln(" if ec is None:")
+ w.Writeln(" # Interpreter shutdown: ErrorCodes may already be cleared; avoid noisy teardown")
+ w.Writeln(" return")
+ w.Writeln(" if errorCode != ec.SUCCESS.value:")
w.Writeln(" if instance:")
w.Writeln(" if instance._wrapper != self:")
- w.Writeln(" raise E%sException(ErrorCodes.INVALIDCAST, 'invalid wrapper call')", NameSpace)
+ w.Writeln(" raise E%sException(ec.INVALIDCAST, 'invalid wrapper call')", NameSpace)
w.Writeln(" message,_ = self.%s(instance)", componentdefinition.Global.ErrorMethod)
w.Writeln(" raise E%sException(errorCode, message)", NameSpace)
w.Writeln(" ")