Commit a10b1107 authored by Evan Simpson's avatar Evan Simpson

Type-check 'map' arguments

parent dbede1d8
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
from zbytecodehacks.VSExec import SafeBlock, GuardedBinaryOps, \ from zbytecodehacks.VSExec import SafeBlock, GuardedBinaryOps, \
UntupleFunction, RedirectWrites, WriteGuard, RedirectReads, ReadGuard, \ UntupleFunction, RedirectWrites, WriteGuard, RedirectReads, ReadGuard, \
...@@ -200,6 +200,7 @@ def __careful_map__(f, *seqs): ...@@ -200,6 +200,7 @@ def __careful_map__(f, *seqs):
for seq in seqs: for seq in seqs:
if type(seq) is type(''): if type(seq) is type(''):
raise TypeError, 'cannot map a string' raise TypeError, 'cannot map a string'
list(seq) # Ensure that it's a sequence
return apply(map, tuple([f] + map(ReadGuard, seqs))) return apply(map, tuple([f] + map(ReadGuard, seqs)))
safebin['map'] = __careful_map__ safebin['map'] = __careful_map__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment