-
Notifications
You must be signed in to change notification settings - Fork 25
Harden Python bindings against shutdown-time destructor errors #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses interpreter shutdown issues in Python bindings by adding a safety guard to prevent NoneType errors during teardown, fixing issue #226. The changes ensure that destructor calls during Python interpreter shutdown don't fail when the ErrorCodes module has already been cleared.
Key Changes:
- Modified the
checkErrormethod in Python bindings to check ifErrorCodesis available before accessing it - Updated interface GUIDs in Pascal implementation files
- Corrected class inheritance declarations in WASM bindings
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Source/buildbindingpython.go | Added shutdown-safe guard to generated Python wrapper's checkError method to handle interpreter teardown |
| Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py | Applied the generated shutdown-safe guard to example Python bindings |
| Examples/RTTI/RTTI_component/Implementations/Pascal/Interfaces/rtti_interfaces.pas | Updated interface GUIDs for Pascal implementation |
| Examples/RTTI/RTTI_component/Examples/Python/build.sh | Added Python binary location check to build script |
| Examples/RTTI/RTTI_component/Bindings/WASM/rtti_bindings.cpp | Fixed missing base class declarations and updated ACT version comment |
| Examples/RTTI/RTTI_component/Bindings/CSharp/RTTI.cs | Renamed exception class from RTTIException to ERTTIException for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Exception class for RTTI errors | ||
| /// </summary> | ||
| public class RTTIException : Exception | ||
| public class ERTTIException : Exception |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception class is renamed from RTTIException to ERTTIException, but this inconsistency should be resolved. The class name ERTTIException doesn't follow C# naming conventions, which typically don't prefix exception classes with 'E'. Consider using RttiException instead to maintain consistency with .NET naming standards.
| if errorCode != ErrorCodes.SUCCESS.value: | ||
| ec = globals().get('ErrorCodes') | ||
| if ec is None: | ||
| # Interpreter shutdown: ErrorCodes may already be cleared; avoid noisy teardown |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word 'noisy' in the comment could be clearer. Consider rephrasing to 'avoid errors during teardown' for better clarity.
| # Interpreter shutdown: ErrorCodes may already be cleared; avoid noisy teardown | |
| # Interpreter shutdown: ErrorCodes may already be cleared; avoid errors during teardown |
This PR fixes #226