mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Fix Optional type hints not respecting explicitly set defaults
This commit is contained in:
parent
095aaa9ad1
commit
9fd63ad7f3
@ -627,10 +627,11 @@ def annotation_to_parameter(annotation: Any, parameter: inspect.Parameter) -> Co
|
|||||||
|
|
||||||
(inner, default) = get_supported_annotation(annotation)
|
(inner, default) = get_supported_annotation(annotation)
|
||||||
type = inner.type()
|
type = inner.type()
|
||||||
if default is MISSING:
|
|
||||||
default = parameter.default
|
if default is MISSING or default is None:
|
||||||
if default is parameter.empty:
|
param_default = parameter.default
|
||||||
default = MISSING
|
if param_default is not parameter.empty:
|
||||||
|
default = param_default
|
||||||
|
|
||||||
# Verify validity of the default parameter
|
# Verify validity of the default parameter
|
||||||
if default is not MISSING:
|
if default is not MISSING:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user