Allow -OO mode for docstring_decorator#29689
Conversation
Fixes
```
File "/nix/store/rv8xdwghdad9jv2w86b8g08kan9l6ksm-python3.11-transformers-4.38.2/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.py", line 987, in <module>
class AutoConfig:
File "/nix/store/rv8xdwghdad9jv2w86b8g08kan9l6ksm-python3.11-transformers-4.38.2/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.py", line 1011, in AutoConfig
@replace_list_option_in_docstrings()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/rv8xdwghdad9jv2w86b8g08kan9l6ksm-python3.11-transformers-4.38.2/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.py", line 966, in docstring_decorator
lines = docstrings.split("\n")
^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'
```
|
Hi @matthid, thannks for opening a PR,
Could you provide some more context here? Specifically where this change is being made and ideally a minimal code snippet which reproduces the issue? |
|
Sure just use the following script: and run the script with I hope this helps. |
|
Even more minimal (you can see in the stacktrace): |
|
@matthid Could you share |
|
The script is literally the line I showed:
Run the following in a shell where I'm not sure what else I can say. |
|
@matthid Sorry, my bad, I was skimming over this quickly and didn't notice the import line (and was misreading -OO as -00) |
There was a problem hiding this comment.
@matthid OK, as there's other parts of the library which handle the case when __doc__ is None, I think it's OK to add this.
However, I don't think we can guarantee the whole library is going to be compatible running with the -OO flag, so use at your own risk!
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
What does this PR do?
Fixes
Note; I found this, but I'm now using
-Oinstead of-OOso this fix might not be exhaustive in the sense that now-OOmight run into the next issue. But since I run into that one, I figured sending a fix would be worthwhile, feel free to close if you think otherwise.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.