Skip to content

migrate some stuffs in ctypes/__init__.pyi into _ctypes.pyi, but circular import occurs #8633

@junkmd

Description

@junkmd

When we submitted PR that adds the stdlib/_ctypes.pyi(#8582), imports some stuffs from ctypes.

But the implementation imports some stuffs from _ctypes to ctypes.

However, trying to write type stubs as close as possible to the implementation would result in circular imports if we just move definitions around.

  • For example, CDLL in args of _CData methods.
    • In implementation...
      • CDLLL is defined in ctypes
      • _CData(base class of _SimpleCData) is defined in _ctypes.
  • Some PRs, such as delete _importlib_modulespec #5350, were merged as "should be fine in pyi files" even if they are circular imports.

Any opinions would be appreciated.

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