summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-05-07 12:07:30 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-05-07 12:07:30 +0000
commit00a18ecf4a86081753e27d394473a70dc287e9ed (patch)
tree837f658c530fd21f7a69c7a8c2609300b588d01c
parentefc28aa7196aa0b8a4e6305b44f99cd383453e13 (diff)
downloaddocutils-00a18ecf4a86081753e27d394473a70dc287e9ed.tar.gz
Python 2.1 compatibility fix
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/readers/python/moduleparser.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/docutils/readers/python/moduleparser.py b/docutils/readers/python/moduleparser.py
index 7f965e6e2..ddfe21ea7 100644
--- a/docutils/readers/python/moduleparser.py
+++ b/docutils/readers/python/moduleparser.py
@@ -386,11 +386,11 @@ class FunctionVisitor(DocstringVisitor):
special = []
argnames = list(node.argnames)
if node.kwargs:
- special.append(make_parameter(argnames[-1], excess_keyword=True))
+ special.append(make_parameter(argnames[-1], excess_keyword=1))
argnames.pop()
if node.varargs:
special.append(make_parameter(argnames[-1],
- excess_positional=True))
+ excess_positional=1))
argnames.pop()
defaults = list(node.defaults)
defaults = [None] * (len(argnames) - len(defaults)) + defaults
@@ -689,7 +689,11 @@ def make_attribute(name, lineno):
n.append(make_object_name(name))
return n
-def make_parameter(name, excess_keyword=False, excess_positional=False):
+def make_parameter(name, excess_keyword=0, excess_positional=0):
+ """
+ excess_keyword and excess_positional must be either 1 or 0, and
+ not both of them can be 1.
+ """
n = pynodes.parameter()
n.append(make_object_name(name))
assert not excess_keyword or not excess_positional