summaryrefslogtreecommitdiff
path: root/Cython/Plex
diff options
context:
space:
mode:
authorStefan Behnel <scoder@users.berlios.de>2009-04-24 08:43:55 +0200
committerStefan Behnel <scoder@users.berlios.de>2009-04-24 08:43:55 +0200
commit8fce6199bf973a03b9f3125264b048b266321d62 (patch)
tree5b66f4fc77f72c92ee236beeb59c398c7fe2c8a1 /Cython/Plex
parentbe696078f02a5b7617f04200d6ff58cf148d5f22 (diff)
downloadcython-8fce6199bf973a03b9f3125264b048b266321d62.tar.gz
fix some 'python2.6 -3' warnings
Diffstat (limited to 'Cython/Plex')
-rw-r--r--Cython/Plex/Lexicons.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Cython/Plex/Lexicons.py b/Cython/Plex/Lexicons.py
index 905c6c50f..e6cea0528 100644
--- a/Cython/Plex/Lexicons.py
+++ b/Cython/Plex/Lexicons.py
@@ -164,10 +164,13 @@ class Lexicon(object):
# token_number, "Pattern can match 0 input symbols")
if isinstance(action_spec, Actions.Action):
action = action_spec
- elif callable(action_spec):
- action = Actions.Call(action_spec)
else:
- action = Actions.Return(action_spec)
+ try:
+ action_spec.__call__
+ except AttributeError:
+ action = Actions.Return(action_spec)
+ else:
+ action = Actions.Call(action_spec)
final_state = machine.new_state()
re.build_machine(machine, initial_state, final_state,
match_bol = 1, nocase = 0)