mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #7821: autodoc: TypeError is raised for overloaded C-ext function
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -17,6 +17,7 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* #7808: autodoc: Warnings raised on variable and attribute type annotations
|
* #7808: autodoc: Warnings raised on variable and attribute type annotations
|
||||||
|
* #7821: autodoc: TypeError is raised for overloaded C-ext function
|
||||||
* #7812: autosummary: generates broken stub files if the target code contains
|
* #7812: autosummary: generates broken stub files if the target code contains
|
||||||
an attribute and module that are same name
|
an attribute and module that are same name
|
||||||
* #7811: sphinx.util.inspect causes circular import problem
|
* #7811: sphinx.util.inspect causes circular import problem
|
||||||
|
|||||||
@@ -1237,7 +1237,11 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
|||||||
params = list(sig.parameters.values())
|
params = list(sig.parameters.values())
|
||||||
if params[0].annotation is Parameter.empty:
|
if params[0].annotation is Parameter.empty:
|
||||||
params[0] = params[0].replace(annotation=typ)
|
params[0] = params[0].replace(annotation=typ)
|
||||||
func.__signature__ = sig.replace(parameters=params) # type: ignore
|
try:
|
||||||
|
func.__signature__ = sig.replace(parameters=params) # type: ignore
|
||||||
|
except TypeError:
|
||||||
|
# failed to update signature (ex. built-in or extension types)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class SingledispatchFunctionDocumenter(FunctionDocumenter):
|
class SingledispatchFunctionDocumenter(FunctionDocumenter):
|
||||||
@@ -1833,7 +1837,11 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
|
|||||||
params = list(sig.parameters.values())
|
params = list(sig.parameters.values())
|
||||||
if params[1].annotation is Parameter.empty:
|
if params[1].annotation is Parameter.empty:
|
||||||
params[1] = params[1].replace(annotation=typ)
|
params[1] = params[1].replace(annotation=typ)
|
||||||
func.__signature__ = sig.replace(parameters=params) # type: ignore
|
try:
|
||||||
|
func.__signature__ = sig.replace(parameters=params) # type: ignore
|
||||||
|
except TypeError:
|
||||||
|
# failed to update signature (ex. built-in or extension types)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class SingledispatchMethodDocumenter(MethodDocumenter):
|
class SingledispatchMethodDocumenter(MethodDocumenter):
|
||||||
|
|||||||
Reference in New Issue
Block a user