Added further sanity checking of any symbol table passed into the API.
1 parent d293768 commit 0ca7f47ca5dc9a133a6b919b14fd7f0719ad5403
@tundra tundra authored on 24 Mar 2004
Showing 1 changed file
View
48
tconfpy.py
 
# Program Information
 
PROGNAME = "tconfpy"
RCSID = "$Id: tconfpy.py,v 1.141 2004/03/25 00:52:31 tundra Exp $"
RCSID = "$Id: tconfpy.py,v 1.142 2004/03/25 01:29:17 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
des = InitialSymTbl[sym]
 
# Make sure a valid descriptor was passed for each variable
 
if isinstance(des, VarDescriptor):
desok = True
 
# Make sure we got a Var Descriptor Object
if not isinstance(des, VarDescriptor):
desok = False
 
# Check various entries for type agreement
 
dt = des.Type
 
if des.Default and type(des.Default) != dt:
desok = False
 
for lv in des.LegalVals:
if type(lv) != dt:
desok = False
 
for mm in (des.Min, des.Max):
if mm and type(mm) != TYPE_INT:
desok = False
 
# Update or error based on validity of descriptor
if desok:
SymTable[sym] = des
 
# Invalid descriptor passed
else: