[New-bugs-announce] [issue23189] Set docstrings to empty string when optimizing with -OO.

Jarle Selvåg report at bugs.python.org
Thu Jan 8 10:41:45 CET 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue23189>
_______________________________________


More information about the New-bugs-announce mailing list