@@ -179,6 +179,8 @@ TPythonVersionProp = record
179179
180180 METH_VARARGS = $0001 ;
181181 METH_KEYWORDS = $0002 ;
182+ METH_CLASS = $0010 ;
183+ METH_STATIC = $0020 ;
182184
183185 // Masks for the co_flags field of PyCodeObject
184186 CO_OPTIMIZED = $0001 ;
@@ -2110,6 +2112,12 @@ TMethodsContainer = class(TEngineClient)
21102112 function AddMethodWithKeywords ( AMethodName : PAnsiChar;
21112113 AMethod : PyCFunctionWithKW;
21122114 ADocString : PAnsiChar ) : PPyMethodDef;
2115+ function AddClassMethodWithKeywords ( AMethodName : PAnsiChar;
2116+ AMethod : PyCFunctionWithKW;
2117+ ADocString : PAnsiChar ) : PPyMethodDef;
2118+ function AddStaticMethodWithKeywords ( AMethodName : PAnsiChar;
2119+ AMethod : PyCFunctionWithKW;
2120+ ADocString : PAnsiChar ) : PPyMethodDef;
21132121 function AddDelphiMethod ( AMethodName : PAnsiChar;
21142122 ADelphiMethod: TDelphiMethod;
21152123 ADocString : PAnsiChar ) : PPyMethodDef;
@@ -2363,7 +2371,6 @@ TPythonModule = class(TMethodsContainer)
23632371 - Properties ob_refcnt and ob_type will call GetSelf to access their data.
23642372}
23652373 // The base class of all new Python types
2366- TPyObjectClass = class of TPyObject;
23672374 TPyObject = class
23682375 private
23692376 function Get_ob_refcnt : NativeInt;
@@ -2470,6 +2477,7 @@ TPyObject = class
24702477 class procedure RegisterGetSets ( APythonType : TPythonType ); virtual ;
24712478 class procedure SetupType ( APythonType : TPythonType ); virtual ;
24722479 end ;
2480+ TPyObjectClass = class of TPyObject;
24732481
24742482 TBasicServices = set of (bsGetAttr, bsSetAttr,
24752483 bsRepr, bsCompare, bsHash,
@@ -6594,6 +6602,20 @@ function TMethodsContainer.AddMethodWithKeywords( AMethodName : PAnsiChar;
65946602 Result^.ml_flags := Result^.ml_flags or METH_KEYWORDS;
65956603end ;
65966604
6605+ function TMethodsContainer.AddStaticMethodWithKeywords (AMethodName: PAnsiChar;
6606+ AMethod: PyCFunctionWithKW; ADocString: PAnsiChar): PPyMethodDef;
6607+ begin
6608+ Result := AddMethodWithKeywords(AMethodName, AMethod, ADocString);
6609+ Result^.ml_flags := Result^.ml_flags or METH_STATIC;
6610+ end ;
6611+
6612+ function TMethodsContainer.AddClassMethodWithKeywords (AMethodName: PAnsiChar;
6613+ AMethod: PyCFunctionWithKW; ADocString: PAnsiChar): PPyMethodDef;
6614+ begin
6615+ Result := AddMethodWithKeywords(AMethodName, AMethod, ADocString);
6616+ Result^.ml_flags := Result^.ml_flags or METH_CLASS;
6617+ end ;
6618+
65976619function TMethodsContainer.AddDelphiMethod ( AMethodName : PAnsiChar;
65986620 ADelphiMethod: TDelphiMethod;
65996621 ADocString : PAnsiChar ) : PPyMethodDef;
0 commit comments