[stdlib] Enforce non-NULL PythonObjects to prevent segfaults by dl-alexandre · Pull Request #6327 · modular/modular
BEGIN_PUBLIC [stdlib] Enforce non-NULL PythonObjects to prevent segfaults This implements safer error handling for Python-Mojo bindings to avoid segfaults from NULL pointer propagation. Changes: - Added PythonException type for explicit error representation - Changed PyFunctionRaising to return Variant[PythonException, PythonObject] - Added NULL kwargs canonicalization (NULL -> empty dict) - Added NULL check in PythonObject.__del__ to prevent segfaults - Added comprehensive tests for exception handling and NULL safety Fixes modular#5414 END_PUBLIC Signed-off-by: Dalton Alexandre <166029845+dl-alexandre@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters