Skip to content

mangle_docstring is called on already-processed docstrings #134

Closed
@jnothman

Description

@jnothman

It seems that due to wrap_mangling_directives, even in our simple example code, we're visiting the same docstring multiple times, and running our mangling over an already-mangled docstring. This is creating especial rubbish with reference renaming, but we've certainly not tested the effect of this on any of our docscrape apparatus either!

With the current example.py and docs, we get calls to mangle_docstrings with:

what='module', name='example', len(lines)=9, hash(tuple(lines))=-8903261816696980551
what='function', name='example.foo', len(lines)=83, hash(tuple(lines))=-6998798167062068361
what='function', name="foo(var1, var2, long_var_name='hi')", len(lines)=108, hash(tuple(lines))=3694357165576974898

I show hashes and line counts to illustrate that we have mangled the dosctring, at least in some cases.

When I add a class Foobar and its method foobar, we get the following invocations of mangle_docstring:

what='module', name='example', len(lines)=9, hash(tuple(lines))=-475644803089738938, rubric in lines=False
what='class', name='example.Foobar', len(lines)=6, hash(tuple(lines))=-5539289288007919216, rubric in lines=False
what='method', name='example.Foobar.foobar', len(lines)=6, hash(tuple(lines))=7217615682760160437, rubric in lines=False
what='function', name='example.foo', len(lines)=83, hash(tuple(lines))=-8508781800898451264, rubric in lines=False
what='class', name='Foobar', len(lines)=39, hash(tuple(lines))=8692486620067943275, rubric in lines=True
what='method', name='example.Foobar.foobar', len(lines)=6, hash(tuple(lines))=7217615682760160437, rubric in lines=False
what='method', name='example.Foobar.foobar', len(lines)=22, hash(tuple(lines))=5869529305210585233, rubric in lines=False
what='function', name='Foobar.foobar()', len(lines)=5, hash(tuple(lines))=-8048095480324991988, rubric in lines=False
what='function', name="foo(var1, var2, long_var_name='hi')", len(lines)=108, hash(tuple(lines))=-7634163004091929948, rubric in lines=True

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions