Repository navigation
How to fix from Delphi XE2 #509
Description
Activity
You can try:
FSlots := Concat(FSlots, [PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P)]); FSlots := Concat(FSlots), [PyModuleDef_Slot.Make(0, nil)]);
Please, let me know if it works.
Hello, for some reason the error still remains the same =(
FSlots := Concat(FSlots, [PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P)]); [DCC Error] PythonEngine.pas(7712): E2001 Ordinal type requiredYou can try:
Insert(PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P), FSlots, Length(FSlots));
You can try:
Insert(PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P), FSlots, Length(FSlots));
// Fill the m_slots for multi-phase initialization FSlots[0] := PyModuleDef_Slot.Make(Py_mod_exec, GetCallBack(Self, @TPythonModule.Exec_Module, 1, DEFAULT_CALLBACK_TYPE)); .. Insert(PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P), FSlots, Length(FSlots)); [DCC Error] PythonEngine.pas(7712): E2008 Incompatible types[DCC Error] PythonEngine.pas(7712): E2008 Incompatible types
Damn. This works in Delphi 12.
Then try:
SetLength(FSLots, Length(FSlots) + 1); FSlots[High(FSlots)] := PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P);[DCC Error] PythonEngine.pas(7712): E2008 Incompatible types
Damn. This works in Delphi 12.
Then try:
SetLength(FSLots, Length(FSlots) + 1); FSlots[High(FSlots)] := PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P);How to fix the full procedure correctly ?=)
procedure TPythonModule.MakeModuleDef; var P: Pointer; begin FillChar(FModuleDef, SizeOf(FModuleDef), 0); FModuleDef.m_base.ob_refcnt := 1; FModuleDef.m_name := PAnsiChar(ModuleName); FModuleDef.m_methods := MethodsData; FModuleDef.m_size := 0; // Doc string if FDocString.Count > 0 then begin FEncodedDocString := UTF8Encode(CleanString(FDocString.Text, False)); FModuleDef.m_doc := PAnsiChar(FEncodedDocString); end; // Fill the m_slots for multi-phase initialization FSlots := [PyModuleDef_Slot.Make(Py_mod_exec, GetCallBack(Self, @TPythonModule.Exec_Module, 1, DEFAULT_CALLBACK_TYPE))]; // E2001 Ordinal type required if (Engine.MajorVersion > 3) or (Engine.MinorVersion >= 12) then begin case FMultInterpretersSupport of mmiNotSupported: P := Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED; mmiPerInterpreterGIL: P := Py_MOD_PER_INTERPRETER_GIL_SUPPORTED; else P := Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED; end; FSlots := FSlots + [PyModuleDef_Slot.Make(Py_mod_multiple_interpreters, P)]; // E2001 Ordinal type required end; FSlots := FSlots + [PyModuleDef_Slot.Make(0, nil)]; // E2001 Ordinal type required FModuleDef.m_slots := @FSlots[0]; end;Did my suggestion work? I don't have access to XE2. If yes you do the same for the other array concatenation and it should work.
Did my suggestion work? I don't have access to XE2. If yes you do the same for the other array concatenation and it should work.
Yes, there is no point in fixing them one by one. The binding is there. Maybe it would be better to reconsider/change the logic of the whole procedure.

Hello, the Delphi XE2 compiler shows errors in the code:
[DCC Error] PythonEngine.pas(7702): E2001 Ordinal type required
How to correct errors correctly ?