Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ebe14f

Browse files
author
Alextp
committedOct 22, 2020
sync with P4D, PyIter_Check
1 parent 562f3bc commit 8ebe14f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎python4lazarus/PythonEngine.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,6 @@ TPythonInterface=class(TDynamicDll)
14721472
PyObject_NewVar:function (t:PPyTypeObject; size:NativeInt):PPyObject; cdecl;
14731473
PyObject_Free:procedure (ob:PPyObject); cdecl;
14741474
PyObject_GetIter: function (obj: PPyObject) : PPyObject; cdecl;
1475-
//PyIter_Check: function ( obj : PPyObject ) : Boolean;
14761475
PyIter_Next: function (obj: PPyObject) : PPyObject; cdecl;
14771476
PyObject_IsInstance:function (inst, cls:PPyObject):integer; cdecl;
14781477
PyObject_IsSubclass:function (derived, cls:PPyObject):integer; cdecl;
@@ -1618,6 +1617,7 @@ TPythonInterface=class(TDynamicDll)
16181617
function PyModule_CheckExact( obj : PPyObject ) : Boolean;
16191618
function PySlice_Check( obj : PPyObject ) : Boolean;
16201619
function PyFunction_Check( obj : PPyObject ) : Boolean;
1620+
function PyIter_Check( obj : PPyObject ) : Boolean;
16211621
function PyUnicode_Check( obj : PPyObject ) : Boolean;
16221622
function PyUnicode_CheckExact( obj : PPyObject ) : Boolean;
16231623
function PyType_IS_GC(t : PPyTypeObject ) : Boolean;
@@ -3662,6 +3662,11 @@ function TPythonInterface.PyFunction_Check( obj : PPyObject ) : Boolean;
36623662
(obj^.ob_type = PPyTypeObject(PyFunction_Type)));
36633663
end;
36643664

3665+
function TPythonInterface.PyIter_Check(obj: PPyObject): Boolean;
3666+
begin
3667+
Result := Assigned(obj) and Assigned(obj^.ob_type^.tp_iternext);
3668+
end;
3669+
36653670
function TPythonInterface.PyUnicode_Check( obj : PPyObject ) : Boolean;
36663671
begin
36673672
Result := PyObject_TypeCheck(obj, PyUnicode_Type);

0 commit comments

Comments
 (0)
Please sign in to comment.