Skip to content

cmd2 crashes when from __future__ import annotations is used #1443

@tleonhardt

Description

@tleonhardt

cmd2 crashes when from __future__ import annotations is in a cmd2 application and any hook callback methods are registered.

The underlying cause is that cmd2 is using inspect.signature to introspect on type annotations and that method does not have a safe way of doing this prior to Python 3.10 and even then an extra argument to it is required.

The only good option for fixing this that is compatible with Python 3.9 is to using the typing.get_type_hints() function instead.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions