Skip to content

Module alias as instance attribute does not work #4291

Closed
@JukkaL

Description

@JukkaL

The error generated by the following program is unexpected:

import os

class C:
    def __init__(self) -> None:
        self.os = os
        self.os.chdir('/')  # Error: Module has no attribute "chdir"
        os.chdir('/')  # Ok

C()  # No runtime error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions