Skip to content
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

Unable to use at optimisation level 2 #347

Open
mirabilos opened this issue Jul 7, 2023 · 2 comments
Open

Unable to use at optimisation level 2 #347

mirabilos opened this issue Jul 7, 2023 · 2 comments

Comments

@mirabilos
Copy link

File "/usr/lib/python3/dist-packages/mastodon/Mastodon.py", line 103, in api_min_version_decorator
  function.__doc__ = function.__doc__ + "\n\n        *Added: Mastodon v" + created_ver + ", last changed: Mastodon v" + last_changed_ver + "*"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

(line numbers match 1.5.1-1 in Debian bullseye)

This is because python3 -OO strips away docstrings. A test for the presence of __doc__ should probably suffice.

@halcy
Copy link
Owner

halcy commented Jul 8, 2023

oof. I'll add that next release. Please tell me it doesn't also strip annotations

@codl
Copy link
Contributor

codl commented Jul 8, 2023

-O strips asserts and sets __debug__ to False
-OO does that and also strips docstrings
https://docs.python.org/3/using/cmdline.html#cmdoption-O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants