__doc__
attribute references disabling all removal of literals
#11
Labels
defect
Something isn't working
__doc__
attribute references disabling all removal of literals
#11
When running
pyminify --remove-literal-statements file.py
, any reference to__doc__
anywhere in the processed module will disable removal of any literal.The documentation states (emphasis mine):
Should the documentation be changed to clarify that no literals will be removed, or is the current behavior not intended?
Another thing to note is that only references to attributes named
__doc__
will disable the removal, meaning that e.g.will strip the docstring and make the resulting code fail. This is a very contrived example, of course, and I hope it doesn't actually exist anywhere (but it probably does).
It may be that this issue should be split up into multiple issues, depending on the intended behavior, apologies in advance.
Side note: does it make sense to disable literal removal due to references to any attribute named
__doc__
? For all we know the reference may be to the docstring of something that is defined in another module, which itself had its docstrings stripped.It seems to me that since docstring removal in the general case comes with some risks, and should be done with care (even if most of the time it won't have any practical impact), there may be some value in providing an additional flag that disables the
__doc__
check entirely (with appropriately severe warnings to the user).The text was updated successfully, but these errors were encountered: