Skip to content

Commit

Permalink
[sipify] Fix staticmethod (qgis#59517)
Browse files Browse the repository at this point in the history
* [sipify] Fix staticmethod 

When building bindings for Kadas, we get an AttributeError on startup and not a NameError.

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
3nids and pre-commit-ci-lite[bot] authored Dec 3, 2024
1 parent 6933b13 commit 4ddc236
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scripts/sipify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3105,10 +3105,9 @@ def cpp_to_python_signature(cpp_function: str) -> str:
if additions:
this_class_additions = "\n".join(" " + c for c in additions)
CONTEXT.output_python.append(
f"try:\n{this_class_additions}\nexcept NameError:\n pass\n"
f"try:\n{this_class_additions}\nexcept (NameError, AttributeError):\n pass\n"
)


if args.python_output and CONTEXT.output_python:

with open(args.python_output, "w") as f:
Expand Down

0 comments on commit 4ddc236

Please sign in to comment.