mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7823 from tk0miya/7821_overload_builtin_function
Fix #7821: autodoc: TypeError is raised for overloaded C-ext function
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -18,6 +18,7 @@ Bugs fixed
|
||||
|
||||
* #7808: autodoc: Warnings raised on variable and attribute type annotations
|
||||
* #7802: autodoc: EOFError is raised on parallel build
|
||||
* #7821: autodoc: TypeError is raised for overloaded C-ext function
|
||||
* #7812: autosummary: generates broken stub files if the target code contains
|
||||
an attribute and module that are same name
|
||||
* #7811: sphinx.util.inspect causes circular import problem
|
||||
|
||||
@@ -1237,7 +1237,11 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
||||
params = list(sig.parameters.values())
|
||||
if params[0].annotation is Parameter.empty:
|
||||
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):
|
||||
@@ -1833,7 +1837,11 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
|
||||
params = list(sig.parameters.values())
|
||||
if params[1].annotation is Parameter.empty:
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user