00001 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall. 00002 # 00003 # This file is part of the Python-on-a-Chip program. 00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify 00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. 00006 # 00007 # Python-on-a-Chip is distributed in the hope that it will be useful, 00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 00011 # is seen in the file COPYING up one directory from this. 00012 00013 # 00014 # System Test 190 00015 # Fix segfault when num args is fewer than expected 00016 # 00017 00018 def foo(): 00019 return "foo" 00020 00021 def foo1(a=42): 00022 return a+1 00023 00024 def foo2(a,b=42): 00025 return a+b 00026 00027 00028 print foo() 00029 00030 print foo1() 00031 print foo1(1) 00032 00033 print foo2(1) 00034 print foo2(1,2) 00035 00036 00037 # NOTE: uncomment each of the following lines one at a time and test 00038 00039 #print foo(1) # Expect TypeError (0xED) 00040 #print foo1(1,2) # Expect TypeError (0xED) 00041 #print foo2() # Expect TypeError (0xED) 00042 #print foo2(1,2,3) # Expect TypeError (0xED) 00043 00044 # If the following line causes a segfault, it's a regression. 00045 print "Expect TypeError:" 00046 map(map, range(5)) # Expect TypeError (0xED)