Skip to content

Commit

Permalink
Add generation of the version.
Browse files Browse the repository at this point in the history
  • Loading branch information
loewis committed Feb 28, 2006
1 parent 17e5905 commit 40d8459
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Doc/lib/libast.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ \chapter{Abstract Syntax Trees\label{ast}}

\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
Expand Down Expand Up @@ -41,6 +43,9 @@ \chapter{Abstract Syntax Trees\label{ast}}

\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}
3 changes: 2 additions & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ def visitModule(self, mod):
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)
Expand Down

0 comments on commit 40d8459

Please sign in to comment.