]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add generation of the version.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 28 Feb 2006 00:30:54 +0000 (00:30 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 28 Feb 2006 00:30:54 +0000 (00:30 +0000)
Doc/lib/libast.tex
Parser/asdl_c.py

index 9fdd4fbe7749b00cb5842b354dc24114f2f0fd1a..ca798c9c5fa8f89aabfbf603f5cda5ce158c9d47 100644 (file)
@@ -4,6 +4,8 @@
 
 \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de}
 
+\versionadded{2.5}
+
 The \code{_ast} module helps Python applications to process
 trees of the Python abstract syntax grammar. The Python compiler
 currently provides read-only access to such trees, meaning that
@@ -41,6 +43,9 @@ values are represented as Python lists.
 
 \subsection{Abstract Grammar}
 
+The module defines a string constant \code{__version__} which
+is the decimal subversion revision number of the file shown below.
+
 The abstract grammar is currently defined as follows:
 
 \verbatiminput{../../Parser/Python.asdl}
\ No newline at end of file
index 3f62af36be5fb4bdf279899e0a4b625e02afa559..b55b6eb1c790b8920b1840e1ab4a9188d6df980b 100755 (executable)
@@ -524,7 +524,8 @@ class ASTModuleVisitor(PickleVisitor):
         self.emit('if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;', 1)
         self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1)
         self.emit("return;", 2)
-        self.emit("/* %s */" % mod.version.value, 1)
+        # Value of version: "$Revision$"
+        self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' % mod.version.value[12:-3], 1)
         for dfn in mod.dfns:
             self.visit(dfn)
         self.emit("}", 0)