@@ -1961,7 +1961,8 @@ TPythonInterface=class(TDynamicDll)
1961
1961
DEFAULT_DATETIME_CONVERSION_MODE = dcmToTuple;
1962
1962
type
1963
1963
TEngineClient = class ;
1964
- TSysPathInitEvent = procedure ( Sender : TObject; PathList : PPyObject ) of Object ;
1964
+ TSysPathInitEvent = procedure(Sender: TObject; PathList: PPyObject) of object ;
1965
+ TConfigInitEvent = procedure(Sender: TObject; var Config: PyConfig) of object ;
1965
1966
TPythonFlag = (pfDebug, pfInteractive, pfNoSite, pfOptimize, pfVerbose,
1966
1967
pfFrozenFlag, pfIgnoreEnvironmentFlag, pfIsolated);
1967
1968
TPythonFlags = set of TPythonFlag;
@@ -2013,6 +2014,7 @@ TPythonEngine = class(TPythonInterface)
2013
2014
FPythonHome: UnicodeString;
2014
2015
FPythonPath: UnicodeString;
2015
2016
FOnSysPathInit: TSysPathInitEvent;
2017
+ FOnConfigInit: TConfigInitEvent;
2016
2018
FTraceback: TPythonTraceback;
2017
2019
FUseWindowsConsole: Boolean;
2018
2020
FGlobalVars: PPyObject;
@@ -2163,6 +2165,8 @@ TPythonEngine = class(TPythonInterface)
2163
2165
property UseWindowsConsole: Boolean read FUseWindowsConsole write FUseWindowsConsole default False;
2164
2166
property OnAfterInit: TNotifyEvent read FOnAfterInit write FOnAfterInit;
2165
2167
property OnSysPathInit: TSysPathInitEvent read FOnSysPathInit write FOnSysPathInit;
2168
+ property OnConfigInit: TConfigInitEvent read FOnConfigInit write FOnConfigInit;
2169
+
2166
2170
end ;
2167
2171
2168
2172
@@ -4789,6 +4793,10 @@ procedure TPythonEngine.Initialize;
4789
4793
// PythonPath
4790
4794
SetPythonPath(Config);
4791
4795
4796
+ // Fine tune Config
4797
+ if Assigned(FOnConfigInit) then
4798
+ FOnConfigInit(Self, Config);
4799
+
4792
4800
Py_InitializeFromConfig(Config);
4793
4801
finally
4794
4802
PyConfig_Clear(Config);
0 commit comments