[issue23189] Set docstrings to empty string when optimizing with -OO.
Jarle Selvåg added the comment: I agree that -OO does what (people have agreed) it's supposed to do. Many packages manipulates the docstring without checking for 'None' (see list below). For many package developers, it seems hard to remember that the docstrings may disappear after optimization. This behavior is not intuitive. At least in cases where the docstring is set to a string value, the expected behavior in my opinion would be to set its value to an empty string during optimization with -OO. Here are some of the packages that run into trouble when the docstrings are set to 'None' by the -OO optimization: algopy astropy lmfit pyamg pyvisa mpl_toolkits sympy statsmodels patsy sklearn -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23189] Set docstrings to empty string when optimizing with -OO.
New submission from Jarle Selvåg: Python code byte-compiled with -OO has doc-strings stripped out. This creates problems when compiling different packages which changes the doc-strings by doing something like this: __doc__ += additional text (when the docstring is 'None', this will fail). The packages lmfit 0.8.1 and Patsy 0.3.0 have this problem, and must be patched before compilation. See related discussion on Stackoverflow: http://stackoverflow.com/questions/22299532/unsupported-operand-types-for-nonetype-and-str-winappdbg-error-after-c Proposal: Set the doc-strings to empty string () instead of removing them completely during optimization with -OO. The memory footprint would anyway be the same. -- components: Interpreter Core messages: 233634 nosy: jvs priority: normal severity: normal status: open title: Set docstrings to empty string when optimizing with -OO. type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23189] Set docstrings to empty string when optimizing with -OO.
Jarle Selvåg added the comment: This issue is only relevant for classes that have this construct: class MyClass(object): __doc__ += '''Some more text''' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com