-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The minimal, reproducible example is to click on a link to view the ast documentation.
Desired output
The example, if it were to include None values, would read
ast.Module(
body=[
ast.AsyncFunctionDef(
name='f',
args=ast.arguments(
posonlyargs=[],
args=[],
vararg=None,
kwonlyargs=[],
kw_defaults=[],
kwarg=None,
defaults=[]),
body=[
ast.Expr(
value=ast.Await(
value=ast.Call(
func=ast.Name(id='other_func', ctx=ast.Load()),
args=[],
keywords=[])))],
decorator_list=[],
returns=None,
type_comment=None,
type_params=[])],
type_ignores=[])Solution
Change
Lines 147 to 149 in 7291eab
| if value is None and getattr(cls, name, ...) is None: | |
| keywords = True | |
| continue |
To
if value is None and getattr(cls, name, ...) is None:
if show_empty:
args.append('%s=%s' % (name, value))
keywords = True
continueCPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Windows, Other
Linked PRs
- gh-134733: fix: ast.dump( show_empty=True ) now displays all
Nonevalues #134743 - gh-134733: Fix documentation for the show_empty option of ast.dump() #134925
- [3.14] gh-134733: Fix documentation for the show_empty option of ast.dump() (GH-134925) #134940
- [3.13] gh-134733: Fix documentation for the show_empty option of ast.dump() (GH-134925) #134941
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error