Skip to content

TYP: dtypes.pyi is missing StringDType #26747

@bersbersbers

Description

@bersbersbers

Describe the issue:

The below code runs fine, but does not type check:

Reproduce the code example:

import numpy as np

arr = np.array("abc", dtype=np.dtypes.StringDType)
arr += "def"
print(arr)

Error message:

(.venv) C:\Code\project>mypy bug.py
bug.py:3: error: Module has no attribute "StringDType"  [attr-defined]
Found 1 error in 1 file (checked 1 source file)

Python and NumPy Versions:

2.0.0
3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]

Runtime Environment:

(not relevant)

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions