@@ -95,7 +95,8 @@ interface
95
95
{ $IF not Defined(FPC) and (CompilerVersion >= 23)}
96
96
const
97
97
{ $IF CompilerVersion >= 33}
98
- pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32 or pidOSX64 or pidLinux64;
98
+ pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32 or pidOSX64
99
+ or pidLinux64 or pidAndroid32Arm or pidAndroid64Arm;
99
100
{ $ELSE}
100
101
pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32;
101
102
{ $IFEND}
@@ -402,7 +403,7 @@ TPythonVersionProp = record
402
403
newfunc = function ( subtype: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl;
403
404
allocfunc = function ( self: PPyTypeObject; nitems : NativeInt) : PPyObject; cdecl;
404
405
405
- PyNumberMethods = { $IFNDEF CPUX64 } packed { $ENDIF} record
406
+ PyNumberMethods = { $IFDEF CPUX86 } packed { $ENDIF} record
406
407
nb_add : binaryfunc;
407
408
nb_subtract : binaryfunc;
408
409
nb_multiply : binaryfunc;
@@ -442,7 +443,7 @@ TPythonVersionProp = record
442
443
end ;
443
444
PPyNumberMethods = ^PyNumberMethods;
444
445
445
- PySequenceMethods = { $IFNDEF CPUX64 } packed { $ENDIF} record
446
+ PySequenceMethods = { $IFDEF CPUX86 } packed { $ENDIF} record
446
447
sq_length : lenfunc;
447
448
sq_concat : binaryfunc;
448
449
sq_repeat : ssizeargfunc;
@@ -456,37 +457,37 @@ TPythonVersionProp = record
456
457
end ;
457
458
PPySequenceMethods = ^PySequenceMethods;
458
459
459
- PyMappingMethods = { $IFNDEF CPUX64 } packed { $ENDIF} record
460
+ PyMappingMethods = { $IFDEF CPUX86 } packed { $ENDIF} record
460
461
mp_length : lenfunc;
461
462
mp_subscript : binaryfunc;
462
463
mp_ass_subscript : objobjargproc;
463
464
end ;
464
465
PPyMappingMethods = ^PyMappingMethods;
465
466
466
- Py_complex = { $IFNDEF CPUX64 } packed { $ENDIF} record
467
+ Py_complex = { $IFDEF CPUX86 } packed { $ENDIF} record
467
468
real : double;
468
469
imag : double;
469
470
end ;
470
471
471
- PyObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
472
+ PyObject = { $IFDEF CPUX86 } packed { $ENDIF} record
472
473
ob_refcnt: NativeInt;
473
474
ob_type: PPyTypeObject;
474
475
end ;
475
476
476
- _frozen = { $IFNDEF CPUX64 } packed { $ENDIF} record
477
+ _frozen = { $IFDEF CPUX86 } packed { $ENDIF} record
477
478
name : PAnsiChar;
478
479
code : PByte;
479
480
size : Integer;
480
481
end ;
481
482
482
- PySliceObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
483
+ PySliceObject = { $IFDEF CPUX86 } packed { $ENDIF} record
483
484
ob_refcnt: NativeInt;
484
485
ob_type: PPyTypeObject;
485
486
start, stop, step: PPyObject;
486
487
end ;
487
488
488
489
PPyMethodDef = ^PyMethodDef;
489
- PyMethodDef = { $IFNDEF CPUX64 } packed { $ENDIF} record
490
+ PyMethodDef = { $IFDEF CPUX86 } packed { $ENDIF} record
490
491
ml_name: PAnsiChar;
491
492
ml_meth: PyCFunction;
492
493
ml_flags: Integer;
@@ -495,11 +496,11 @@ TPythonVersionProp = record
495
496
496
497
// structmember.h
497
498
PPyMemberDef = ^PyMemberDef;
498
- PyMemberDef = { $IFNDEF CPUX64 } packed { $ENDIF} record
499
+ PyMemberDef = { $IFDEF CPUX86 } packed { $ENDIF} record
499
500
name : PAnsiChar;
500
501
_type : integer;
501
502
offset : NativeInt;
502
- flags : integer ;
503
+ flags : Integer ;
503
504
doc : PAnsiChar;
504
505
end ;
505
506
@@ -511,7 +512,7 @@ TPythonVersionProp = record
511
512
setter = function ( obj, value : PPyObject; context : Pointer) : integer; cdecl;
512
513
513
514
PPyGetSetDef = ^PyGetSetDef;
514
- PyGetSetDef = { $IFNDEF CPUX64 } packed { $ENDIF} record
515
+ PyGetSetDef = { $IFDEF CPUX86 } packed { $ENDIF} record
515
516
name : PAnsiChar;
516
517
get : getter;
517
518
_set : setter;
@@ -522,7 +523,7 @@ TPythonVersionProp = record
522
523
wrapperfunc = function (self, args: PPyObject; wrapped : Pointer) : PPyObject; cdecl;
523
524
524
525
pwrapperbase = ^wrapperbase;
525
- wrapperbase = { $IFNDEF CPUX64 } packed { $ENDIF} record
526
+ wrapperbase = { $IFDEF CPUX86 } packed { $ENDIF} record
526
527
name : PAnsiChar;
527
528
wrapper : wrapperfunc;
528
529
doc : PAnsiChar;
@@ -537,7 +538,7 @@ TPythonVersionProp = record
537
538
}
538
539
539
540
PPyDescrObject = ^PyDescrObject;
540
- PyDescrObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
541
+ PyDescrObject = { $IFDEF CPUX86 } packed { $ENDIF} record
541
542
// Start of the Head of an object
542
543
ob_refcnt : NativeInt;
543
544
ob_type : PPyTypeObject;
@@ -547,7 +548,7 @@ TPythonVersionProp = record
547
548
end ;
548
549
549
550
PPyMethodDescrObject = ^PyMethodDescrObject;
550
- PyMethodDescrObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
551
+ PyMethodDescrObject = { $IFDEF CPUX86 } packed { $ENDIF} record
551
552
// Start of PyDescr_COMMON
552
553
// Start of the Head of an object
553
554
ob_refcnt : NativeInt;
@@ -560,7 +561,7 @@ TPythonVersionProp = record
560
561
end ;
561
562
562
563
PPyMemberDescrObject = ^PyMemberDescrObject;
563
- PyMemberDescrObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
564
+ PyMemberDescrObject = { $IFDEF CPUX86 } packed { $ENDIF} record
564
565
// Start of PyDescr_COMMON
565
566
// Start of the Head of an object
566
567
ob_refcnt : NativeInt;
@@ -573,7 +574,7 @@ TPythonVersionProp = record
573
574
end ;
574
575
575
576
PPyGetSetDescrObject = ^PyGetSetDescrObject;
576
- PyGetSetDescrObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
577
+ PyGetSetDescrObject = { $IFDEF CPUX86 } packed { $ENDIF} record
577
578
// Start of PyDescr_COMMON
578
579
// Start of the Head of an object
579
580
ob_refcnt : NativeInt;
@@ -586,7 +587,7 @@ TPythonVersionProp = record
586
587
end ;
587
588
588
589
PPyWrapperDescrObject = ^PyWrapperDescrObject;
589
- PyWrapperDescrObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
590
+ PyWrapperDescrObject = { $IFDEF CPUX86 } packed { $ENDIF} record
590
591
// Start of PyDescr_COMMON
591
592
// Start of the Head of an object
592
593
ob_refcnt : NativeInt;
@@ -600,7 +601,7 @@ TPythonVersionProp = record
600
601
end ;
601
602
602
603
PPyModuleDef_Base = ^PyModuleDef_Base;
603
- PyModuleDef_Base = { $IFNDEF CPUX64 } packed { $ENDIF} record
604
+ PyModuleDef_Base = { $IFDEF CPUX86 } packed { $ENDIF} record
604
605
// Start of the Head of an object
605
606
ob_refcnt : NativeInt;
606
607
ob_type : PPyTypeObject;
@@ -611,7 +612,7 @@ TPythonVersionProp = record
611
612
end ;
612
613
613
614
PPyModuleDef = ^PyModuleDef;
614
- PyModuleDef = { $IFNDEF CPUX64 } packed { $ENDIF} record
615
+ PyModuleDef = { $IFDEF CPUX86 } packed { $ENDIF} record
615
616
m_base : PyModuleDef_Base;
616
617
m_name : PAnsiChar;
617
618
m_doc : PAnsiChar;
@@ -625,7 +626,7 @@ TPythonVersionProp = record
625
626
626
627
627
628
// object.h
628
- PyTypeObject = { $IFNDEF CPUX64 } packed { $ENDIF} record
629
+ PyTypeObject = { $IFDEF CPUX86 } packed { $ENDIF} record
629
630
ob_refcnt: NativeInt;
630
631
ob_type: PPyTypeObject;
631
632
ob_size: NativeInt; // Number of items in variable part
@@ -724,7 +725,7 @@ TPythonVersionProp = record
724
725
// Parse tree node interface
725
726
726
727
PNode = ^node;
727
- node = { $IFNDEF CPUX64 } packed { $ENDIF} record
728
+ node = { $IFDEF CPUX86 } packed { $ENDIF} record
728
729
n_type : smallint;
729
730
n_str : PAnsiChar;
730
731
n_lineno : integer;
@@ -734,7 +735,7 @@ TPythonVersionProp = record
734
735
end ;
735
736
736
737
PPyCompilerFlags = ^PyCompilerFlags;
737
- PyCompilerFlags = { $IFNDEF CPUX64 } packed { $ENDIF} record
738
+ PyCompilerFlags = { $IFDEF CPUX86 } packed { $ENDIF} record
738
739
flags : integer;
739
740
cf_feature_version : integer; // added in Python 3.8
740
741
end ;
@@ -765,11 +766,9 @@ TPythonVersionProp = record
765
766
766
767
{ # of bytes for year, month, day, hour, minute, second, and usecond. }
767
768
_PyDateTime_DATETIME_DATASIZE = 10 ;
768
- PyGILState_LOCKED = 0 ;
769
- PyGILState_UNLOCKED = 1 ;
770
769
771
770
type
772
- PyDateTime_Delta = { $IFNDEF CPUX64 } packed { $ENDIF} record
771
+ PyDateTime_Delta = { $IFDEF CPUX86 } packed { $ENDIF} record
773
772
// Start of the Head of an object
774
773
ob_refcnt : NativeInt;
775
774
ob_type : PPyTypeObject;
@@ -781,7 +780,7 @@ TPythonVersionProp = record
781
780
end ;
782
781
PPyDateTime_Delta = ^PyDateTime_Delta;
783
782
784
- PyDateTime_TZInfo = { $IFNDEF CPUX64 } packed { $ENDIF} record // a pure abstract base clase
783
+ PyDateTime_TZInfo = { $IFDEF CPUX86 } packed { $ENDIF} record // a pure abstract base clase
785
784
// Start of the Head of an object
786
785
ob_refcnt : NativeInt;
787
786
ob_type : PPyTypeObject;
@@ -803,7 +802,7 @@ TPythonVersionProp = record
803
802
* convenient to cast to, when getting at the hastzinfo member of objects
804
803
* starting with _PyTZINFO_HEAD.
805
804
*}
806
- _PyDateTime_BaseTZInfo = { $IFNDEF CPUX64 } packed { $ENDIF} record
805
+ _PyDateTime_BaseTZInfo = { $IFDEF CPUX86 } packed { $ENDIF} record
807
806
// Start of _PyTZINFO_HEAD
808
807
// Start of the Head of an object
809
808
ob_refcnt : NativeInt;
@@ -826,7 +825,7 @@ TPythonVersionProp = record
826
825
unsigned char data[_PyDateTime_TIME_DATASIZE];
827
826
}
828
827
829
- _PyDateTime_BaseTime = { $IFNDEF CPUX64 } packed { $ENDIF} record // hastzinfo false
828
+ _PyDateTime_BaseTime = { $IFDEF CPUX86 } packed { $ENDIF} record // hastzinfo false
830
829
// Start of _PyDateTime_TIMEHEAD
831
830
// Start of _PyTZINFO_HEAD
832
831
// Start of the Head of an object
@@ -841,7 +840,7 @@ TPythonVersionProp = record
841
840
end ;
842
841
_PPyDateTime_BaseTime = ^_PyDateTime_BaseTime;
843
842
844
- PyDateTime_Time = { $IFNDEF CPUX64 } packed { $ENDIF} record // hastzinfo true
843
+ PyDateTime_Time = { $IFDEF CPUX86 } packed { $ENDIF} record // hastzinfo true
845
844
// Start of _PyDateTime_TIMEHEAD
846
845
// Start of _PyTZINFO_HEAD
847
846
// Start of the Head of an object
@@ -864,7 +863,7 @@ TPythonVersionProp = record
864
863
* the plain date type is a base class for datetime, so it must also have
865
864
* a hastzinfo member (although it's unused there).
866
865
*}
867
- PyDateTime_Date = { $IFNDEF CPUX64 } packed { $ENDIF} record
866
+ PyDateTime_Date = { $IFDEF CPUX86 } packed { $ENDIF} record
868
867
// Start of _PyTZINFO_HEAD
869
868
// Start of the Head of an object
870
869
ob_refcnt : NativeInt;
@@ -883,7 +882,7 @@ TPythonVersionProp = record
883
882
unsigned char data[_PyDateTime_DATETIME_DATASIZE];
884
883
}
885
884
886
- _PyDateTime_BaseDateTime = { $IFNDEF CPUX64 } packed { $ENDIF} record // hastzinfo false
885
+ _PyDateTime_BaseDateTime = { $IFDEF CPUX86 } packed { $ENDIF} record // hastzinfo false
887
886
// Start of _PyTZINFO_HEAD
888
887
// Start of the Head of an object
889
888
ob_refcnt : NativeInt;
@@ -896,7 +895,7 @@ TPythonVersionProp = record
896
895
end ;
897
896
_PPyDateTime_BaseDateTime = ^_PyDateTime_BaseDateTime;
898
897
899
- PyDateTime_DateTime = { $IFNDEF CPUX64 } packed { $ENDIF} record // hastzinfo true
898
+ PyDateTime_DateTime = { $IFDEF CPUX86 } packed { $ENDIF} record // hastzinfo true
900
899
// Start of _PyDateTime_DATETIMEHEAD
901
900
// Start of _PyTZINFO_HEAD
902
901
// Start of the Head of an object
@@ -917,6 +916,10 @@ TPythonVersionProp = record
917
916
// ## GIL state ##
918
917
// ## ##
919
918
// #######################################################
919
+ const
920
+ PyGILState_LOCKED = 0 ;
921
+ PyGILState_UNLOCKED = 1 ;
922
+ type
920
923
PyGILState_STATE = type Integer; // (PyGILState_LOCKED, PyGILState_UNLOCKED);
921
924
922
925
// #######################################################
@@ -1586,12 +1589,13 @@ TPythonInterface=class(TDynamicDll)
1586
1589
PyEval_EvalCode : function ( co : PPyObject; globals, locals : PPyObject) : PPyObject; cdecl;
1587
1590
Py_GetVersion : function : PAnsiChar; cdecl;
1588
1591
Py_GetCopyright : function : PAnsiChar; cdecl;
1589
- Py_GetExecPrefix : function : PAnsiChar; cdecl;
1590
- Py_GetPath : function : PAnsiChar; cdecl;
1592
+ Py_GetExecPrefix : function : PWCharT; cdecl;
1593
+ Py_GetPath : function : PWCharT; cdecl;
1594
+ Py_SetPath : procedure (path: PWCharT); cdecl;
1591
1595
Py_SetPythonHome : procedure (home : PWCharT); cdecl;
1592
1596
Py_GetPythonHome : function : PWCharT; cdecl;
1593
- Py_GetPrefix : function : PAnsiChar ; cdecl;
1594
- Py_GetProgramName : function : PAnsiChar ; cdecl;
1597
+ Py_GetPrefix : function : PWCharT ; cdecl;
1598
+ Py_GetProgramName : function : PWCharT ; cdecl;
1595
1599
1596
1600
PyParser_SimpleParseStringFlags : function ( str : PAnsiChar; start, flags : Integer) : PNode; cdecl;
1597
1601
PyNode_Free : procedure( n : PNode ); cdecl;
@@ -2534,7 +2538,8 @@ TPythonType = class(TGetSetContainer)
2534
2538
// methods
2535
2539
// /////////////////////////////////////
2536
2540
function NewSubtypeInst ( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl;
2537
-
2541
+ public
2542
+ const TYPE_COMP_NAME_SUFFIX = ' Type' ;
2538
2543
public
2539
2544
constructor Create( AOwner : TComponent ); override;
2540
2545
destructor Destroy; override;
@@ -3560,6 +3565,7 @@ procedure TPythonInterface.MapDll;
3560
3565
Py_GetCopyright := Import (' Py_GetCopyright' );
3561
3566
Py_GetExecPrefix := Import (' Py_GetExecPrefix' );
3562
3567
Py_GetPath := Import (' Py_GetPath' );
3568
+ Py_SetPath := Import (' Py_SetPath' );
3563
3569
Py_SetPythonHome := Import (' Py_SetPythonHome' );
3564
3570
Py_GetPythonHome := Import (' Py_GetPythonHome' );
3565
3571
Py_GetPrefix := Import (' Py_GetPrefix' );
@@ -5043,7 +5049,7 @@ function TPythonEngine.EncodeWindowsFilePath(const str: string): AnsiString;
5043
5049
Result := AnsiString(str);
5044
5050
end ;
5045
5051
5046
- function TPythonEngine.TypeByName ( const aTypeName : AnsiString ) : PPyTypeObject;
5052
+ function TPythonEngine.TypeByName ( const aTypeName : AnsiString ) : PPyTypeObject;
5047
5053
var
5048
5054
i : Integer;
5049
5055
begin
0 commit comments