Mastodon.py icon indicating copy to clipboard operation
Mastodon.py copied to clipboard

Unable to use at optimisation level 2

Open mirabilos opened this issue 2 years ago • 2 comments
trafficstars

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.

mirabilos avatar Jul 07 '23 22:07 mirabilos

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

halcy avatar Jul 08 '23 09:07 halcy

-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

codl avatar Jul 08 '23 10:07 codl