Skip to content

stubtest ignores strict_bytes = true in pyproject.toml 1.15.0 #18744

Closed
@jorenham

Description

@jorenham

This causes mypy build errors to be reported when I run stubtest --mypy-config-file=pyproject.toml numpy (in numpy/numtype), where the pyproject.toml contains:

[tool.mypy]
# [...]
strict_bytes = true

The build error is of the overload-cannot-match kind, and is caused by a memoryview promotion in https://github.com/numpy/numtype/blob/2a9953a1be3c14660f29aabbaffc3e7fb6c2135a/src/numpy-stubs/__init__.pyi#L1143.


The workaround is to use the superseded (and undocumented) flags instead:

[tool.mypy]
# [...]
disable_bytearray_promotion = true
disable_memoryview_promotion = true

Running the command again with this pyproject.toml shows no build errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions