10000 fix(ctypesutil): correctly apply wrapped lib function as CLibrary member by semcodech · Pull Request #1116 · hardbyte/python-can · GitHub
[go: up one dir, main page]

Skip to content

fix(ctypesutil): correctly apply wrapped lib function as CLibrary member #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions can/ctypesutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ def map_symbol(
else:
prototype = _FUNCTION_TYPE(restype)
try:
self.func_name = prototype((func_name, self))
func = prototype((func_name, self))
except AttributeError:
raise ImportError(
f'Could not map function "{func_name}" from library {self._name}'
) from None

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

if errcheck is not None:
self.func_name.errcheck = errcheck
func.errcheck = errcheck

return self.func_name
setattr(self, func_name, func)
return func


if sys.platform == "win32":
Expand Down
0