Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 460491e

Browse filesBrowse files
committed
Add private unparse names to getattr
1 parent dc95d19 commit 460491e
Copy full SHA for 460491e

File tree

1 file changed

+6
-0
lines changed
Filter options

1 file changed

+6
-0
lines changed

‎Lib/ast.py

Copy file name to clipboardExpand all lines: Lib/ast.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,4 +659,10 @@ def __getattr__(name):
659659
from _ast_unparse import unparse
660660
return unparse
661661

662+
if name in {'_INFSTR', '_SINGLE_QUOTES', '_MULTI_QUOTES', '_ALL_QUOTES',
663+
'_Precedence', '_Unparser'}:
664+
# all of these names are private, but re-exported for compatibility
665+
import _ast_unparse
666+
return getattr(_ast_unparse, name)
667+
662668
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.