Hi! Python will crash with a None dereference error on this line: http://selenic.com/hg/file/038b389d80f5/mercurial/filemerge.py#l28 It assumes __doc__ is always non-None, which is not true when byte- compilation strips function docstrings out. Our use case is that we run py2exe on our product, which uses Mercurial. (We ship the source code separately in a ZIP per GPL.) When it imports Mercurial's modules, which cause an import to filemerge, Python crashes on that line because py2exe byte-compiles all the source files. It'd be awesome a patch for this could be accepted for 2.2; I'll submit a patch tomorrow if nobody else does (I have to head home now).
Stripping out doc strings will almost certainly break most of the built-in help support? We know that there's more to this than py2exe as TortoiseHG also uses py2exe without hitting this. More likely, this is related to Python's -OO option: -O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x -OO : remove doc-strings in addition to the -O optimizations And those optimizations are basically negligible. So, yes, we could fix this, but it seems easier to just turn off "optimization" which results in fewer surprises for developers.
Noted, thanks.
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:30 EDT --- This bug was previously known as _bug_ 3412 at http://mercurial.selenic.com/bts/issue3412