Skip to content

Commit f8673cb

Browse files
committed
Fix for Python 3.9 since types.NoneType doesn't exist until 3.10
1 parent 1587eb3 commit f8673cb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd2/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from collections.abc import Callable, Iterable
1717
from difflib import SequenceMatcher
1818
from enum import Enum
19-
from types import NoneType
2019
from typing import TYPE_CHECKING, Any, Optional, TextIO, TypeVar, Union, cast, get_type_hints
2120

2221
from . import constants
@@ -1263,6 +1262,6 @@ def get_types(func_or_method: Callable[..., Any]) -> tuple[dict[str, Any], Any]:
12631262
ret_ann = type_hints.pop('return', None) # Pop off the return annotation if it exists
12641263
if inspect.ismethod(func_or_method):
12651264
type_hints.pop('self', None) # Pop off `self` hint for methods
1266-
if ret_ann is NoneType:
1265+
if ret_ann is type(None):
12671266
ret_ann = None # Simplify logic to just return None instead of NoneType
12681267
return type_hints, ret_ann

0 commit comments

Comments
 (0)