You've already forked gnatstudio
mirror of
https://github.com/AdaCore/gnatstudio.git
synced 2026-02-12 12:42:33 -08:00
R406-026 Preventing python finalization error
Change-Id: I163227331c3295b94a4d2c0cc047a1210908126b
This commit is contained in:
@@ -747,7 +747,25 @@ package body Python_Module is
|
||||
-------------
|
||||
|
||||
overriding procedure Destroy (Module : in out Python_Module_Record) is
|
||||
Script : constant Scripting_Language :=
|
||||
Get_Kernel (Module).Scripts.Lookup_Scripting_Language (Python_Name);
|
||||
Errors : aliased Boolean;
|
||||
Result : PyObject;
|
||||
begin
|
||||
-- Importing jedi (versions 0.9, 0.12) raises "Error in sys.exitfunc"
|
||||
-- in console if future 0.16 is installed because of some exception
|
||||
-- when python is finalizing. Following code prevent this.
|
||||
|
||||
Result := Run_Command
|
||||
(Python_Scripting (Script),
|
||||
"import atexit ; atexit._run_exitfuncs()",
|
||||
Need_Output => False,
|
||||
Show_Command => False,
|
||||
Hide_Output => True,
|
||||
Hide_Exceptions => True,
|
||||
Errors => Errors'Unchecked_Access);
|
||||
Py_XDECREF (Result);
|
||||
|
||||
Unregister_Python_Scripting (Get_Kernel (Module).Scripts);
|
||||
end Destroy;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user