Skip to content

PLC2701 treats os._exit as private, unlike SLF001 #18143

@dscorbett

Description

@dscorbett

Summary

Despite its name, os._exit is not private; see #6483. import-private-name (PLC2701) treats it as private, which is inconsistent with private-member-access (SLF001). The two rules should share the same set of exceptionally non-private module members (which is currently just os._exit).

$ cat >plc2701.py <<'# EOF'
from os import _exit
# EOF

$ ruff --isolated check plc2701.py --preview --select PLC2701 --output-format concise -q
plc2701.py:1:16: PLC2701 Private name import `_exit` from external module `os`

Version

ruff 0.11.10 (b35bf8a 2025-05-15)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions