Skip to content

Python's datetime.datetime.strptime has wrong return type #9578

Closed
@PythonCoderAS

Description

@PythonCoderAS

According to the stubs, datetime.datetime.strptime returns a datetime. However, it actually returns the type of the class. So if I subclass datetime and call the subclass's strptime method, I get back an instance of the subclass and not a datetime object, violating the return type constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions