annotate python/pydc/pydc.pyi @ 66:7a61dd082341 default tip

pydc: - fix double free triggered by capsule destructor, when freeing pydc and callback objects, manually
author Tassilo Philipp
date Fri, 24 May 2024 18:16:29 +0200
parents 8e905c0798c7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
1 import sys
54
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
2 from typing import Optional, Any, TypeVar, Callable
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
3
47
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
4 # Handle type, depending on python version this is either internal type
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
5 # PyCObject or PyCapsule, neither of one can be used as annotation
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
6 H = TypeVar('H')
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
7
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
8 def load(libpath: Optional[str]) -> H: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
9 def find(libhandle: H, symbol: str) -> H: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
10 def free(libhandle: H) -> None: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
11 def get_path(libhandle: Optional[H]) -> str: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
12 def call(funcptr: H, signature: str, *arguments: Any) -> Any: ...
54
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
13 def new_callback(c_signature: str, f: Callable) -> H: ... # note: only callbacks with positional args
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
14 def free_callback(cbhandle: H) -> None: ...
60
8e905c0798c7 - p2Z() helper func
Tassilo Philipp
parents: 54
diff changeset
15 def p2Z(ptr: int) -> Optional[str]: ... # note: only correct for python 3
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
16