Skip to content

Unexpected output when class attribute and constructor arg have same name (napoleon bug) #308

Closed
@hoodmane

Description

@hoodmane

This is an upstream bug: sphinx-doc/sphinx#11143

Suppose we have the following class:

class Example:
    """
    A Class

    Parameters
    ----------
    blah:
        Description of parameter blah
    """
    def __init__(self, blah: CodeType):
        pass

    blah: ModuleType

We get the following output (just the parameters):

   Parameters:
      **blah** (*module*) -- Description of parameter blah

Expected output:

   Parameters:
      **blah** ("CodeType") -- Description of parameter blah

If you want I can provide a monkey patch that implements my fix in sphinx-doc/sphinx#11143 on existing versions of sphinx. I'm not sure how far we want to go in patching with upstream bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions