Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40d8459

Browse files
committed
Add generation of the version.
1 parent 17e5905 commit 40d8459

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Doc/lib/libast.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ \chapter{Abstract Syntax Trees\label{ast}}
44

55
\sectionauthor{Martin v. L\"owis}{[email protected]}
66

7+
\versionadded{2.5}
8+
79
The \code{_ast} module helps Python applications to process
810
trees of the Python abstract syntax grammar. The Python compiler
911
currently provides read-only access to such trees, meaning that
@@ -41,6 +43,9 @@ \chapter{Abstract Syntax Trees\label{ast}}
4143

4244
\subsection{Abstract Grammar}
4345

46+
The module defines a string constant \code{__version__} which
47+
is the decimal subversion revision number of the file shown below.
48+
4449
The abstract grammar is currently defined as follows:
4550

4651
\verbatiminput{../../Parser/Python.asdl}

Parser/asdl_c.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ def visitModule(self, mod):
524524
self.emit('if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;', 1)
525525
self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1)
526526
self.emit("return;", 2)
527-
self.emit("/* %s */" % mod.version.value, 1)
527+
# Value of version: "$Revision$"
528+
self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' % mod.version.value[12:-3], 1)
528529
for dfn in mod.dfns:
529530
self.visit(dfn)
530531
self.emit("}", 0)

0 commit comments

Comments
 (0)