8000 fix(ctypesutil): correctly apply wrapped lib function as CLibrary mem… · projectgus/python-can@44bd901 · GitHub
[go: up one dir, main page]

Skip to content

Commit 44bd901

Browse files
semcodech0xa5a5
andauthored
fix(ctypesutil): correctly apply wrapped lib function as CLibrary member (hardbyte#1116)
Co-authored-by: Simon Ausserlechner <s.ausserlechner@gmail.com>
1 parent 5b63bb2 commit 44bd901

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

can/ctypesutil.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def map_symbol(
5555
else:
5656
prototype = _FUNCTION_TYPE(restype)
5757
try:
58-
self.func_name = prototype((func_name, self))
58+
func = prototype((func_name, self))
5959
except AttributeError:
6060
raise ImportError(
6161
f'Could not map function "{func_name}" from library {self._name}'
6262
) from None
6363

64-
self.func_name._name = func_name # pylint: disable=protected-access
64+
func._name = func_name # pylint: disable=protected-access
6565
log.debug(
6666
'Wrapped function "%s", result type: %s, error_check %s',
6767
func_name,
@@ -70,9 +70,10 @@ def map_symbol(
7070
)
7171

7272
if errcheck is not None:
73-
self.func_name.errcheck = errcheck
73+
func.errcheck = errcheck
7474

75-
return self.func_name
75+
setattr(self, func_name, func)
76+
return func
7677

7778

7879
if sys.platform == "win32":

0 commit comments

Comments
 (0)
0